query_id
stringlengths 32
32
| query
stringlengths 7
6.75k
| positive_passages
listlengths 1
1
| negative_passages
listlengths 88
101
|
---|---|---|---|
97fb85039590b89c98e9664877bfc4ba | Top games sold by Sony Computer Entertainment | [
{
"docid": "1a454a5c45bbb60f1c585018c66fc143",
"score": "0.0",
"text": "def query2\n @data1 = VideoGame.select(:name, 'na_sales+eu_sales+jp_sales+other_sales+global_sales AS global').joins(:sale).where(\"publisher = 'Sony Computer Entertainment'\").order(global: :desc).limit(10)\n end",
"title": ""
}
] | [
{
"docid": "ad9fe4535fd457c24055e0f5b81df923",
"score": "0.70192844",
"text": "def top_games(limit=10)\n placeholder = SecureRandom.uuid.downcase.gsub('-', '')\n games = Event.connection.execute(\n <<-SQL\n select * from (\n select\n regexp_replace(initcap(regexp_replace(lower(t.title), '''', '#{placeholder}')), '#{placeholder}', '''', 'i' ) as title\n ,t.id as title_id\n ,count(distinct c.id) as checkouts\n from games g\n left join (select * from checkouts where event_id = #{self.id}) c on g.id = c.game_id\n inner join titles t on t.id = g.title_id\n where\n g.status = #{Game::STATUS[:active]}\n or (g.status = #{Game::STATUS[:culled]} and g.updated_at::date between '#{self.start_date}' and '#{self.end_date}')\n or (g.status = #{Game::STATUS[:stored]} and g.updated_at::date between '#{self.start_date}' and '#{self.end_date}')\n group by 2\n order by 3 desc,1\n ) c\n where checkouts > 0\n limit '#{Event.connection.quote(limit)}'\n SQL\n )\n games.map do |game|\n game[:available] = Game.copy_available(game[\"title_id\"])\n game\n end\n end",
"title": ""
},
{
"docid": "a63ad924bae2a950d44dfa27cbfe3795",
"score": "0.6794404",
"text": "def highest_scoring_home_team\n best_offense(\"home\")\n end",
"title": ""
},
{
"docid": "841b21ec437b6e84ac67fd4123765d5c",
"score": "0.67670304",
"text": "def top_teams\n plays = self.plays.where(:selection => [\"Favorite\", \"Underdog\"])\n counts = Hash.new(0)\n plays.each do |p|\n p.selection == \"Favorite\" ? \"#{team = p.game.favorite}\" : \"#{team = p.game.underdog}\"\n counts[team] +=1\n puts counts.inspect\n end\n end",
"title": ""
},
{
"docid": "3f92ce9c6c51b95c02e3483def03cfb7",
"score": "0.6724228",
"text": "def winning_team_game\n self.team_games.sort_by { |team_game| team_game.total_score }.last\n end",
"title": ""
},
{
"docid": "5865cb8226b390c1eefc13d64d239a60",
"score": "0.66532",
"text": "def scrape_top_games_index\n\t\tself.get_page.css(\".pod_topgames ol li\")\n\tend",
"title": ""
},
{
"docid": "206be141be2542ae0bbe8f9473534004",
"score": "0.66020167",
"text": "def test_list_all_top_games\n games = List.top_games(\"pc\")\n assert_equal 10, games.size\n assert games.first.is_a?(Game)\n end",
"title": ""
},
{
"docid": "04c0f83a2119d90e8e07756ca2576e3d",
"score": "0.65800744",
"text": "def best_offense\n teams_goals = {}\n @game.each do |game|\n teams_goals[name_from_id(game.home_team_id)] = 0\n teams_goals[name_from_id(game.away_team_id)] = 0\n end\n @game.each do |game|\n teams_goals[name_from_id(game.home_team_id)] += game.home_goals.to_i\n teams_goals[name_from_id(game.away_team_id)] += game.away_goals.to_i\n end\n teams_goals.each do |key, value|\n teams_goals[key] = (value / number_of_games_by_team(key).to_f).round(3)\n end\n winner = teams_goals.sort_by do |team, avg_goals|\n teams_goals[team]\n end\n winner.last.first\n end",
"title": ""
},
{
"docid": "98d25610aec0b78413be9dcbe9de23df",
"score": "0.6563167",
"text": "def probable_home_venue\n arr = home_games.order(start_time: :desc).first(30)\n arr.max_by { |i| arr.count(i) }\n end",
"title": ""
},
{
"docid": "2b8cfab24edc38b8b27b4d2ee67e8c4d",
"score": "0.65597624",
"text": "def my_games\n # sort my games by release date\n by_release = games.order(:created_at).map{|g| g.id}\n # get the games from my events\n dgid = events.joins(:games).group('games.id').order('count(games.id) desc').count\n\n # Stick it into an array of game_ids\n mg = dgid.sort_by {|k,v| v}.reverse.map{|x| x[0]}\n # Add any games left out by release date\n ordering = mg + by_release.select{|id| !dgid[id]}\n # Return my game skus (game_game_system_user_joins)\n user_games.sort_by {|game| ordering.index game.game_id}[1..5]\n end",
"title": ""
},
{
"docid": "c56f1a5ffccbee9f6521a74b68d8d116",
"score": "0.65546894",
"text": "def show\n #TODO: do this all in the db\n @owned_games = @player.owned_games #.includes(:ratings)\n @top_20_games = @player.rated_games.select('games.*, ratings.rating').order('ratings.rating desc, games.name').where('ratings.rating > 6').limit(20)\n playwish_counts_all = PlayWish.group(:game_id).count\n playwish_counts_all.default=0\n @playwish_counts = Hash[* @player.owned_games.map{ |g| [g.id, playwish_counts_all[g.id]] }.flatten ]\n\n top_ten = @playwish_counts.sort_by{|gid,n| n}.reverse[0..9]\n @most_desired_games = top_ten.map { |gid, n| \n @owned_games.detect{|g| g.id == gid}\n }\n\n @playwish_counts = Hash[* top_ten.flatten]\n \n @uniquely_owned_games = Game.owned_uniquely_by(@player)\n end",
"title": ""
},
{
"docid": "12426f7ffadab6accb8d6dd1867d918c",
"score": "0.6472793",
"text": "def lowest_scoring_home_team\n worst_offense(\"home\")\n end",
"title": ""
},
{
"docid": "53ef579e9e9348a6579d4d66c1f7c7c1",
"score": "0.6468484",
"text": "def index\n @user = User.find params[:user_id]\n response = HTTParty.get(\"http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=#{Rails.application.secrets.steam_api_key}&steamid=#{@user.steam_id}&include_appinfo=1&format=json\")\n @pile_of_shame = 0\n @games = response.parsed_response['response']\n\n if @games['games'].present?\n @pile_of_shame = @games['games'].map { |game| game['playtime_forever'] if game['playtime_forever'].zero? }.compact.count \n @games['games'] = @games['games'].sort_by { |k| k['name'] }.each\n end\n end",
"title": ""
},
{
"docid": "2767a660557e913f400fc8283efc9546",
"score": "0.6467099",
"text": "def most_steals\n mostSteals = 0\n playerWithMostSteals = \"\"\n\n game_hash.each do |place, team|\n team.each do |attribute, data|\n if attribute == :players\n data.each do |player|\n numSteals = player[:steals]\n if numSteals > mostSteals\n mostSteals= numSteals\n playerWithMostSteals = player[:player_name]\n end\n end\n end\n end\n end\n playerWithMostSteals\nend",
"title": ""
},
{
"docid": "9528dc471f9978482f028accbe726608",
"score": "0.6412319",
"text": "def highest_scoring_home_team\n x = @game_team_stats.map do |game|\n game.hoa == \"away\"\n game.team_id\n end\n goals_scored_visitor = Hash.new(0)\n @game_team_stats.each do |games|\n games.hoa == \"away\"\n goals_scored_visitor[games.team_id] += games.goals.to_i\n end\n y = goals_scored_visitor.max_by {|team, values| values / x.count(team) }\n team_id_converter(y[0])\n end",
"title": ""
},
{
"docid": "219181f2b4dfbb98bcfdb3065e9a519b",
"score": "0.64107925",
"text": "def player_with_most_steals\n most_steals = 0\n most_steals_player = 0\n game_hash.each do |location, attributes|\n attributes[:players].each do |category|\n if category[:steals] > most_steals\n most_steals = category[:steals]\n most_steals_player = category[:player_name]\n end\n end\n end\n most_steals_player\nend",
"title": ""
},
{
"docid": "ebcb4e0ad1d7eb2a9d26e004a467d345",
"score": "0.64085484",
"text": "def bestseller\n book_top(1)\n end",
"title": ""
},
{
"docid": "fae31bc1e77eb3aace34af8e2bc32f4d",
"score": "0.64027965",
"text": "def fetch_games; end",
"title": ""
},
{
"docid": "3ba350864785a19c77c32a576d486676",
"score": "0.63877875",
"text": "def index\n @shoes = Shoe.paginate(:page => params[:page], :per_page => 5).order('price DESC') \n @most_viewed = Shoe.order('impressions_count DESC').take(3)\n end",
"title": ""
},
{
"docid": "fac74c547759e5c7d0b67d85baffb9cb",
"score": "0.63848835",
"text": "def analyze_games(games)\n\t\t\tplayer_totals = {}\n\t\t\tnum_hands = 0\n\t\t\tsb, bb = games[0]['small_blind'], games[0]['big_blind']\n\t\t\tgames.each do |game|\n\t\t\t\tnum_hands += 1\n\t\t\t\tdb.execute(\"select * from game_players where game_id=?\", game['id']) do |p|\n\t\t\t\t\tpl = (player_totals[p['name']] ||= {})\n\t\t\t\t\tpl[:total_score] ||= 0\n\t\t\t\t\tpl[:total_score] += p['won']\n\t\t\t\tend\n\t\t\tend\n\t\t\tplayer_totals.each do |name, tots|\n\t\t\t\tsbh = (tots[:total_score] / num_hands / bb)\n\t\t\t\ttots[:sbh] = sbh\n\t\t\tend\n\t\t\tputs \"From #{num_hands} hands:\"\n\t\t\tplayer_totals.sort_by{|k, v| v[:sbh]}.reverse.each do |name, v|\n\t\t\t\tputs \"#{name}: #{v[:sbh]}\"\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "9269dd4afdcbdc2860ad54c029deecb1",
"score": "0.6371297",
"text": "def play_best_of_game_set\n while game.highest_player_score < best_of\n play_game\n end\n publish_winners(game.players_with_highest_score, \"game\")\n end",
"title": ""
},
{
"docid": "7c4cb52b0a99bb024236749dd9ad2d58",
"score": "0.6369029",
"text": "def winning_team\n brooklyn_players = team_player_info(\"Brooklyn Nets\")\n charlotte_players = team_player_info(\"Charlotte Hornets\")\n\n brooklyn_scores = brooklyn_players.map {|stats|\n stats[:points]}\n\n charlotte_scores = charlotte_players.map {|stats|\n stats[:points]}\n \n brooklyn_total = brooklyn_scores.sum\n charlotte_total = charlotte_scores.sum\n\n charlotte_total > brooklyn_total ? (return charlotte_total) : (return brooklyn_total)\nend",
"title": ""
},
{
"docid": "64537fc4443c42b706605cfbc8516c14",
"score": "0.63420683",
"text": "def winning_team \n home_counter = 0\n away_counter = 0 \n home_point_totals = 0\n away_point_totals = 0 \n #Adds point total of all the home players \n while home_counter < game_hash[:home][:players].length\n home_point_totals += game_hash[:home][:players][home_counter][:points]\n home_counter += 1\n end \n #Adds point total of all the away players \n while away_counter < game_hash[:away][:players].length\n away_point_totals += game_hash[:away][:players][away_counter][:points]\n away_counter += 1\n end \n #Determines if home has more points than away, then returns team name of highest point total \n if home_point_totals > away_point_totals\n return game_hash[:home][:team_name]\n else \n return game_hash[:away][:team_name]\n end \nend",
"title": ""
},
{
"docid": "87193e572d5a4c81e080d316dde5edf8",
"score": "0.6338398",
"text": "def winning_team\n home_score = 0\n home_team = game_hash[:home][:team_name]\n away_score = 0\n away_team = game_hash[:away][:team_name]\n \n (game_hash[:home][:players]).each do |person_name, data|\n home_score += data[:points]\n end\n (game_hash[:away][:players]).each do |person_name, data|\n away_score += data[:points]\n end\n team_scores = {home_team => home_score, away_team => away_score}\n highest_scoring_team = team_scores.max_by { |team, score| score }[0]\nend",
"title": ""
},
{
"docid": "9f58e7e6059b570984af1315fab8c75c",
"score": "0.63227135",
"text": "def getGameWinners\n games = Game.where(week_id: session[:currentWeek])\n winners = Hash.new\n pushcount = 50\n games.each do |g|\n # put winners in key and loser in value\n if g.winning_team_id > 0\n if g.winning_team_id == g.home_team_id\n loser = g.vis_team_id\n elsif \n loser = g.home_team_id\n end\n if g.winning_team_id == 100\n winners[pushcount] = g.home_team_id\n pushcount += 1\n winners[pushcount] = g.vis_team_id\n pushcount += 1\n end\n winners[g.winning_team_id] = loser\n end\n end\n return winners\n end",
"title": ""
},
{
"docid": "4ce5fe551110daf477917c35c796d1f0",
"score": "0.6322509",
"text": "def top(options = {}, &block)\n params = {}\n\n if options[:hls]\n params[:hls] = true\n end\n\n return @query.connection.accumulate(\n :path => 'games/top',\n :params => params,\n :json => 'top',\n :create => -> hash { Game.new(hash, @query) },\n :limit => options[:limit],\n :offset => options[:offset],\n &block\n )\n end",
"title": ""
},
{
"docid": "4cada58d45f75376daa75407b845b874",
"score": "0.62999505",
"text": "def order_games_by_venue\n most_popular_venue = Hash.new(0)\n sort_games_by_venue.each do |venue|\n most_popular_venue[venue] += 1\n end\n most_popular_venue\n end",
"title": ""
},
{
"docid": "cbc4107467c0f1d032445162ca2f3e29",
"score": "0.6290708",
"text": "def home_shoe_max\n join_teams.max_by do |player|\n player[:shoe]\nend\nend",
"title": ""
},
{
"docid": "d44785dd8838378ed4c71e34b67afea9",
"score": "0.62906057",
"text": "def current_winning_team(game)\n score_keeper = {}\n \n game.each do |team, team_info|\n score = 0\n\n team_info[:players].each_value do |player_info, info|\n score += player_info[:stats][:points]\n end\n \n score_keeper[team] = score\n\n end\n\n high_score = score_keeper.values.max\n high_scorer = score_keeper.key(high_score)\n\n puts \"The winning team is #{high_scorer} with a score of #{high_score}. Yasss.\"\n\nend",
"title": ""
},
{
"docid": "cfa33e813325e4a9424a03d84e716ad4",
"score": "0.6258382",
"text": "def index\n @games = Game.order(\"#{sort_column} #{sort_direction}\").page(params[:page]).per(20)\n @most = Game.most\n end",
"title": ""
},
{
"docid": "4f3efb2902c698f3598a48903eb012b8",
"score": "0.6251452",
"text": "def index\n @games = Game.all\n @latest_games = Game.latest\n @popular_games = Game.most_popular\n @best_games = Game.best\n end",
"title": ""
},
{
"docid": "58f1243cdcfcc69e4a9ae071cb44e9bf",
"score": "0.624418",
"text": "def fetch_games\n params = {\n include_appinfo: 1,\n include_played_free_games: 1,\n steamId: steam_id64\n }\n games_data = WebApi.json 'IPlayerService', 'GetOwnedGames', 1, params\n @games = {}\n @recent_playtimes = {}\n @total_playtimes = {}\n games_data[:response][:games].each do |game_data|\n app_id = game_data[:appid]\n @games[app_id] = SteamGame.new app_id, game_data\n\n @recent_playtimes[app_id] = game_data[:playtime_2weeks] || 0\n @total_playtimes[app_id] = game_data[:playtime_forever] || 0\n end\n\n @games\n end",
"title": ""
},
{
"docid": "3b435da6ddc73bf8fc62876c571a73e9",
"score": "0.624416",
"text": "def top_six_wins\n top_six_wins = 0\n away_fantasy_games = self.away_fantasy_games.where(week: 1..13)\n home_fantasy_games = self.home_fantasy_games.where(week: 1..13)\n\n away_fantasy_games.each do |game|\n away_teams_beaten = FantasyGame.where(\"away_score < ?\", game.away_score).where(year: self.year, week: game.week).count\n home_teams_beaten = FantasyGame.where(\"home_score < ?\", game.away_score).where(year: self.year, week: game.week).count\n if (away_teams_beaten + home_teams_beaten) > 5\n top_six_wins += 1\n end\n end\n\n home_fantasy_games.each do |game|\n away_teams_beaten = FantasyGame.where(\"away_score < ?\", game.home_score).where(year: self.year, week: game.week).count\n home_teams_beaten = FantasyGame.where(\"home_score < ?\", game.home_score).where(year: self.year, week: game.week).count\n if (away_teams_beaten + home_teams_beaten) > 5\n top_six_wins += 1\n end\n end\n return top_six_wins\n end",
"title": ""
},
{
"docid": "1f5b4607eb63ea92b5e57da5a2fcfcba",
"score": "0.62356454",
"text": "def winning_team\n \n info = game_hash\n \n #arrays to iterate over to pass as arguments to stat_search method\n all_home = info[:home][:players].map{|hash| hash.fetch(:player_name)}\n all_away = info[:away][:players].map{|hash| hash.fetch(:player_name)}\n \n total_home = 0\n total_away = 0\n \n all_home.each{|name| total_home += stat_search(name, :points)}\n all_away.each{|name| total_away += stat_search(name, :points)}\n \n if total_home > total_away\n return info[:home][:team_name]\n else\n if total_away > total_home\n return info[:away][:team_name]\n else \n return \"It's a tie!\"\n end\n end\n \nend",
"title": ""
},
{
"docid": "8eefed2629daa63daf78aa4367177260",
"score": "0.623109",
"text": "def show_most_popular\n @cards = Card.order(\"impressions_count DESC\")[0..19]\n end",
"title": ""
},
{
"docid": "6efc492c5c11d70f26ca519940739b50",
"score": "0.622954",
"text": "def top10Gainers\n gainersLosers.first(10).to_h\n end",
"title": ""
},
{
"docid": "ff4b8f6913b444d3a43e3ff77faebef4",
"score": "0.6224532",
"text": "def games; end",
"title": ""
},
{
"docid": "68cf0c93301099382f8ef3d46197dc69",
"score": "0.62159896",
"text": "def most_steals\n steals_arr = []\n game_hash.each do |key, value|\n value[:players].each do |player|\n steals_arr << player[:steals]\n steals_arr.sort!\n end\n end\n steals_arr[-1]\nend",
"title": ""
},
{
"docid": "186af28ac62e00f4898ffaadc7639dba",
"score": "0.6203237",
"text": "def most_popular()\n sql = \"SELECT screenings.*, films.title\n FROM films\n INNER JOIN screenings\n ON screenings.film_id = films.id\n WHERE film_id = $1\n ORDER BY screenings.tickets_sold DESC;\"\n\n result = SqlRunner.run(sql, [@id])\n #gives all sorted with most sold 1st\n screenings = Screening.map_items(result)\n #pulls out the show_time from the first result in that array\n screenings.first().show_time\nend",
"title": ""
},
{
"docid": "af12d4e061665fb1b73e720af50c787b",
"score": "0.62023914",
"text": "def _get_games\n games = []\n\n thisgame = []\n belowNS, belowEW = 0, 0 # Cumulative totals for results in this game.\n\n self.each do |result|\n thisgame << result\n if [Direction.north, Direction.south].include?(result.contract.declarer)\n belowNS += result.score[1]\n if belowNS >= 100\n games << [thisgame, [Direction.north, Direction.south]]\n else\n belowEW += result.score[1]\n if belowEW >= 100\n games << [thisgame, [Direction.east, Direction.west]]\n end\n end\n # If either total for this game exceeds 100, proceed to next game.\n if belowNS >= 100 or belowEW >= 100 \n thisgame = []\n belowNS, belowEW = 0, 0 # Reset accumulators.\n end\n end\n end\n return games\n end",
"title": ""
},
{
"docid": "22331706bf4548465ed5c8710c89070c",
"score": "0.6189638",
"text": "def show_game_results(players, num_rounds, num_shoes)\n puts; 79.times { print \"-\" }; puts\n for player in players\n puts player.summary\n end\n puts \"Total of all bankrolls: \\$#{players[0].all_bankrolls}\"\n puts \"Total rounds completed: #{num_rounds}\"\n puts \"Total shoes completed: #{num_shoes}\"\n end",
"title": ""
},
{
"docid": "7b410c068b5ced93e680b1544b3612d0",
"score": "0.61752456",
"text": "def highest_scoring_home_team\n foo = {}\n\n teams.each do |team|\n team_id = team['team_id']\n team_name = team['teamName']\n\n foo[team_name] = average_goals_home(team_id)\n end\n\n foo.min_by { |_k, v| -v }[0]\n end",
"title": ""
},
{
"docid": "51297c268b0684058609b7aa7f31c8ca",
"score": "0.61621183",
"text": "def get_stats(games, team)\n\n team[:wins] = 0\n team[:losses] = 0\n\n games.each do |game|\n\n #Wins and losses if a game is found with the team playing at home...\n if game[:home_team] == team[:team]\n\n game[:home_score].to_i > game[:away_score].to_i ? team[:wins] += 1 : team[:losses] += 1\n\n # or if a game is found with the team playing away.\n elsif game[:away_team] == team[:team]\n\n game[:away_score].to_i > game[:home_score].to_i ? team[:wins] += 1 : team[:losses] += 1\n\n end\n\n end\n\nend",
"title": ""
},
{
"docid": "d1fbfda221ec23974fa717f898dc3bc2",
"score": "0.61578685",
"text": "def most_steals(game)\n big_steals = [\"Default\", 0] #[Name, steals]\n\n game.each_value do |team, team_info|\n team[:players].each do |name, player_info|\n if player_info[:stats][:steals] > big_steals[1]\n big_steals[0] = name\n big_steals[1] = player_info[:stats][:steals]\n end\n end\n end\n\n high_stealer = big_steals[0]\n high_steal_num = big_steals[1]\n puts \"#{high_stealer} stole #{high_steal_num} times, the most out of them all!\"\n\n high_stealer\nend",
"title": ""
},
{
"docid": "738fb3ed61b4466d9034e49d20a7bad2",
"score": "0.6153602",
"text": "def list_games\n\t\tputs <<-DOC\n \tHere are the current top #{@given_range} games.\nRank\tGame\n DOC\n\t\tcounter = 0\n\t\t@games.each do |game|\n\t\t\tif counter < @given_range\n\t\t\t\tputs \"#{game.rank} \t#{game.title}\"\n\t\t\tend #end the if\n\t\t\tcounter +=1\n\t\tend #ends the each do\n\t\t\ttop_menu\n\tend",
"title": ""
},
{
"docid": "8b3a70a51acb3ad25f647cc9cb35efd3",
"score": "0.61499953",
"text": "def show\n @games = add_game_sort(@franchise.games.\n default_preload.\n paginate page: params[:page])\n get_rankings\n end",
"title": ""
},
{
"docid": "9e40207a1ffcbdfccc800b4aa4afd29c",
"score": "0.6143229",
"text": "def games\n scores.sort.map {|sc| sc.game }\n end",
"title": ""
},
{
"docid": "4950db9a492909c53cf4017b698a0398",
"score": "0.61396295",
"text": "def get_season_stats(games)\n mechanize=Mechanize.new\n games.each do |game|\n puts game.code\n get_team_boxscore(game, game.home_team.team, mechanize)\n get_team_boxscore(game, game.away_team.team, mechanize)\n end\nend",
"title": ""
},
{
"docid": "bfb19f1bcaface3def210062819d2055",
"score": "0.6137125",
"text": "def most_points_scored\n high_points = \"\"\n player_with_points = \"\"\n game_hash.each do |place, team|\n team.each do |attributes, data|\n if attributes == :players \n data.each do |player, stats|\n if high_points == \"\"\n high_points = stats[:points]\n player_with_points = player \n elsif stats[:points] > high_points\n high_points = stats[:points]\n player_with_points = player \n end \n end \n end \n end \n end \n player_with_points\nend",
"title": ""
},
{
"docid": "ab7e2743f6d6f2d0c2281fbdcba395d0",
"score": "0.6136916",
"text": "def find_top\n return @all_listings.tops\n end",
"title": ""
},
{
"docid": "ab7e2743f6d6f2d0c2281fbdcba395d0",
"score": "0.6136916",
"text": "def find_top\n return @all_listings.tops\n end",
"title": ""
},
{
"docid": "020bc829892fa4410410318cc430f1ab",
"score": "0.6115759",
"text": "def steam_games(steam_id)\n game = JSON.parse(Net::HTTP.get(URI(\"https://api.steampowered.com/ISteamApps/GetAppList/v2/\")))[\"applist\"][\"apps\"]\n games = []\n game_time = []\n pairing = []\n total_games = Steam::Player.owned_games(steam_id)['games']\n Steam::Player.owned_games(steam_id)['games'].each{ |game_specs|\n game_time << game_specs['playtime_forever'].to_i/60\n }\n # if game_time.length >= 50\n # game_time = game_time[0..50]\n # total_games = total_games[0..50]\n # end\n \n #Total number of games the account owns\n #Tterates through each hash(game)\n total_games.each { |x|\n #2nd API which is used to turn the game ID into itle\n #'game' is a array of hashes of all of steam's games\n game.each { |app_id| \n if app_id['appid'] == x['appid']\n games << app_id['name']\n break\n end\n }\n }\n for i in 0...games.length do\n pairing << {game_time[i] => games[i]} \n end\n pairing.each.sort_by { |hash| hash.keys }.reverse\n end",
"title": ""
},
{
"docid": "2669a0232dbc88e8b6e60cbdcb46f397",
"score": "0.6115028",
"text": "def top5\n results[0..4]\n end",
"title": ""
},
{
"docid": "395d6c59f2b45e373b3a09780b621776",
"score": "0.6114205",
"text": "def final_top\n top_list = []\n\n # Get all the user selected for top\n @tops.each do |top|\n top_list << @players.find(top.topplayer)\n end\n\n # Sort the list with count\n @count_tops = top_list.each_with_object(Hash.new(0)) { |o, h| h[o] += 1 }\n\n # Reverse in order to have most voted first\n @count_tops = @count_tops.sort_by {|k,v| v}.reverse\n end",
"title": ""
},
{
"docid": "395d6c59f2b45e373b3a09780b621776",
"score": "0.6114205",
"text": "def final_top\n top_list = []\n\n # Get all the user selected for top\n @tops.each do |top|\n top_list << @players.find(top.topplayer)\n end\n\n # Sort the list with count\n @count_tops = top_list.each_with_object(Hash.new(0)) { |o, h| h[o] += 1 }\n\n # Reverse in order to have most voted first\n @count_tops = @count_tops.sort_by {|k,v| v}.reverse\n end",
"title": ""
},
{
"docid": "d0fd005a2ca5694ac568331710464ff5",
"score": "0.6112855",
"text": "def winning_team\n home_points = game_hash[:home][:players].collect { |player, player_data| player_data[:points]}\n home_sum = home_points.reduce(:+)\n away_points = game_hash[:away][:players].collect { |player, player_data| player_data[:points]}\n away_sum = away_points.reduce(:+)\n if home_sum > away_sum\n game_hash[:home][:team_name]\n elsif away_sum > home_sum\n game_hash[:away][:team_name]\n else\n \"tie score\"\n end\nend",
"title": ""
},
{
"docid": "0b981a1f9ca3e913707f8740ebf650e2",
"score": "0.6110435",
"text": "def winningest_coach(season)\n season_game_teams = season_game_teams(season)\n foo = {}\n\n coaches.each do |coach|\n foo[coach] = season_coaching_data(coach, season_game_teams)\n end\n\n foo.sort_by { |k, _v| -k }.min_by { |_k, v| -v[:winning_percentage] }[0]\n end",
"title": ""
},
{
"docid": "438c451362ebe088d50d93dfaa0e3dc5",
"score": "0.6107045",
"text": "def best_offense\n foo = {}\n\n teams.each do |team|\n team_id = team['team_id']\n team_name = team['teamName']\n\n foo[team_name] = average_goals_scored_per_game(team_id)\n end\n\n foo.min_by { |_k, v| -v }[0]\n end",
"title": ""
},
{
"docid": "d1808916324c7955dbba4d7379cdec2d",
"score": "0.609939",
"text": "def topshit\n\t\t@title = t(:page_top_list)\n @topshits = Shit.topshit(10)\n end",
"title": ""
},
{
"docid": "edc7334c9d59e32b356e982c24d67b61",
"score": "0.6097831",
"text": "def get_highest_home_runners(players, year)\n highest_hr_total = 0\n home_run_winners = []\n players.each do |player|\n if player.stats_for_year(year).home_runs > highest_hr_total\n home_run_winners = [player]\n highest_hr_total = player.stats_for_year(year).home_runs \n elsif player.stats_for_year(year).home_runs == highest_hr_total\n home_run_winners << player\n end\n end\n home_run_winners\n end",
"title": ""
},
{
"docid": "61eb02a76cb92706432c39bc3b46d651",
"score": "0.6094198",
"text": "def winning_team\n home_score = 0\n away_score = 0\n game_hash[:home][:players].each do |category|\n home_score += category[:points]\n end\n game_hash[:away][:players].each do |category|\n away_score += category[:points]\n end\n(home_score > away_score ? game_hash[:home][:team_name] :\ngame_hash[:away][:team_name])\nend",
"title": ""
},
{
"docid": "ce09eacb3f63d2ba158765c335ef5685",
"score": "0.6091949",
"text": "def most_points_scored \n game_hash \n home_counter = 0\n away_counter = 0\n home_counter2 = 0\n away_counter2 = 0 \n point_totals = []\n most_points = 0\n #Adds point total of all the home players to array\n while home_counter < game_hash[:home][:players].length\n point_totals << game_hash[:home][:players][home_counter][:points]\n home_counter += 1\n end \n #Adds point total of all the away players to array\n while away_counter < game_hash[:away][:players].length\n point_totals << game_hash[:away][:players][away_counter][:points]\n away_counter += 1\n end \n #Find largest point total in array and set it to variable \n most_points = point_totals.max \n #Checks to see if the largest point total belongs to a player on the away team, if so, returns his name\n while away_counter2 < game_hash[:away][:players].length do\n if game_hash[:away][:players][away_counter2][:points] == most_points\n return game_hash[:away][:players][away_counter2][:player_name]\n else \n end \n away_counter2 += 1\n end \n #Checks to see if the largest point total belongs to a player on the home team, if so, returns his name\n while home_counter2 < game_hash[:home][:players].length do\n if game_hash[:home][:players][home_counter2][:points] == most_points\n return game_hash[:home][:players][home_counter2][:player_name]\n else \n end \n home_counter2 += 1\n end \nend",
"title": ""
},
{
"docid": "bc5c1b36b1af6a357e09c5a939218660",
"score": "0.6089123",
"text": "def who_is_winning(game)\n home_points = 0\n away_points = 0\n \n game[:home][:players].each do |player_hash|\n home_points += player_hash[:stats][:points]\n end\n \n game[:away][:players].each do |player_hash|\n away_points += player_hash[:stats][:points]\n end\n \n home_points > away_points ? {\"Home: #{game[:home][:team_name]}\" => home_points} : {\"Away: #{game[:away][:team_name]}\" => away_points}\nend",
"title": ""
},
{
"docid": "9f83d16f3e5a944901e2093f28a9547d",
"score": "0.6087834",
"text": "def top10Losers\n gainersLosers.last(10).reverse\n end",
"title": ""
},
{
"docid": "abfd283a489ed7b8b1f102114ba72f78",
"score": "0.6086698",
"text": "def top_played_champs\n @player_champs_list.sort_by{ |champ| -champ.total_games }\n end",
"title": ""
},
{
"docid": "d0fdfee23ad62b0276d711fbde481549",
"score": "0.60856676",
"text": "def winning_team\n home_team = 0\n away_team = 0\n\n game_hash.each do |location, team_data|\n #sum home team points\n if location == :home\n team_data.each do |attribute, data|\n if attribute == :players\n data.each do |player_data|\n player_data.each do |name, stats|\n home_team += stats[:points]\n end\n end\n end\n end\n end\n #sum away team points\n if location == :away\n team_data.each do |attribute, data|\n if attribute == :players\n data.each do |player_data|\n player_data.each do |name, stats|\n away_team += stats[:points]\n end\n end\n end\n end\n end\n end\n\n if home_team > away_team\n return game_hash[:home][:team_name]\n else\n return game_hash[:away][:team_name]\n end\n\nend",
"title": ""
},
{
"docid": "c84f7e909581ff26dcc932344cc62816",
"score": "0.60811126",
"text": "def most_slam_dunks\n slam_numbers = 0\n slammers = \"\"\n search_players { |player|\n if player[:slam_dunks] > slam_numbers\n slam_numbers = player[:slam_dunks]\n slammers = player[:player_name]\n end\n }\n puts \"#{slammers} has the most slam dunks at #{slam_numbers} dunks\"\nend",
"title": ""
},
{
"docid": "7591d973f99dd39fd1efe28077502bfe",
"score": "0.60807586",
"text": "def current_games\n\t\t@current_games ||= get_lines([\"http://www.vegasinsider.com/#{sport_name}/odds/las-vegas/\",\"http://www.vegasinsider.com/#{sport_name}/odds/las-vegas/money/\"])\n\tend",
"title": ""
},
{
"docid": "955652dade24b3fdfdad799af3e43c25",
"score": "0.6074794",
"text": "def cheapest_products\n top_products = @products.sort_by { |hsh| hsh[:price] }\n\n # JSON.pretty_generate(top_products[0 .. 10])\n puts \"Best Seller products => #{JSON.pretty_generate(top_products[0 .. 10])}\"\n end",
"title": ""
},
{
"docid": "46decfab2f2df17bfddad00a0a0fbb2a",
"score": "0.607401",
"text": "def highest_scoring_visitor\n away_goals = Hash.new(0.00)\n\n #get sum of away_goals per away team (hash output)\n\n unique_away_teams_array_helper.each do |team_id|\n self.games.each_value do |game|\n away_goals[team_id] += (game.away_goals) if game.away_team_id == team_id\n end\n end\n\n #turn sum into average\n\n away_goals.merge!(total_away_games_helper) do |key, oldval, newval|\n (oldval / newval).round(2)\n end\n\n #return highest\n\n highest_avg_hash = away_goals.max_by do |k, v|\n v\n end\n\n team_name_finder_helper(highest_avg_hash[0])\n\n end",
"title": ""
},
{
"docid": "e8be597bbc4036ecfb051b0064817777",
"score": "0.60722977",
"text": "def top_players_general(hash={})\n return if hash.blank?\n\n result = {}\n\n # points to assign to positions\n points = [25, 18, 15, 12, 10, 0]\n\n hash.each_pair do |game, players|\n\n players.each_with_index do |player, index|\n next if index>5 #only 5 first players have points\n\n result[player.player_email] ||= 0\n\n # acumulate points to the player in each game\n result[player.player_email] += points[index]\n end\n end\n\n result = result.sort_by{|email, score| score}.reverse[0..Game::TOP_GENERAL]\n\n result\n end",
"title": ""
},
{
"docid": "f853b893ffdcb8d9665ae2a851d4350b",
"score": "0.60703987",
"text": "def popular_games(currencies, size = 25, page = 1)\n get(\n \"#{qt_plate_form_url}/v1/games/most-popular?currencies=#{currencies}&size=#{size}&page=#{page}\",\n qt_plateform_headers\n )\n end",
"title": ""
},
{
"docid": "8888ea0ae37b52513ba5bb62308446bb",
"score": "0.6069539",
"text": "def find_top\n return @listings.tops\n end",
"title": ""
},
{
"docid": "3fec01a96c9bc32d2505f458fd675d04",
"score": "0.6068732",
"text": "def fetch_games\n url = \"#{base_url}/games?xml=1\"\n\n @games = {}\n @playtimes = {}\n games_data = REXML::Document.new(open(url, {:proxy => true}).read).root\n games_data.elements.each('games/game') do |game_data|\n game = SteamGame.new(game_data)\n @games[game.app_id] = game\n recent = total = 0\n unless game_data.elements['hoursLast2Weeks'].nil?\n recent = game_data.elements['hoursLast2Weeks'].text.to_f\n end\n unless game_data.elements['hoursOnRecord'].nil?\n total = game_data.elements['hoursOnRecord'].text.to_f\n end\n @playtimes[game.app_id] = [(recent * 60).to_i, (total * 60).to_i]\n end\n\n true\n end",
"title": ""
},
{
"docid": "e8a59f41279753d3f2d72478a9de66cb",
"score": "0.60632706",
"text": "def get_top\n url = base_url + 'cryptocurrency/listings/latest'\n fetch_data(url)\n end",
"title": ""
},
{
"docid": "19073a4e4bed8a56ee2a36bc47700a80",
"score": "0.60604405",
"text": "def winningest_team\n foo = {}\n\n teams.each do |team|\n team_id = team['team_id']\n team_name = team['teamName']\n\n foo[team_name] = winning_percentage(team_id)\n end\n\n foo.min_by { |_k, v| -v }[0]\n end",
"title": ""
},
{
"docid": "d58c05a90fe3905dfa9896fbf171ea27",
"score": "0.6053424",
"text": "def winning_team\n home_team_points = 0\n away_team_points = 0\n\n game_hash.each do |location, team_data|\n points = 0\n team_data[:players].each do |player_hash|\n points += player_hash[:points]\n end\n location == :home ? home_team_points = points : away_team_points = points\n end\n\n home_team_points > away_team_points ? game_hash[:home][:team_name] : game_hash[:away][:team_name]\nend",
"title": ""
},
{
"docid": "e8d7615478a3a95cc3cfeda4b56f52d8",
"score": "0.60474133",
"text": "def player_numbers(team)\n #iterate through home and away\n return_array = []\n game_hash.each do |location, attribute|\n if game_hash[location][:team_name] == team\n return_array = game_hash[location][:players].collect do |pname, stat|\n game_hash[location][:players][pname][:number]\n end\n return_array.sort!\n end\n end\n return_array\nend",
"title": ""
},
{
"docid": "9b25730ce3e258c7b861668807338bd1",
"score": "0.6045683",
"text": "def winning_team\n home = 0\n away = 0\n game_hash.each do |team|\n if team[0] == :away\n team[1][:players].each do |player|\n away += player[:points]\n end\n else \n team[1][:players].each do |player|\n home += player[:points]\n end\n end\n end\n home > away ? \"Brooklyn Nets\" : \"Charlotte Hornets\"\nend",
"title": ""
},
{
"docid": "dac0f0065d75330d84713ad4dbd9efbd",
"score": "0.6043935",
"text": "def winning_team\n homepoints = 0\n awayPoints = 0\n winningName = nil\n game_hash.each do |place, team|\n team.each do |team_info_key, team_info_value|\n if team_info_key == :players\n team_info_value.each do |player|\n if place == :home\n homepoints += player[:points]\n end\n if place == :away\n awayPoints += player[:points]\n end\n end\n end\n end\n end\n if homepoints < awayPoints\n winningName = game_hash[:away][:team_name]\n puts awayPoints\n puts winningName\n end\n if homepoints > awayPoints\n winningName = game_hash[:home][:team_name]\n puts homepoints\n puts winningName\n end\n if homepoints == awayPoints\n puts \"It is a tie\"\n end\nend",
"title": ""
},
{
"docid": "4ff48c93a21a9d451e9198e36bb74d29",
"score": "0.60351354",
"text": "def best_of_n\n puts \"How many games are we playing?\"\n @games = gets.chomp.to_i\n end",
"title": ""
},
{
"docid": "cab43ba1560d71fe4681dbe6cdeed0c2",
"score": "0.6032814",
"text": "def winning_team()\n home_team_hash = game_hash[:home]\n home_players_array = home_team_hash[:players]\n home_points = 0\n\n away_team_hash = game_hash[:away]\n away_players_array = away_team_hash[:players]\n away_points = 0\n i = 0\n h_len = home_players_array.length()\n a_len = away_players_array.length()\n while i < h_len && i < a_len\n h_player = home_players_array[i]\n h_points = h_player[:points]\n home_points += h_points\n a_player = away_players_array[i]\n a_points = a_player[:points]\n away_points += a_points\n i += 1\n end\n if(home_points > away_points)\n name = home_team_hash[:team_name]\n return name\n end\n name = name = away_team_hash[:team_name]\n return name\nend",
"title": ""
},
{
"docid": "90b27b2fac09911d07459a5367fa7600",
"score": "0.6031045",
"text": "def cheapest_products\n top_products = @products.sort_by { |hsh| hsh[:price] }\n\n JSON.pretty_generate(top_products[0 .. 9])\n # puts \"Best Seller products => #{JSON.pretty_generate(top_products[0 .. 9])}\"\n end",
"title": ""
},
{
"docid": "0bab45cc96a396b6a8446c22f356575f",
"score": "0.6027397",
"text": "def winningest_coach(season)\n coach_win_percentage_hash = coach_win_percentage_helper(season)\n best_win_percentage = 0.0\n best_coach = \"\"\n\n coach_win_percentage_hash.each do |coach, win_percentage|\n if win_percentage > best_win_percentage\n best_win_percentage = win_percentage\n best_coach = coach\n end\n end\n best_coach\n end",
"title": ""
},
{
"docid": "536d30c7e824c346b4319fed713dcc90",
"score": "0.60250294",
"text": "def highest_scoring_visitor\n foo = {}\n\n teams.each do |team|\n team_id = team['team_id']\n team_name = team['teamName']\n\n foo[team_name] = average_goals_away(team_id)\n end\n\n foo.min_by { |_k, v| -v }[0]\n end",
"title": ""
},
{
"docid": "87e647220f891eb406af0d7f16b2c06b",
"score": "0.60249704",
"text": "def best_offense\n best_team = @teams.max_by do |team|\n team.average_goals_scored(@games)\n end\n return best_team.teamname\n end",
"title": ""
},
{
"docid": "9e7fe08d5afd6d5fbe06741e84d6a257",
"score": "0.60094243",
"text": "def winning_teams(data)\r\n score_1 = data[:home][:players].sum { |_, h| h[:points] }\r\n #=> 96\r\n score_2 = data[:away][:players].sum { |k, v| v[:points] }\r\n #=> 85\r\n if score_1 > score_2 \r\n puts \"Brooklyn Nets won the game, their score was #{score_1} points\"\r\n else \r\n puts \"Charlotte Hornets won the game, their score was #{score_2} points\"\r\n end\r\nend",
"title": ""
},
{
"docid": "94a2d4e0c3ee6ec0f8dde35e3a795559",
"score": "0.5997206",
"text": "def winning_team\n home_team = 0\n away_team = 0\n game_hash[:home][:players].each do |name, value|\n home_team += value[:points]\n end\n game_hash[:away][:players].each do |name, value|\n away_team += value[:points]\n end\n if home_team > away_team\n game_hash[:home][:team_name]\n elsif home_team < away_team\n game_hash[:away][:team_name]\n else\n \"It's a tie!\"\n end\n end",
"title": ""
},
{
"docid": "30d411a43e87438bb8f8c70e20846f78",
"score": "0.5992403",
"text": "def biggest_shoe\n biggest_shoe = {:shoe => 0}\n #iterate through teams\n game_hash.each do |teams, info|\n #iterate through team info\n info.each do |team_info, value|\n if team_info == :players\n #iterate through players and update biggest_shoe if shoe size larger\n value.each do |player|\n if player[:shoe] > biggest_shoe[:shoe]\n biggest_shoe = player\n end\n end\n end\n end\n end\n return biggest_shoe\nend",
"title": ""
},
{
"docid": "20592d757f434d0fa816b57843183c21",
"score": "0.59889066",
"text": "def bestBat(game_table)\n #for getting best WPA from the team won\n if @team_won == \"HOME\"\n scalar = 1\n else\n scalar = -1 #get the most negative WPA\n end\n \n bestBat = Hash.new\n bestWPA = -100.1 #lower than lowest WPA\n \n game_table.each do |inning|\n inning.each do |bat_hash|\n bat_WPA = bat_hash[\"WPA\"]\n if (bat_WPA * scalar) > bestWPA \n bestBat = bat_hash\n bestWPA = bat_WPA\n end\n end\n end\n \n return bestBat\n end",
"title": ""
},
{
"docid": "f1eac91078e7b432c0c0a85a9444ba99",
"score": "0.59886396",
"text": "def nintendo_switch_games\n # uses the nintendo_switch_games scope to retrieve all the games for the Nintendo Switch\n @games = Game.nintendo_switch_games\n # sorts the games by title in alphabetical order\n @games = @games.sort_by(&:title)\n end",
"title": ""
},
{
"docid": "5939c9425af9ce040befb958649e3c81",
"score": "0.5987656",
"text": "def winning_team\n points_home = 0\n game_hash.each do |a,b|\n b[:players].each do |c,d|\n if a.to_s == \"home\"\n points_home = d[:points] + points_home\n end\n end\n end \n points_away = 0\n game_hash.each do |a,b|\n b[:players].each do |c,d|\n if a.to_s == \"away\"\n points_away = d[:points] + points_away\n end\n end\n end \n points_home > points_away ? game_hash[:home][:team_name] : game_hash[:away][:team_name]\nend",
"title": ""
},
{
"docid": "93c570b9e740ace04a40b3bfd2837380",
"score": "0.5982588",
"text": "def get_top_snow_resorts\n\n\t\topen(\"http://feeds.snocountry.net/conditions.php?apiKey=#{@keys['snocountry_consumer_key']}&resortType=Alpine&action=top20\") do |f|\n\t\t\tjson_string = f.read\n\t\t\t\t\t\t\n\t\t\tparsed_json = JSON.parse(json_string)\n\t\t\t\n\t\t\treturn parsed_json\n\t\t\n\t\tend\t\n\t\t\n\t\t\n\tend",
"title": ""
},
{
"docid": "0006d2741023779da3f123773643d238",
"score": "0.59811074",
"text": "def best_offense\n teams_total_goals = total_goals_helper\n teams_total_games = total_games_helper\n\n best_team_goals_avg = 0\n best_offense_team_id = 0\n this_team_goals_avg = 0\n\n teams_total_games.each do |games_key, games_value|\n teams_total_goals.each do |goals_key, goals_value|\n if goals_key == games_key\n this_team_goals_avg = (goals_value / games_value.to_f)\n if this_team_goals_avg > best_team_goals_avg\n best_team_goals_avg = this_team_goals_avg\n best_offense_team_id = games_key\n end\n end\n end\n end\n\n team_with_best_offense = nil\n self.teams.each_value do |team_obj|\n if team_obj.team_id. == best_offense_team_id\n team_with_best_offense = team_obj.team_name\n end\n end\n\n team_with_best_offense\n end",
"title": ""
},
{
"docid": "81af093edfa26195cfa9782a65b1e6f6",
"score": "0.5980438",
"text": "def highest_scoring_visitor\n best_offense(\"away\")\n end",
"title": ""
},
{
"docid": "5ed64d498cbadf43763d619c0ba5fb50",
"score": "0.5971757",
"text": "def lowest_scoring_home_team\n foo = {}\n\n teams.each do |team|\n team_id = team['team_id']\n team_name = team['teamName']\n\n foo[team_name] = average_goals_home(team_id)\n end\n\n foo.max_by { |_k, v| -v }[0]\n end",
"title": ""
},
{
"docid": "49f483c5ea901fedfd9bfef8ac3e1472",
"score": "0.5970847",
"text": "def most_points_scored\n #Set max_shoe equal to negative infinity\n max_points = -1.0/0\n max_points_player = nil\n game_hash.each do |location, attributes|\n game_hash[location][:players].each do|pname, stats|\n if game_hash[location][:players][pname][:points] > max_points\n max_points = game_hash[location][:players][pname][:points]\n max_points_player = pname\n end\n end\n end\n max_points_player\nend",
"title": ""
},
{
"docid": "2d74096684dec1b8bd58c5b573ea8527",
"score": "0.5967631",
"text": "def highest_priced_game\n\nend",
"title": ""
},
{
"docid": "614c28b864c5b2fc3a24d1adbdee416f",
"score": "0.59639484",
"text": "def most_popular_showing()\n # binding.pry\n sql = \"SELECT screenings.* FROM screenings\n WHERE screenings.film_id = $1\"\n values = [@id]\n results = SqlRunner.run(sql, values)\n screenings = Screening.map_screenings(results)\n most_popular = screenings.max_by {|screening| screening.tickets_sold}\n return most_popular.show_time\n end",
"title": ""
},
{
"docid": "98569cec8d04f9b4579efcf0b3bf5e7b",
"score": "0.5963827",
"text": "def winning_team\n most_points = 0\n winner = []\n game_hash.values.each do |team|\n team_points = 0\n team[:players].values.each do |stats|\n team_points += stats[:points]\n end\n if team_points > most_points\n most_points = team_points\n winner = team[:team_name]\n end\n end\n winner\nend",
"title": ""
},
{
"docid": "84e4f25d75a545a35b56fcff421c739f",
"score": "0.59631145",
"text": "def winning_team\n home_points = []\n away_points = []\n game_hash.each do |team, team_info_hash|\n if team == :home \n team_info_hash.each do |attribute, data|\n if attribute == :players\n data.each do |index|\n home_points << index[:points]\n end\n end\n end\n end\n if team == :away\n team_info_hash.each do |attribute, data|\n if attribute == :players\n data.each do |index|\n away_points << index[:points]\n end\n end\n end\n end\n end\n home_points.sum > away_points.sum ? game_hash[:home][:team_name] : game_hash[:away][:team_name]\n end",
"title": ""
},
{
"docid": "120549e68840e536fc0935175b8626ec",
"score": "0.5960045",
"text": "def top_quizzes\n @quizzes = Quiz.most_games\n end",
"title": ""
}
] |
c2175533a04b50c6add00840cd67ad78 | GET /data_cleaning_algorithms/1 GET /data_cleaning_algorithms/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "06e9428864f549a73a0c593141dbfcd1",
"score": "0.67035544",
"text": "def index\n @data_cleaning_algorithms = DataCleaningAlgorithm.all\n end",
"title": ""
},
{
"docid": "17ee82683aab2adc5db4c112a0081853",
"score": "0.57562226",
"text": "def hecto\n # extract factor from params, if valid; default otherwise\n if params[:factor] && @@allowed_factors.include?(params[:factor].to_i)\n factor = params[:factor].to_i\n else\n factor = 1000\n end\n \n # extract key from params, if valid; return empty set otherwise\n if params[:hecto_key] && params[:hecto_key].length == @@allowed_key_size\n key = params[:hecto_key]\n\n @collection = Rails.cache.fetch(\"#{factor}/#{key}\", expires_in: 12.hours) do\n RoadSegment.by_factor(factor, key)\n end\n else\n @collection = []\n end\n \n respond_to do |format|\n format.json { render json: @collection.map(&:as_base64).to_json }\n end\n end",
"title": ""
},
{
"docid": "0fded6c1935300ce769a5ef371d16ed7",
"score": "0.56975067",
"text": "def destroy\n @data_cleaning_algorithm.destroy\n respond_to do |format|\n format.html { redirect_to data_cleaning_algorithms_url, notice: 'Data cleaning algorithm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "645de68d360447749d7a5e6b371474b6",
"score": "0.5642453",
"text": "def query_datasf\n read_json(\"https://data.sfgov.org/resource/wwmu-gmzc.json?$limit=1000000\")\nend",
"title": ""
},
{
"docid": "f5bdaa4f61eda92c0a6374351d2dbc9b",
"score": "0.56306386",
"text": "def index\n @algorithms = Algorithm.all\n end",
"title": ""
},
{
"docid": "f5bdaa4f61eda92c0a6374351d2dbc9b",
"score": "0.5630001",
"text": "def index\n @algorithms = Algorithm.all\n end",
"title": ""
},
{
"docid": "d0cf9a40f495cb9fae7f0c197140d563",
"score": "0.5584064",
"text": "def get_array_counts \n get(\"/arrays.json/summary\")\nend",
"title": ""
},
{
"docid": "5e4d7b1a908b8ed420afb685b8d9df11",
"score": "0.55543435",
"text": "def service\n begin\n res = RestClient.get(\"http://hn.algolia.com/api/v1/search_by_date?query=github&restrictSearchableAttributes=url&numericFilters=points>=1000\")\n JSON.parse res\n rescue => e\n e.response\n end \n end",
"title": ""
},
{
"docid": "0c8d99eb780b92c44b3c5ef5ddbe2858",
"score": "0.547797",
"text": "def dataset_analysis\n respond_to do |format|\n format.json {\n render json: Api::V1.dataset_analysis(params[:dataset_id], params[:question_code], clean_filtered_params(request.filtered_parameters)), callback: params[:callback]\n }\n end\n end",
"title": ""
},
{
"docid": "acf4484e7187c466c43c8811c6984e1d",
"score": "0.54380643",
"text": "def create\n @data_cleaning_algorithm = DataCleaningAlgorithm.new(data_cleaning_algorithm_params)\n\n respond_to do |format|\n if @data_cleaning_algorithm.save\n format.html { redirect_to @data_cleaning_algorithm, notice: 'Data cleaning algorithm was successfully created.' }\n format.json { render :show, status: :created, location: @data_cleaning_algorithm }\n else\n format.html { render :new }\n format.json { render json: @data_cleaning_algorithm.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f863ac0d159917526a8e90d778d97ed8",
"score": "0.54235715",
"text": "def retrieve_data\n # #YELLOW\n unless @raw_data # rubocop:disable GuardClause\n begin\n unless config[:server].start_with?('https://', 'http://')\n config[:server].prepend('http://')\n end\n\n url = \"#{config[:server]}/render?format=json&target=#{formatted_target}&from=#{config[:from]}\"\n\n url_opts = {}\n\n if config[:no_ssl_verify]\n url_opts[:ssl_verify_mode] = OpenSSL::SSL::VERIFY_NONE\n end\n\n if config[:username] && (config[:password] || config[:passfile])\n if config[:passfile]\n pass = File.open(config[:passfile]).readline\n elsif config[:password]\n pass = config[:password]\n end\n\n url_opts[:http_basic_authentication] = [config[:username], pass.chomp]\n end # we don't have both username and password trying without\n\n handle = open(url, url_opts)\n\n @raw_data = handle.gets\n if @raw_data == '[]'\n unknown 'Empty data received from Graphite - metric probably doesn\\'t exists'\n else\n @json_data = JSON.parse(@raw_data)\n output = {}\n @json_data.each do |raw|\n raw['datapoints'].delete_if { |v| v.first.nil? }\n next if raw['datapoints'].empty?\n target = raw['target']\n data = raw['datapoints'].map(&:first)\n start = raw['datapoints'].first.last\n dend = raw['datapoints'].last.last\n step = ((dend - start) / raw['datapoints'].size.to_f).ceil\n output[target] = { 'target' => target, 'data' => data, 'start' => start, 'end' => dend, 'step' => step }\n end\n output\n end\n rescue OpenURI::HTTPError\n unknown 'Failed to connect to graphite server'\n rescue NoMethodError\n unknown 'No data for time period and/or target'\n rescue Errno::ECONNREFUSED\n unknown 'Connection refused when connecting to graphite server'\n rescue Errno::ECONNRESET\n unknown 'Connection reset by peer when connecting to graphite server'\n rescue EOFError\n unknown 'End of file error when reading from graphite server'\n rescue => e\n unknown \"An unknown error occured: #{e.inspect}\"\n end\n end\n end",
"title": ""
},
{
"docid": "f02356041330b0d9f3a29c282921c7ba",
"score": "0.53652513",
"text": "def index\n @preprocess_algorithms = PreprocessAlgorithm.all\n end",
"title": ""
},
{
"docid": "d9e8c859c111187a1fc1e55be0b32503",
"score": "0.53559947",
"text": "def set_data_cleaning_algorithm\n @data_cleaning_algorithm = DataCleaningAlgorithm.find(params[:id])\n end",
"title": ""
},
{
"docid": "3ea6125f324b4630939238012bc97a06",
"score": "0.5319178",
"text": "def filter(event)\n total = event.get(\"[dois][buckets]\")\n\n dois = total.map do |dataset| \n\n unique_regular = dataset[\"access_method\"][\"buckets\"].find {|access_method| access_method['key'] == 'regular' }\n unique_machine = dataset[\"access_method\"][\"buckets\"].find {|access_method| access_method['key'] == 'machine' }\n total_regular = dataset[\"total\"][\"buckets\"].find {|access_method| access_method['key'] == 'regular' }\n total_machine = dataset[\"total\"][\"buckets\"].find {|access_method| access_method['key'] == 'machine' }\n\n puts dataset[\"key\"]\n { \n doi: dataset[\"key\"], \n unique_counts_regular: unique_regular.nil? ? 0 : unique_regular[\"unqiue\"][\"value\"],\n unique_counts_machine: unique_machine.nil? ? 0 : unique_machine[\"unqiue\"][\"value\"],\n total_counts_regular: total_regular.nil? ? 0 : total_regular[\"doc_count\"],\n total_counts_machine: total_machine.nil? ? 0: total_machine[\"doc_count\"]\n }\n end\n\n conn = Faraday.new(:url => API_URL)\n logger = Logger.new(STDOUT)\n logger.info total.size\n \n arr = dois.map do |dataset| \n logger.info dataset\n doi = dataset[:doi]\n json = conn.get \"/works/#{doi}\"\n next unless json.success?\n logger.info \"Success on getting metadata for #{doi}\"\n data = JSON.parse(json.body)\n\n instances =[\n {\n count: dataset[:total_counts_regular],\n \"access-method\": \"regular\",\n \"metric-type\": \"total-resolutions\"\n },\n {\n count: dataset[:unique_counts_regular],\n \"access-method\": \"regular\",\n \"metric-type\": \"unique-resolutions\"\n },\n {\n count: dataset[:unique_counts_machine],\n \"access-method\": \"machine\",\n \"metric-type\": \"unique-resolutions\"\n },\n {\n count: dataset[:total_counts_machine],\n \"access-method\": \"machine\",\n \"metric-type\": \"total-resolutions\"\n },\n ]\n\n instances.delete_if {|instance| instance.dig(:count) <= 0}\n\n attributes = data.dig(\"data\",\"attributes\")\n { \n \"dataset-id\": [{type: \"doi\", value: attributes[\"doi\"]}],\n \"data-type\": attributes[\"resource-type-id\"],\n yop: attributes[\"published\"],\n uri: attributes[\"identifier\"],\n publisher: attributes[\"container-title\"],\n \"dataset-title\": attributes[\"title\"],\n \"publisher-id\": [{\n type: \"client-id\",\n value: attributes[\"data-center-id\"]\n }],\n \"dataset-dates\": [{\n type: \"pub-date\",\n value: attributes[\"published\"]\n }],\n \"dataset-contributors\": attributes[\"author\"].map { |a| get_authors(a) },\n tags:[\"_dc_meta\"],\n platform: \"datacite\",\n performance: [{\n period: {\n \"begin-date\": \"\",\n \"end-date\": \"\",\n },\n instance: instances\n }]\n }\n end\n\n arr.map! do |instance|\n LogStash::Event.new(instance)\n end\n\n arr\nend",
"title": ""
},
{
"docid": "d7650a57a2f91ae078ae99de01175374",
"score": "0.5297164",
"text": "def retrieve_data\n # #YELLOW\n unless options[:server].start_with?('https://', 'http://')\n options[:server] = 'http://' + options[:server]\n end\n\n url = \"#{options[:server]}/render?format=json&target=#{formatted_target}&from=#{options[:from]}\"\n\n url_opts = {}\n\n if options[:no_ssl_verify]\n url_opts[:ssl_verify_mode] = OpenSSL::SSL::VERIFY_NONE\n end\n\n if options[:username] && (options[:password] || options[:passfile])\n if options[:passfile]\n pass = File.open(options[:passfile]).readline\n elsif options[:password]\n pass = options[:password]\n end\n\n url_opts[:http_basic_authentication] = [options[:username], pass.chomp]\n end # we don't have both username and password trying without\n handle = open(url, url_opts)\n\n @raw_data = handle.gets\n if @raw_data == '[]'\n fail 'Empty data received from Graphite - metric probably doesn\\'t exists'\n else\n @json_data = JSON.parse(@raw_data)\n output = {}\n @json_data.each do |raw|\n raw['datapoints'].delete_if { |v| v.first.nil? }\n next if raw['datapoints'].empty?\n target = raw['target']\n data = raw['datapoints'].map(&:first)\n start = raw['datapoints'].first.last\n dend = raw['datapoints'].last.last\n step = ((dend - start) / raw['datapoints'].size.to_f).ceil\n output[target] = { 'target' => target, 'data' => data, 'start' => start, 'end' => dend, 'step' => step }\n end\n output\n end\n end",
"title": ""
},
{
"docid": "b69d942d526a77bddf5f3bc995aa960e",
"score": "0.5294268",
"text": "def list_penalized_arrays(args = {}) \n get(\"/arrays.json/backoffice/penalty\", args)\nend",
"title": ""
},
{
"docid": "30b4fc40c94649c24494a47596ff7220",
"score": "0.52942634",
"text": "def index\n Algorithm.where(checked: false).each do |algorithm|\n algorithm.try_check\n end\n\n if current_user.vip\n @algorithms = Algorithm.all.desc(:created_at)\n else\n @algorithms = current_user.algorithms.desc(:created_at)\n end\n @algorithms = @algorithms.page(params[:page]).per(20)\n\n render layout: 'no_sidebar'\n end",
"title": ""
},
{
"docid": "5d12747080edbc6ab0ba510eca1839c5",
"score": "0.5291852",
"text": "def get_data\n uri = URI(\"https://taskboardv2.herokuapp.com/station1.json\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n JSON.parse(response.body)\nend",
"title": ""
},
{
"docid": "f715ec2588992cdbba28dac40fd3ae91",
"score": "0.52726096",
"text": "def data_cleaning_algorithm_params\n params.fetch(:data_cleaning_algorithm, {})\n end",
"title": ""
},
{
"docid": "d1d596d85d0e1f5c09a1274ee8dc991f",
"score": "0.52649343",
"text": "def index\n\n # This is an empty ActiveRecord object. It is never saved.\n @deposit = Deposit.new\n\n # if user asked for new/updated datasets, fetch or update them\n if params[:refresh] == 'true'\n # Get number of results to return\n num_datasets = get_number_of_results('has_model_ssim:\"Dlibhydra::Dataset\"')\n solr_response = nil\n # Get all dataset records from Solr\n unless num_datasets == 0\n solr_response = solr_query_short('has_model_ssim:\"Dlibhydra::Dataset\"','pure_uuid_tesim',num_datasets)\n end\n if params[:refresh_num]\n\n c = get_uuids(params[:refresh_num])\n get_datasets_from_collection(c, solr_response)\n\n elsif params[:refresh_from]\n\n c = get_uuids_created_from_tonow(params[:refresh_from])\n uuids = get_datasets_from_collection(c, solr_response)\n\n # uuids is a list of new datasets created after the solr query\n # these are used to ensure we don't create duplicates\n c = get_uuids_modified_from_tonow(params[:refresh_from])\n get_datasets_from_collection(c, solr_response, uuids)\n\n else\n c = get_uuids\n get_datasets_from_collection(c, solr_response)\n end\n end\n\n # setup base query parameters\n q = 'has_model_ssim:\"Dlibhydra::Dataset\"'\n ids = []\n fq = []\n no_results = false\n\n unless params[:q].nil?\n # TODO or search for multiple words etc.\n unless params[:q] == ''\n fq << 'for_indexing_tesim:' + params[:q] + ' OR restriction_note_tesim:' + params[:q]\n end\n\n unless params[:new].nil?\n fq << '!wf_status_tesim:*' # no workflow statuses\n fq << '!member_ids_ssim:*' # no packages\n end\n\n unless params[:doi].nil?\n if params[:doi] == 'doi'\n q += 'and doi_tesim:*'\n elsif params[:doi] == 'nodoi'\n fq << '!doi_tesim:*'\n end\n end\n\n unless params[:status].nil?\n params[:status].each do |s|\n q += ' and wf_status_tesim:' + s + ''\n end\n end\n\n unless params[:aip_status].nil?\n params[:aip_status].each do |aipstatus|\n\n if aipstatus == 'noaip'\n fq << '!member_ids_ssim:*'\n else\n fq << 'member_ids_ssim:*'\n num_results = get_number_of_results('has_model_ssim:\"Dlibhydra::Dataset\" and member_ids_ssim:*',)\n if num_results == 0\n fq << 'member_ids_ssim:*'\n else\n r = solr_filter_query('has_model_ssim:\"Dlibhydra::Dataset\" and member_ids_ssim:*', [],\n 'id,member_ids_ssim', num_results)\n if aipstatus == 'uploaded'\n status_query = 'aip_status_tesim:UPLOADED'\n elsif aipstatus == 'inprogress'\n status_query = 'aip_status_tesim:(COMPLETE or PROCESSING or \"Not Yet Processed\")'\n elsif aipstatus == 'problem'\n status_query = 'aip_status_tesim:(ERROR or FAILED or USER_INPUT)'\n end\n r['docs'].each do |dataset|\n dataset['member_ids_ssim'].each do |aip|\n num_results = get_number_of_results('id:'+ aip, status_query)\n if num_results == 0\n fq << '!id:' + dataset['id']\n else\n ids << dataset['id']\n end\n end\n end\n end\n end\n end\n end\n end\n\n unless params[:dip_status].nil?\n no_results = true\n params[:dip_status].each do |dipstatus|\n num_results = get_number_of_results('has_model_ssim:\"Dlibhydra::Dataset\" and member_ids_ssim:*',)\n if num_results == 0\n fq << 'member_ids_ssim:*'\n else\n r = solr_filter_query('has_model_ssim:\"Dlibhydra::Dataset\" and member_ids_ssim:*', [],\n 'id,member_ids_ssim', num_results)\n r['docs'].each do |dataset|\n dataset['member_ids_ssim'].each do |dip|\n if dipstatus == 'APPROVE' or dipstatus == 'UPLOADED'\n num_results = get_number_of_results('id:'+ dip +' and dip_status_tesim:' + dipstatus, [])\n if num_results == 0\n fq << '!id:' + dataset['id']\n else\n ids << dataset['id']\n no_results = false\n end\n elsif dipstatus == 'waiting'\n num_results = get_number_of_results('id:'+ dip, ['requestor_email_tesim:*', '!dip_status_tesim:*'])\n if num_results == 0\n fq << '!id:' + dataset['id']\n else\n ids << dataset['id']\n no_results = false\n end\n else\n num_results = get_number_of_results('id:'+ dip +' and dip_uuid_tesim:*')\n unless num_results == 0\n no_results = false\n fq << '!id:' + dataset['id']\n end\n end\n end\n end\n end\n end\n end\n\n unless ids.empty?\n extra_fq = 'id:('\n ids.each_with_index do |i, index|\n if index == ids.length - 1\n extra_fq += \"#{i}\"\n else\n extra_fq += \"#{i} or \"\n end\n\n end\n extra_fq += ')'\n fq << extra_fq\n end\n\n # SORTING AND PAGING\n @results_per_page = 10\n # set up an array for holding the sort clause - default to sorting on id\n solr_sort_fields = [\"id asc\"]\n # if a valid sort parameter was given\n if params[:sort] and [\"access\", \"created\", \"available\"].include?(params[:sort])\n solr_sort = ''\n # set up the appropriate solr sort field\n if params[:sort] == 'access'\n solr_sort = 'access_rights_tesi'\n elsif params[:sort] == 'created'\n solr_sort = 'pure_creation_ssi'\n elsif params[:sort] == 'available'\n solr_sort = 'date_available_ssi'\n end\n # if a valid sort direction was given, include that in the sort clause\n if params[:sort_order] and [\"asc\",\"desc\"].include?(params[:sort_order]) then\n solr_sort += ' ' + params[:sort_order]\n else\n solr_sort += ' asc'\n end\n # prepend it to the sort clause array\n solr_sort_fields = solr_sort_fields.unshift(solr_sort)\n end\n # handle paging - default to the first page of results\n @current_page = 1\n # if a valid paging parameter was given\n if params[:page] and params[:page].match(/^\\d+$/)\n # use it to get the requested page\n @current_page = params[:page].to_i\n end\n\n if no_results\n response = nil\n else\n num_results = get_number_of_results(q, fq)\n unless num_results == 0\n response = solr_filter_query(q, fq,\n 'id,pure_uuid_tesim,preflabel_tesim,wf_status_tesim,date_available_tesim,\n access_rights_tesim,creator_ssim,pureManagingUnit_ssim,\n pure_link_tesim,doi_tesim,pure_creation_tesim, wf_status_tesim,retention_policy_tesim,\n restriction_note_tesim',\n @results_per_page, solr_sort_fields.join(\",\"), (@current_page - 1) * @results_per_page)\n end\n end\n\n\n if response.nil?\n @deposits = []\n else\n @deposits = response\n end\n respond_to do |format|\n if params[:refresh]\n format.html { redirect_to deposits_path }\n else\n format.html { render :index }\n\n end\n # format.json { render :index, status: :created, location: @dataset }\n end\n end",
"title": ""
},
{
"docid": "db57b33952d24d3af157e1ca1351fd67",
"score": "0.5255651",
"text": "def apicall\n\n # url = \"https://developer.nps.gov/api/v1/parks?limit=498&api_key=\"\n api_key = ENV[\"API_KEY\"]\n # fullURL = URI(url + api_key)\n urlstart =\"https://developer.nps.gov/api/v1/parks?limit=50&start=\"\n urlkey = \"&api_key=\"\n n = 1\n urlarray = []\n datadump=[]\n while n < 500\n numb = n.to_s\n fullUrltest = URI(urlstart + numb + urlkey + api_key)\n urlarray.push(fullUrltest)\n n += 50\n end\n\n urlarray.each do |urldata|\n http = Net::HTTP.new(urldata.host, urldata.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(urldata)\n request[\"authorization\"] = '196E647D-37EF-4CBC-A201-BAECEEBE9319'\n request[\"cache-control\"] = 'no-cache'\n request[\"postman-token\"] = '33cb9a05-1fe6-9b05-e371-777b601a5b14'\n\n response = http.request(request)\n\n # JSON.parse(response.read_body)\n a = JSON.parse(response.body)\n\n a[\"data\"].each do |listing|\n datadump.push(listing)\n end\n\n end\n return datadump\n\n # http = Net::HTTP.new(fullUrltest.host, fullUrltest.port)\n # http.use_ssl = true\n # http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n #\n # request = Net::HTTP::Get.new(fullUrltest)\n # request[\"authorization\"] = '196E647D-37EF-4CBC-A201-BAECEEBE9319'\n # request[\"cache-control\"] = 'no-cache'\n # request[\"postman-token\"] = '33cb9a05-1fe6-9b05-e371-777b601a5b14'\n #\n # response = http.request(request)\n #\n # JSON.parse(response.read_body)\n # JSON.parse(response.body)\n\nend",
"title": ""
},
{
"docid": "7eacd015c9b1b3f8f7baf1e46b4869b9",
"score": "0.5243629",
"text": "def retrieve_data\n unless @raw_data\n begin\n unless config[:server].start_with?('https://', 'http://')\n config[:server].prepend('http://')\n end\n\n url = \"#{config[:server]}/render?format=json&target=#{formatted_target}&from=#{config[:from]}&until=#{config[:until]}\"\n\n url_opts = {}\n\n if config[:no_ssl_verify]\n url_opts[:ssl_verify_mode] = OpenSSL::SSL::VERIFY_NONE\n end\n\n if config[:username] && (config[:password] || config[:passfile])\n if config[:passfile]\n pass = File.open(config[:passfile]).readline\n elsif config[:password]\n pass = config[:password]\n end\n\n url_opts[:http_basic_authentication] = [config[:username], pass.chomp]\n end # we don't have both username and password trying without\n\n handle = open(url, url_opts)\n\n @raw_data = handle.gets\n if @raw_data == '[]'\n unknown 'Empty data received from Graphite - metric probably doesn\\'t exist'\n else\n @json_data = JSON.parse(@raw_data)\n output = {}\n @json_data.each do |raw|\n raw['datapoints'].delete_if { |v| v.first.nil? }\n next if raw['datapoints'].empty?\n target = raw['target']\n data = raw['datapoints'].map(&:first)\n start = raw['datapoints'].first.last\n dend = raw['datapoints'].last.last\n step = ((dend - start) / raw['datapoints'].size.to_f).ceil\n output[target] = { 'target' => target, 'data' => data, 'start' => start, 'end' => dend, 'step' => step }\n end\n output\n end\n rescue SocketError\n unknown 'Failed to connect to graphite server'\n rescue OpenURI::HTTPError\n unknown 'Server error or invalid graphite expression'\n rescue NoMethodError\n unknown 'No data for time period and/or target'\n rescue Errno::ECONNREFUSED\n unknown 'Connection refused when connecting to Graphite server'\n rescue Errno::ECONNRESET\n unknown 'Connection reset by peer when connecting to Graphite server'\n rescue EOFError\n unknown 'End of file error when reading from Graphite server'\n rescue => e\n unknown \"An unknown error occurred: #{e.inspect}\"\n end\n end\n end",
"title": ""
},
{
"docid": "0cddd74feac7ece37feca1d9eaa1aed6",
"score": "0.5218046",
"text": "def api_call_anagrams(new_random_string)\n api_data = RestClient.get(\"http://www.anagramica.com/all/\\:#{new_random_string}\")\n var = JSON.parse(api_data)['all'].select { |word| word.length > 1 }\n var.delete(new_random_string)\n var\nend",
"title": ""
},
{
"docid": "91cf508da3040eeb479063a1f8ff345c",
"score": "0.52041626",
"text": "def get_algorithms\n call(\"get-algorithms\")\n end",
"title": ""
},
{
"docid": "2d1a9b037e1fc9f33941b6fa1b709143",
"score": "0.51800615",
"text": "def generateCountryDatav3()\n #newApiCall = settings.oipa_api_url + \"activity?q=reporting_org_ref:(#{settings.goverment_department_ids.gsub(\",\",\" OR \")}) AND budget_period_start_iso_date:[#{settings.current_first_day_of_financial_year}T00:00:00Z TO *] AND budget_period_end_iso_date:[* TO #{settings.current_last_day_of_financial_year}T00:00:00Z] AND recipient_country_code:AL&fl=recipient_country_code,budget_period_start_iso_date,budget_period_end_iso_date,budget_value_gbp,recipient_country_name,sector_code,sector_percentage,hierarchy,related_activity_type,related_activity_ref&rows=50000\"\n count = 20\n #newApiCall = settings.oipa_api_url + \"activity?q=iati_identifier:(GB-1-204158* OR GB-GOV-1-301371* OR GB-GOV-1-301433* OR GB-GOV-1-301465* OR GB-GOV-1-301511* OR GB-GOV-1-301527* OR GB-GOV-1-300420* OR GB-GOV-1-300708* OR GB-GOV-1-301019* OR GB-GOV-1-301095*) AND hierarchy:2 AND reporting_org_ref:(#{settings.goverment_department_ids.gsub(\",\",\" OR \")}) AND recipient_country_code:*&fl=budget_value,activity_status_code,iati_identifier,budget.period-start.quarter,budget.period-end.quarter,recipient_country_code,budget_period_start_iso_date,budget_period_end_iso_date,budget_value_gbp,recipient_country_name,sector_code,sector_percentage,hierarchy,related_activity_type,related_activity_ref,related_budget_value,related_budget_period_start_quarter,related_budget_period_end_quarter,related_budget_period_start_iso_date,related_budget_period_end_iso_date&start=0&rows=#{count}\"\n newApiCall = settings.oipa_api_url + \"activity?q=reporting_org_ref:(#{settings.goverment_department_ids.gsub(\",\",\" OR \")}) AND recipient_country_code:NE&fl=recipient_country_percentage,budget_value,activity_status_code,iati_identifier,budget.period-start.quarter,budget.period-end.quarter,recipient_country_code,budget_period_start_iso_date,budget_period_end_iso_date,budget_value_gbp,recipient_country_name,sector_code,sector_percentage,hierarchy,related_activity_type,related_activity_ref,related_budget_value,related_budget_period_start_quarter,related_budget_period_end_quarter,related_budget_period_start_iso_date,related_budget_period_end_iso_date&start=0&rows=#{count}\"\n ##pagination stuff\n puts newApiCall\n page = 1\n page = page.to_i - 1\n finalPage = page * count\n ######\n pd = RestClient.get newApiCall\n pd = JSON.parse(pd)\n numOActivities = pd['response']['numFound'].to_i\n puts ('Number of activities: ' + numOActivities.to_s)\n pulledData = pd['response']['docs'] \n if (numOActivities > count)\n pages = (numOActivities.to_f/count).ceil\n for p in 2..pages do\n p = p - 1\n finalPage = p * count\n tempData = JSON.parse(RestClient.get settings.oipa_api_url + \"activity?q=reporting_org_ref:(#{settings.goverment_department_ids.gsub(\",\",\" OR \")}) AND recipient_country_code:NE&fl=recipient_country_percentage,budget_value,activity_status_code,iati_identifier,budget.period-start.quarter,budget.period-end.quarter,recipient_country_code,budget_period_start_iso_date,budget_period_end_iso_date,budget_value_gbp,recipient_country_name,sector_code,sector_percentage,hierarchy,related_activity_type,related_activity_ref,related_budget_value,related_budget_period_start_quarter,related_budget_period_end_quarter,related_budget_period_start_iso_date,related_budget_period_end_iso_date,&start=#{finalPage}&rows=#{count}\")\n tempData = tempData['response']['docs']\n tempData.each do |item|\n if item.has_key?('activity_status_code')\n if item['activity_status_code'].to_i == 2\n pulledData.push(item)\n end\n end\n end\n end\n end\n puts ('Activity count: ' + pulledData.count.to_s)\n sectorHierarchy = JSON.parse(File.read('data/sectorHierarchies.json'))\n countryHash = {}\n projectDataHash = {}\n projectTracker = []\n countryProjecttracker = {}\n currentFinYear = financial_year\n firstDayOfFinYear = first_day_of_financial_year(DateTime.now)\n lastDayOfFinYear = last_day_of_financial_year(DateTime.now)\n pulledData.each do |element|\n if element.has_key?('activity_status_code')\n if element['activity_status_code'].to_i == 2\n tempTotalBudget = 0\n if element.has_key?('budget_value')\n element['budget_value_gbp'].each_with_index do |data, index|\n if(element['budget_period_start_iso_date'][index].to_datetime >= firstDayOfFinYear && element['budget_period_end_iso_date'][index].to_datetime <= lastDayOfFinYear)\n tempTotalBudget = tempTotalBudget + data.to_f\n end\n end\n end\n #######################################\n if(element['hierarchy'] == 2 && element['reporting_org_ref'].to_s == 'GB-GOV-1')\n if element.has_key?('related_activity_type')\n if(!element['related_activity_type'].index('1').nil?)\n if(countryProjecttracker.has_key?(element[\"recipient_country_code\"].first))\n if(countryProjecttracker[element[\"recipient_country_code\"].first].index(element['related_activity_ref'][element['related_activity_type'].index('1')].to_s).nil?)\n countryProjecttracker[element[\"recipient_country_code\"].first].push(element['related_activity_ref'][element['related_activity_type'].index('1')].to_s)\n projectDataHash[element[\"recipient_country_code\"].first][\"projects\"] = projectDataHash[element[\"recipient_country_code\"].first][\"projects\"] + 1\n projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] = projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] + tempTotalBudget\n else\n projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] = projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] + tempTotalBudget\n end\n else\n countryProjecttracker[element[\"recipient_country_code\"].first] = []\n countryProjecttracker[element[\"recipient_country_code\"].first].push(element['related_activity_ref'][element['related_activity_type'].index('1')].to_s)\n projectDataHash[element[\"recipient_country_code\"].first] = {}\n projectDataHash[element[\"recipient_country_code\"].first][\"country\"] = element.has_key?('recipient_country_name') ? element[\"recipient_country_name\"].first : 'N/A'\n projectDataHash[element[\"recipient_country_code\"].first][\"id\"] = element[\"recipient_country_code\"].first\n projectDataHash[element[\"recipient_country_code\"].first][\"projects\"] = 1\n projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] = tempTotalBudget\n projectDataHash[element[\"recipient_country_code\"].first][\"flag\"] = '/images/flags/' + element[\"recipient_country_code\"].first.downcase + '.png'\n end\n else\n puts ('faileddddd')\n ###new logic\n end\n end\n elsif(element['reporting_org_ref'].to_s != 'GB-GOV-1')\n if element.has_key?('recipient_country_code') and tempTotalBudget > 0\n if element['recipient_country_code'].length() > 1\n element['recipient_country_code'].each_with_index do |c, index|\n if(countryProjecttracker.has_key?(c))\n if(countryProjecttracker[c].index(element['iati_identifier'].to_s).nil?)\n countryProjecttracker[c].push(element['iati_identifier'].to_s)\n projectDataHash[c][\"projects\"] = projectDataHash[c][\"projects\"] + 1\n begin\n projectDataHash[c][\"budget\"] = projectDataHash[c][\"budget\"] + ((tempTotalBudget * element['recipient_country_percentage'][index].to_f) / 100)\n rescue\n puts 'staged----'\n puts 'temp total budget:' + tempTotalBudget.to_s\n puts projectDataHash[c][\"budget\"]\n puts element['iati_identifier']\n projectDataHash[c][\"budget\"] = projectDataHash[c][\"budget\"] + 0\n end\n else\n projectDataHash[c][\"budget\"] = projectDataHash[c][\"budget\"] + ((tempTotalBudget * element['recipient_country_percentage'][index].to_f) / 100)\n end\n else\n countryProjecttracker[c] = []\n countryProjecttracker[c].push(element['iati_identifier'].to_s)\n projectDataHash[c] = {}\n projectDataHash[c][\"country\"] = element.has_key?('recipient_country_name') ? element[\"recipient_country_name\"][index] : 'N/A'\n projectDataHash[c][\"id\"] = begin element[\"recipient_country_code\"][index] rescue '' end\n projectDataHash[c][\"projects\"] = 1\n projectDataHash[c][\"budget\"] = tempTotalBudget\n projectDataHash[c][\"flag\"] = '/images/flags/' + element[\"recipient_country_code\"].first.downcase + '.png'\n end\n end\n else\n c = element['recipient_country_code'].first\n if(countryProjecttracker.has_key?(c))\n if(countryProjecttracker[c].index(element['iati_identifier'].to_s).nil?)\n countryProjecttracker[c].push(element['iati_identifier'].to_s)\n projectDataHash[c][\"projects\"] = projectDataHash[c][\"projects\"] + 1\n projectDataHash[c][\"budget\"] = projectDataHash[c][\"budget\"] + tempTotalBudget \n else\n projectDataHash[c][\"budget\"] = projectDataHash[c][\"budget\"] + tempTotalBudget\n end\n else\n countryProjecttracker[c] = []\n countryProjecttracker[c].push(element['iati_identifier'].to_s)\n projectDataHash[c] = {}\n projectDataHash[c][\"country\"] = element.has_key?('recipient_country_name') ? element[\"recipient_country_name\"].first : 'N/A'\n projectDataHash[c][\"id\"] = begin element[\"recipient_country_code\"].first rescue '' end\n projectDataHash[c][\"projects\"] = 1\n projectDataHash[c][\"budget\"] = tempTotalBudget\n projectDataHash[c][\"flag\"] = '/images/flags/' + element[\"recipient_country_code\"].first.downcase + '.png'\n end\n end\n end\n end\n end\n end\n end\n finalOutput = Array.new\n finalOutput.push(projectDataHash.to_s.gsub(\"[\", \"\").gsub(\"]\", \"\").gsub(\"=>\",\":\").gsub(\"}}, {\",\"},\"))\n finalOutput.push(projectDataHash)\n output = {}\n output['map_data'] = finalOutput\n output\n end",
"title": ""
},
{
"docid": "3080cb7aa381c6316ad5cb9bfe9d8bc5",
"score": "0.5147716",
"text": "def generateCountryDatav2()\n #newApiCall = settings.oipa_api_url + \"activity?q=reporting_org_ref:(#{settings.goverment_department_ids.gsub(\",\",\" OR \")}) AND budget_period_start_iso_date:[#{settings.current_first_day_of_financial_year}T00:00:00Z TO *] AND budget_period_end_iso_date:[* TO #{settings.current_last_day_of_financial_year}T00:00:00Z] AND recipient_country_code:AL&fl=recipient_country_code,budget_period_start_iso_date,budget_period_end_iso_date,budget_value_gbp,recipient_country_name,sector_code,sector_percentage,hierarchy,related_activity_type,related_activity_ref&rows=50000\"\n count = 20\n #newApiCall = settings.oipa_api_url + \"activity?q=iati_identifier:(GB-1-204158* OR GB-GOV-1-301371* OR GB-GOV-1-301433* OR GB-GOV-1-301465* OR GB-GOV-1-301511* OR GB-GOV-1-301527* OR GB-GOV-1-300420* OR GB-GOV-1-300708* OR GB-GOV-1-301019* OR GB-GOV-1-301095*) AND hierarchy:2 AND reporting_org_ref:(#{settings.goverment_department_ids.gsub(\",\",\" OR \")}) AND recipient_country_code:*&fl=budget_value,activity_status_code,iati_identifier,budget.period-start.quarter,budget.period-end.quarter,recipient_country_code,budget_period_start_iso_date,budget_period_end_iso_date,budget_value_gbp,recipient_country_name,sector_code,sector_percentage,hierarchy,related_activity_type,related_activity_ref,related_budget_value,related_budget_period_start_quarter,related_budget_period_end_quarter,related_budget_period_start_iso_date,related_budget_period_end_iso_date&start=0&rows=#{count}\"\n newApiCall = settings.oipa_api_url + \"activity?q=reporting_org_ref:(#{settings.goverment_department_ids.gsub(\",\",\" OR \")}) AND recipient_country_code:*&fl=budget_value,activity_status_code,iati_identifier,budget.period-start.quarter,budget.period-end.quarter,recipient_country_code,budget_period_start_iso_date,budget_period_end_iso_date,budget_value_gbp,recipient_country_name,sector_code,sector_percentage,hierarchy,related_activity_type,related_activity_ref,related_budget_value,related_budget_period_start_quarter,related_budget_period_end_quarter,related_budget_period_start_iso_date,related_budget_period_end_iso_date&start=0&rows=#{count}\"\n ##pagination stuff\n puts newApiCall\n page = 1\n page = page.to_i - 1\n finalPage = page * count\n ######\n pd = RestClient.get newApiCall\n pd = JSON.parse(pd)\n numOActivities = pd['response']['numFound'].to_i\n puts ('Number of activities: ' + numOActivities.to_s)\n pulledData = pd['response']['docs'] \n if (numOActivities > count)\n pages = (numOActivities.to_f/count).ceil\n for p in 2..pages do\n p = p - 1\n finalPage = p * count\n tempData = JSON.parse(RestClient.get settings.oipa_api_url + \"activity?q=reporting_org_ref:(#{settings.goverment_department_ids.gsub(\",\",\" OR \")}) AND recipient_country_code:*&fl=budget_value,activity_status_code,iati_identifier,budget.period-start.quarter,budget.period-end.quarter,recipient_country_code,budget_period_start_iso_date,budget_period_end_iso_date,budget_value_gbp,recipient_country_name,sector_code,sector_percentage,hierarchy,related_activity_type,related_activity_ref,related_budget_value,related_budget_period_start_quarter,related_budget_period_end_quarter,related_budget_period_start_iso_date,related_budget_period_end_iso_date,&start=#{finalPage}&rows=#{count}\")\n tempData = tempData['response']['docs']\n tempData.each do |item|\n if item.has_key?('activity_status_code')\n if item['activity_status_code'].to_i == 2\n pulledData.push(item)\n end\n end\n end\n end\n end\n puts ('Activity count: ' + pulledData.count.to_s)\n sectorHierarchy = JSON.parse(File.read('data/sectorHierarchies.json'))\n countryHash = {}\n projectDataHash = {}\n projectTracker = []\n countryProjecttracker = {}\n currentFinYear = financial_year\n firstDayOfFinYear = first_day_of_financial_year(DateTime.now)\n lastDayOfFinYear = last_day_of_financial_year(DateTime.now)\n pulledData.each do |element|\n if element.has_key?('activity_status_code')\n if element['activity_status_code'].to_i == 2\n tempTotalBudget = 0\n if element.has_key?('budget_value')\n element['budget_value_gbp'].each_with_index do |data, index|\n if(element['budget_period_start_iso_date'][index].to_datetime >= firstDayOfFinYear && element['budget_period_end_iso_date'][index].to_datetime <= lastDayOfFinYear)\n tempTotalBudget = tempTotalBudget + data.to_f\n end\n end\n end\n # begin\n # if element.has_key?('budget_value')\n # element['budget_value'].each_with_index do |data, index|\n # tStart = Time.parse(element['budget_period_start_iso_date'][index])\n # fyStart = if element['budget.period-start.quarter'][index].to_i == 1 then tStart.year - 1 else tStart.year end\n # tEnd = Time.parse(element['budget_period_end_iso_date'][index])\n # fyEnd = if element['budget.period-end.quarter'][index].to_i == 1 then tEnd.year - 1 else tEnd.year end\n # if fyStart <= currentFinYear && fyEnd >= currentFinYear\n # tempTotalBudget = tempTotalBudget + data.to_f\n # else\n # puts element['budget_period_start_iso_date'][index]\n # #puts ('start year: ' + fyStart.to_s + ' and end year: ' + fyEnd.to_s + ' and current system fin year: ' + currentFinYear.to_s)\n # end\n # end\n # end\n # rescue\n # puts 'Issue found: '\n # puts element\n # end\n # if element.has_key?('related_budget_value')\n # element['related_budget_value'].each_with_index do |data, index|\n # tStart = Time.parse(element['related_budget_period_start_iso_date'][index])\n # fyStart = if element['related_budget_period_start_quarter'][index].to_i == 1 then tStart.year - 1 else tStart.year end\n # tEnd = Time.parse(element['related_budget_period_end_iso_date'][index])\n # fyEnd = if element['related_budget_period_end_quarter'][index].to_i == 1 then tEnd.year - 1 else tEnd.year end\n # if fyStart <= currentFinYear || fyEnd >= currentFinYear\n # tempTotalBudget = tempTotalBudget + data.to_f\n # end\n # end\n # end\n #######################################\n if(element['hierarchy'] == 2 && element['reporting_org_ref'].to_s == 'GB-GOV-1')\n if element.has_key?('related_activity_type')\n if(!element['related_activity_type'].index('1').nil?)\n if(countryProjecttracker.has_key?(element[\"recipient_country_code\"].first))\n if(countryProjecttracker[element[\"recipient_country_code\"].first].index(element['related_activity_ref'][element['related_activity_type'].index('1')].to_s).nil?)\n countryProjecttracker[element[\"recipient_country_code\"].first].push(element['related_activity_ref'][element['related_activity_type'].index('1')].to_s)\n projectDataHash[element[\"recipient_country_code\"].first][\"projects\"] = projectDataHash[element[\"recipient_country_code\"].first][\"projects\"] + 1\n projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] = projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] + tempTotalBudget\n else\n projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] = projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] + tempTotalBudget\n end\n else\n countryProjecttracker[element[\"recipient_country_code\"].first] = []\n countryProjecttracker[element[\"recipient_country_code\"].first].push(element['related_activity_ref'][element['related_activity_type'].index('1')].to_s)\n projectDataHash[element[\"recipient_country_code\"].first] = {}\n projectDataHash[element[\"recipient_country_code\"].first][\"country\"] = element.has_key?('recipient_country_name') ? element[\"recipient_country_name\"].first : 'N/A'\n projectDataHash[element[\"recipient_country_code\"].first][\"id\"] = element[\"recipient_country_code\"].first\n projectDataHash[element[\"recipient_country_code\"].first][\"projects\"] = 1\n projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] = tempTotalBudget\n projectDataHash[element[\"recipient_country_code\"].first][\"flag\"] = '/images/flags/' + element[\"recipient_country_code\"].first.downcase + '.png'\n end\n else\n puts ('faileddddd')\n ###new logic\n end\n end\n elsif(element['reporting_org_ref'].to_s != 'GB-GOV-1')\n if element.has_key?('recipient_country_code')\n element['recipient_country_code'].each_with_index do |c, index|\n if(countryProjecttracker.has_key?(c))\n if(countryProjecttracker[c].index(element['iati_identifier'].to_s).nil?)\n countryProjecttracker[c].push(element['iati_identifier'].to_s)\n projectDataHash[c][\"projects\"] = projectDataHash[c][\"projects\"] + 1\n projectDataHash[c][\"budget\"] = projectDataHash[c][\"budget\"] + ((tempTotalBudget * element['recipient_country_percentage'][index].to_f) / 100)\n else\n projectDataHash[c][\"budget\"] = projectDataHash[c][\"budget\"] + ((tempTotalBudget * element['recipient_country_percentage'][index].to_f) / 100)\n end\n else\n countryProjecttracker[c] = []\n countryProjecttracker[c].push(element['iati_identifier'].to_s)\n projectDataHash[c] = {}\n projectDataHash[c][\"country\"] = element.has_key?('recipient_country_name') ? element[\"recipient_country_name\"][index] : 'N/A'\n projectDataHash[c][\"id\"] = begin element[\"recipient_country_code\"][index] rescue '' end\n projectDataHash[c][\"projects\"] = 1\n projectDataHash[c][\"budget\"] = tempTotalBudget\n projectDataHash[c][\"flag\"] = '/images/flags/' + element[\"recipient_country_code\"].first.downcase + '.png'\n end\n end\n end\n ####\n # if(countryProjecttracker.has_key?(element[\"recipient_country_code\"].first))\n # if(countryProjecttracker[element[\"recipient_country_code\"].first].index(element['iati_identifier'].to_s).nil?)\n # countryProjecttracker[element[\"recipient_country_code\"].first].push(element['iati_identifier'].to_s)\n # projectDataHash[element[\"recipient_country_code\"].first][\"projects\"] = projectDataHash[element[\"recipient_country_code\"].first][\"projects\"] + 1\n # projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] = projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] + tempTotalBudget\n # else\n # projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] = projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] + tempTotalBudget\n # end\n # else\n # countryProjecttracker[element[\"recipient_country_code\"].first] = []\n # countryProjecttracker[element[\"recipient_country_code\"].first].push(element['iati_identifier'].to_s)\n # projectDataHash[element[\"recipient_country_code\"].first] = {}\n # projectDataHash[element[\"recipient_country_code\"].first][\"country\"] = element.has_key?('recipient_country_name') ? element[\"recipient_country_name\"].first : 'N/A'\n # projectDataHash[element[\"recipient_country_code\"].first][\"id\"] = element[\"recipient_country_code\"].first\n # projectDataHash[element[\"recipient_country_code\"].first][\"projects\"] = 1\n # projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] = tempTotalBudget\n # projectDataHash[element[\"recipient_country_code\"].first][\"flag\"] = '/images/flags/' + element[\"recipient_country_code\"].first.downcase + '.png'\n # end\n end\n ######################################\n if(!countryHash.has_key?(element['recipient_country_code'].first))\n countryHash[element['recipient_country_code'].first] = {}\n end\n #highLvlSectorData = sectorHierarchy.select{|s| s['Code (L3)'].to_i == catCode.to_i}\n if element.has_key?('sector_code')\n element['sector_code'].each_with_index do |data, index|\n if !sectorHierarchy.find_index{|k,_| k['Code (L3)'].to_i == data.to_i}.nil?\n selectedHiLvlSectorData = sectorHierarchy.find{|k,_| k['Code (L3)'].to_i == data.to_i}\n if(countryHash[element['recipient_country_code'].first].has_key?(selectedHiLvlSectorData['High Level Sector Description']))\n if(element.has_key?('sector_percentage'))\n countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']]['budget'] = countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']]['budget'] + (tempTotalBudget * (element['sector_percentage'][index].to_f/100))\n else\n countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']]['budget'] = countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']]['budget'] + tempTotalBudget\n end\n else\n countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']] = {}\n countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']]['code'] = selectedHiLvlSectorData['High Level Code (L1)'].to_i\n countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']]['name'] = selectedHiLvlSectorData['High Level Sector Description']\n if(element.has_key?('sector_percentage'))\n countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']]['budget'] = (tempTotalBudget * (element['sector_percentage'][index].to_f/100))\n else\n countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']]['budget'] = tempTotalBudget\n end\n end\n end\n end\n end\n end\n end\n #######################\n # if (element.has_key?('recipient_country_code'))\n # tempTotalBudget = 0\n # element['budget_period_start_iso_date'].each_with_index do |data, index|\n # if(data.to_datetime >= settings.current_first_day_of_financial_year && element['budget_period_end_iso_date'][index].to_datetime <= settings.current_last_day_of_financial_year)\n # tempTotalBudget = tempTotalBudget + element['budget_value_gbp'][index].to_f\n # end\n # end\n # ## Prepare projects hash\n # if(element['hierarchy'] == 2)\n # if(!element['related_activity_type'].index('1').nil?)\n # if(countryProjecttracker.has_key?(element[\"recipient_country_code\"].first))\n # if(countryProjecttracker[element[\"recipient_country_code\"].first].index(element['related_activity_ref'][element['related_activity_type'].index('1')].to_s).nil?)\n # countryProjecttracker[element[\"recipient_country_code\"].first].push(element['related_activity_ref'][element['related_activity_type'].index('1')].to_s)\n # projectDataHash[element[\"recipient_country_code\"].first][\"projects\"] = projectDataHash[element[\"recipient_country_code\"].first][\"projects\"] + 1\n # projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] = projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] + tempTotalBudget\n # else\n # projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] = projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] + tempTotalBudget\n # end\n # else\n # countryProjecttracker[element[\"recipient_country_code\"].first] = []\n # countryProjecttracker[element[\"recipient_country_code\"].first].push(element['related_activity_ref'][element['related_activity_type'].index('1')].to_s)\n # projectDataHash[element[\"recipient_country_code\"].first] = {}\n # projectDataHash[element[\"recipient_country_code\"].first][\"country\"] = element.has_key?('recipient_country_name') ? element[\"recipient_country_name\"].first : 'N/A'\n # projectDataHash[element[\"recipient_country_code\"].first][\"id\"] = element[\"recipient_country_code\"].first\n # projectDataHash[element[\"recipient_country_code\"].first][\"projects\"] = 1\n # projectDataHash[element[\"recipient_country_code\"].first][\"budget\"] = tempTotalBudget\n # projectDataHash[element[\"recipient_country_code\"].first][\"flag\"] = '/images/flags/' + element[\"recipient_country_code\"].first.downcase + '.png'\n # end\n # else\n # puts ('faileddddd')\n # ###new logic\n # end\n # end\n # ##\n # if(!countryHash.has_key?(element['recipient_country_code'].first))\n # countryHash[element['recipient_country_code'].first] = {}\n # end\n # #highLvlSectorData = sectorHierarchy.select{|s| s['Code (L3)'].to_i == catCode.to_i}\n # if element.has_key?('sector_code')\n # element['sector_code'].each_with_index do |data, index|\n # if !sectorHierarchy.find_index{|k,_| k['Code (L3)'].to_i == data.to_i}.nil?\n # selectedHiLvlSectorData = sectorHierarchy.find{|k,_| k['Code (L3)'].to_i == data.to_i}\n # if(countryHash[element['recipient_country_code'].first].has_key?(selectedHiLvlSectorData['High Level Sector Description']))\n # if(element.has_key?('sector_percentage'))\n # countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']]['budget'] = countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']]['budget'] + (tempTotalBudget * (element['sector_percentage'][index].to_f/100))\n # else\n # countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']]['budget'] = countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']]['budget'] + tempTotalBudget\n # end\n # else\n # countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']] = {}\n # countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']]['code'] = selectedHiLvlSectorData['High Level Code (L1)'].to_i\n # countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']]['name'] = selectedHiLvlSectorData['High Level Sector Description']\n # if(element.has_key?('sector_percentage'))\n # countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']]['budget'] = (tempTotalBudget * (element['sector_percentage'][index].to_f/100))\n # else\n # countryHash[element['recipient_country_code'].first][selectedHiLvlSectorData['High Level Sector Description']]['budget'] = tempTotalBudget\n # end\n # end\n # end\n # end\n # end\n # end\n end\n finalOutput = Array.new\n finalOutput.push(projectDataHash.to_s.gsub(\"[\", \"\").gsub(\"]\", \"\").gsub(\"=>\",\":\").gsub(\"}}, {\",\"},\"))\n finalOutput.push(projectDataHash)\n countryHash.each do |key|\n countryHash[key[0]] = key[1].sort_by{ |x, y| -y[\"budget\"] }\n end\n countryHash\n output = {}\n output['map_data'] = finalOutput\n output['countryHash'] = countryHash\n output['xx'] = countryProjecttracker\n output\n end",
"title": ""
},
{
"docid": "a90d83ec4293d679548b808c60dee6a9",
"score": "0.51423264",
"text": "def index_algorithms; end",
"title": ""
},
{
"docid": "3e0b4c67f67bcab0db5141baeadac3e8",
"score": "0.513327",
"text": "def index\n @cryptos = Crypto.all\n require 'net/http'\n require 'uri'\n require 'json'\n\n uri = URI.parse(\"https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest\")\n request = Net::HTTP::Get.new(uri)\n request[\"X-Cmc_pro_api_key\"] = \"e61e9e0d-81b2-4718-805d-863cb7772d19\"\n request[\"Accept\"] = \"application/json\"\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n \n @raw = JSON.parse(response.body)\n @search_crypto = @raw[\"data\"]\n @profit_loss = 0\n \n end",
"title": ""
},
{
"docid": "42c8c16eb794471439b3214f841a9bc1",
"score": "0.50854594",
"text": "def destroy\n @algo.destroy\n respond_to do |format|\n format.html { redirect_to algos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "741c1643e2a4ece1d8a6c76e7dccf653",
"score": "0.5081274",
"text": "def index\n @algos = Algo.all\n end",
"title": ""
},
{
"docid": "73d6e5581fb24db4486179fba97122ff",
"score": "0.50806963",
"text": "def all\n @query_codes = params[:term_codes].blank? ? '' : params[:term_codes]\n @query_hospital = params[:term_hospitals].blank? ? '' : params[:term_hospitals]\n\n if @locale.to_s == 'de'\n @query_codes.gsub!('ue', 'u')\n @query_codes.gsub!('ae', 'a')\n @query_codes.gsub!('oe', 'o')\n end\n\n # Caching is currently disabled due to problems with dumping singletons\n @drgs, @adrgs, @mdcs = nil #Rails.cache.fetch(\"#{@query_codes}/code_search\", expires_in: 12.hours) do\n if @query_codes.blank? || @query_codes.length < 3\n @drgs = []\n @adrgs = []\n @mdcs = []\n else\n @drgs = code_search(Drg, @query_codes, 'code')\n @adrgs = code_search(Adrg, @query_codes, 'code')\n @mdcs = code_search(Mdc, @query_codes, 'code_search')\n Searchkick.multi_search([@drgs, @adrgs, @mdcs])\n\n if @drgs.empty? && @adrgs.empty? && @mdcs.empty? && @query_codes.length > 5\n @drgs = code_search_tolerant(Drg, @query_codes, 'code')\n @adrgs = code_search_tolerant(Adrg, @query_codes, 'code')\n @mdcs = code_search_tolerant(Mdc, @query_codes, 'code_search')\n Searchkick.multi_search([@drgs, @adrgs, @mdcs])\n end\n end\n # [@drgs, @adrgs, @mdcs]\n # end\n\n\n json = {}\n json[:drgs] = @drgs\n json[:adrgs] = @adrgs\n json[:mdcs] = @mdcs\n\n # remove all 'Z' DRGs already present as ADRG\n adrg_codes = @adrgs.map {|adrg| adrg.code}\n @exclude_codes = @drgs.map {|drg| drg.code}\n @exclude_codes.select! {|code| code.ends_with?('Z') && adrg_codes.include?(code[0..2])}\n\n json[:hospitals] = @hospitals = hospital_search @query_hospital\n\n respond_to do |format|\n format.json { render json: json}\n format.html { render partial: 'systems/search_results' }\n end\n end",
"title": ""
},
{
"docid": "a9d7c268608379fea96eff918793a08f",
"score": "0.5071691",
"text": "def index_algorithms\n {}\n end",
"title": ""
},
{
"docid": "743873a3dcd0841d20aaaba69f1dc144",
"score": "0.5056517",
"text": "def seed_scores\n # Get array of all cities\n all_cities = obtain_cities\n puts \"Browsing #{all_cities.length} cities\"\n all_cities.each do |city_url|\n uri = URI(city_url + \"details/\")\n puts uri\n response = Net::HTTP.get(uri)\n search_data = JSON.parse(response)\n end\nend",
"title": ""
},
{
"docid": "2c3f38bbfcfa0c4a93dcdc4ec73c4bd1",
"score": "0.5052612",
"text": "def destroy\n @algorithm = Algorithm.find(params[:id])\n @algorithm.destroy\n\n respond_to do |format|\n format.html { redirect_to algorithms_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e9d25bee4106ebe7c3fddec2f3692fc3",
"score": "0.5047504",
"text": "def explore\n\n\t\t# Retrieve the data set\n\t\tid = params[:id]\n\t\t@dataset = Dataset.where(:identifier => id).first\n\n\t\t# POST requests are typically associated with some chart\n\t\tif request.post?\n\n \t\t\t# Figure out what sort of chart it is\n \t\t\tchart = params[:chart]\n\n \t\t\t# Handles pie chart data requests\n \t\t\tif chart == 'pie'\n\n\t\t\t\t# Get the key and the aggregate\n\t\t\t\tkey = params[:chart_options]['key']\n\t\t\t\taggregate = params[:chart_options]['value']\n\n\t\t\t\t# Limit to only one aggregate value in pie charts\n\t\t\t\taggregate = aggregate.slice(0, 1);\n\n\t \t\t\t# Render as JSON data\n\t \t\t\trender json: getGoogleData(key, aggregate)\n\n\t \t\t# Handles bar chart data requests\n\t \telsif chart == 'bar'\n\n\t \t\t\t# Get the key and aggregate\n\t \t\t\tkey_values = params[:chart_options]['key']\n\t \t\t\taggregate_values = params[:chart_options]['value']\n\n\t \t\t\trender json: getGoogleData(key_values, aggregate_values)\n\n\t \t\t# Handles line chart data requests\n\t \telsif chart == 'line'\n\n\t \t\t\t# Get the key and aggregate\n\t \t\t\tkey = params[:chart_options]['key']\n\t \t\t\taggregate = params[:chart_options]['value']\n\n\t \t\t\trender json: getGoogleData(key, aggregate)\n\n\n\t \t\t# Handles the geo chart data request\n\t \telsif chart == 'geo'\n\n\t \t\tlatitude = params[:chart_options]['key']\n\t \t\tlongitude = params[:chart_options]['value'][0]\n\t \t\taggregate = params[:chart_options]['aggregate']\n\n\t \t\trender json: getGeoData(latitude, longitude, aggregate)\n\n\t \t\t# If we don't receive a chart type, handle as a filtered data request\n\t \telse\n\t \t\trender json: fullDatasetGoogleData()\n\t \tend\n\n\t \t# If it is a GET request, return basic information\n\t else\n\n\t \trender json: fullDatasetGoogleData()\n\n\t end\n\tend",
"title": ""
},
{
"docid": "387cde900289aeb91bb722dd590a09b8",
"score": "0.5046078",
"text": "def index\n @machine_learning_algorithms = MachineLearningAlgorithm.all\n end",
"title": ""
},
{
"docid": "07fd63b4f63292f2d153c8504e227378",
"score": "0.50355804",
"text": "def destroy\n @preprocess_algorithm.destroy\n respond_to do |format|\n format.html { redirect_to preprocess_algorithms_url, notice: 'Preprocess algorithm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cc018cb81e0962a7f0fb5ad3423f836f",
"score": "0.5029703",
"text": "def submit\n domain = params['domain']\n \thttp = Curl.get(\"http://api.builtwith.com/v8/api.json?KEY=ed74821a-728a-4184-9625-144aa20091d5&LOOKUP=#{domain}\")\n # remove when fix.\n data = \"{\\\"Results\\\":[{\\\"Lookup\\\":\\\"bonaverde.com\\\",\\\"Result\\\":{\\\"Paths\\\":[{\\\"FirstIndexed\\\":1384297200000,\\\"LastIndexed\\\":1455750000000,\\\"Domain\\\":\\\"bonaverde.com\\\",\\\"Url\\\":\\\"\\\",\\\"SubDomain\\\":\\\"\\\",\\\"Technologies\\\":[{\\\"Categories\\\":[\\\"Ad Network\\\",\\\"Facebook Exchange\\\",\\\"Retargeting / Remarketing\\\"],\\\"Name\\\":\\\"AdRoll\\\",\\\"Description\\\":\\\"AdRoll is a retargeting platform with a mission to make display advertising simple for business of all sizes.\\\",\\\"Link\\\":\\\"http://adroll.com\\\",\\\"Tag\\\":\\\"ads\\\",\\\"FirstDetected\\\":1385679600000,\\\"LastDetected\\\":1455681706918},{\\\"Categories\\\":null,\\\"Name\\\":\\\"nginx 1.5\\\",\\\"Description\\\":\\\"nginx version 1.5.*\\\",\\\"Link\\\":\\\"http://nginx.org/en/CHANGES-1.5\\\",\\\"Tag\\\":\\\"Web Server\\\",\\\"FirstDetected\\\":1385679600000,\\\"LastDetected\\\":1393455600000},{\\\"Categories\\\":[\\\"JavaScript Library\\\"],\\\"Name\\\":\\\"jQuery\\\",\\\"Description\\\":\\\"JQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. jQuery is designed to change the way that you write JavaScript.\\\",\\\"Link\\\":\\\"http://jquery.com\\\",\\\"Tag\\\":\\\"javascript\\\",\\\"FirstDetected\\\":1384297200000,\\\"LastDetected\\\":1455750000000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"nginx\\\",\\\"Description\\\":\\\"nginx [engine x] is a HTTP server and mail proxy server written by Igor Sysoev.\\\",\\\"Link\\\":\\\"http://nginx.net/\\\",\\\"Tag\\\":\\\"Web Server\\\",\\\"FirstDetected\\\":1384297200000,\\\"LastDetected\\\":1393455600000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Google Font API\\\",\\\"Description\\\":\\\"The Google Font API helps you add web fonts to any web page.\\\",\\\"Link\\\":\\\"http://code.google.com/webfonts\\\",\\\"Tag\\\":\\\"widgets\\\",\\\"FirstDetected\\\":1384297200000,\\\"LastDetected\\\":1455750000000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Google Apps for Business\\\",\\\"Description\\\":\\\"Web-based email, calendar, and documents for teams. Now known as Google Apps for Work.\\\",\\\"Link\\\":\\\"http://www.google.com/a\\\",\\\"Tag\\\":\\\"mx\\\",\\\"FirstDetected\\\":1384297200000,\\\"LastDetected\\\":1455750000000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Google Analytics\\\",\\\"Description\\\":\\\"Google Analytics offers a host of compelling features and benefits for everyone from senior executives and advertising and marketing professionals to site owners and content developers. \\\",\\\"Link\\\":\\\"http://google.com/analytics\\\",\\\"Tag\\\":\\\"analytics\\\",\\\"FirstDetected\\\":1384297200000,\\\"LastDetected\\\":1455681706918},{\\\"Categories\\\":null,\\\"Name\\\":\\\"AJAX Libraries API\\\",\\\"Description\\\":\\\"The AJAX Libraries API is a content distribution network and loading architecture for the most popular, open source JavaScript libraries.\\\",\\\"Link\\\":\\\"http://code.google.com/apis/ajaxlibs/documentation/\\\",\\\"Tag\\\":\\\"cdn\\\",\\\"FirstDetected\\\":1384297200000,\\\"LastDetected\\\":1393455600000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Facebook Like\\\",\\\"Description\\\":\\\"Allows users to Like items they find on the web, similar to how you Like items within Facebook.\\\",\\\"Link\\\":\\\"http://developers.facebook.com/docs/reference/plugins/like\\\",\\\"Tag\\\":\\\"widgets\\\",\\\"FirstDetected\\\":1384297200000,\\\"LastDetected\\\":1427324400000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"jQuery 1.7.1\\\",\\\"Description\\\":\\\"jQuery version 1.7.1\\\",\\\"Link\\\":\\\"http://blog.jquery.com/2011/11/21/jquery-1-7-1-released/\\\",\\\"Tag\\\":\\\"javascript\\\",\\\"FirstDetected\\\":1389222000000,\\\"LastDetected\\\":1393455600000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"New Relic\\\",\\\"Description\\\":\\\"New Relic is a dashboard used to keep an eye on application health and availability while monitoring real user experience.\\\",\\\"Link\\\":\\\"http://newrelic.com/\\\",\\\"Tag\\\":\\\"analytics\\\",\\\"FirstDetected\\\":1389913200000,\\\"LastDetected\\\":1393455600000},{\\\"Categories\\\":[\\\"Compatibility\\\"],\\\"Name\\\":\\\"Modernizr\\\",\\\"Description\\\":\\\"Modernizr allows you to target specific browser functionality in your stylesheet.\\\",\\\"Link\\\":\\\"http://www.modernizr.com\\\",\\\"Tag\\\":\\\"javascript\\\",\\\"FirstDetected\\\":1390518000000,\\\"LastDetected\\\":1444786204000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Google Universal Analytics\\\",\\\"Description\\\":\\\"The analytics.js JavaScript snippet is a new way to measure how users interact with your website. It is similar to the previous Google tracking code, ga.js, but offers more flexibility for developers to customize their implementations.\\\",\\\"Link\\\":\\\"https://developers.google.com/analytics/devguides/collection/analyticsjs/\\\",\\\"Tag\\\":\\\"analytics\\\",\\\"FirstDetected\\\":1390518000000,\\\"LastDetected\\\":1455681706918},{\\\"Categories\\\":null,\\\"Name\\\":\\\"yepnope\\\",\\\"Description\\\":\\\"yepnope is an asynchronous conditional resource loader that\\\\u0027s super-fast, and allows you to load only the scripts that your users need.\\\",\\\"Link\\\":\\\"http://yepnopejs.com/\\\",\\\"Tag\\\":\\\"javascript\\\",\\\"FirstDetected\\\":1392332400000,\\\"LastDetected\\\":1444690800000},{\\\"Categories\\\":[\\\"Live Stream / Webcast\\\",\\\"Online Video Platform\\\",\\\"Social Video Platform\\\"],\\\"Name\\\":\\\"YouTube\\\",\\\"Description\\\":\\\"Embedded videos from YouTube.\\\",\\\"Link\\\":\\\"http://youtube.com\\\",\\\"Tag\\\":\\\"media\\\",\\\"FirstDetected\\\":1392937200000,\\\"LastDetected\\\":1455681706918},{\\\"Categories\\\":null,\\\"Name\\\":\\\"1and1 DNS\\\",\\\"Description\\\":\\\"DNS services provided by 1\\\\u00261.\\\",\\\"Link\\\":\\\"http://1and1.com\\\",\\\"Tag\\\":\\\"ns\\\",\\\"FirstDetected\\\":1393196400000,\\\"LastDetected\\\":1455750000000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Apache\\\",\\\"Description\\\":\\\"Apache has been the most popular web server on the Internet since April 1996.\\\",\\\"Link\\\":\\\"http://httpd.apache.org/\\\",\\\"Tag\\\":\\\"Web Server\\\",\\\"FirstDetected\\\":1405638000000,\\\"LastDetected\\\":1451088000000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"jQuery 1.11.0\\\",\\\"Description\\\":\\\"jQuery version 1.11.0\\\",\\\"Link\\\":\\\"http://blog.jquery.com/2014/01/24/jquery-1-11-and-2-1-released/\\\",\\\"Tag\\\":\\\"javascript\\\",\\\"FirstDetected\\\":1405638000000,\\\"LastDetected\\\":1444786204000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"jQuery Cookie\\\",\\\"Description\\\":\\\"A simple, lightweight jQuery plugin for reading, writing and deleting cookies.\\\",\\\"Link\\\":\\\"https://github.com/carhartl/jquery-cookie\\\",\\\"Tag\\\":\\\"javascript\\\",\\\"FirstDetected\\\":1406678400000,\\\"LastDetected\\\":1444786204000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Font Awesome\\\",\\\"Description\\\":\\\"Iconic font and CSS toolkit.\\\",\\\"Link\\\":\\\"http://fontawesome.io\\\",\\\"Tag\\\":\\\"widgets\\\",\\\"FirstDetected\\\":1406678400000,\\\"LastDetected\\\":1444786204000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Content Delivery Network\\\",\\\"Description\\\":\\\"This page contains links that give the impression that some of the site contents are stored on a content delivery network.\\\",\\\"Link\\\":\\\"http://en.wikipedia.org/wiki/Content_Delivery_Network\\\",\\\"Tag\\\":\\\"CDN\\\",\\\"FirstDetected\\\":1406678400000,\\\"LastDetected\\\":1453852800000},{\\\"Categories\\\":[\\\"A/B Testing\\\",\\\"Conversion Optimization\\\",\\\"Personalization\\\",\\\"Site Optimization\\\"],\\\"Name\\\":\\\"Optimizely\\\",\\\"Description\\\":\\\"Optimizely empowers companies to deliver more relevant and effective digital experiences on websites and mobile through A/B testing and personalization.\\\",\\\"Link\\\":\\\"http://www.optimizely.com\\\",\\\"Tag\\\":\\\"analytics\\\",\\\"FirstDetected\\\":1406678400000,\\\"LastDetected\\\":1447196400000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Google Tag Manager\\\",\\\"Description\\\":\\\"Tag management that lets you add and update website tags without changes to underlying website code.\\\",\\\"Link\\\":\\\"http://google.com/tagmanager\\\",\\\"Tag\\\":\\\"widgets\\\",\\\"FirstDetected\\\":1406678400000,\\\"LastDetected\\\":1444786204000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Zendesk Dropbox\\\",\\\"Description\\\":\\\"Widget for submitting Zendesk support tickets.\\\",\\\"Link\\\":\\\"http://zendesk.com\\\",\\\"Tag\\\":\\\"widgets\\\",\\\"FirstDetected\\\":1406678400000,\\\"LastDetected\\\":1455681706918},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Orientation\\\",\\\"Description\\\":\\\"CSS Orientation Media Query\\\",\\\"Link\\\":\\\"https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries#orientation\\\",\\\"Tag\\\":\\\"css\\\",\\\"FirstDetected\\\":1406761200000,\\\"LastDetected\\\":1455750000000},{\\\"Categories\\\":[\\\"Animation\\\"],\\\"Name\\\":\\\"GSAP\\\",\\\"Description\\\":\\\"GSAP is a suite of tools for scripted, high-performance HTML5 animations that work in all major browsers from GreenSock.\\\",\\\"Link\\\":\\\"http://greensock.com/gsap/\\\",\\\"Tag\\\":\\\"javascript\\\",\\\"FirstDetected\\\":1406761200000,\\\"LastDetected\\\":1444690800000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Min Width\\\",\\\"Description\\\":\\\"A CSS media query to display specific CSS if a device greater than the minimum width specified.\\\",\\\"Link\\\":\\\"http://www.w3.org/TR/css3-mediaqueries/\\\",\\\"Tag\\\":\\\"css\\\",\\\"FirstDetected\\\":1406761200000,\\\"LastDetected\\\":1455750000000},{\\\"Categories\\\":[\\\"Compatibility\\\"],\\\"Name\\\":\\\"html5shiv\\\",\\\"Description\\\":\\\"HTML5 IE enabling script shim.\\\",\\\"Link\\\":\\\"http://code.google.com/p/html5shiv/\\\",\\\"Tag\\\":\\\"javascript\\\",\\\"FirstDetected\\\":1406761200000,\\\"LastDetected\\\":1444690800000},{\\\"Categories\\\":[\\\"Dedicated Hosting\\\",\\\"German hosting\\\"],\\\"Name\\\":\\\"Hetzner\\\",\\\"Description\\\":\\\"German based dedicated and virtual hosting running on 100% green energy.\\\",\\\"Link\\\":\\\"http://www.hetzner.de\\\",\\\"Tag\\\":\\\"hosting\\\",\\\"FirstDetected\\\":1406761200000,\\\"LastDetected\\\":1451088000000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Max Width\\\",\\\"Description\\\":\\\"Media query to limit CSS to display for devices with a maximum width defined.\\\",\\\"Link\\\":\\\"http://www.w3.org/TR/css3-mediaqueries/\\\",\\\"Tag\\\":\\\"css\\\",\\\"FirstDetected\\\":1406761200000,\\\"LastDetected\\\":1455750000000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Twitter Ads\\\",\\\"Description\\\":\\\"Twitter advertising includes conversion tracking and re-marketing tools.\\\",\\\"Link\\\":\\\"http://ads.twitter.com\\\",\\\"Tag\\\":\\\"ads\\\",\\\"FirstDetected\\\":1407628800000,\\\"LastDetected\\\":1432684800000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"DoubleClick.Net\\\",\\\"Description\\\":\\\"DoubleClick enables agencies, marketers and publishers to work together successfully and profit from their digital marketing investments.\\\",\\\"Link\\\":\\\"http://www.doubleclick.com\\\",\\\"Tag\\\":\\\"ads\\\",\\\"FirstDetected\\\":1407628800000,\\\"LastDetected\\\":1455750000000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Facebook Exchange FBX\\\",\\\"Description\\\":\\\"Facebook Exchange (FBX) is a real-time bidded ad serving protocol.\\\",\\\"Link\\\":\\\"https://developers.facebook.com/docs/reference/ads-api/rtb/\\\",\\\"Tag\\\":\\\"ads\\\",\\\"FirstDetected\\\":1407628800000,\\\"LastDetected\\\":1432684800000},{\\\"Categories\\\":[\\\"Ad Exchange\\\",\\\"Demand-side Platform\\\"],\\\"Name\\\":\\\"AppNexus\\\",\\\"Description\\\":\\\"Provides access to the major exchanges and aggregators, as well as cloud infrastructure scalable to billions of ad impressions a day with a layer of real-time decisioning on top.\\\",\\\"Link\\\":\\\"http://www.appnexus.com/\\\",\\\"Tag\\\":\\\"ads\\\",\\\"FirstDetected\\\":1407628800000,\\\"LastDetected\\\":1453852800000},{\\\"Categories\\\":[\\\"Marketing Automation\\\"],\\\"Name\\\":\\\"Rapleaf\\\",\\\"Description\\\":\\\"Marketing automation tools with the necessary data to help brands keep their customers engaged.\\\",\\\"Link\\\":\\\"http://www.rapleaf.com\\\",\\\"Tag\\\":\\\"analytics\\\",\\\"FirstDetected\\\":1407628800000,\\\"LastDetected\\\":1432684800000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Twitter Analytics\\\",\\\"Description\\\":\\\"A tool that helps website owners understand how much traffic they receive from Twitter and the effectiveness of Twitter integrations on their sites. Includes Twitter Conversion Tracking.\\\",\\\"Link\\\":\\\"https://dev.twitter.com/blog/introducing-twitter-web-analytics\\\",\\\"Tag\\\":\\\"analytics\\\",\\\"FirstDetected\\\":1407628800000,\\\"LastDetected\\\":1432684800000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Facebook Custom Audiences\\\",\\\"Description\\\":\\\"Custom Audiences from your website makes it possible to reach people who visit your website and deliver the right message to them on Facebook.\\\",\\\"Link\\\":\\\"https://developers.facebook.com/docs/reference/ads-api/custom-audience-website\\\",\\\"Tag\\\":\\\"ads\\\",\\\"FirstDetected\\\":1409785200000,\\\"LastDetected\\\":1442444400000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Facebook for Websites\\\",\\\"Description\\\":\\\"Allows a user to make a website more sociable and connected with integrations from the hugely popular Facebook website.\\\",\\\"Link\\\":\\\"http://developers.facebook.com/\\\",\\\"Tag\\\":\\\"javascript\\\",\\\"FirstDetected\\\":1409785200000,\\\"LastDetected\\\":1455681706918},{\\\"Categories\\\":null,\\\"Name\\\":\\\"AppNexus Segment Pixel\\\",\\\"Description\\\":\\\"An AppNexus Segment Pixel.\\\",\\\"Link\\\":\\\"http://appnexus.com\\\",\\\"Tag\\\":\\\"ads\\\",\\\"FirstDetected\\\":1411516800000,\\\"LastDetected\\\":1453852800000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Openads/OpenX\\\",\\\"Description\\\":\\\"Openads offer ad serving software that is simple, reliable and totally independent. Best of all, it\\\\u0027s free!\\\",\\\"Link\\\":\\\"http://openads.org\\\",\\\"Tag\\\":\\\"ads\\\",\\\"FirstDetected\\\":1412204400000,\\\"LastDetected\\\":1432684800000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Yahoo Small Business\\\",\\\"Description\\\":\\\"Yahoo advertising network and search engine marketing solutions.\\\",\\\"Link\\\":\\\"http://sem.smallbusiness.yahoo.com/searchenginemarketing/\\\",\\\"Tag\\\":\\\"ads\\\",\\\"FirstDetected\\\":1412204400000,\\\"LastDetected\\\":1432684800000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"IponWeb BidSwitch\\\",\\\"Description\\\":\\\"BidSwitch facilitates both Supply and Demand technology partners to efficiently and transparently connect, trade and manage multiple RTB partners. \\\",\\\"Link\\\":\\\"http://www.iponweb.com/bidswitch\\\",\\\"Tag\\\":\\\"ads\\\",\\\"FirstDetected\\\":1412204400000,\\\"LastDetected\\\":1432684800000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Centro\\\",\\\"Description\\\":\\\"Media Logistics and advertising distribution systems.\\\",\\\"Link\\\":\\\"http://centro.net/\\\",\\\"Tag\\\":\\\"ads\\\",\\\"FirstDetected\\\":1412809200000,\\\"LastDetected\\\":1414281600000},{\\\"Categories\\\":[\\\"Dynamic Creative Optimization\\\"],\\\"Name\\\":\\\"Pubmatic\\\",\\\"Description\\\":\\\"PubMatic Enables Ad Optimization Across Every Ad Network\\\",\\\"Link\\\":\\\"http://pubmatic.com\\\",\\\"Tag\\\":\\\"ads\\\",\\\"FirstDetected\\\":1412809200000,\\\"LastDetected\\\":1418515200000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Cascading Style Sheets\\\",\\\"Description\\\":\\\"Cascading Style Sheets (CSS) is a stylesheet language used to describe the presentation of a document written in a markup language. Its most common application is to style web pages written in HTML \\\",\\\"Link\\\":\\\"http://en.wikipedia.org/wiki/Cascading_Style_Sheets\\\",\\\"Tag\\\":\\\"docinfo\\\",\\\"FirstDetected\\\":1413331200000,\\\"LastDetected\\\":1413849600000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"IFrame\\\",\\\"Description\\\":\\\"The page shows content with an iframe; an embedded frame that loads another webpage.\\\",\\\"Link\\\":\\\"http://www.w3schools.com/tags/tag_iframe.asp\\\",\\\"Tag\\\":\\\"docinfo\\\",\\\"FirstDetected\\\":1413331200000,\\\"LastDetected\\\":1413849600000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Twitter Bootstrap\\\",\\\"Description\\\":\\\"Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites.\\\",\\\"Link\\\":\\\"http://twitter.github.com/bootstrap/\\\",\\\"Tag\\\":\\\"docinfo\\\",\\\"FirstDetected\\\":1413331200000,\\\"LastDetected\\\":1413849600000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"HTML 5 Specific Tags\\\",\\\"Description\\\":\\\"This page contains tags that are specific to an HTML 5 implementation.\\\",\\\"Link\\\":\\\"http://dev.w3.org/html5/html-author/\\\",\\\"Tag\\\":\\\"docinfo\\\",\\\"FirstDetected\\\":1413331200000,\\\"LastDetected\\\":1413849600000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"SEO_TITLE\\\",\\\"Description\\\":\\\"SEO Title\\\",\\\"Link\\\":\\\"\\\",\\\"Tag\\\":\\\"seo_title\\\",\\\"FirstDetected\\\":1413331200000,\\\"LastDetected\\\":1413849600000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"SEO_META_DESCRIPTION\\\",\\\"Description\\\":\\\"SEO Meta Description\\\",\\\"Link\\\":\\\"http://builtwith.com\\\",\\\"Tag\\\":\\\"seo_meta\\\",\\\"FirstDetected\\\":1413331200000,\\\"LastDetected\\\":1413849600000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Mobile Non Scaleable Content\\\",\\\"Description\\\":\\\"This content is formatted for mobile devices, it does not allow the content to be scaled.\\\",\\\"Link\\\":\\\"http://developer.apple.com/library/safari/#documentation/appleapplications/reference/SafariHTMLRef/Articles/MetaTags.html\\\",\\\"Tag\\\":\\\"mobile\\\",\\\"FirstDetected\\\":1413331200000,\\\"LastDetected\\\":1455681706918},{\\\"Categories\\\":null,\\\"Name\\\":\\\"SEO_H1\\\",\\\"Description\\\":\\\"SEO H1\\\",\\\"Link\\\":\\\"\\\",\\\"Tag\\\":\\\"seo_headers\\\",\\\"FirstDetected\\\":1413331200000,\\\"LastDetected\\\":1413849600000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Google Chrome IE Frame\\\",\\\"Description\\\":\\\"Frames Google Chrome window into Internet Explorer for HTML 5 compatibility.\\\",\\\"Link\\\":\\\"http://code.google.com/chrome/chromeframe/\\\",\\\"Tag\\\":\\\"docinfo\\\",\\\"FirstDetected\\\":1413331200000,\\\"LastDetected\\\":1413849600000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Javascript\\\",\\\"Description\\\":\\\"JavaScript is a scripting language most often used for client-side web development. Its proper name is ECMAScript, though \\\\\\\"JavaScript\\\\\\\" is much more commonly used. The website uses JavaScript.\\\",\\\"Link\\\":\\\"http://en.wikipedia.org/wiki/JavaScript\\\",\\\"Tag\\\":\\\"docinfo\\\",\\\"FirstDetected\\\":1413331200000,\\\"LastDetected\\\":1413849600000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Open Graph Protocol\\\",\\\"Description\\\":\\\"The Open Graph protocol enables any web page to become a rich object in a social graph, a open protocol supported by Facebook\\\",\\\"Link\\\":\\\"http://opengraphprotocol.org/\\\",\\\"Tag\\\":\\\"docinfo\\\",\\\"FirstDetected\\\":1413331200000,\\\"LastDetected\\\":1413849600000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Meta Keywords\\\",\\\"Description\\\":\\\"Meta tag containing keywords related to the page.\\\",\\\"Link\\\":\\\"http://en.wikipedia.org/wiki/Meta_tag#The_keywords_attribute\\\",\\\"Tag\\\":\\\"docinfo\\\",\\\"FirstDetected\\\":1413331200000,\\\"LastDetected\\\":1413849600000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"UTF-8\\\",\\\"Description\\\":\\\"UTF-8 (8-bit UCS/Unicode Transformation Format) is a variable-length character encoding for Unicode. It is the preferred encoding for web pages.\\\",\\\"Link\\\":\\\"http://en.wikipedia.org/wiki/UTF-8\\\",\\\"Tag\\\":\\\"encoding\\\",\\\"FirstDetected\\\":1413331200000,\\\"LastDetected\\\":1413849600000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"SEO_META_KEYWORDS\\\",\\\"Description\\\":\\\"SEO Meta Keywords\\\",\\\"Link\\\":\\\"http://builtwith.com\\\",\\\"Tag\\\":\\\"seo_meta\\\",\\\"FirstDetected\\\":1413331200000,\\\"LastDetected\\\":1413849600000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Meta Description\\\",\\\"Description\\\":\\\"The description attribute provides a concise explanation of the page content.\\\",\\\"Link\\\":\\\"http://en.wikipedia.org/wiki/Meta_tag#The_description_attribute\\\",\\\"Tag\\\":\\\"docinfo\\\",\\\"FirstDetected\\\":1413331200000,\\\"LastDetected\\\":1413849600000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Viewport Meta\\\",\\\"Description\\\":\\\"This page uses the viewport meta tag which means the content may be optimized for mobile content.\\\",\\\"Link\\\":\\\"https://developers.google.com/speed/docs/insights/ConfigureViewport\\\",\\\"Tag\\\":\\\"mobile\\\",\\\"FirstDetected\\\":1413331200000,\\\"LastDetected\\\":1455681706918},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Rubicon Project\\\",\\\"Description\\\":\\\"Advertising optimization service.\\\",\\\"Link\\\":\\\"http://rubiconproject.com\\\",\\\"Tag\\\":\\\"ads\\\",\\\"FirstDetected\\\":1414018800000,\\\"LastDetected\\\":1414972800000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"MLN Advertising\\\",\\\"Description\\\":\\\"Campaign management, analytics and optimization - now known as MediaGlu.\\\",\\\"Link\\\":\\\"http://mlnadvertising.com\\\",\\\"Tag\\\":\\\"ads\\\",\\\"FirstDetected\\\":1414623600000,\\\"LastDetected\\\":1417042800000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Comodo PositiveSSL\\\",\\\"Description\\\":\\\"Comodo Positive SSL certificate.\\\",\\\"Link\\\":\\\"http://www.positivessl.com/ssl-certificate-positivessl.php\\\",\\\"Tag\\\":\\\"ssl\\\",\\\"FirstDetected\\\":1418857200000,\\\"LastDetected\\\":1451088000000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Comodo SSL\\\",\\\"Description\\\":\\\"Certificate provided by Comodo.\\\",\\\"Link\\\":\\\"http://comodo.com\\\",\\\"Tag\\\":\\\"ssl\\\",\\\"FirstDetected\\\":1418857200000,\\\"LastDetected\\\":1451088000000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"SSL by Default\\\",\\\"Description\\\":\\\"The website redirects traffic to an HTTPS/SSL version by default.\\\",\\\"Link\\\":\\\"http://trends.builtwith.com/ssl\\\",\\\"Tag\\\":\\\"ssl\\\",\\\"FirstDetected\\\":1418857200000,\\\"LastDetected\\\":1444690800000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Facebook SDK\\\",\\\"Description\\\":\\\" JavaScript SDK enables you to access all of the features of the Graph API via JavaScript, and it provides a rich set of client-side functionality for authentication and sharing. It differs from Facebook Connect.\\\",\\\"Link\\\":\\\"http://developers.facebook.com/docs/reference/javascript/\\\",\\\"Tag\\\":\\\"javascript\\\",\\\"FirstDetected\\\":1421020800000,\\\"LastDetected\\\":1455681706918},{\\\"Categories\\\":null,\\\"Name\\\":\\\"BootstrapCDN\\\",\\\"Description\\\":\\\"MaxCDN\\\\u0027s Bootstrap CDN system.\\\\r\\\\n\\\",\\\"Link\\\":\\\"http://www.bootstrapcdn.com/\\\",\\\"Tag\\\":\\\"cdn\\\",\\\"FirstDetected\\\":1423090800000,\\\"LastDetected\\\":1444786204000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Facebook Tag API\\\",\\\"Description\\\":\\\"The Javascript Tag API can be used to track custom audience and conversion events.\\\",\\\"Link\\\":\\\"https://developers.facebook.com/docs/ads-for-websites/tag-api\\\",\\\"Tag\\\":\\\"analytics\\\",\\\"FirstDetected\\\":1425340800000,\\\"LastDetected\\\":1442444400000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Zendesk Feedback Tab\\\",\\\"Description\\\":\\\"Zendesk feedback tab website integration.\\\",\\\"Link\\\":\\\"http://zendesk.com\\\",\\\"Tag\\\":\\\"widgets\\\",\\\"FirstDetected\\\":1430348400000,\\\"LastDetected\\\":1447196400000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Device Width\\\",\\\"Description\\\":\\\"Describes the width of the output device (meaning the entire screen or page, rather than just the rendering area, such as the document window).\\\",\\\"Link\\\":\\\"https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries#device-width\\\",\\\"Tag\\\":\\\"css\\\",\\\"FirstDetected\\\":1451088000000,\\\"LastDetected\\\":1455750000000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Device Pixel Ratio\\\",\\\"Description\\\":\\\"A media query to display different CSS based on the device pixel ratio. Standard screens have a pixel ratio of 1, retina devices have a pixel ratio greater than 1.\\\",\\\"Link\\\":\\\"http://www.hongkiat.com/blog/css-retina-display/\\\",\\\"Tag\\\":\\\"css\\\",\\\"FirstDetected\\\":1451088000000,\\\"LastDetected\\\":1455750000000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Ruby on Rails Token\\\",\\\"Description\\\":\\\"Ruby on Rails is an open-source web framework that is optimized for programmer happiness and sustainable productivity. Note that Ruby on Rails has two detection techniques and this is one of them.\\\",\\\"Link\\\":\\\"http://www.rubyonrails.org/\\\",\\\"Tag\\\":\\\"framework\\\",\\\"FirstDetected\\\":1452466800000,\\\"LastDetected\\\":1455681706918},{\\\"Categories\\\":[\\\"Online Video Platform\\\",\\\"Video Players\\\"],\\\"Name\\\":\\\"Vimeo\\\",\\\"Description\\\":\\\"Use Vimeo to exchange videos with only the people you want to. We have a bunch of different privacy options so you can choose exactly who can see your videos, and others can do the same. The website embeds vimeo.\\\",\\\"Link\\\":\\\"http://vimeo.com\\\",\\\"Tag\\\":\\\"media\\\",\\\"FirstDetected\\\":1452637531318,\\\"LastDetected\\\":1455681706918},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Ruby on Rails\\\",\\\"Description\\\":\\\"Ruby on Rails is an open-source web framework that is optimized for programmer happiness and sustainable productivity.\\\",\\\"Link\\\":\\\"http://www.rubyonrails.org/\\\",\\\"Tag\\\":\\\"framework\\\",\\\"FirstDetected\\\":1452466800000,\\\"LastDetected\\\":1455681706918},{\\\"Categories\\\":[\\\"Cloud Hosting\\\",\\\"Cloud PaaS\\\"],\\\"Name\\\":\\\"Amazon\\\",\\\"Description\\\":\\\"This site is hosted on Amazon infrastructure.\\\",\\\"Link\\\":\\\"http://aws.amazon.com\\\",\\\"Tag\\\":\\\"hosting\\\",\\\"FirstDetected\\\":1452726000000,\\\"LastDetected\\\":1455750000000}]},{\\\"FirstIndexed\\\":1411516800000,\\\"LastIndexed\\\":1453852800000,\\\"Domain\\\":\\\"bonaverde.com\\\",\\\"Url\\\":\\\"dd\\\",\\\"SubDomain\\\":\\\"\\\",\\\"Technologies\\\":[{\\\"Categories\\\":null,\\\"Name\\\":\\\"jQuery Easing\\\",\\\"Description\\\":\\\"A jQuery extension that provides functionality to \\\\\\\"ease\\\\\\\" things onto or off of the screen.\\\",\\\"Link\\\":\\\"http://gsgd.co.uk/sandbox/jquery/easing/\\\",\\\"Tag\\\":\\\"javascript\\\",\\\"FirstDetected\\\":1411516800000,\\\"LastDetected\\\":1418515200000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"SEO_H2\\\",\\\"Description\\\":\\\"SEO H2\\\",\\\"Link\\\":\\\"\\\",\\\"Tag\\\":\\\"seo_headers\\\",\\\"FirstDetected\\\":1413331200000,\\\"LastDetected\\\":1413849600000},{\\\"Categories\\\":[\\\"Ad Analytics\\\",\\\"Ad Network\\\"],\\\"Name\\\":\\\"ContextWeb\\\",\\\"Description\\\":\\\"ContextWeb, Inc. provides high-precision, real-time contextual advertising solutions guaranteed to maximize the results and impact of online advertising. Now known as PulsePoint.\\\",\\\"Link\\\":\\\"http://contextweb.com\\\",\\\"Tag\\\":\\\"ads\\\",\\\"FirstDetected\\\":1417824000000,\\\"LastDetected\\\":1417824000000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Switch Ads\\\",\\\"Description\\\":\\\"UK based advertising system.\\\",\\\"Link\\\":\\\"http://switchads.com\\\",\\\"Tag\\\":\\\"ads\\\",\\\"FirstDetected\\\":1418515200000,\\\"LastDetected\\\":1418515200000},{\\\"Categories\\\":[\\\"Plugin / Module\\\"],\\\"Name\\\":\\\"WooCommerce\\\",\\\"Description\\\":\\\"Transforms your WordPress website into an online store.\\\",\\\"Link\\\":\\\"http://www.woothemes.com/woocommerce/\\\",\\\"Tag\\\":\\\"shop\\\",\\\"FirstDetected\\\":1422399600000,\\\"LastDetected\\\":1447196400000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"jQuery Marquee\\\",\\\"Description\\\":\\\"Adds an annoying Marquee feature to text like it was 1995 again.\\\",\\\"Link\\\":\\\"http://remysharp.com/2008/09/10/the-silky-smooth-marquee/\\\",\\\"Tag\\\":\\\"javascript\\\",\\\"FirstDetected\\\":1422399600000,\\\"LastDetected\\\":1434841200000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"WPML Multilingual\\\",\\\"Description\\\":\\\"Multilingual platform support for WordPress.\\\",\\\"Link\\\":\\\"http://wpml.org/\\\",\\\"Tag\\\":\\\"widgets\\\",\\\"FirstDetected\\\":1422399600000,\\\"LastDetected\\\":1447196400000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"WordPress PopUp\\\",\\\"Description\\\":\\\"Popup sytem for WordPress.\\\",\\\"Link\\\":\\\"https://wordpress.org/plugins/wordpress-popup/\\\",\\\"Tag\\\":\\\"widgets\\\",\\\"FirstDetected\\\":1434841200000,\\\"LastDetected\\\":1447196400000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Froogaloop\\\",\\\"Description\\\":\\\"Froogaloop is a small Javascript utility framework to help with the complexities\\\\r\\\\ninvolved in dealing with using the Javascript API through window.postMessage\\\\r\\\\nfor controlling Vimeo\\\\u0027s Moogaloop video player.\\\",\\\"Link\\\":\\\"https://github.com/vimeo/froogaloop\\\",\\\"Tag\\\":\\\"javascript\\\",\\\"FirstDetected\\\":1447196400000,\\\"LastDetected\\\":1447196400000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"YouTube IFrame Upload\\\",\\\"Description\\\":\\\"Lets users upload videos to YouTube from any webpage.\\\",\\\"Link\\\":\\\"http://developers.google.com/youtube/youtube_upload_widget\\\",\\\"Tag\\\":\\\"widgets\\\",\\\"FirstDetected\\\":1447196400000,\\\"LastDetected\\\":1447196400000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Vimeo CDN\\\",\\\"Description\\\":\\\"This page uses content from the Vimeo CDN.\\\",\\\"Link\\\":\\\"http://vimeo.com\\\",\\\"Tag\\\":\\\"cdn\\\",\\\"FirstDetected\\\":1453852800000,\\\"LastDetected\\\":1453852800000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Google Analytics Classic\\\",\\\"Description\\\":\\\"Classic Google Analytics - sites that are using non-universal analytics code.\\\",\\\"Link\\\":\\\"https://developers.google.com/analytics/devguides/collection/gajs/\\\",\\\"Tag\\\":\\\"analytics\\\",\\\"FirstDetected\\\":1453852800000,\\\"LastDetected\\\":1453852800000}]},{\\\"FirstIndexed\\\":1408060800000,\\\"LastIndexed\\\":1412467200000,\\\"Domain\\\":\\\"bonaverde.com\\\",\\\"Url\\\":\\\"\\\",\\\"SubDomain\\\":\\\"seedmatch\\\",\\\"Technologies\\\":[{\\\"Categories\\\":null,\\\"Name\\\":\\\"Google Conversion Tracking\\\",\\\"Description\\\":\\\"This free tool in AdWords can show you what happens after customers click your ad (for example, whether they purchased your product, called from a mobile phone or downloaded your app).\\\",\\\"Link\\\":\\\"https://support.google.com/adwords/answer/1722054\\\",\\\"Tag\\\":\\\"analytics\\\",\\\"FirstDetected\\\":1408060800000,\\\"LastDetected\\\":1412467200000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Facebook CDN\\\",\\\"Description\\\":\\\"This page has content that links to the Facebook content delivery network.\\\",\\\"Link\\\":\\\"http://www.facebook.com\\\",\\\"Tag\\\":\\\"cdn\\\",\\\"FirstDetected\\\":1408060800000,\\\"LastDetected\\\":1412467200000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Google Analytics with Ad Tracking\\\",\\\"Description\\\":\\\"Google Analytics collects the information it normally does, as well as the DoubleClick cookie when that cookie is present in relation to display advertising tracking.\\\",\\\"Link\\\":\\\"https://support.google.com/analytics/answer/2444872\\\",\\\"Tag\\\":\\\"analytics\\\",\\\"FirstDetected\\\":1408060800000,\\\"LastDetected\\\":1412467200000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Vimeo CDN\\\",\\\"Description\\\":\\\"This page uses content from the Vimeo CDN.\\\",\\\"Link\\\":\\\"http://vimeo.com\\\",\\\"Tag\\\":\\\"cdn\\\",\\\"FirstDetected\\\":1408060800000,\\\"LastDetected\\\":1412467200000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Akamai\\\",\\\"Description\\\":\\\"Akamai provides a distributed computing platform for global Internet content and application delivery.\\\",\\\"Link\\\":\\\"http://akamai.com\\\",\\\"Tag\\\":\\\"cdn\\\",\\\"FirstDetected\\\":1408060800000,\\\"LastDetected\\\":1412467200000},{\\\"Categories\\\":[\\\"Advertiser Tracking\\\",\\\"Audience Measurement\\\",\\\"Conversion Optimization\\\",\\\"Site Optimization\\\",\\\"Visitor Count Tracking\\\"],\\\"Name\\\":\\\"comScore\\\",\\\"Description\\\":\\\"Market research company that studies internet trends and behavior.\\\",\\\"Link\\\":\\\"http://www.comscore.com\\\",\\\"Tag\\\":\\\"analytics\\\",\\\"FirstDetected\\\":1408060800000,\\\"LastDetected\\\":1412467200000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Google Plus One Platform\\\",\\\"Description\\\":\\\"Google+ API functionality.\\\",\\\"Link\\\":\\\"https://developers.google.com/+/\\\",\\\"Tag\\\":\\\"widgets\\\",\\\"FirstDetected\\\":1408060800000,\\\"LastDetected\\\":1412467200000},{\\\"Categories\\\":[\\\"Bookmarking\\\",\\\"Social Sharing\\\"],\\\"Name\\\":\\\"ShareThis\\\",\\\"Description\\\":\\\"One button sharing - quick sharing to MySpace, Email and more!\\\",\\\"Link\\\":\\\"http://sharethis.com\\\",\\\"Tag\\\":\\\"widgets\\\",\\\"FirstDetected\\\":1408060800000,\\\"LastDetected\\\":1412467200000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Facebook Like Box\\\",\\\"Description\\\":\\\"The use of a fan page Like box Facebook page integration.\\\",\\\"Link\\\":\\\"http://developers.facebook.com/docs/reference/plugins/like-box\\\",\\\"Tag\\\":\\\"widgets\\\",\\\"FirstDetected\\\":1408060800000,\\\"LastDetected\\\":1412467200000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Google API\\\",\\\"Description\\\":\\\"The website uses some form of Google APIs to provide interaction with the many API\\\\u0027s Google Providers.\\\",\\\"Link\\\":\\\"http://code.google.com\\\",\\\"Tag\\\":\\\"javascript\\\",\\\"FirstDetected\\\":1408060800000,\\\"LastDetected\\\":1412467200000},{\\\"Categories\\\":null,\\\"Name\\\":\\\"Google Remarketing\\\",\\\"Description\\\":\\\"Google code specifically for remarketing/retargeting based advertising.\\\",\\\"Link\\\":\\\"http://www.google.com.au/ads/innovations/remarketing.html\\\",\\\"Tag\\\":\\\"ads\\\",\\\"FirstDetected\\\":1408492800000,\\\"LastDetected\\\":1412467200000}]}]},\\\"Meta\\\":{\\\"Social\\\":null,\\\"CompanyName\\\":null,\\\"Telephones\\\":null,\\\"Emails\\\":[],\\\"City\\\":null,\\\"State\\\":null,\\\"Postcode\\\":null,\\\"Country\\\":\\\"\\\",\\\"ARank\\\":0,\\\"QRank\\\":0,\\\"Names\\\":null},\\\"FirstIndexed\\\":1384297200000,\\\"LastIndexed\\\":1455750000000}],\\\"Errors\\\":[]}\"\n # for parse JSON data. \n data = JSON.parse(data) \n if data[\"Results\"].present? && data[\"Results\"].first[\"Result\"][\"Paths\"].present?\n @categories = data[\"Results\"].first[\"Result\"][\"Paths\"].first[\"Technologies\"]\n end \t\n end",
"title": ""
},
{
"docid": "14c29d827d6a935645afa34b2799a898",
"score": "0.5029402",
"text": "def retrieve_data\n unless @raw_data\n begin\n\n url = \"http://#{config[:server]}/render?format=json&target=#{formatted_target}&from=#{config[:from]}\"\n\n if (config[:username] && (config[:password] || config[:passfile]))\n if config[:passfile]\n pass = File.open(config[:passfile]).readline\n elsif config[:password]\n pass = config[:password]\n end\n handle = open(url, :http_basic_authentication =>[\"#{config[:username]}\", pass.chomp])\n else # we don't have both username and password trying without\n handle = open(url)\n end\n\n @raw_data = JSON.parse(handle.gets)\n output = {}\n @raw_data.each do |raw|\n raw['datapoints'].delete_if{|v| v.first.nil? }\n next if raw['datapoints'].empty?\n target = raw['target']\n data = raw['datapoints'].map {|dp| Float(dp.first) }\n start = raw['datapoints'].first.last\n dend = raw['datapoints'].last.last\n step = ((dend - start) / raw['datapoints'].size.to_f).ceil\n output[target] = { 'target' => target, 'data' => data, 'start' => start, 'end' => dend, 'step' => step }\n end\n output\n rescue OpenURI::HTTPError\n unknown \"Failed to connect to graphite server\"\n rescue NoMethodError\n unknown \"No data for time period and/or target\"\n rescue Errno::ECONNREFUSED\n unknown \"Connection refused when connecting to graphite server\"\n rescue Errno::ECONNRESET\n unknown \"Connection reset by peer when connecting to graphite server\"\n rescue EOFError\n unknown \"End of file error when reading from graphite server\"\n rescue Exception => e\n unknown \"An unknown error occured: #{e.inspect}\"\n end\n end\n end",
"title": ""
},
{
"docid": "61e207fea3b969dac6343e4f33966190",
"score": "0.5024474",
"text": "def get_DPLA_url(title, author, start_pub_year, end_pub_year)\n search_prep(title, author, start_pub_year, end_pub_year)\n base_url = 'http://api.dp.la'\n search_url = '/v2/items?'\n search_url += ('sourceResource.title=' + @new_title + '&sourceResource.creator=' + @new_author + '&sourceResource.date.after=' + @start_date + '&sourceResource.date.before=' + @stop_date + '&api_key=' + @api_key )\n final_url = base_url + search_url\n final_url_uri = URI.parse(final_url)\n response = Net::HTTP.get_response(final_url_uri)\n response_body = response.body\n data_hash = JSON.parse(response_body)\n #json_data = Net::HTTP.get(URI.parse(search_url))\n #file = file.read(json_data)\n #data_hash = JSON.parse(json_data)\n\n #add DPLA content to hash\n count = data_hash[\"count\"]\n dpla_hash= @result_hash[:DPLA]= {:count=>count}\n if count> 10\n count = 10\n end\n if count > 0\n for i in 0..(count-1)\n begin\n title = data_hash[\"docs\"][i][\"sourceResource\"][\"title\"]\n creator = data_hash[\"docs\"][i][\"sourceResource\"][\"creator\"]\n pub_date = data_hash[\"docs\"][i][\"sourceResource\"][\"date\"][\"end\"]\n provider = data_hash[\"docs\"][i][\"provider\"][\"name\"]\n publisher = data_hash[\"docs\"][i][\"sourceResource\"][\"publisher\"]\n url = data_hash[\"docs\"][i][\"isShownAt\"]\n begin\n city = data_hash[\"docs\"][i][\"sourceResource\"][\"spatial\"][\"city\"]\n country = data_hash[\"docs\"][i][\"sourceResource\"][\"spatial\"][\"country\"]\n location = city + \", \" + country\n dpla_hash[i]= {:title=>title, :author => creator, :pub_date=> pub_date, :provider=> provider, :publisher=> publisher, :location=> location, :url => url}\n rescue Exception => e\n dpla_hash[i]= {:title=>title, :author => creator, :pub_date=> pub_date, :provider=> provider, :publisher=> publisher, :url => url}\n end\n rescue\n url = nil\n end\n end\n end\n end",
"title": ""
},
{
"docid": "a652b9486e54911aa0f7982c52acdb0c",
"score": "0.5019952",
"text": "def gather_brake_category\n years = (2016..2016).to_a #1 year only for now\n uri = URI.parse('https://www.r1concepts.com/home/allMake') #Get the makes\n\n http_client = Net::HTTP.new(uri.host, uri.port)\n http_client.use_ssl = true\n\n request = Net::HTTP::Post.new(uri.path) # For some reason, getting the makes require a HTTP POST\n request['X-Requested-With'] = 'XMLHttpRequest' #Specifies that this is AJAX\n\n complete_data = {}\n initialize_hash_keys(complete_data, years)\n\n years.each do |year|\n request.set_form_data({'year' => year})\n response = http_client.request(request)\n page = Nokogiri::HTML(response.body) # Read up on Nokogiri, it basically takes a string and turns into a virtual DOM\n makes = page.css('li').collect {|make_li| make_li.text} # With nokogiri, we can get the HTTP Response, turn it into a DOM, and run CSS3 selectors!\n\n initialize_hash_keys(complete_data[year], makes) #makes becomes the keys in the hash of complete_data\n makes.each do |make|\n make_get_uri = URI.parse(\"https://www.r1concepts.com/home/allModel?make=#{make}&year=#{year}\")\n make_get_request = Net::HTTP::Get.new(make_get_uri) # Now for some reason, getting models is a HTTP GET LOL\n response = http_client.request(make_get_request)\n page = Nokogiri::HTML(response.body)\n\n models = page.css('li').collect {|model_li| model_li.text}\n\n initialize_hash_keys(complete_data[year][make], models)\n\n models.each do |model|\n submodel_get_uri = URI.parse(\"https://www.r1concepts.com/home/allSubmodel?make=#{make}&year=#{year}&model=#{model}\")\n submodel_get_request = Net::HTTP::Get.new(submodel_get_uri)\n puts (\"Requesting #{year} - #{make} - #{model}\")\n response = http_client.request(submodel_get_request)\n page = Nokogiri::HTML(response.body)\n submodels = page.css('li').collect {|submodel_li| submodel_li.text}\n initialize_hash_keys(complete_data[year][make][model], submodels)\n\n end\n\n end\n\n end\n\n #Inserting into the Category table\n complete_data.each do |year, year_hash|\n year_hash.each do |make, make_hash|\n make_hash.each do |model, model_hash|\n # Check if model has many submodels and one of it is \"All\", if so, remove \"All\"\n if model_hash.keys.include?('All') && model_hash.keys.length > 1\n model_hash.delete('All')\n end\n model_hash.each do |submodel|\n\n category = Category.find_or_create_by({year: year, make: make, model: model, submodel: submodel[0]})\n puts (\"Inserting: #{category.attributes.inspect}\")\n end\n end\n end\n end\n\n redirect_to root_path\n end",
"title": ""
},
{
"docid": "a1fb0775774555b15ad222d6802b3565",
"score": "0.5016014",
"text": "def search_data(url,apikey)\n \n url = URI(url + apikey)\n http= Net::HTTP.new(url.host, url.port)\n request = Net::HTTP::Get.new(url)\n http.use_ssl=true\n #http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n search_data=Net::HTTP::Get.new(url)\n request[\"cache-control\"]=\"no-cache\"\n request[\"postamn-token\"]= '5f4b1b36-5bcd-4c49-f578-75a752af8fd5'\n response = http.request(search_data)\n return JSON.parse(response.read_body)\n\nend",
"title": ""
},
{
"docid": "90a31b27aba7c16db0079c6f61226930",
"score": "0.49965036",
"text": "def index\n @judges = Judge.all.sort_by { |j| j.total_value}.reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @judges }\n end\n end",
"title": ""
},
{
"docid": "22530ec7d1766b225915311d43d2f839",
"score": "0.4996357",
"text": "def index\n respond_to do |format|\n format.html { render :index }\n format.json { \n serialize_predictions(current_user.predictions, \"app/assets/json_files/unexpired_predictions.json\") \n }\n end\n end",
"title": ""
},
{
"docid": "f58414df22f2f58013f1b6cb353a13b1",
"score": "0.49809453",
"text": "def show\n @algorithm = Algorithm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @algorithm }\n end\n end",
"title": ""
},
{
"docid": "adbfa941ec6cf42ad888214a5acc5fa4",
"score": "0.49790797",
"text": "def analyze\n respond_to do |format|\n format.json { render json: get_metric_data_with_category(params[:metric], params[:category], params[:time]) }\n end\n end",
"title": ""
},
{
"docid": "dddc00f2aea06cfd2f162ed1aff9a04e",
"score": "0.4973207",
"text": "def clean\n Analytic.destroy_all\n render :json => 'ok'\n end",
"title": ""
},
{
"docid": "6f1c0a5e0be6c7d4fdbd7194a863b2a3",
"score": "0.4970921",
"text": "def index\n if params[:client_id]\n client = Client.find params[:client_id]\n @clearings = client.clearings\n else\n @clearings = Clearing.all_cached\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clearings }\n end\n end",
"title": ""
},
{
"docid": "2b7f84e12bd73f27f545352d201c7481",
"score": "0.49684402",
"text": "def destroy\n @algorithm.destroy\n respond_to do |format|\n format.html { redirect_to algorithms_url, notice: 'Algorithm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2b7f84e12bd73f27f545352d201c7481",
"score": "0.49678126",
"text": "def destroy\n @algorithm.destroy\n respond_to do |format|\n format.html { redirect_to algorithms_url, notice: 'Algorithm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2b7f84e12bd73f27f545352d201c7481",
"score": "0.49678126",
"text": "def destroy\n @algorithm.destroy\n respond_to do |format|\n format.html { redirect_to algorithms_url, notice: 'Algorithm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4a3776100ab43dc0559e989e32b9da35",
"score": "0.49677622",
"text": "def index\n @firewalls = getmydata(\"Firewall\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @firewalls }\n end\n end",
"title": ""
},
{
"docid": "3262db734142451674de36f850a8a500",
"score": "0.49613637",
"text": "def get_analysis_data(analysis, datapoint_id = nil, only_completed_normal = true, options = {})\n # Get the mappings of the variables that were used - use the as_json only to hide the null default fields that show\n # up from the database only operator\n\n # require 'ruby-prof'\n # RubyProf.start\n start_time = Time.now\n variables = nil\n plot_data = nil\n\n var_fields = [:_id, :perturbable, :pivot, :visualize, :export, :output, :objective_function,\n :objective_function_group, :objective_function_index, :objective_function_target,\n :scaling_factor, :display_name, :display_name_short, :name, :units, :value_type, :data_type]\n\n # dynamic query, only add 'or' for option fields that are true\n or_qry = [{ perturbable: true }, { pivot: true }, { output: true }]\n options.each do |k, v|\n or_qry << { :\"#{k}\" => v } if v\n end\n logger.debug \"get_analysis_data or_qry: #{or_qry}\" \n variables = Variable.where(analysis_id: analysis, :name.exists => true, :name.ne => '').any_of(or_qry)\n .order_by([:pivot.desc, :perturbable.desc, :output.desc, :name.asc]).as_json(only: var_fields)\n logger.debug \"get_analysis_data variables: #{variables.to_a}\"\n\n # Create a map from the _id to the variables machine name\n variable_name_map = Hash[variables.map { |v| [v['_id'], v['name'].tr('.', '|')] }]\n # logger.info \"Variable name map is #{variable_name_map}\"\n\n # logger.info 'looking for datapoints'\n\n # This map/reduce method is much faster than trying to do all this munging via mongoid/json/hashes. The concept\n # below is to map the inputs/outputs to a flat hash.\n map = %{\n function() {\n key = this._id;\n new_data = {\n name: this.name, run_start_time: this.run_start_time, run_end_time: this.run_end_time,\n status: this.status, status_message: this.status_message\n };\n\n // Retrieve all the results and map the variables to a.b\n var mrMap = #{variables.map { |v| v['name'].split('.') }.to_json};\n for (var i in mrMap){\n if (typeof this.results[mrMap[i][0]] !== 'undefined' && typeof this.results[mrMap[i][0]][mrMap[i][1]] !== 'undefined') {\n new_data[mrMap[i].join('|')] = this.results[mrMap[i][0]][mrMap[i][1]]\n }\n }\n\n // Set the variable names to a.b\n var variableMap = #{variable_name_map.reject { |_k, v| v.nil? }.to_json};\n for (var p in this.set_variable_values) {\n new_data[variableMap[p]] = this.set_variable_values[p];\n }\n\n new_data['data_point_uuid'] = \"/data_points/\" + this._id\n\n emit(key, new_data);\n }\n }\n\n reduce = %{\n function(key, values) {\n return values[0];\n }\n }\n\n finalize = %{\n function(key, value) {\n value['_id'] = key;\n db.datapoints_mr.insert(value);\n }\n }\n\n # Eventually use this where the timestamp is processed as part of the request to save time\n logger.info \"datapoint_id.size: #{datapoint_id.size}\" if !datapoint_id.nil?\n logger.info \"datapoint_id.class: #{datapoint_id.class}\"\n plot_data = if datapoint_id\n if only_completed_normal\n if datapoint_id.class == Array\n DataPoint.where(analysis_id: analysis, status: 'completed', :id.in => datapoint_id, status_message: 'completed normal')\n else\n DataPoint.where(analysis_id: analysis, status: 'completed', :id => datapoint_id, status_message: 'completed normal')\n end\n else\n if datapoint_id.class == Array\n DataPoint.where(analysis_id: analysis, :id.in => datapoint_id)\n else\n DataPoint.where(analysis_id: analysis, :id => datapoint_id)\n end\n end\n else\n if only_completed_normal\n DataPoint.where(analysis_id: analysis, status: 'completed', status_message: 'completed normal').order_by(:created_at.asc)\n else\n DataPoint.where(analysis_id: analysis).order_by(:created_at.asc)\n end\n end\n logger.info \"PLOT_DATA.count: #{plot_data.count}\"\n logger.info \"finished fixing up data: #{Time.now - start_time}\"\n\n start_time = Time.now\n logger.info 'mapping variables'\n variables.map! { |v| { :\"#{v['name']}\".to_sym => v } }\n\n variables = variables.reduce({}, :merge)\n logger.info \"finished mapping variables: #{Time.now - start_time}\"\n\n start_time = Time.now\n logger.info 'Start map/reduce'\n # Remove all the old items first\n Mongoid.default_client.database.collection(:\"datapoints_mr_#{analysis.id}\").drop\n plot_data = plot_data.map_reduce(map, reduce).out(replace: \"datapoints_mr_#{analysis.id}\")\n # just call the first one so that is flushes the results to the database\n plot_data.first\n logger.info \"Finished map/reduce: #{Time.now - start_time}\"\n\n # Go query the map reduce results again. For some reason the results of the map/reduce is\n # limited to only the first 100 documents.\n start_time = Time.now\n logger.info 'Start as_json'\n plot_data = Mongoid.default_client.database.collection(:\"datapoints_mr_#{analysis.id}\").find.as_json\n logger.info \"Finished as_json: #{Time.now - start_time}\"\n\n start_time = Time.now\n logger.info 'Start collapse'\n plot_data.each_with_index do |pd, i|\n pd.merge!(pd.delete('value'))\n\n # Horrible hack right now until we decide how to handle variables with periods in the key\n # The root of this issue is that Mongo 2.6 now strictly checks for periods in the hash and will\n # throw an exception. The map/reduce script above has to save the result of the map/reduce to the\n # database because it is too large. So the results have to be stored with pipes (|) temporary, then\n # mapped back out.\n plot_data[i] = Hash[pd.map { |k, v| [k.tr('|', '.'), v] }]\n end\n logger.info \"finished merge: #{Time.now - start_time}\"\n\n # plot_data.merge(plot_data.delete('value'))\n\n [variables, plot_data]\n end",
"title": ""
},
{
"docid": "1ab8aac70f7a53c3d6608868b7460337",
"score": "0.4958399",
"text": "def destroy\n @algorithm.destroy\n\n respond_to do |format|\n format.html { redirect_to(algorithms_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "682672fab8363e4dbf1e82d020e752ed",
"score": "0.4954329",
"text": "def index\n render json: self.collection = model.refine_by(params)\n end",
"title": ""
},
{
"docid": "33ef802891c945c6cf06b9d29b1103f5",
"score": "0.4953651",
"text": "def status\n logger.info \"analyses_contoller.status enter\"\n analysis_only_fields = [:status, :analysis_type, :jobs, :run_flag, :exit_on_guideline_14]\n data_point_only_fields = [:status, :analysis_type, :analysis_id, :status_message, :name]\n\n job_statuses = params[:jobs] ? [params[:jobs]] : DataPoint.status_states\n # analysis_states = params[:state] ? [params[:state]] : Analyses.status_states\n\n logger.info 'Version 2 of analyses/status'\n @analyses = params[:id] ? Analysis.where(id: params[:id]).only(analysis_only_fields) : Analysis.all.only(analysis_only_fields)\n\n logger.info \"there are #{@analyses.size} analyses\"\n\n respond_to do |format|\n format.json do\n data = @analyses.map do |a|\n {\n _id: a.id,\n id: a.id,\n status: a.status,\n analysis_type: a.analysis_type,\n run_flag: a.run_flag,\n exit_on_guideline_14: a.exit_on_guideline_14,\n total_datapoints: a.data_points.where(:status.in => job_statuses).only(:id).count,\n jobs: a.jobs.order_by(:index.asc).map do |j|\n {\n index: j.index,\n analysis_type: j.analysis_type,\n status: j.status,\n status_message: j.status_message\n }\n end,\n data_points: a.data_points.where(:status.in => job_statuses).only(data_point_only_fields).map do |dp|\n {\n _id: dp.id,\n id: dp.id,\n name: dp.name,\n analysis_id: dp.analysis_id,\n status: dp.status,\n status_message: dp.status_message\n }\n end\n }\n end\n\n if data.size == 1\n render json: {\n analysis: data.first\n }\n else\n render json: {\n analyses: data\n }\n end\n end\n end\n logger.info \"analyses_contoller.status leave\"\n end",
"title": ""
},
{
"docid": "4f6e36aa3c17839e82430b18efce101d",
"score": "0.4953099",
"text": "def all_searches\n render json: Query.all.most_frequent\n end",
"title": ""
},
{
"docid": "dd83410d8bf00a6c8df3f7213ccc0195",
"score": "0.49493274",
"text": "def index\n @url_data = UrlDatum.all.limit(5).desc(:hits)\n\n render json: @url_data\n end",
"title": ""
},
{
"docid": "94c01e2912d398d70660faf46db05191",
"score": "0.49484476",
"text": "def index\n @search = Algorithm.where(nil) if current_user.admin?\n @search = current_user.algorithms unless current_user.admin?\n\n @search = @search.metasearch(params[:search])\n @algorithms = @search.paginate(:page => @page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @algorithms }\n end\n end",
"title": ""
},
{
"docid": "c8ada483d88512dcaac2e95ba0e40f22",
"score": "0.4944667",
"text": "def index\n @q = Circuit.search(params[:q])\n @circuits = @q.result(:distinct => true).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @circuits }\n end\n end",
"title": ""
},
{
"docid": "6a456b1c87e2542623e089fa71b490e1",
"score": "0.49252114",
"text": "def index\n field = params[:q] || \"annual\"\n areas = [\"ANDAMAN & NICOBAR ISLANDS\", \"ARUNACHAL PRADESH\", \"ASSAM & MEGHALAYA\", \"BIHAR \", \"CHATTISGARH\", \"COASTAL KARNATAKA\", \"COSTAL ANDHRA PRADESH\", \"EAST RAJASTHAN \", \"EAST MADHYA PRADESH\", \"EAST UTTAR PRADESH\", \"GANGETIC WEST BENGAL\", \"GUJARAT REGION, DADRA & NAGAR HAVELI\", \"HARYANA, DELHI & CHANDIGARH\", \"HIMACHAL PRADESH\", \"JAMMU & KASHMIR\", \"JHARKHAND\", \"KERALA\", \"KOKAN & GOA\", \"LAKSHADWEEP \", \"MADHYA MAHARASHTRA\", \"MARATWADA \", \"NAGALAND, MANIPUR, MIZORAM,TRIPURA\", \"NORTH INTERIOR KARNATAKA\", \"ORISSA\", \"PUNJAB \", \"RAYALSEEMA\", \"SAURASHTRA KUTCH & DIU\", \"SOUTH INTERIOR KARNATAKA\", \"SUB-HIMALAYAN W BENGAL & SIKKIM\", \"TAMIL NADU & PONDICHERRY\", \"TELENGANA\", \"UTTARANCHAL\", \"VIDARBHA\", \"WEST MADHYA PRADESH\", \"WEST RAJASTHAN \", \"WEST UTTAR PRADESH\"]\n hash = {}\n\n RainDatum.where(name: areas).group(:name, :year).pluck(:year, :annual, :name).each {|d|\n hash[d[0]] ||= []\n hash[d[0]].push([d[2],d[1]])\n }\n\n data = []\n hash.each do |year,val|\n data.push(\n year => states.map do |state, v|\n { \"hc-key\" => v[:key], value: val.map { |vv| vv[1] if v[:region].include?(vv[0]) }.compact.sum }\n end\n )\n end\n\n respond_to do |format|\n format.html {}\n format.json {\n render json: data\n }\n end\n end",
"title": ""
},
{
"docid": "43e7995efe5a94f5e0c413bd742d2355",
"score": "0.49231362",
"text": "def index\n #get the list of digital specimens from api\n if not(params.key?(\"page\"))\n session[:num_page] = session.fetch(:num_page, 1)\n else\n session[:num_page] = params[:page].to_i\n end\n if not(params.key?(\"items\"))\n session[:page_size] = session.fetch(:page_size, 50)\n else\n session[:page_size] = params[:items].to_i\n end\n if not(params.key?(\"search\"))\n session[:search] = session.fetch(:search, \"\")\n else\n session[:search] = params[:search]\n end\n puts(\"*****************GET /dsdata*****************\")\n # get DS list from CORDRA\n begin\n # enable search\n @search = session[:search]\n query = \"type:DigitalSpecimen\"\n unless @search.to_s.strip.empty?\n if (@search.include?\":\") && (@search.include?\"/\") || (@search.downcase.include?\" and \") || (@search.downcase.include?\" or \")\n # the user seems to do a search using a Lucene query syntax, so keep it\n query += \" AND (\" + @search.gsub(\" and \",\" AND \").gsub(\" or \", \" OR \") + \")\"\n else\n # the user doesn't seems to do a search using a lucene query syntax, so we escape it\n query += \" AND (\\\"\" + @search.gsub(/([\\\\|\\+|\\-|\\!|\\(|)|\\:|\\^|\\[|\\]|\\\"|\\{|\\~|\\*|\\?|\\||\\&|\\/])/, '\\\\\\\\\\1') + \"\\\")\"\n end\n end\n\n # enable pagination\n @current_page = session[:num_page]\n @page_size = session[:page_size]\n\n # Get digital specimens from CORDRA\n list_ds = CordraRestClient::DigitalObject.advanced_search(Rails.configuration.cordra_server_url,query,@current_page-1,@page_size)\n\n @total_records = list_ds[\"size\"]\n @total_pages = (@total_records.to_f/@page_size).ceil\n\n\n # get DS schema from CORDRA\n do_schema = CordraRestClient::DigitalObject.get_schema(Rails.configuration.cordra_server_url,\"DigitalSpecimen\")\n # create a new class for the DS from the schema\n do_properties = do_schema[\"properties\"].keys\n ds_class = CordraRestClient::DigitalObjectFactory.create_class \"DigitalSpecimen\", do_properties\n\n # convert each of the results into a DS object and \n # build a list of DS objects\n ds_return=[]\n list_ds[\"results\"].each do |ds|\n new_ds = ds_class.new\n ds_data = ds[\"content\"]\n CordraRestClient::DigitalObjectFactory.assing_attributes new_ds, ds_data\n ds_return.push(new_ds)\n end\n rescue Faraday::ConnectionFailed => e\n list_ds = helpers.load_data_json('ds_list.json')\n @do_schema = helpers.load_data_json('ds_schema.json')\n @do_properties = @do_schema[\"properties\"].keys\n puts @properties\n ds_class = CordraRestClient::DigitalObjectFactory.create_class \"DigitalSpecimen\", @do_properties\n ds_return=[]\n list_ds[\"results\"].each do |ds|\n new_ds = ds_class.new\n ds_data = ds[\"content\"]\n CordraRestClient::DigitalObjectFactory.assing_attributes new_ds, ds_data\n ds_return.push(new_ds)\n end\n puts e\n end\n\n #end\n @dsdata = ds_return\n # puts(\"*****************GET /dsobj*****************\")\n # @dsdata.each do |dsdatum|\n # puts dsdatum.id\n # end\n # puts(\"*****************GET /dsobj*****************\")\n end",
"title": ""
},
{
"docid": "ef7e0e6f04dbde4327bf277d90730b25",
"score": "0.49159718",
"text": "def compare\n input = JSON(request.body.read) rescue nil\n if input.nil?\n render json: {\"error\": \"invalid JSON\"},\n status: 422\n return\n end\n input_vals = input.map { |i| i[\"value\"] }\n\n fragment_id = params[:fragment_id].to_s rescue nil\n if !valid_fragment?(fragment_id)\n render json: {\"error\": \"invalid fragment_id\"}.to_json,\n status: 422\n return\n end\n\n account_id = params[:account_id].to_i rescue nil\n if account_id == 0\n accounts = []\n data = get_fragment(fragment_id)\n fragment_size = 0\n Doorkeeper::Application.pluck(:id).each do |account_id|\n key = get_fragment_key(fragment_id, account_id)\n account_data = apply_watermark(data, key)\n fragment_vals = account_data.map { |i| i[\"item\"][\"value\"] }\n fragment_size = fragment_vals.length\n dist, similarity = distance(input_vals, fragment_vals)\n accounts << {\n \"id\": account_id,\n \"distance\": dist,\n \"similarity\": similarity\n }\n\n end\n\n retVal = {\n \"input\": {\n \"size\": input_vals.length,\n \"fragment\": fragment_id,\n \"fragment-size\": fragment_size\n },\n \"accounts\": accounts.sort_by { |i| i[:distance] }\n }\n render json: retVal, \n status: 200\n\n else\n if !valid_account?(account_id)\n render json: {\"error\": \"invalid account_id\"}.to_json,\n status: 422\n return\n end\n data = get_fragment(fragment_id)\n key = get_fragment_key(fragment_id, account_id)\n data = apply_watermark(data, key)\n fragment_vals = data.map { |i| i[\"item\"][\"value\"] }\n\n dist, similarity = distance(input_vals, fragment_vals)\n retVal = {\n \"input\": {\n \"size\": input_vals.length,\n \"fragment\": fragment_id,\n \"fragment-size\": fragment_vals.length\n },\n \"accounts\": [{\n \"id\": account_id,\n \"distance\": dist,\n \"similarity\": similarity\n }]\n }\n render json: retVal, \n status: 200\n end\n end",
"title": ""
},
{
"docid": "8969f2a1b5bde07a003b12d7f102e035",
"score": "0.4915773",
"text": "def index\n params[:search] ? @guides = Guide.search(params[:search]) : @guides = Guide.all\n # build a hash of all guide sections keyed by guide id\n @guide_sections = {}\n @guides.each do |g|\n \t@guide_sections[g.id] = GuideSection.find_all_by_guide_id(g.id, :order => \"display_order ASC\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guides }\n end\n end",
"title": ""
},
{
"docid": "f1105cb49a7bee3e13b68c4cd6a6b08a",
"score": "0.4911438",
"text": "def list_arrays_not_assigned_to_a_profile(args = {}) \n get(\"/arrays.json/unassigned\", args)\nend",
"title": ""
},
{
"docid": "515d3156857a231628ad86a65597d2c7",
"score": "0.49106836",
"text": "def get_results_with_no_degrees(json)\r\n\t\tbegin\r\n\t\t\tno_degree_jobs = remove_degrees_from_indeed(json)\r\n\t\t\t# first call\r\n\t\t\t@search_results.concat(no_degree_jobs)\r\n\r\n\t\trescue Errno::ETIMEDOUT => e\r\n\t\t\tretry\r\n\t\tend\r\n\tend",
"title": ""
},
{
"docid": "4c26d97e215f410b0b0d6d10b1f39698",
"score": "0.48963776",
"text": "def dataset\n respond_to do |format|\n format.json {\n render json: Api::V1.dataset(params[:dataset_id], clean_filtered_params(request.filtered_parameters)), each_serializer: DatasetSerializer, callback: params[:callback]\n }\n end\n end",
"title": ""
},
{
"docid": "06aab2a47503b9a1409e75970560c587",
"score": "0.4895052",
"text": "def index\n @cleanings = Cleaning.paginate page: params[:page], order: \"created_at DESC\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cleanings }\n end\n end",
"title": ""
},
{
"docid": "9db643584c22c0a967152b65c53d3b88",
"score": "0.48937845",
"text": "def index_for_check\n restful Check.find(params[:check_id]).metrics\n end",
"title": ""
},
{
"docid": "f4ca0547452ce7a57641af4180ce5afe",
"score": "0.48927823",
"text": "def index #regular web request method\n @genomes = Genome.all\n @genomes.each do |gen|\n # gen.meta ? gen.meta = JSON::parse(\"#{gen.meta}\") : nil\n end\n respond @genomes\n end",
"title": ""
},
{
"docid": "586e2a49e45106d3f155e23b0b190547",
"score": "0.4886202",
"text": "def index\n @api_v1_segmentations = Api::V1::Segmentation.all\n end",
"title": ""
},
{
"docid": "5936d15e372adf7143ec32b76837f914",
"score": "0.48801783",
"text": "def index\n @keypairs = getmydata(\"Keypair\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @keypairs }\n end\n end",
"title": ""
},
{
"docid": "fd9ebcc697fb371b778f6ad375009c71",
"score": "0.4878098",
"text": "def get_all_apps_with_categories \n get(\"/appcon.json/\")\nend",
"title": ""
},
{
"docid": "62383d8e0d2005e6f8de24bcdcf9013f",
"score": "0.4875403",
"text": "def index\n service = PredictionService.new(entity: 'user', entity_id: current_user.id.to_s, num: 5)\n service.call\n #respond_with ActiveModel::ArraySerializer.new(service.fetch_from_db(model: :mongoid), each_serializer: CitySerializer).to_json\n render json: service.fetch_from_db(model: :mongoid)\n end",
"title": ""
},
{
"docid": "833e89f79c8249372b06469ec95bbc8d",
"score": "0.48713174",
"text": "def destroy\n @algo = Algo.find(params[:id])\n @algo.destroy\n\n respond_to do |format|\n format.html { redirect_to algos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "948687cacbfbaf06319f74392248991f",
"score": "0.48709604",
"text": "def get_ungraded\n\n #need to add some sort of status that says that submission is being graded\n\n if Submission.exists?(:completed => false)\n incomplete = Submission.where(completed: false).first\n puts \"======================\"\n puts incomplete\n puts \"====================\"\n result = Result.where(problem_id: incomplete.problem.id).first\n \n to_return = {\n submission_id: incomplete.id,\n code: incomplete.code,\n language: incomplete.language.name,\n test_code: Test.where(language_id: incomplete.language.id, problem_id: incomplete.problem.id)[0].test_code,\n input: result.input,\n output: result.expected_result\n }.to_json\n else\n to_return = {}\n end\n \n respond_to do |format|\n format.html {redirect_to root_path}\n format.json {render json: to_return}\n\n # format.json { render json: incompletes, :include => :problem}\n # format.json { render json: {'submission' => incompletes}}\n end\n end",
"title": ""
},
{
"docid": "c24e9c3d0c0d4e9f0fbe90acbfd68e84",
"score": "0.4867079",
"text": "def new\n @algorithm = Algorithm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @algorithm }\n end\n end",
"title": ""
},
{
"docid": "9ea0c595c949a6a4ac9519049ad1b9a8",
"score": "0.48646474",
"text": "def api_call_association\nvalid_array = []\n until valid_array != []\n puts \"Please, enter 2 valid Crazy words of your choice!\"\n association = get_word_association\n word1 = association[:idea1].delete(' ')\n word2 = association[:idea2].delete(' ')\n api_data = RestClient.get(\"https://api.datamuse.com/words?rel_jjb=#{word1}\\&topics\\=#{word2}\")\n valid_array = JSON.parse(api_data)\n end\n array = valid_array.select { |instance| instance[\"word\"].length.between?(5, 9)}\n array.first[\"word\"]\nend",
"title": ""
},
{
"docid": "b13db6a6781d9a220270f4f13123c2ce",
"score": "0.48622224",
"text": "def service_implementations_with_datasets\n service_entries = get_service_implementations_with_datasets(params.permit(:name))\n\n render json: {\n 'hits': service_entries.count,\n 'items': service_entries.map do |entry|\n [entry['Guid'], entry['Name']]\n end\n }\n rescue\n render json: service_entries\n end",
"title": ""
},
{
"docid": "b76c8bdb42804373f5477e998cc0b7ce",
"score": "0.48618343",
"text": "def index\n authorize :usage\n args = default_query_args\n user_data(args: args, as_json: true)\n plan_data(args: args, as_json: true)\n total_plans(args: min_max_dates(args: args))\n total_users(args: min_max_dates(args: args))\n total_dmp_ids\n @separators = Rails.configuration.x.application.csv_separators\n @funder = current_user.org.funder?\n @filtered = args[:filtered]\n end",
"title": ""
},
{
"docid": "d2b2de6309c173cfd4c0d8855069c6eb",
"score": "0.4857365",
"text": "def index\n if params[:clearing_id]\n clearing = Clearing.find params[:clearing_id]\n @enclosures = clearing.enclosures\n else\n @enclosures = Enclosure.all_cached\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enclosures }\n end\n end",
"title": ""
},
{
"docid": "7b4cb4e24eebb58b0708eb2f3004628e",
"score": "0.48548004",
"text": "def index\n @nodes = Node.all\n @rtt = {}\n @loss = {}\n conf = Collectd.new\n @iface_names = {}\n @iface_stats = {}\n \n @nodes.each do |node|\n collectd_node = CollectdNode.new(node.id.to_s(16),node.link_local_address)\n begin\n\t# Stations stat\n\tiwstat = conf.stat(collectd_node,\"iwinfo\",nil,nil)\n\t@iface_names[node] = iwstat.interfaces\n\t@iface_stats[node] = @iface_names[node].map do |name|\n\t c_stat = conf.stat(collectd_node,\"iwinfo\",nil, nil)\n\t c_stat.current_interface = name\n\t c_stat\n\tend\n logger.info \"DS-Name: #{conf.stat(collectd_node,\"ping\",nil,nil).ping_ds_name}\"\n\t# Ping stat\n\t@rtt[node] = conf.stat(collectd_node,\"ping\",nil,nil).rtt_5_min\n @loss[node] = conf.stat(collectd_node,\"ping\",nil,nil).loss_5_min\n\n rescue Exception => e #Ignore errors in single hosts (-> missing rrd-Files for newly created ...)\n logger.error \"Unable to calculate stats: #{e}\"\n end\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json do \n data = {}\n @nodes.each do |n| \n data[n.id] = {id_hex: n.id_hex, \n loss_5_min: (@loss[n].nil? || @loss[n].nan?) ? nil : @loss[n], \n rtt_5_min: (@loss[n].nil? || @rtt[n].nan?) ? nil : @rtt[n]}\n end\n render json: data\n end\n end\n end",
"title": ""
},
{
"docid": "92f12b3a3db3dd825988865ade7b2ad0",
"score": "0.48522648",
"text": "def index\n @client.cluster.health\n\n sample_data = PageView.map_sample_data\n before = sample_data[:before]\n after = sample_data[:after]\n interval = sample_data[:interval]\n\n response = []\n\n sample_data[:urls].each do |url|\n response << search({ page_url: url }, { before: before, after: after }, interval)\n end\n\n render json: response\n rescue => error\n render json: [{ error: error }]\n end",
"title": ""
},
{
"docid": "987f8aa5856e3476c5f7e5d32e05f252",
"score": "0.4849969",
"text": "def index\n @allUrls = UrlShorten.all\n json_response(@allUrls)\n\n end",
"title": ""
},
{
"docid": "b38006f20cbe5c504503f0e1ae9cf9d5",
"score": "0.48493767",
"text": "def index\n render json: self.collection = model.refine_by(where_params)\n end",
"title": ""
},
{
"docid": "a46084c465df92fe9a50599ee6e6e2b3",
"score": "0.4846838",
"text": "def index\n query = BadgeQuery.new\n render json: query.result(req_params)\n end",
"title": ""
},
{
"docid": "8d4ec36722f117af76d61e7c89699306",
"score": "0.484435",
"text": "def get_discipline_list\n response = RestClient.get(\"http://www.gw2spidy.com/api/v0.9/json/disciplines\")\n disciplines = JSON.parse(response)\n disciplines[\"results\"]\nend",
"title": ""
},
{
"docid": "09cecfd9b29085eac9f6cda50f424502",
"score": "0.48442653",
"text": "def index\n render jsonapi: Halls::UseCases::FetchAll.new.call\n end",
"title": ""
},
{
"docid": "2ab73e4ff9d9d3d1a5f6a7dac12f0140",
"score": "0.4842088",
"text": "def identify\n input = JSON(request.body.read) rescue nil\n\n if input.nil?\n render json: {\"error\": \"invalid JSON\"},\n status: 422\n return\n end\n\n input_vals = input.map { |i| i[\"value\"] }\n retVal = []\n all_fragments(\"\").each do |fragment_id|\n fragment_vals = get_fragment(fragment_id).map { |i| JSON(i[\"item\"])[\"value\"] }\n dist, similarity = distance(input_vals, fragment_vals) \n retVal << { \"fragment\": fragment_id, \n \"size\": fragment_vals.length,\n \"distance\": dist,\n \"similarity\": similarity }\n end\n render json: { \"input\": {\"size\": input_vals.length},\n \"identify\": retVal.sort_by { |i| i[:distance] } }, \n status: 200\n end",
"title": ""
},
{
"docid": "467e2845c4c29df11c9906491c884b29",
"score": "0.4840061",
"text": "def index\n @library_checks = LibraryCheck.find(:all, :conditions => [\"deleted_at IS NULL\"], :order => \"id DESC\")\t\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @library_checks }\n end\n end",
"title": ""
},
{
"docid": "9f10cf18824b56d814859251650859f4",
"score": "0.48379993",
"text": "def process\n puts \"processing data keeping #{@alpha}...\"\n # First remove the random outliers and pare down to a set of\n # locations\n begin\n open_data(cache_file)\n puts \"opened data from cached file\"\n rescue\n puts \"Could not load cached data, run app with --build-cache first\"\n exit\n end\n \n # Next calculate the edit distance for each pair of points and the\n # reference point\n puts \"processing each sample..\"\n # Different types of metrics we support\n case @method.to_sym\n when :edit_dist\n process_each_sample(lambda { |c,sam,skew,ref,cur| \n edit_dist_process(c,sam,skew,conv(take_initial_segment(ref)),conv(take_initial_segment(cur)))})\n when :set_int\n process_each_sample(lambda { |c,sam,skew,ref,cur| \n set_int_process(c,sam,skew,conv(take_initial_segment(ref)),conv(take_initial_segment(cur)))})\n when :add_dist\n process_each_sample(lambda { |c,sam,skew,ref,cur|\n additional_dist_process(c,sam,skew,conv(ref),conv(cur))})\n end\n \n # Calculate the median error for each city and skew value\n puts \"calculating median error\"\n calculate_median_error()\n @median_error\n end",
"title": ""
},
{
"docid": "6bc287c753d702f0f10a06e3f534b042",
"score": "0.48350725",
"text": "def get_array_throughput_time_series_data(args = {}) \n get(\"/arrays.json/stats/throughput\", args)\nend",
"title": ""
},
{
"docid": "447af16113d6082a00ec113925e59789",
"score": "0.48341388",
"text": "def summary\n unit_num = 0;\n unit = \"\";\n if params[:unit]\n unit_num = params[:unit].scan(/\\d+/)[0]\n #make matric as default(according to dk standard)\n if params[:unit].gsub(unit_num, \"\") == \"C\" || params[:unit].gsub(unit_num, \"\") == \"c\" || params[:unit].gsub(unit_num, \"\") == \"°C\" || params[:unit].gsub(unit_num, \"\") == \"°c\"\n unit = \"metric\"\n elsif params[:unit].gsub(unit_num, \"\") == \"F\" || params[:unit].gsub(unit_num, \"\") == \"f\" || params[:unit].gsub(unit_num, \"\") == \"°F\" || params[:unit].gsub(unit_num, \"\") == \"°f\"\n unit = \"imperial\"\n else\n unit = \"metric\"\n end\n unit_num = unit_num.to_i\n end\n if params[:locations]\n locations = params[:locations]\n end\n if locations.present? && unit.present?\n #call third party API(OpenWeatherMap) with Unit and location IDs\n api_response = Openweather::Search.by_summary(locations, unit)\n if api_response.present?\n if api_response.body.present?\n api_response_body = JSON.parse(api_response.body)\n #check if there is data coming from third party API\n if api_response_body.present?\n if api_response_body[\"cod\"].present? && api_response_body[\"cod\"] != \"200\"\n render json: api_response_body and return\n else\n @response = get_response_by_summary(api_response_body, unit_num)\n render json: @response and return\n end\n end\n end\n end\n end\n render json: { status: 404, message: 'No Data Available' }\n end",
"title": ""
},
{
"docid": "4e30bd763000c8ebcc8e991b2fa336aa",
"score": "0.48324785",
"text": "def index\n @rules = getmydata(\"Rule\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rules }\n end\n end",
"title": ""
},
{
"docid": "3b934b11fd07094298c1faf508f333b5",
"score": "0.4830311",
"text": "def get_guidance_concept_data_no_stats\n @concept = @course.topicconcepts.concepts.where(id: params[:concept_id]).first\n result = {}\n\n if !@concept.nil?\n concept_criteria = get_concept_criteria_student_progress_with @concept\n if concept_criteria[:enabled]\n result[:criteria] = concept_criteria[:criteria]\n else\n result[:criteria] = []\n end\n\n respond_to do |format|\n format.json { render json: result}\n end \n else\n access_denied \"Concept id is invalid!\", course_topicconcepts_path(@course)\n end\n end",
"title": ""
},
{
"docid": "05f76dcd65d89d278e4219fc7ad73af3",
"score": "0.48289856",
"text": "def run_query (query_path)\n api_version = \"v3\"\n api_host = \"http://api.nytimes.com/svc/politics/#{api_version}/us/legislative/congress/\"\n api_key = \"b8ba79c23fb90f20c144b168f24a1e45:14:65821016\"\n\n query_params = { \"api-key\" => api_key } \n uri = URI(api_host + query_path)\n uri.query = URI.encode_www_form query_params\n logger.info \"getting #{uri}\"\n response = Net::HTTP.get(uri)\n\n json = ActiveSupport::JSON.decode(response)\n return json\n end",
"title": ""
},
{
"docid": "1c38523e0874026ba75c1b7947005242",
"score": "0.48272327",
"text": "def get_all_glassware\n counter = 1\n response_array = []\n while counter < 2\n response_string = RestClient.get('https://sandbox-api.brewerydb.com/v2/glassware/?p='\"#{counter}\"'&key=67caa2c52c8169eeea83e4c37e6d9b14')\n response_hash = JSON.parse(response_string)\n response_array << response_hash[\"data\"]\n counter += 1\n # binding.pry\n end\n response_array.flatten\nend",
"title": ""
},
{
"docid": "b3bad7f1732f2dbf80b7615f3c06085f",
"score": "0.4826788",
"text": "def index\n #Get all undeleted classes from database\n @training_classes = TrainingClass.find_by_sql [\"SELECT * FROM training_classes\"] \n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @training_classes}\n end\n end",
"title": ""
},
{
"docid": "bed2b8601ed93173d19481494e74919e",
"score": "0.4820626",
"text": "def show\n @dataset = Dataset.find(params[:id])\n @users = AccessToken.all\n @strategies = Strategy.includes( :mallet_run).where( :mallet_runs => {:dataset_id => @dataset.id})\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dataset }\n end\n end",
"title": ""
},
{
"docid": "15e278b4f14a3bef7973e0db424b98b7",
"score": "0.4818356",
"text": "def scrap_data(opts, code, category_hash)\n\t# Keys for institution hash\n\tkeys = [\"name\", \"status\", \"year\", \"website\", \"description\", \"powers\", \"areas\"]\n\n\t# Clear txts\n\tbootstrap_dir(TXT_PATH)\n\n\t# Generate the html file with pdf2htmlex\n\tputs \"Generating html file from pdf\"\n\tKristin.convert(PDF_FILE, HTML_FILE, opts)\n\tprint \"\\rDone\\n\"\n\n\t@html = Nokogiri::HTML(File.open(HTML_FILE))\n\n\t@html.css('span').each do |span|\n\t\tspan.swap(span.children.text.gsub(\" \", \" \").gsub(\"\\n\", \" \").gsub(\"\\s\", \" \"))\n\tend\n\n\t# Create text file with all data\n\tprint \"Generating txt file from html.\"\n\tFile.open(TXT_FILE, \"w\") { |file|\n\t\t@html.css('div.pf').each do |organization|\n\t\t\t# file.puts (organization.text.gsub(' ', \"\\n\").gsub('-', '').sub('(', \"\\n\").sub(')', ''))\n\t\t\tfile.puts (organization.text.gsub(' ', \"\\n\").gsub('-', ''))\n\t\tend\n\t}\n\tputs \" Done\"\n\n\t# Create a text file per institution\n\tputs \"Generating txt files. One per institution\"\n\tFile.open(TXT_FILE, \"r\") { |file|\n\t\tinstitution_counter = 0\n\t\tcounter = 0\n\t\tfile.each_line do |line|\n\t\t\tputs line if line.strip == \"/\\d+/\"\n\t\t\t# print \"\\r#{institution_counter}\"\n\t\t\tif (line == \"\\n\")\n\t\t\t\tcounter = 0\n\t\t\t\tinstitution_counter += 1\n\t\t\t\tnext\n\t\t\tend\n\t\t\tif (counter < 8)\n\t\t\t\tcounter += 1\n\t\t\t\tFile.open(\"#{TXT_PATH}/#{institution_counter}.txt\", \"a\") { |institution_file|\n\t\t\t\t\tinstitution_file.puts line\n\t\t\t\t}\n\t\t\tend\n\n\t\tend\n\t}\n\tputs \"\\nDone\"\n\n\t# Create json files from text files\n\tputs \"Generating json files from txt files.\"\n\tjson_file_counter = 0\n\tDir.foreach(TXT_PATH) do |txtfile|\n\t\tnext if txtfile == '.' or txtfile == '..'\n\n\t\tsize = 0\n\t\tfilename = \"\"\n\t\tFile.open(\"#{TXT_PATH}/#{txtfile}\", \"r\") { |file|\n\t\t\tsize = file.readlines.size\n\t\t\tfilename = File.basename(file, \".*\")\n\t\t}\n\n\t\tdata = File.open(\"#{TXT_PATH}/#{txtfile}\").read()\n\t\tcount = data.count(':')\n\t\tnext if count < 3\n\n\t\t# Skip pathological cases\n\t\t# next if (txtfile == \"104.txt\" ||\n\t\t# \t\ttxtfile == \"110.txt\")\n\n\t\t# Skip files with less than 3 lines\n\t\tnext if size < 3\n\t\tjson_file_counter += 1\n\n\t\t# Debug\n\t\t# File.open(\"#{TXT_PATH}/#{txtfile}\", \"r\") { |file|\n\t\t# \tputs \"Printing contents of #{File.basename(file)}\"\n\t\t# \tfile.each_line do |line|\n\t\t# \t\tputs line\n\t\t# \tend\n\t\t# \tputs \"End Printing\"\n\t\t# }\n\n\t\t# Load lines of txtfile in memory\n\t\tlines = File.readlines(\"#{TXT_PATH}/#{txtfile}\")\n\n\t\t# If the last line is number remove it from array\n\t\tif /\\d+/.match(lines[-1])\n\t\t\tlines.delete_at(-1)\n\t\tend\n\n\t\tcounter = 0\n\t\tclean_line = Array.new\n\t\tname_array = Array.new\n\t\thash = Hash.new\n\n\t\t# Create hash from txfile\n\t\tfor line in lines do\n\t\t\tif (line.include? ':')\n\t\t\t\tvalue = clean_line.join(\" \").gsub(\"\\n\", \"\")\n\t\t\t\tif (value.include? ':')\n\t\t\t\t\tvalue = value.slice(value.index(\":\")..-1).gsub(\":\", \"\").strip\n\t\t\t\tend\n\t\t\t\thash[:\"#{keys[counter]}\"] = value\n\t\t\t\tclean_line.clear\n\t\t\t\tclean_line.push(line)\n\t\t\t\tcounter += 1\n\t\t\t\tif (line == lines[-1])\n\t\t\t\t\tvalue = clean_line.join(\" \").gsub(\"\\n\", \"\")\n\t\t\t\t\tif (value.include? ':')\n\t\t\t\t\t\tvalue = value.slice(value.index(\":\")..-1).gsub(\":\", \"\").strip\n\t\t\t\t\tend\n\t\t\t\t\thash[:\"#{keys[counter]}\"] = value\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tclean_line.push(line)\n\t\t\tend\n\t\tend\n\n\t\t# Get short short name if it exists\n\t\tif hash[:name].include? \"(\"\n\t\t\tname_array = hash[:name].gsub(\"(\", \"@\").gsub(\")\", \"\").partition(\"@\").collect{ |item| item.strip }\n\t\t\thash[:name] = name_array.first\n\t\t\thash[:short] = name_array.last\n\t\telse\n\t\t\thash[:short] = \"\"\n\t\tend\n\n\t\t# :areas values tend to have a trailing number. Clean it and trim\n\t\tif hash.key?(:areas)\n\t\t\thash[:areas] = hash[:areas].gsub(/\\d+$/, \"\").strip\n\t\tend\n\n\t\t# Check whether every key in keys exists in hash\n\t\tfor key in keys\n\t\t\tif !hash.key?(:\"#{key}\")\n\t\t\t\thash[:\"#{key}\"] = \"\"\n\t\t\tend\n\t\tend\n\n\t\t# Add category key\n\t\thash[:category] = category_hash\n\n\t\t# Fix urls\n\t\tif !(hash[:website] == \"\") and !(hash[:website].include?(\":\"))\n\t\t\tif hash[:website].start_with?('http')\n\t\t\t\thash[:website].insert(4, \":\")\n\t\t\telse\n\t\t\t\thash[:website].prepend(\"http://\")\n\t\t\tend\n\t\tend\n\n\t\t# Write json file for institution\n\t\tFile.open(\"data/json/#{code}-#{filename}.json\", \"w\") { |json_file|\n\t\t\tjson_file.write(hash.to_json)\n\t\t}\n\tend\n\tputs \"\\nDone\"\nend",
"title": ""
},
{
"docid": "6a54fbd7ba1d39cd4a00e4ee003718b4",
"score": "0.48140576",
"text": "def search \n recipes = []\n\n recipes += Recipe.search_recipes(params[:query])\n\n api_recipes = Recipe.api_search(params[:query])\n\n # get all the unique ones before adding them so we don't compound the time it takes\n non_overlap = api_recipes.filter do |ar|\n recipes.none? {|r| r.api_id == ar.api_id}\n end\n\n recipes += non_overlap\n\n puts \"RECIPE SEARCH\"\n puts recipes\n\n render json: recipes, :include => :user, except: [:created_at, :updated_at]\n end",
"title": ""
}
] |
14a140566e30871745865958067bc811 | don't look at corporate holdings, only players | [
{
"docid": "1e7fe3db172724d28d73a4fa2510ef41",
"score": "0.0",
"text": "def can_dump?(entity, bundle)\n return true unless bundle.presidents_share\n\n sh = bundle.corporation.player_share_holders\n (sh.reject { |k, _| k == entity }.values.max || 0) >= bundle.presidents_share.percent\n end",
"title": ""
}
] | [
{
"docid": "5055318f779c0e74b189c530c8ac329c",
"score": "0.6636163",
"text": "def active_players\n super.reject { |player| player == @union_bank }\n end",
"title": ""
},
{
"docid": "9b21527baa75e3a174501de99cc3e899",
"score": "0.65076363",
"text": "def still_to_play\n return self.game_players.where.not(\n id: self.current_hand.hand_players.where.not(bid: nil).select(:game_player_id)\n )\n end",
"title": ""
},
{
"docid": "f030a6a35edfee3b05ac2ee2359e1702",
"score": "0.64447427",
"text": "def show_game_cert_limit?(player)\n return super unless player\n\n player != @union_bank\n end",
"title": ""
},
{
"docid": "80c179c59271521f2bc31edcba1e9a6d",
"score": "0.6415972",
"text": "def losing_players\n players.select { |player| player.hit_points <= 0 }\n end",
"title": ""
},
{
"docid": "f0cfca63df046ac6c83ca87468a672f2",
"score": "0.63919604",
"text": "def acquisition_players\n owners = @players.select { |p| p != @foreign_investor && !p.companies.empty? }\n @corporations.each { |c| owners << c.owner if c.owner && !c.receivership? }\n owners.uniq\n end",
"title": ""
},
{
"docid": "5c107dcc6aac5089ab322025ecb7f8ab",
"score": "0.62473917",
"text": "def alive_players\n @players.select {|r| not r.dead? }\n end",
"title": ""
},
{
"docid": "32637f8f1c39fd943eba3ee029dfd660",
"score": "0.62435657",
"text": "def cantarget(u, u2) #private\n !(u2.city? || u2.ruin? || u.player == u2.player || \n u.player.friendly.include?(u2.player))\nend",
"title": ""
},
{
"docid": "3e3ea5e3fcd04b98ead7b7c66fd54a64",
"score": "0.6234368",
"text": "def unassigned\n mechanize = Mechanize.new\n players = log_in_get_player_info(mechanize)\n ids_by_div_name = teamsnap_divs_by_id\n @unassigned_player = Array.new\n @league_id = ids_by_div_name[\"Big Apple Softball League\"]\n players_by_payments = sort_players(players)\n players_by_payments[:paid].each do |player|\n if player['division_id'].blank? && player['team'].blank? && !player['name'].include?('Sponsor Payment') # tournament player\n @unassigned_player.push(player)\n elsif player['division_id'] == @league_id # season player\n @unassigned_player.push(player)\n end\n end\n end",
"title": ""
},
{
"docid": "b5ecbb79ef77b1ec81988895a4cbab04",
"score": "0.61988604",
"text": "def other_player(p) @players[~@players.index(p)] end",
"title": ""
},
{
"docid": "28db929d2cbbbd286cf7b38bb8ffb48d",
"score": "0.6178223",
"text": "def noaward\n\n game_player_ids = @game_round.game_award_players.pluck(:game_player_id)\n @game_players = @game_round.game_players.where.not( id: game_player_ids)\n end",
"title": ""
},
{
"docid": "8f17d5d9a6d3414db09dd35ec309e392",
"score": "0.614448",
"text": "def eligible_players\n\t\t\treturn @players.select {|player| !player.has_lost}\n\t\tend",
"title": ""
},
{
"docid": "5408114b09f33e3d0b0f06d34c1ad928",
"score": "0.6131846",
"text": "def espers; $game_party.unlocked_dominations; end",
"title": ""
},
{
"docid": "2301481bbc3aeddcdbf874f2090d277d",
"score": "0.6119863",
"text": "def losing_players\n @players.select { |player| player.hp <= 0 }\n end",
"title": ""
},
{
"docid": "8271b76b4b07921447c300da0fa181db",
"score": "0.60937214",
"text": "def other_players\n end",
"title": ""
},
{
"docid": "25ea637d882296161be3f94769b7b67d",
"score": "0.60767066",
"text": "def select_players_for_slytherin(full_list_of_players, already_used_players)\n slytherin = the_players.keep_if {the_players != gryffindor}\n puts \"#{name} will play for slytherin!\"\nend",
"title": ""
},
{
"docid": "6a9daf83f3237bebe6961856005c71d6",
"score": "0.6018513",
"text": "def checkPlayers(dealer)\n remaining = []\n for player in dealer.players\n if player.money <= 0 #Bankrupt case - Player does not continue\n puts \"Sorry, #{player.name}! You're out of money! Try again next time.\"\n else \n remaining << player #Add player to next round\n end\n end\n dealer.players = remaining\nend",
"title": ""
},
{
"docid": "82f9cf00a289def11196be80ed199c5d",
"score": "0.6006296",
"text": "def result_players\n @players.reject { |p| p == @union_bank }\n end",
"title": ""
},
{
"docid": "86e67748c82b37a5404819700a9a5629",
"score": "0.5992599",
"text": "def opponents\n Game.world[:players].select {|p| p != self}\n end",
"title": ""
},
{
"docid": "70d96c9417b9c5bafedc1f9a782e7dc1",
"score": "0.59059525",
"text": "def player_non_submitted_poems\n self.non_submitted_poems.select do |poem|\n Round.find(poem.round_id).creator_id != self.id\n end\n end",
"title": ""
},
{
"docid": "e027e7e3347fc17a0b3dbd99c9eda29b",
"score": "0.59038574",
"text": "def burn_player_if_needed\n return if user.blank?\n return if match_played.blank?\n\n championship.freeze!(user) if match_played >= (championship.matches.size / 2.0)\n end",
"title": ""
},
{
"docid": "a068a1d553113a8551e9587a313b2473",
"score": "0.5886223",
"text": "def check_players\n players.each do |player|\n if player.insurance && player.points.include?(21)\n player.tie?('bj_insurance')\n elsif player.points.include?(21)\n player.tie?('bj')\n elsif player.insurance\n player.lose?('insurance')\n else\n puts say(\"#{player.name} do not hit Blackjack. #{player.name} lose bet. Lose for #{player.name}.\")\n end\n end\n end",
"title": ""
},
{
"docid": "385add9a1d1d198ae1c8867ac056e013",
"score": "0.58742833",
"text": "def remove_bankrupt_player()\n\t\t@players.reject! { |p| p.money <= 0};\n\t\tif @players.length == 0\n\t\t\tputs \"Everyone runs bankruptcy, game over\";\n\t\t\texit();\n\t\tend\n\tend",
"title": ""
},
{
"docid": "bfda24476fb185ac1096d1a68d65ce5a",
"score": "0.5873553",
"text": "def other_available_players\n @other_available_players = User.possible_players.select { |player| player.id != self.id }\n end",
"title": ""
},
{
"docid": "1947c4c05e0cadb4ec7ba5176b80dddb",
"score": "0.58376926",
"text": "def lost_all_lives\n @players[@current_player].lives == 0\n end",
"title": ""
},
{
"docid": "94f590ca3aac47f7b9cdd1e94be3597b",
"score": "0.58354545",
"text": "def ignore?\n cat = @data['from']['category']\n\n cat == \"Club\" || cat == \"Arts/entertainment/nightlife\"\n end",
"title": ""
},
{
"docid": "db8d2bc7c7c731cf7f51752b9aae9f9a",
"score": "0.5833341",
"text": "def player_1_wins_with_paper\n @player_1_weapon == \"paper\" && @player_2_weapon != \"scissors\"\n end",
"title": ""
},
{
"docid": "82b9e90d4b339b9f13e853a8674c6a56",
"score": "0.5816376",
"text": "def ntfy_state_ontable_lessplayers\n end",
"title": ""
},
{
"docid": "da5cbf2631d81393b7d560918ce319c5",
"score": "0.5815681",
"text": "def p1_misspelled_weapon\n (@player_1_weapon == \"paper\") || (@player_1_weapon == \"rock\") || (@player_1_weapon == \"scissors\")\n end",
"title": ""
},
{
"docid": "82df0a11efe6e1ef092232ede40d6b60",
"score": "0.57994723",
"text": "def judge\n return $game_party.all_dead?\n end",
"title": ""
},
{
"docid": "37bd73b3e5e7c684ecfaf9a806fa7531",
"score": "0.57878137",
"text": "def p2_misspelled_weapon\n (@player_2_weapon == \"paper\") || (@player_2_weapon == \"rock\") || (@player_2_weapon == \"scissors\")\n end",
"title": ""
},
{
"docid": "2bc82fdf5b18d9ef6cbf85103bfb48de",
"score": "0.5776285",
"text": "def is_guest?\n !current_player\n end",
"title": ""
},
{
"docid": "08ba313031365bce119193e9bafa9d53",
"score": "0.57762164",
"text": "def owning_planets(player_id)\n\t\t@planets.select{|x| x.planet_id == player_id}\n\tend",
"title": ""
},
{
"docid": "7e7bf34e1ddeb8e083028ca50072d411",
"score": "0.5766275",
"text": "def player_stats(givenplayer)\n find_the_player(givenplayer).reject { |key, value| key == :player_name }\nend",
"title": ""
},
{
"docid": "a6533f075f4873af8d8c115f556d9d65",
"score": "0.5755226",
"text": "def loser\n players.detect{ |p| p != winner }\n end",
"title": ""
},
{
"docid": "f2d205c8478545bcdcad28673adecd6a",
"score": "0.5749932",
"text": "def catalog_enabled\r\n $game_party.total_items > 0\r\n end",
"title": ""
},
{
"docid": "1dea473e176efda4f97fa5d09698efff",
"score": "0.5732686",
"text": "def exclude_holds\n @exclude_holds || false\n end",
"title": ""
},
{
"docid": "1cfb3f2344b2bf8e2a77f57aaf693112",
"score": "0.57257116",
"text": "def looking_for_players?\n looking_for_players\n end",
"title": ""
},
{
"docid": "47ee4ae653d0b5525bc6ce177cc52ff3",
"score": "0.5724007",
"text": "def is_player?\r\n return false\r\n end",
"title": ""
},
{
"docid": "db13afab3ab96477d7da9249e2b19fe2",
"score": "0.571687",
"text": "def game_over?\n losing_players.any?\n end",
"title": ""
},
{
"docid": "7e388a198b53ca24f4fd1bc3f815ab40",
"score": "0.569401",
"text": "def reject_nested_player(attrs)\n return attrs[:name].blank? || (players.map(&:name).include?(attrs[:name]))\n end",
"title": ""
},
{
"docid": "a1fbf0a9ba97701e7fb3ddc7ffb18d55",
"score": "0.56937754",
"text": "def available\n if @auctioning\n [@auctioning]\n else\n # Show the current players pile\n current_entity.unsold_companies\n end\n end",
"title": ""
},
{
"docid": "f2ea6fa47e835e31c579a999239e7684",
"score": "0.56702715",
"text": "def pbCanSkyBattle?(pokemon)\n # list of pokemon that aren't allowed to participate, even though they are flying or have levitate\n inelligible=[getID(PBSpecies,:PIDGEY),getID(PBSpecies,:SPEAROW),getID(PBSpecies,:FARFETCHD),\n getID(PBSpecies,:DODUO),getID(PBSpecies,:DODRIO),getID(PBSpecies,:GENGAR),\n getID(PBSpecies,:HOOTHOOT),getID(PBSpecies,:NATU),getID(PBSpecies,:MURKROW),\n getID(PBSpecies,:DELIBIRD),getID(PBSpecies,:TAILOW),getID(PBSpecies,:STARLY),\n getID(PBSpecies,:CHATOT),getID(PBSpecies,:SHAYMIN),getID(PBSpecies,:PIDOVE),\n getID(PBSpecies,:ARCHEN),getID(PBSpecies,:DUCKLETT),getID(PBSpecies,:RUFFLET),\n getID(PBSpecies,:VULLABY),getID(PBSpecies,:FLETCHLING),getID(PBSpecies,:HAWLUCHA)]\n return (pokemon.hasType?(:FLYING) || pokemon.ability==getID(PBAbilities,:LEVITATE)) &&\n !(inelligible.include?(pokemon.species))\nend",
"title": ""
},
{
"docid": "7877555a6e5b79668b1147820457bb08",
"score": "0.5668417",
"text": "def castle_do_not_track!\n @castle_do_not_track = true\n end",
"title": ""
},
{
"docid": "e548dc64591786bd5ca6bfc73b954784",
"score": "0.56657296",
"text": "def dank_you_very_much\n other_players.each do |minion|\n if minion.player.respond_to?(:trade) && real_dank_chron\n minion.player.trade(:set_target, real_dank_chron.player)\n end\n end\n end",
"title": ""
},
{
"docid": "c29a4e9e3972abbfb9269bd70b8feb24",
"score": "0.5665451",
"text": "def determine_possible_attackers(opponent)\n end",
"title": ""
},
{
"docid": "675edc3a7dd69c3a451b8a1aa7cbb8a1",
"score": "0.5658365",
"text": "def outrage\n # evilness - marketing\n end",
"title": ""
},
{
"docid": "420553357c4eda8575bfdaf5fc44953d",
"score": "0.56492525",
"text": "def bots_equipped?; end",
"title": ""
},
{
"docid": "e4ff31ed887363c7be6c0681a1e84022",
"score": "0.5645073",
"text": "def all_players_active\n players.find_by_active(false).nil?\n end",
"title": ""
},
{
"docid": "e1954efbb86f00a91e30adde5857b57f",
"score": "0.5639241",
"text": "def players_bj\n players.each do |player|\n player.won?('blackjack')\n end\n end",
"title": ""
},
{
"docid": "cbd86c640b81bec6cefc4f6ce6c7d613",
"score": "0.56377006",
"text": "def dead_players\n self.players - live_players\n end",
"title": ""
},
{
"docid": "3fb6e6985b1b06be0604b2895e7021b3",
"score": "0.563064",
"text": "def loose?\n self.player_alive_units.length <= 0 \n end",
"title": ""
},
{
"docid": "943507843acba295b4df47659075d7a3",
"score": "0.5626287",
"text": "def not_eligable_work_in_uk\n self.eligableuk == \"no\" && self.passport == \"no\"\n end",
"title": ""
},
{
"docid": "7a69505c1bac81a1dd5957563b1783f9",
"score": "0.56227696",
"text": "def ignore_limbo\r\n end",
"title": ""
},
{
"docid": "febfe5b70c4a40bc573914c4965c5208",
"score": "0.5620483",
"text": "def player_tables\n tables.reject(&:headquarters?)\n end",
"title": ""
},
{
"docid": "d7cef2e62ae309161eb178662c749815",
"score": "0.5612732",
"text": "def checkForLosers()\n @players.each do |player|\n # Remove players with no cards left from the game\n if player.handLength() == 0\n puts \"#{player.name} lost and has been removed from the game\"\n puts\n removePlayer(player)\n return true\n end\n end\n return false\n end",
"title": ""
},
{
"docid": "9d7ebc48359221f49e611e33549f2c42",
"score": "0.5611504",
"text": "def challengeable_trainers\n other_trainers = Trainer.all.reject { |trainer| trainer == self }\n other_trainers.select do |trainer|\n trainer.nearby?(coordinates) && trainer.live_kudomon?\n end\n end",
"title": ""
},
{
"docid": "12a262554da7a2d117f062adf9944c2d",
"score": "0.5608611",
"text": "def no_agents_remaining?\n game.words.count { |word| word.reveal.eql?(word.send(\"identity#{player}\")) }.eql?(9)\n end",
"title": ""
},
{
"docid": "b46a5e21af8b7aebfd48e5491cee6572",
"score": "0.56053805",
"text": "def get_players_for_game_state logged_in_user = nil\n players = []\n user_player = Player.where([\"game_id = ?\", self.id]).where([\"user_id = ?\", logged_in_user.id]).first\n non_user_players = Player.where([\"game_id = ?\", self.id]).where.not([\"user_id = ?\", logged_in_user.id])\n players.push(user_player)\n non_user_players.each do |p|\n players.push(p)\n end\n return players\n\n end",
"title": ""
},
{
"docid": "c35b7f1839eeb9a07cdcc7b6ec995668",
"score": "0.56050247",
"text": "def not_in_play?\n\t\tnot @in_play\n\tend",
"title": ""
},
{
"docid": "a3ea2634c77d2b70bd0cdad3baa777ff",
"score": "0.5600413",
"text": "def potential_sub_players\n CompatibilityEngine.get_compatible_players(self)\n end",
"title": ""
},
{
"docid": "aa1b4abdd723e8cc5eaf07a4aeaf1021",
"score": "0.55954707",
"text": "def opponent_of player\n\t\tplayers.select {|element| element !=player}[0]\n\tend",
"title": ""
},
{
"docid": "ec193c74fe6f96ee8540b7fb74fcaeb4",
"score": "0.5593819",
"text": "def select_players\n players = @league.find_all_players do |pl|\n pl.status == \"game_waiting\" &&\n game_name?(pl.game_name) &&\n pl.sente == nil &&\n pl.rated? # Only players who have player ID can participate in Floodgate (rating match)\n end\n return players\n end",
"title": ""
},
{
"docid": "beffffb955c8f29766c51bcfbff83f32",
"score": "0.55927336",
"text": "def player_hopeless?\n\t\tplayer_smallest? or (@player.m + absorbable) < next_largest\n\tend",
"title": ""
},
{
"docid": "a2f274d8a544fe11e011898de3dfd0f1",
"score": "0.55904084",
"text": "def players\n return unless user\n return user.full_name unless opponent\n \"#{user.full_name} v #{opponent.full_name}\"\n end",
"title": ""
},
{
"docid": "a18fb3e4732dc907f7b1851bd10ef47c",
"score": "0.5590334",
"text": "def all_dead?\r\n super && ($game_party.in_battle || members.size > 0)\r\n end",
"title": ""
},
{
"docid": "383581e74c3d5439c666324341be948f",
"score": "0.5574805",
"text": "def in_limbo?\n if not self.has_started_program?\n false\n elsif not self.player_budge.present?\n false\n elsif not self.player_budge.start_date.present?\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "c407f8524eb3cd32f7c0990ea0b2fc7a",
"score": "0.55724984",
"text": "def players_near_me\n users = []\n\n my_courts.each do |court|\n users_near_court(court).each do |user|\n users << user unless user == current_user\n end\n end\n\n return users.uniq\n end",
"title": ""
},
{
"docid": "3f0c9b4d973fcb51a1ff7698c4464f47",
"score": "0.55684453",
"text": "def players_are_alive\n !P1.gameover && !P2.gameover\nend",
"title": ""
},
{
"docid": "d294b2f8ecbcae1864f75de87e27a545",
"score": "0.5566617",
"text": "def game_over\n alive_players.count == 1\n end",
"title": ""
},
{
"docid": "bb77c269fc022df5238adc8330574c10",
"score": "0.5564013",
"text": "def block_cloud_object_takeover_through_hard_match_enabled\n return @block_cloud_object_takeover_through_hard_match_enabled\n end",
"title": ""
},
{
"docid": "15d450b8cbf3e9717c12f79e8c876dc8",
"score": "0.556146",
"text": "def unproxied_restricted\n %w[incommon:unc.edu\n ebookcentral.proquest.com\n overdrive.com\n panopto.com\n swankmp.net\n unc.kanopy.com\n unc.kanopystreaming.com\n vb3lk7eb4t.search.serialssolutions.com\n bloomberglaw.com\n cali.org\n heinonline.org\n lexis.com\n thomsonreuters.com\n westlaw.com]\n end",
"title": ""
},
{
"docid": "bd1774b2e21957dd7c4b899ba8f338db",
"score": "0.556031",
"text": "def reset_player_available\r\n Player.all.each do |player|\r\n player.tlfl_team_id == nil ? player.update(available: true) : player.update(available: false)\r\n end\r\n end",
"title": ""
},
{
"docid": "bcb32b9cac76f3953017a1d328787e78",
"score": "0.5559899",
"text": "def to_be_kept?\n inside_frame? and !catched?(@player)\n end",
"title": ""
},
{
"docid": "4d42b9442440e8dc38f7d497c705c6e1",
"score": "0.5558103",
"text": "def players_not_done\n load_variables\n # player_moves\n all_bets_this_round = []\n @player.each do |player|\n all_bets_this_round.push(player.latest_bet_this_round.to_i)\n end\n \n players_not_done = []\n @player.each do |player|\n if player.folded == false && (player.latest_bet_this_round.to_i < all_bets_this_round.max || player.latest_bet_this_round == nil)\n players_not_done.push(player.player_number)\n end\n end\n \n players_not_done\n end",
"title": ""
},
{
"docid": "6013cea9f53567c7d742e34387f97fc7",
"score": "0.5553178",
"text": "def not_home(player_number)\n not_home_points = points.select { |p| p.owned_by_player?(player_number) && !p.home?(player_number) }\n self.class.new(points: not_home_points)\n end",
"title": ""
},
{
"docid": "744be7b9b2d4ba756af350bae8181aa0",
"score": "0.5552878",
"text": "def one_boird_wanders\n end",
"title": ""
},
{
"docid": "2494510d5bada8595a15b78550a6771c",
"score": "0.555173",
"text": "def good_wordlist\n\t\tpossible_wordlist \\\n\t\t\t.reject { |word| word_would_land_on_the_player(word) } \\\n\t\t\t.reject { |word| word_begins_with_another_word(word) }\n\tend",
"title": ""
},
{
"docid": "37b13768b7e24e469c7e58d1c1a15ced",
"score": "0.55513996",
"text": "def partner_present?\n @players.select { |player| player.is_partner? }.any?\n end",
"title": ""
},
{
"docid": "1f0afacb360cf1b7a36eebd63293cc0f",
"score": "0.5550161",
"text": "def player_nation_active?\r\n return @game.nations.include? @game.player\r\n end",
"title": ""
},
{
"docid": "18b10453b0c66bdd8e4cce600fbab968",
"score": "0.55480474",
"text": "def rounds_as_player\n self.participating_rounds.select {|round| round.creator_id != self.id }\n end",
"title": ""
},
{
"docid": "9fd2673c1da5ba543ee7e9ce51b43f89",
"score": "0.5546022",
"text": "def available?\n @player == nil\n end",
"title": ""
},
{
"docid": "1afc2d9e08623722adcdc3adb90e48bb",
"score": "0.55275935",
"text": "def unlinked_attending\n @players = Player.unlinked_but_attending_something\n render :index\n end",
"title": ""
},
{
"docid": "275f80420925bcbf9d0df32e863fc484",
"score": "0.5524461",
"text": "def enforce_obligations\n @next_priority ||= @players[@round.entity_index]\n @players.each do |player|\n remaining_fine = 0\n player.companies.dup.each do |company|\n corp = corporation_by_id(company.id)\n @log << \"#{player.name} has missed obligation for #{corp.name}\"\n new_fine = corp.par_price.price * 5\n @log << \"#{player.name} is fined #{format_currency(new_fine)}\"\n player.companies.delete(company)\n company.owner = nil\n @chartered.delete(corp)\n\n if player.cash >= new_fine\n @log << \"#{player.name} pays #{format_currency(new_fine)}\"\n player.spend(new_fine, @bank)\n restart_corporation!(corp)\n next\n elsif player.cash.positive?\n @log << \"#{player.name} pays #{format_currency(player.cash)}\"\n new_fine -= player.cash\n player.spend(player.cash, @bank)\n else\n @log << \"#{player.name} has no cash to pay fine\"\n end\n\n @log << \"#{player.name} still owes #{format_currency(new_fine)} on #{corp.name} obligation\"\n\n # sell shares of company until either debt is repaid, or out of those shares\n share_value = effective_price(corp)\n shares = player.shares_of(corp).sort_by(&:percent)\n share_revenue = 0\n while new_fine.positive? && !shares.empty?\n share = shares.shift\n sale_price = share.percent * share_value / 10\n new_fine -= sale_price\n share_revenue += sale_price\n end\n @log << \"#{player.name} sells shares of #{corp.name} for #{format_currency(share_revenue)}\"\n\n unless new_fine.positive?\n @bank.spend(-new_fine, player) unless new_fine.zero?\n restart_corporation!(corp)\n next\n end\n\n if player.shares.empty?\n @log << \"#{player.name} has no more assets. Remainder of debt is forgiven.\"\n restart_corporation!(corp)\n next\n end\n\n @log << \"#{player.name} still owes #{format_currency(new_fine)} on #{corp.name} obligation\"\n remaining_fine += new_fine\n restart_corporation!(corp)\n end\n\n if remaining_fine.positive? && can_sell_any_shares?(player)\n @log << \"-- #{player.name} owes #{format_currency(remaining_fine)} on all obligations and is required\"\\\n ' to sell some or all assets --'\n @round.pending_forced_sales << {\n entity: player,\n amount: remaining_fine,\n }\n elsif remaining_fine.positive?\n @log << \"#{player.name} has no more sellable assets. Remainder of debt is forgiven.\"\n end\n end\n end",
"title": ""
},
{
"docid": "e13821dc5bc069572f45f45ffa66eb7a",
"score": "0.5514401",
"text": "def party_ongoing\n @game = Game.new\n while @game.victory? == false && @game.draw? == false\n @game.board_game.show\n @game.placement(game.player1)\n @game.board_game.show\n if @game.victory? == false && @game.draw? == false\n @game.placement(@game.player2)\n end\n end\n end",
"title": ""
},
{
"docid": "18425136c3e5496e36e6e0939b50f297",
"score": "0.55100405",
"text": "def find_opponents\n Character.all.select { |c| c.protag_battle_ready?(self) }\n end",
"title": ""
},
{
"docid": "145debeff1cb5f6af5d9b5f8dc3a10b5",
"score": "0.55047804",
"text": "def player_loses_insurance(player)\n puts \"#{player.name}, you lose the insurance bet :-(\"\n end",
"title": ""
},
{
"docid": "d41692a1f53b1053397c916b222ab8fc",
"score": "0.5504171",
"text": "def blocked_by; end",
"title": ""
},
{
"docid": "3e85df1e762991ae4dd1e90619abef49",
"score": "0.5499798",
"text": "def auction_private\n asset = @bank.cheapest_private\n unless asset.bids.empty?\n if asset.bids.length == 1\n # only 1 bidder auto buys\n asset.bids[0][:player].buy(asset, @bank, asset.bids[0][:price])\n asset.clear_bids\n asset.bidders.each { |b| b.clear_bids }\n return false\n else\n return true\n end\n else\n false\n end\n end",
"title": ""
},
{
"docid": "247571155acce83c935788038042404e",
"score": "0.54987717",
"text": "def unplayed\n where(\n :player_id => nil,\n :in_play => true,\n )\n end",
"title": ""
},
{
"docid": "762e4b15e404545f742585fc99902502",
"score": "0.54974353",
"text": "def trade_players(player, aquiring_player)\n if self.players.include?(player) && !self.players.include?(aquiring_player)\n owners_team_id = player.team_id \n player.team_id = aquiring_player.team_id \n aquiring player.team_id = owners_team_id \n else \n puts \"These players cannot be traded.\"\n end\n end",
"title": ""
},
{
"docid": "e1279ad95686f678944f3ca5dc6c0825",
"score": "0.5494881",
"text": "def haveStolen\n @canISteal= false\n end",
"title": ""
},
{
"docid": "9d6ad118e79446e06b3b2880862f2d89",
"score": "0.5487593",
"text": "def is_private_game?\r\n return @private_pg\r\n end",
"title": ""
},
{
"docid": "ba81bf1c730ae2b5d254c9d1c2a9fbc5",
"score": "0.54870504",
"text": "def infect_plague\n $game_troop.check_plague\n $game_party.check_plague\n end",
"title": ""
},
{
"docid": "ba81bf1c730ae2b5d254c9d1c2a9fbc5",
"score": "0.54870504",
"text": "def infect_plague\n $game_troop.check_plague\n $game_party.check_plague\n end",
"title": ""
},
{
"docid": "5d39315355948bd73c4ddb3a5537ac6b",
"score": "0.54859835",
"text": "def empty_for_player?(player_number)\n pieces_owned_by_player(player_number).none?\n end",
"title": ""
},
{
"docid": "f4281c3b2bf7bc34777b44f9ba67ea42",
"score": "0.54841936",
"text": "def player_dead?\n\t\t@player.m <= LifeForm::TOL\n\tend",
"title": ""
},
{
"docid": "e00e423512e9b07e92ad6a15394b2356",
"score": "0.5480773",
"text": "def get_players\n the_players = self.players\n if self.all_players and self.players.size > 0\n # This logic is probably unnecessary. The default league should only have\n # one player.\n unaccounted_players = self.players\n until unaccounted_players.empty?\n the_players |= unaccounted_players[0].players_in_clique\n unaccounted_players -= the_players\n end\n else\n the_players = self.players\n end\n return the_players\n end",
"title": ""
},
{
"docid": "d94656a051b3652363f08c5aed512614",
"score": "0.54719555",
"text": "def discoverable_pots\n Pot.visible - pots - invited_pots\n end",
"title": ""
},
{
"docid": "360cf87b55bda29017d8dfac5f914173",
"score": "0.5469877",
"text": "def dead_opponents(battler = $game_player)\n opponents = []\n @action_battlers.each do |key, members|\n next if key == battler.team_id\n members.compact.each do |member|\n next unless member.dead?\n opponents.push(member)\n end\n end\n return opponents\n end",
"title": ""
},
{
"docid": "ae3aee0ac00016b4de9ae16ce4ec1c1b",
"score": "0.5465686",
"text": "def choose_player(other_players)\n # DO NOT IMPLEMENT\n end",
"title": ""
},
{
"docid": "0ae64028586ec9a62f9637e94d70def5",
"score": "0.54638743",
"text": "def ukiyoye_noah_passant?()\n goodyear_chronophotograph_pyrographic?(trombidium_presupposal, dis)\n end",
"title": ""
}
] |
0c850f2d39f26c5f08c6a30b980cd78e | define combine method that comines the two arrays | [
{
"docid": "6303ed0da73e15715aa2d533087ac1e7",
"score": "0.0",
"text": "def combine\n\t\t@name_catalog.each_with_index do |name, rating| \n\t\t\t@full_catalog[name] = @rating_catalog[rating]\n\t\tend\n\tend",
"title": ""
}
] | [
{
"docid": "4e557c5544e1118643573f1c5ab03466",
"score": "0.7993656",
"text": "def combine(array1, array2)\n array1.zip(array2).flatten\nend",
"title": ""
},
{
"docid": "23aaec15126c6be1a6568b12f51c1925",
"score": "0.76956344",
"text": "def merge(array1, array2)\n array1 | array2\n\nend",
"title": ""
},
{
"docid": "b89a613283aca833579389e2ab0d863f",
"score": "0.7650966",
"text": "def merge(arr1, arr2)\nend",
"title": ""
},
{
"docid": "4e44fbb4fc670aba3d78034fc18deba9",
"score": "0.7635904",
"text": "def combine(array1, array2)\n [array1, array2].transpose.flatten\nend",
"title": ""
},
{
"docid": "4b1f274fecfa130fd9ff8b68c4403f94",
"score": "0.76272243",
"text": "def merge(array1, array2)\n array1 | array2\n\nend",
"title": ""
},
{
"docid": "f849780ee05f4fa2b921365de098eefa",
"score": "0.7602359",
"text": "def merge(array1, array2)\n array1.union(array2)\nend",
"title": ""
},
{
"docid": "36c216166fa7088fe4889924f0225fa2",
"score": "0.7599888",
"text": "def merge(array_1, array_2)\n array_1 | array_2\nend",
"title": ""
},
{
"docid": "36c216166fa7088fe4889924f0225fa2",
"score": "0.7599888",
"text": "def merge(array_1, array_2)\n array_1 | array_2\nend",
"title": ""
},
{
"docid": "36c216166fa7088fe4889924f0225fa2",
"score": "0.7599888",
"text": "def merge(array_1, array_2)\n array_1 | array_2\nend",
"title": ""
},
{
"docid": "36c216166fa7088fe4889924f0225fa2",
"score": "0.7599888",
"text": "def merge(array_1, array_2)\n array_1 | array_2\nend",
"title": ""
},
{
"docid": "36c216166fa7088fe4889924f0225fa2",
"score": "0.7599888",
"text": "def merge(array_1, array_2)\n array_1 | array_2\nend",
"title": ""
},
{
"docid": "36c216166fa7088fe4889924f0225fa2",
"score": "0.7599888",
"text": "def merge(array_1, array_2)\n array_1 | array_2\nend",
"title": ""
},
{
"docid": "36c216166fa7088fe4889924f0225fa2",
"score": "0.7599888",
"text": "def merge(array_1, array_2)\n array_1 | array_2\nend",
"title": ""
},
{
"docid": "48ccd9709f7e4398c10611bfa456d96b",
"score": "0.7519441",
"text": "def using_concat(array1,array2)\n array1.concat(array2)\nend",
"title": ""
},
{
"docid": "8325442c16750a5a8476b098b7910ff0",
"score": "0.7505968",
"text": "def using_concat(array1,array2)\n return array1.concat(array2)\nend",
"title": ""
},
{
"docid": "b95efe9a40251b3dc6c1c87d7f70b90f",
"score": "0.74843615",
"text": "def with_our_powers_combined(arr1, arr2)\n \n # use zip to combine \n zip_arr = arr1.zip(arr2)\n # initialize an empty array\n merge_arr = []\n \n # if both arrays of same length\n if arr1.length == arr2.length\n zip_arr.each do |x,y|\n merge_arr.push(x,y)\n end\n else \n arr1.zip(arr2).each do |x,y|\n merge_arr.push(x,y)\n \n end\n for x in arr2[arr1.length..-1]\n merge_arr.push(x)\n end\n end\n \n return merge_arr.to_s\n\nend",
"title": ""
},
{
"docid": "d5ba618cb774a929928c2c40f18f7f4c",
"score": "0.7481001",
"text": "def using_concat(array_one,array_two)\n array_one.concat(array_two)\nend",
"title": ""
},
{
"docid": "15697387805774ea6d953e09e155f33a",
"score": "0.7466501",
"text": "def merge_array(array1, array2)\n\tarray = array1 | array2\n\n\treturn array\nend",
"title": ""
},
{
"docid": "4a129f888c45d934e89dc0c51bc0c5ba",
"score": "0.74559987",
"text": "def merge2(array_1, array_2)\n array_1 | array_2\nend",
"title": ""
},
{
"docid": "6e058b6741e67c703ac62b4ed1562fe2",
"score": "0.7443476",
"text": "def merge(array1, array2)\n array1 | array2\nend",
"title": ""
},
{
"docid": "6e058b6741e67c703ac62b4ed1562fe2",
"score": "0.7443476",
"text": "def merge(array1, array2)\n array1 | array2\nend",
"title": ""
},
{
"docid": "adc89312392ed1b8ba423a6f63a012e2",
"score": "0.74372447",
"text": "def array_concat(array_1, array_2)\n together = array_1 + array_2\n return together\n\nend",
"title": ""
},
{
"docid": "b8c9e3802765d48bda5973058c10b967",
"score": "0.74293905",
"text": "def using_concat(array1,array2)\n array1.concat(array2)\nend",
"title": ""
},
{
"docid": "b8c9e3802765d48bda5973058c10b967",
"score": "0.74293905",
"text": "def using_concat(array1,array2)\n array1.concat(array2)\nend",
"title": ""
},
{
"docid": "e99ce3864654b72bff75a4729a09f396",
"score": "0.7426886",
"text": "def combineArray(arr1, arr2)\n puts arr1 + \" Camry\" + \" \" + arr2 + \" Model 3\"\n \nend",
"title": ""
},
{
"docid": "5b0566ac45f3853aa551775d849b8036",
"score": "0.7419563",
"text": "def array_concat(array_1, array_2)\r\n return array_1 + array_2\r\nend",
"title": ""
},
{
"docid": "fb9a0f0fa2696d03b48eb62f195a666f",
"score": "0.741926",
"text": "def using_concat(first_array, second_array)\n first_array.concat(second_array)\nend",
"title": ""
},
{
"docid": "3731409efa3d998bc6f34d950c976db3",
"score": "0.7418526",
"text": "def merge(arr1, arr2)\n # YOUR WORK HERE\nend",
"title": ""
},
{
"docid": "e173aa8726d93f4d1b1cd540c0c0e0c3",
"score": "0.7410022",
"text": "def custom_concat(arr1, arr2)\n result = arr1 + arr2\n return result\nend",
"title": ""
},
{
"docid": "e6c76bb4a8093981f3a207de5e6a526b",
"score": "0.74079156",
"text": "def combine(*args)\n result = []\n index = 0\n\n # Initialize a loop to iterate through each of our arrays\n\n loop do\n\n # We'll break out of the loop if each array's length is no longer smaller\n # than the index point we're iterating on. This will help to ensure that\n # if one array is shorter/longer than the other, that we'll still be able\n # to get the full results - without missing any elements.\n\n break if args.all? do |arr|\n arr.length <= index\n end\n\n # Iterate through our arrays one at a time. On each iteration, we'll pass in\n # the element from the first array and append that to our result array. We'll\n # continue to iterate through all of the arrays until we reach the end of our\n # arrays.\n args.each do |arr|\n result << arr[index]\n end\n\n # Increment our index by 1\n index += 1\n end\n\n # Return our array and call #compact to remove nils out of our array\n result.compact\nend",
"title": ""
},
{
"docid": "18a149081344c01190f71249cff1afb8",
"score": "0.74066585",
"text": "def custom_concat(arr1, arr2)\r\n arr2.each{|elem| arr1 << elem}\r\n arr1\r\nend",
"title": ""
},
{
"docid": "22803879e07032385c4892b656f93ea1",
"score": "0.740384",
"text": "def merge_arr(sample_array, second_array)\n temp = []\n temp.concat(sample_array).concat(second_array)\n\n return temp\nend",
"title": ""
},
{
"docid": "7d43e35b263898385b7b7f6eb02770ad",
"score": "0.7393944",
"text": "def array_concat(array_1, array_2)\r\n\treturn array_1 + array_2\r\nend",
"title": ""
},
{
"docid": "2a5ddda1cb6dd1afdd0191799172f3b2",
"score": "0.73863196",
"text": "def array_concat(array_1, array_2)\n combo = []\n\n array_1.each do |a| \n combo.push(a)\n end\n\n array_2.each do |b| \n combo.push(b)\n end\n\n p combo\nend",
"title": ""
},
{
"docid": "204ba76452c38f24cede82633e96c1cf",
"score": "0.73753524",
"text": "def array_concat(array_1, array_2)\n koolkatnate = []\n array_1.each { |i| koolkatnate << i }\n array_2.each { |i| koolkatnate << i }\n koolkatnate\nend",
"title": ""
},
{
"docid": "65a9a9dbfab1dd4cc14e27f4bcfdcd39",
"score": "0.7361714",
"text": "def custom_concat(array1, array2)\n array2.each do |num| \n array1 << num\n end\n array1\nend",
"title": ""
},
{
"docid": "bc3a1c244420891c87396daeeb7e6e7a",
"score": "0.7358686",
"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": "dc810b76e9e810b32613d5b253d4d733",
"score": "0.7358634",
"text": "def using_concat(array1, array2)\n return array1.concat(array2)\nend",
"title": ""
},
{
"docid": "6a3ec9687e4f7d6182d6313e930dc1c9",
"score": "0.73561406",
"text": "def array_concat(array_1, array_2)\n\tarray_1 + array_2\nend",
"title": ""
},
{
"docid": "6bb06967ef3ee21954d6106e1da4e717",
"score": "0.7346747",
"text": "def concat(array,array2)\n output = array + array2 \n return output\nend",
"title": ""
},
{
"docid": "9382139670fa847cebc265cddf35aba0",
"score": "0.7346329",
"text": "def using_concat (des_arr,src_arr)\n des_arr.concat(src_arr)\nend",
"title": ""
},
{
"docid": "7058758efe05e47b79ab480fd79923aa",
"score": "0.73275596",
"text": "def merge(arr1, arr2)\n arr1.union(arr2)\nend",
"title": ""
},
{
"docid": "661f858989d53d711ca1f930bdf45681",
"score": "0.73222154",
"text": "def custom_concat(arr1, arr2)\n\n arr1.concat(arr2)\nend",
"title": ""
},
{
"docid": "a0663d873a2a09a21efb5141050513d8",
"score": "0.730952",
"text": "def custom_concat(arr1, arr2)\n arr2.each { |num| arr1 << num }\n arr1\nend",
"title": ""
},
{
"docid": "566114e4edfb2304c5eeb70464ab2d53",
"score": "0.73030996",
"text": "def combine1(ary1, ary2)\n ary3 = []\n\n n = if (ary1.length > ary2.length)\n ary1.length\n else\n ary2.length\n end\n\n for i in (0...n)\n ary3[2*i] = ary1[i]\n ary3[2*i+1] = ary2[i]\n end\n\n p ary3.compact\nend",
"title": ""
},
{
"docid": "ec790ba251040eb295ada8be424cae01",
"score": "0.7302732",
"text": "def using_concat(array1, array2)\n array1.concat(array2)\nend",
"title": ""
},
{
"docid": "ec790ba251040eb295ada8be424cae01",
"score": "0.7302732",
"text": "def using_concat(array1, array2)\n array1.concat(array2)\nend",
"title": ""
},
{
"docid": "ec790ba251040eb295ada8be424cae01",
"score": "0.7302732",
"text": "def using_concat(array1, array2)\n array1.concat(array2)\nend",
"title": ""
},
{
"docid": "281b944b11c8842165903238c2347148",
"score": "0.73007023",
"text": "def array_concat(array_1, array_2)\r\n array_1.concat(array_2)\r\nend",
"title": ""
},
{
"docid": "1f652aa3c6f75ed0b4a8a3b8e1278140",
"score": "0.7298167",
"text": "def combine\n combos = Array.new\n _combine(combos, [], 0)\n combos\n end",
"title": ""
},
{
"docid": "39eafdf9eb448f7bb652d50a5ed404a9",
"score": "0.72905207",
"text": "def merge(array1, array2)\n # array1.union(array2)\n # or\n array1 | array2\nend",
"title": ""
},
{
"docid": "30e5c4c01e04cb707e7d03bbc3544f17",
"score": "0.7290137",
"text": "def array_concat(array_1, array_2)\r\n i = 0\r\n combo_array = []\r\n\r\n if (array_2.length == 0) && (array_1.length == 0)\r\n \treturn combo_array\r\n else \r\n \twhile i < array_1.length\r\n \t\tcombo_array << array_1[i]\r\n \t\ti += 1\r\n \tend\r\n \ti = 0\r\n \twhile i < array_2.length\r\n \t\tcombo_array << array_2[i]\r\n \t\ti += 1\r\n \tend\r\n \treturn combo_array\r\n end\r\nend",
"title": ""
},
{
"docid": "3c00d764730fac3e9738ce08801bc1ed",
"score": "0.72865033",
"text": "def concat(array1, array2)\n return array1 + array2\nend",
"title": ""
},
{
"docid": "3f4c1289677af7c0cd6b8f737213cfe0",
"score": "0.72856",
"text": "def using_concat(array1, array2)\n array1.concat(array2)\nend",
"title": ""
},
{
"docid": "3f4c1289677af7c0cd6b8f737213cfe0",
"score": "0.72856",
"text": "def using_concat(array1, array2)\n array1.concat(array2)\nend",
"title": ""
},
{
"docid": "3f4c1289677af7c0cd6b8f737213cfe0",
"score": "0.72856",
"text": "def using_concat(array1, array2)\n array1.concat(array2)\nend",
"title": ""
},
{
"docid": "3f4c1289677af7c0cd6b8f737213cfe0",
"score": "0.72856",
"text": "def using_concat(array1, array2)\n array1.concat(array2)\nend",
"title": ""
},
{
"docid": "3f4c1289677af7c0cd6b8f737213cfe0",
"score": "0.72856",
"text": "def using_concat(array1, array2)\n array1.concat(array2)\nend",
"title": ""
},
{
"docid": "3f4c1289677af7c0cd6b8f737213cfe0",
"score": "0.72856",
"text": "def using_concat(array1, array2)\n array1.concat(array2)\nend",
"title": ""
},
{
"docid": "3f4c1289677af7c0cd6b8f737213cfe0",
"score": "0.72856",
"text": "def using_concat(array1, array2)\n array1.concat(array2)\nend",
"title": ""
},
{
"docid": "3f4c1289677af7c0cd6b8f737213cfe0",
"score": "0.72848415",
"text": "def using_concat(array1, array2)\n array1.concat(array2)\nend",
"title": ""
},
{
"docid": "fe4f9e84f7a40fecd396996a46649dc3",
"score": "0.72841674",
"text": "def concat(array); end",
"title": ""
},
{
"docid": "c74d0d8a82ed50bbb0de2c804e1d8dcb",
"score": "0.7281452",
"text": "def array_concat(array_1, array_2)\n return array_1 + array_2\nend",
"title": ""
},
{
"docid": "c74d0d8a82ed50bbb0de2c804e1d8dcb",
"score": "0.7281452",
"text": "def array_concat(array_1, array_2)\n return array_1 + array_2\nend",
"title": ""
},
{
"docid": "d797b02a338a7357d3403897905099b1",
"score": "0.727952",
"text": "def merge(arr1, arr2)\n arr1 | arr2\nend",
"title": ""
},
{
"docid": "d797b02a338a7357d3403897905099b1",
"score": "0.727952",
"text": "def merge(arr1, arr2)\n arr1 | arr2\nend",
"title": ""
},
{
"docid": "d797b02a338a7357d3403897905099b1",
"score": "0.727952",
"text": "def merge(arr1, arr2)\n arr1 | arr2\nend",
"title": ""
},
{
"docid": "d797b02a338a7357d3403897905099b1",
"score": "0.727952",
"text": "def merge(arr1, arr2)\n arr1 | arr2\nend",
"title": ""
},
{
"docid": "ce53ff7c11c93aacc6b4ac1327587c87",
"score": "0.7262786",
"text": "def using_concat(array, array1)\n array.concat(array1)\nend",
"title": ""
},
{
"docid": "66511d6768c66356bd629d9cfb885423",
"score": "0.724992",
"text": "def array_concatv2(array_1, array_2)\n array_1.concat(array_2)\nend",
"title": ""
},
{
"docid": "1d8da1d879bd4b34e527b5b804715634",
"score": "0.72481835",
"text": "def custom_concat(arr1, arr2)\n arr2.each do |each|\n arr1.push(each) # or arr1 << each\n end\n arr1\nend",
"title": ""
},
{
"docid": "9365ce52c810596574e56cef7d7636e0",
"score": "0.7246902",
"text": "def array_concat(array_1, array_2)\n\n return array_1 + array_2 # Yes, it's just that simple.\n\nend",
"title": ""
},
{
"docid": "e572e2e4048e9a6f52de83d46e1b714a",
"score": "0.72425693",
"text": "def combine_arrays(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"title": ""
},
{
"docid": "dc6746103dfb1cab8b8c87264c558c15",
"score": "0.7242167",
"text": "def merge(array_1, array_2)\n results = array_1 + array_2\n results.uniq\nend",
"title": ""
},
{
"docid": "f4ec6e0f607280e0e964fb08043b52cf",
"score": "0.7241913",
"text": "def combine(a, b)\n # create a results array\n result = []\n # counters pointing to the index of the smallest elements in each array\n # check that we have elements to compare\n while a.length > 0 && b.length > 0\n if a[0] < b[0]\n result.push(a.shift)\n else\n result.push(b.shift)\n end\n end\n result += b if b.length > 0\n result += a if a.length > 0\n return result\nend",
"title": ""
},
{
"docid": "1f20eb3c2bf303e0ec7da17df34f413b",
"score": "0.72328657",
"text": "def array_concat(array_1, array_2)\n final = []\n array_1.each do |x|\n final << x\n end\n array_2.each do |x|\n final << x\n end\n return final\nend",
"title": ""
},
{
"docid": "56fa7e1bcc034770154a79acce449fbb",
"score": "0.72291476",
"text": "def array_concat(array_1, array_2)\n\tcombined_array = []\n\tarray_1.each do |string|\n\t\tcombined_array.push string\n\tend\n\tarray_2.each do |string|\n\tcombined_array.push string\n\tend\n\treturn combined_array\nend",
"title": ""
},
{
"docid": "778b7e18aa9a78156839b2348ce9de80",
"score": "0.7225641",
"text": "def array_concat(array_1, array_2)\n # Your code here\n \n concat_array = []\n \n array_1.each do |obj|\n concat_array.push(obj)\n end\n \n array_2.each do |obj|\n concat_array.push(obj)\n end\n \n return concat_array\nend",
"title": ""
},
{
"docid": "1cd73a058adc9d4fb958009d81401bae",
"score": "0.7215513",
"text": "def custom_concat(arr1, arr2)\n #Return arr1 with all od the elements from arr2\n #added to the end of it\n arr1 + arr2\nend",
"title": ""
},
{
"docid": "bf7b85e68463f7725c2585694721cdf2",
"score": "0.7213932",
"text": "def merge(array1, array2)\n p array1 | array2\nend",
"title": ""
},
{
"docid": "17bb5ed0e13a326518cf847f5deaa166",
"score": "0.7213914",
"text": "def array_concat(array_1, array_2)\n array_3 = []\n array_1.each { |item| array_3 << item }\n array_2.each { |item| array_3 << item }\n return array_3\nend",
"title": ""
},
{
"docid": "14594465312728cf7ce87d0469e88b1b",
"score": "0.7213219",
"text": "def array_concat(array_1, array_2)\n # Your code here\n concated_array = array_1 + array_2\n return concated_array\nend",
"title": ""
},
{
"docid": "3a008ab735a14097781102f0e55f1d5a",
"score": "0.7199146",
"text": "def array_concat(array_1, array_2)\n ans = []\n array_1.each do |x|\n \tans.push(x)\n end \n\n array_2.each do |x|\n \tans.push(x)\n end\n\n return ans\nend",
"title": ""
},
{
"docid": "5399cffb2b65da3d0faacbff574166b2",
"score": "0.7198713",
"text": "def array_concat(array_1, array_2)\n # Your code here\n return array_1.concat(array_2)\nend",
"title": ""
},
{
"docid": "ae680246008b23776b69861e2d4d46f7",
"score": "0.7194414",
"text": "def array_concat(array_1, array_2)\n\tconcat = []\n\tarray_1.each do |value|\n\t\tconcat.push(value)\n\tend\n\tarray_2.each do |value|\n\t\tconcat.push(value)\n\tend\n\tconcat\nend",
"title": ""
},
{
"docid": "54385d7584a10f0ef0b901a2faf0b7d1",
"score": "0.7193852",
"text": "def merge_union(arr1, arr2)\n arr1 | arr2\nend",
"title": ""
},
{
"docid": "848cddc8cd80465931a57f59296c593c",
"score": "0.7178366",
"text": "def array_concat(array_1, array_2)\n array_1.concat array_2\nend",
"title": ""
},
{
"docid": "dba9561956a6ea4a463ce037713ac557",
"score": "0.71767557",
"text": "def array_concat(array_1, array_2)\n array_3 = []\n for val in array_1\n array_3.push(val)\n end\n for val in array_2\n array_3.push(val)\n end\n return array_3\nend",
"title": ""
},
{
"docid": "45d4992bd3cf85be1c977fbba97af5ef",
"score": "0.71750623",
"text": "def array_concat(array_1, array_2)\n\tnew_array=array_1+array_2\n\treturn new_array\nend",
"title": ""
},
{
"docid": "a7aa1ebe5136669f32898aeb14220e8c",
"score": "0.717461",
"text": "def array_concat(array_1, array_2)\n\tarray_1.concat(array_2)\nend",
"title": ""
},
{
"docid": "a7aa1ebe5136669f32898aeb14220e8c",
"score": "0.717461",
"text": "def array_concat(array_1, array_2)\n\tarray_1.concat(array_2)\nend",
"title": ""
},
{
"docid": "4958014f11d7fd06938a156c17e770df",
"score": "0.717419",
"text": "def array_concat(array_1, array_2)\n # Your code here\n array_1.concat(array_2)\nend",
"title": ""
},
{
"docid": "0b6505b286ad4a2e1cff1c72e6115063",
"score": "0.71622247",
"text": "def array_concat(array_1, array_2)\n\tp both = array_1+array_2\nend",
"title": ""
},
{
"docid": "7097b02e65be0a00ef74c84f3b90b28d",
"score": "0.715152",
"text": "def array_concat(array_1, array_2)\n \n array_2.each { |value|\n\n \tarray_1 << value\n\n }\n\n array_1\n\nend",
"title": ""
},
{
"docid": "18362b985390deae58f7d3860b8f413a",
"score": "0.71398133",
"text": "def array_concat(array_1, array_2)\n Array.new(Array.new(array_1) + Array.new(array_2))\n\nend",
"title": ""
},
{
"docid": "2150abd36791d18a11b11a6bec03ab2b",
"score": "0.71393126",
"text": "def array_concat(array_1, array_2)\n return array_1.concat(array_2)\nend",
"title": ""
},
{
"docid": "2150abd36791d18a11b11a6bec03ab2b",
"score": "0.71393126",
"text": "def array_concat(array_1, array_2)\n return array_1.concat(array_2)\nend",
"title": ""
},
{
"docid": "2f4e29b35bacd251bbb39ba62ea458e3",
"score": "0.7138858",
"text": "def array_concat(array_1, array_2)\n array_3 = array_1 + array_2\n return array_3\nend",
"title": ""
},
{
"docid": "6942137b283d9844ba8a706e18fd07d8",
"score": "0.7138754",
"text": "def array_concat(array_1, array_2)\n # Your code here\n array_1.concat array_2\nend",
"title": ""
},
{
"docid": "6cf0fa53245a09647a48a3dc885ce7d3",
"score": "0.71342075",
"text": "def array_concat (array_1, array_2)\n (array_1).concat(array_2)\nend",
"title": ""
},
{
"docid": "29e16ae422b576fe86ba1137b0ef45eb",
"score": "0.71317685",
"text": "def array_concat(array_1, array_2)\n # Your code here\n # return array_1.concat(array_2) -> One way\n return array_1 + array_2 \n\n\nend",
"title": ""
}
] |
0626bfccc8b08b18d9c9905d61f42a2d | Specifies an autorequire relationship. | [
{
"docid": "5b6feb70ef76d70246a1c35e5865d276",
"score": "0.5645901",
"text": "def autorequire(name = nil, &block)\n # Not needed to describe the type\n nil\n end",
"title": ""
}
] | [
{
"docid": "44101fede29c7b2ffc805745531f0c7b",
"score": "0.6913232",
"text": "def autorequire(rel_catalog = nil)\n reqs = super\n\n [\n @parameters[:prior_to].value,\n @parameters[:resource].value,\n ].flatten.each do |rel|\n reqs << Puppet::Relationship.new(self, catalog.resource(rel.to_s))\n end\n\n reqs\n end",
"title": ""
},
{
"docid": "0a0a23532affdf4a914378c26739a496",
"score": "0.6444345",
"text": "def autorequire(rel_catalog = nil)\n rel_catalog ||= catalog\n raise(Puppet::DevError, \"You cannot add relationships without a catalog\") unless rel_catalog\n\n reqs = []\n self.class.eachautorequire { |type, block|\n # Ignore any types we can't find, although that would be a bit odd.\n next unless typeobj = Puppet::Type.type(type)\n\n # Retrieve the list of names from the block.\n next unless list = self.instance_eval(&block)\n list = [list] unless list.is_a?(Array)\n\n # Collect the current prereqs\n list.each { |dep|\n # Support them passing objects directly, to save some effort.\n unless dep.is_a? Puppet::Type\n # Skip autorequires that we aren't managing\n unless dep = rel_catalog.resource(type, dep)\n next\n end\n end\n\n reqs << Puppet::Relationship.new(dep, self)\n }\n }\n\n reqs\n end",
"title": ""
},
{
"docid": "09433a2a973dc4bfe0aae70e3dacb2a4",
"score": "0.62590086",
"text": "def relationship=(value)\n @relationship = value\n end",
"title": ""
},
{
"docid": "d32d40da3b89797d2bc3fdabb5adec62",
"score": "0.60940707",
"text": "def add_relationship(rel_attr); end",
"title": ""
},
{
"docid": "90eb11c2004ef3532227b6ca9ce6e895",
"score": "0.60612696",
"text": "def relationship(rel_class)\n @relationship = rel_class\n self\n end",
"title": ""
},
{
"docid": "4a4ed5a284bfa20e43e3766549b27fc4",
"score": "0.5980536",
"text": "def one_relationship(name)\n end",
"title": ""
},
{
"docid": "e10aad0f6f07d18ca582b4252f284a5f",
"score": "0.5900123",
"text": "def relationship(rel_class)\n @relationship = rel_class\n self\n end",
"title": ""
},
{
"docid": "20b8ef6513bf3dbf40c9e944c616b6ba",
"score": "0.58676666",
"text": "def set_enquire\n @enquire = Enquire.find(params[:id])\n end",
"title": ""
},
{
"docid": "758323464c016858991deb781b9e398e",
"score": "0.57572174",
"text": "def define_relationship(opts)\n [:name, :contains_references_to_types].each do |p|\n opts[p] or raise \"No #{p} given\"\n end\n\n base = self\n\n ArchivesSpaceService.loaded_hook do\n # We hold off actually setting anything up until all models have been\n # loaded, since our relationships may need to reference a model that\n # hasn't been loaded yet.\n #\n # This is also why the :contains_references_to_types property is a proc\n # instead of a regular array--we don't want to blow up with a NameError\n # if the model hasn't been loaded yet.\n\n\n related_models = opts[:contains_references_to_types].call\n\n clz = Class.new(AbstractRelationship) do\n table = \"#{opts[:name]}_rlshp\".intern\n set_dataset(table)\n set_primary_key(:id)\n\n if !self.db.table_exists?(self.table_name)\n Log.warn(\"Table doesn't exist: #{self.table_name}\")\n end\n\n set_participating_models([base, *related_models].uniq)\n set_json_property(opts[:json_property])\n set_wants_array(opts[:is_array].nil? || opts[:is_array])\n end\n\n opts[:class_callback].call(clz) if opts[:class_callback]\n\n @relationships[opts[:name]] = clz\n\n related_models.each do |model|\n model.include(Relationships)\n model.add_relationship_dependency(opts[:name], base)\n end\n\n # Give the new relationship class a name to help with debugging\n # Example: Relationships::ResourceSubject\n Relationships.const_set(self.name + opts[:name].to_s.camelize, clz)\n\n end\n end",
"title": ""
},
{
"docid": "27ddaee232148d957ad7b7b476983961",
"score": "0.5698524",
"text": "def relationship( name, &block )\n require_identifier!\n return if context.linkage_only?\n\n include_or_mark_partial name do\n builder = RelationshipBuilder.new( context )\n yield builder\n\n relationships = ( output[:relationships] ||= {} )\n relationships[ name.to_sym ] = builder.compile\n end\n end",
"title": ""
},
{
"docid": "bdb42afcfcaa6e7f29fa9d8c55bb4461",
"score": "0.56899494",
"text": "def related_attrs\n relationship = flex_options[:relationship_name]\n send relationship\n end",
"title": ""
},
{
"docid": "9967d58f0c35fa78759f919722821725",
"score": "0.5637896",
"text": "def relationship(sym)\n self.class.relationship(sym)\n end",
"title": ""
},
{
"docid": "20ce501c17769f432041d566b9559b38",
"score": "0.5575463",
"text": "def set_relationship\n @relationship = Relationship.find(params[:id])\n end",
"title": ""
},
{
"docid": "20ce501c17769f432041d566b9559b38",
"score": "0.5575463",
"text": "def set_relationship\n @relationship = Relationship.find(params[:id])\n end",
"title": ""
},
{
"docid": "20ce501c17769f432041d566b9559b38",
"score": "0.5575463",
"text": "def set_relationship\n @relationship = Relationship.find(params[:id])\n end",
"title": ""
},
{
"docid": "20ce501c17769f432041d566b9559b38",
"score": "0.5575463",
"text": "def set_relationship\n @relationship = Relationship.find(params[:id])\n end",
"title": ""
},
{
"docid": "20ce501c17769f432041d566b9559b38",
"score": "0.5575463",
"text": "def set_relationship\n @relationship = Relationship.find(params[:id])\n end",
"title": ""
},
{
"docid": "20ce501c17769f432041d566b9559b38",
"score": "0.5575463",
"text": "def set_relationship\n @relationship = Relationship.find(params[:id])\n end",
"title": ""
},
{
"docid": "20ce501c17769f432041d566b9559b38",
"score": "0.5575463",
"text": "def set_relationship\n @relationship = Relationship.find(params[:id])\n end",
"title": ""
},
{
"docid": "20ce501c17769f432041d566b9559b38",
"score": "0.5575463",
"text": "def set_relationship\n @relationship = Relationship.find(params[:id])\n end",
"title": ""
},
{
"docid": "20ce501c17769f432041d566b9559b38",
"score": "0.5575463",
"text": "def set_relationship\n @relationship = Relationship.find(params[:id])\n end",
"title": ""
},
{
"docid": "00fcbeab9b05081e96946b13cae2de8d",
"score": "0.55382025",
"text": "def set_relationship\n #find relationship\n @relationship = Relationship.find_by_id(params[:id])\n end",
"title": ""
},
{
"docid": "6e911f6ee3d8211e3d006b9fdc74146f",
"score": "0.54945505",
"text": "def association(name, *options); end",
"title": ""
},
{
"docid": "f04bf7e80029715b11ecd62e5e5a4596",
"score": "0.54898036",
"text": "def relationship(*args)\n options = args.extract_options!\n if options[:raise_on_multiple]\n rels = relationships.take(2)\n raise _(\"Multiple relationships found\") if rels.length > 1\n rels.first\n else\n relationships.first\n end\n end",
"title": ""
},
{
"docid": "ac706eca36fdc486f3080e535818cf73",
"score": "0.5441038",
"text": "def relation(rel, &relation_definition)\n raise NotImplementedError, 'relation is not supported yet'\n end",
"title": ""
},
{
"docid": "3ed863edf422c2997ba6e45ac9464cba",
"score": "0.53801495",
"text": "def relationship(sym)\n if @relationships\n @relationships[sym]\n else\n self.class.relationship(sym)\n end\n end",
"title": ""
},
{
"docid": "c3eaebc35f1bcc425b7cba75410a3590",
"score": "0.5372855",
"text": "def relation(relation)\n true\n end",
"title": ""
},
{
"docid": "46a101e3e61dae497389e7711f9878dd",
"score": "0.53539836",
"text": "def relation(name, &block)\n if @resource_config[:relation][name]\n raise DefinitionError, \"relation #{name.inspect} already declared in #{self}\"\n end\n @resource_config[:relation][name] = block\n end",
"title": ""
},
{
"docid": "8a62d3f9411012b5fa53b1e3356b4553",
"score": "0.5347579",
"text": "def configure_relation\n end",
"title": ""
},
{
"docid": "bdfc2e817588b42b07b534dd31e3e285",
"score": "0.53415257",
"text": "def relation(*args, &block)\n boot.relation(*args, &block)\n end",
"title": ""
},
{
"docid": "8f1399041299f9b77adcfd376db89518",
"score": "0.5318147",
"text": "def relationship_related_link(attribute_name); end",
"title": ""
},
{
"docid": "70efaf902b89ec9e60b71050822f07be",
"score": "0.52839744",
"text": "def add_ms_package_relationship(type, target)\n schema = 'http://schemas.microsoft.com/office/2006/relationships'\n @rels.push([schema + type, target])\n end",
"title": ""
},
{
"docid": "74224880d1d122736a1046d2f59ec52f",
"score": "0.52625644",
"text": "def initialize(relationship=\"relationship\", *args)\n @relationship = relationship\n super\n end",
"title": ""
},
{
"docid": "a6a167bb85711b3c47fd963e21fa2e31",
"score": "0.5247369",
"text": "def relationship\n relationship? ? children[1] : nil\n end",
"title": ""
},
{
"docid": "6df495f080e84ec2961855497918a9ff",
"score": "0.52454937",
"text": "def set_survey_question_relationship\n @survey_question_relationship = SurveyQuestionRelationship.find(params[:id])\n end",
"title": ""
},
{
"docid": "355781881937105641ca0d98015085cb",
"score": "0.51990044",
"text": "def decorates_association(relation_name, with: :__guess__)\n relation_name = relation_name.to_sym\n\n define_method(relation_name) do\n @_decorated_associations[relation_name] ||= decorate(__getobj__.public_send(relation_name), with: with)\n end\n end",
"title": ""
},
{
"docid": "16ec95563be4ecfe5416196487b4877c",
"score": "0.514817",
"text": "def ensure_relation(remote_node, attributes = nil)\n if rel = @storage.to_other(remote_node).first\n rel.attributes= attributes if attributes\n rel\n else\n relate(remote_node, attributes)\n end\n end",
"title": ""
},
{
"docid": "a962f8a3a138adf793485c2b597a2ec9",
"score": "0.5125145",
"text": "def relation(related, arguments=[])\n self.send(related.to_sym)\n end",
"title": ""
},
{
"docid": "9d7bf674030c179aa5ac86d4b47e8efe",
"score": "0.51185423",
"text": "def association\n @association ||= options[:association]\n end",
"title": ""
},
{
"docid": "1abd4669c82f437378f8b75111edf52d",
"score": "0.51152426",
"text": "def relationship_constraint(operator, lhs_operand, rhs_operand, options = {}, &block)\n constraint = RelationshipConstraint.new(self, operator, lhs_operand, rhs_operand, options, &block)\n add_unique_to_set(\"relationship\", constraint, @relationship_constraints)\n end",
"title": ""
},
{
"docid": "0047f1efd4c1db4e0614a70e8e966b30",
"score": "0.5112089",
"text": "def update(attrs)\n @attrs.update(attrs[:relationship]) unless attrs[:relationship].nil?\n self\n end",
"title": ""
},
{
"docid": "c6ffdb77d1f7524016ee9732a40fb72b",
"score": "0.5099705",
"text": "def set_squire\n @squire = Squire.find(params[:id])\n end",
"title": ""
},
{
"docid": "83e812870ec39d4b7f596a1d4d68d34f",
"score": "0.50958526",
"text": "def relationship\n Relationship.new(self, CHART_R, \"../#{pn}\")\n end",
"title": ""
},
{
"docid": "f1bc020cd23c3df1d6a4df1b428aebd0",
"score": "0.5092729",
"text": "def init_relationship(parent_rel = nil)\n rel = relationship\n if rel.nil?\n rel = add_relationship(parent_rel)\n elsif !parent_rel.nil?\n rel.update_attribute(:parent, parent_rel)\n end\n rel\n end",
"title": ""
},
{
"docid": "a9cdb28e3a5a10317412edd2eea78fb2",
"score": "0.509148",
"text": "def relate(attribute_name, options = {})\n options[:to] ||= '*'\n store_relation_mapping(options[:to], Internal::MappingFactory.build_relation(attribute_name, options))\n end",
"title": ""
},
{
"docid": "a8c9e823627ebeef50afb0f398161072",
"score": "0.5089356",
"text": "def has_one(direction, name = nil, options = { type: nil })\n if name.is_a?(Hash)\n options.merge(name)\n name = direction\n direction = nil\n elsif name.is_a?(Proc)\n name = direction\n direction = nil\n elsif name.nil?\n name = direction\n end\n reflections[name] = { direction: direction, type: options[:type], kind: :has_one }\n # @!method promise_[name]\n # @return [Promise] on success the .then block will receive a [HyperRecord::Collection] as arg\n # on failure the .fail block will receive the HTTP response object as arg\n define_method(\"promise_#{name}\") do\n @fetch_states[name] = 'i'\n self.class._promise_get(\"#{self.class.resource_base_uri}/#{self.id}/relations/#{name}.json?timestamp=#{`Date.now() + Math.random()`}\").then do |response|\n @relations[name] = self.class._convert_json_hash_to_record(response.json[self.class.to_s.underscore][name])\n @fetch_states[name] = 'f'\n _notify_observers\n @relations[name]\n end.fail do |response|\n error_message = \"#{self.class.to_s}[#{self.id}].#{name}, a has_one association, failed to fetch records!\"\n `console.error(error_message)`\n response\n end\n end\n # @!method [name] get records of the relation\n # @return [HyperRecord::Collection] either a empty one, if the data has not been fetched yet, or the\n # collection with the real data, if it has been fetched already\n define_method(name) do\n _register_observer\n if @fetch_states.has_key?(name) && 'fi'.include?(@fetch_states[name])\n @relations[name]\n elsif self.id\n send(\"promise_#{name}\")\n @relations[name]\n else\n @relations[name]\n end\n end\n # @!method update_[name] mark internal structures so that the relation data is updated once it is requested again\n # @return nil\n define_method(\"update_#{name}\") do\n @fetch_states[name] = 'u'\n nil\n end\n # define_method(\"#{name}=\") do |arg|\n # _register_observer\n # @relations[name] = arg\n # @fetch_states[name] = 'f'\n # @relations[name]\n # end\n end",
"title": ""
},
{
"docid": "9a0804343f3cf8c50e3837f44e4281f6",
"score": "0.507774",
"text": "def relation\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "67758307cd6decff0f9fbe0e906594c3",
"score": "0.506319",
"text": "def refers_to(*args)\n require \"og/relation/refers_to\"\n relations! << Og::RefersTo.new(args, :owner_class => self)\n end",
"title": ""
},
{
"docid": "bf24ffa5f21d9832eb7e019ca7c464bf",
"score": "0.506108",
"text": "def relationship\n response[\"relationship\"]\n end",
"title": ""
},
{
"docid": "2b7c041d14669e499717c7d7b36417d4",
"score": "0.5056275",
"text": "def _arel(associations = [])\n return unless _on || associations.any?\n JoinDependency.new(self, associations)\n end",
"title": ""
},
{
"docid": "9e52d1436022a535e0270787da6fe82e",
"score": "0.5045101",
"text": "def set_one_to_one_associated_object(opts, o)\n if opts.dataset_need_primary_key? && new?\n delay_validate_associated_object(opts, o)\n after_create_hook { super(opts, o) }\n o\n else\n super\n end\n end",
"title": ""
},
{
"docid": "8c38ffba752e69d2035de911c991893a",
"score": "0.5045017",
"text": "def set_taxon_name_relationship\n @taxon_name_relationship = TaxonNameRelationship.find(params[:id])\n end",
"title": ""
},
{
"docid": "b9fe890161f193fe7a93e47e7bb22708",
"score": "0.5039825",
"text": "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs[:relationship]) unless attrs[:relationship].nil?\n self\n end",
"title": ""
},
{
"docid": "af893473949754e24bfbe9f34b570b11",
"score": "0.5034021",
"text": "def relationship(sym, klass=nil, kinds=[])\n if klass\n relationships[sym] = Relationship.new(sym, klass, kinds)\n else\n relationships[sym]\n end\n end",
"title": ""
},
{
"docid": "fce634c3f42dcf32929dd289a46197b4",
"score": "0.50144994",
"text": "def add_package_relationship(type, target)\n @rels.push([Package_schema + type, target])\n end",
"title": ""
},
{
"docid": "2c7d159ba6e2eb6ab6f45fe1c4f277e0",
"score": "0.49958038",
"text": "def relate base, name, metadata\n base.relations_sleeping_king_studios.update metadata.relation_key => metadata\n end",
"title": ""
},
{
"docid": "ef698277ecc25597f0767d9876e9c7d7",
"score": "0.49915737",
"text": "def attach_relationship(data) #FIXME: Method doesn't work, RelationshipManager cannot access to id attribute.\n return @client.raw(\"post\", \"/config/relationships/attach\", nil, data)\n end",
"title": ""
},
{
"docid": "a583ee81ad02c000056520a84f97562d",
"score": "0.49691847",
"text": "def set_firend_relationship\n @firend_relationship = FirendRelationship.find(params[:id])\n end",
"title": ""
},
{
"docid": "ad2fdf49f0aa9e175957f12a37ea8a9e",
"score": "0.49686882",
"text": "def child_association(method)\n if @resource_config[:child_assoc]\n raise DefinitionError, \"child_association already declared in #{self}\"\n end\n @resource_config[:child_assoc] = method\n end",
"title": ""
},
{
"docid": "d5561b42d1d467856a4f572ce1ef6530",
"score": "0.4968627",
"text": "def association(association_name); end",
"title": ""
},
{
"docid": "ce89c15952bbd9441f60333fe6f85042",
"score": "0.49683136",
"text": "def setup_associates(klass, relation, _meta, parent_relation)\n assoc_name =\n if relation.associations.key?(parent_relation)\n parent_relation\n else\n singular_name = inflector.singularize(parent_relation).to_sym\n singular_name if relation.associations.key?(singular_name)\n end\n\n if assoc_name\n klass.associates(assoc_name)\n else\n klass.associates(parent_relation)\n end\n end",
"title": ""
},
{
"docid": "cc8b4d9d0ec8b0d3d1e3cdeded52bffa",
"score": "0.49674833",
"text": "def set_RelationshipType(value)\n set_input(\"RelationshipType\", value)\n end",
"title": ""
},
{
"docid": "da0b6f4810e2b163b38ce2dc0c28d758",
"score": "0.4966208",
"text": "def association\n @association ||= model.reflect_on_association(@name)\n end",
"title": ""
},
{
"docid": "fe9be0d14f9345330917abbce6b4c409",
"score": "0.4963406",
"text": "def association (name, options = {})\n factory_name = options.delete(:factory) || name\n if factory_name_for(factory_name) == self.factory_name\n raise AssociationDefinitionError, \"Self-referencing association '#{name}' in factory '#{self.factory_name}'\"\n end\n @attributes << Attribute::Association.new(name, factory_name, options)\n end",
"title": ""
},
{
"docid": "2e3188008321ba55e1bd2864c49d1919",
"score": "0.49602625",
"text": "def requires(*attrs)\n set_requirements(attrs)\n end",
"title": ""
},
{
"docid": "35da404e871255784c3728f1284c4c92",
"score": "0.49575904",
"text": "def has_one(rel_type, params = {})\n clazz = self\n module_eval(%Q{def #{rel_type}=(value)\n dsl = #{clazz}.decl_relationships[:'#{rel_type.to_s}']\n r = Neo4j::Relationships::HasN.new(self, dsl)\n r.each {|n| n.del} # delete previous relationships, only one can exist\n r << value\n r\n end}, __FILE__, __LINE__)\n\n module_eval(%Q{def #{rel_type}\n dsl = #{clazz}.decl_relationships[:'#{rel_type.to_s}']\n r = Neo4j::Relationships::HasN.new(self, dsl)\n [*r][0]\n end}, __FILE__, __LINE__)\n\n module_eval(%Q{\n def #{rel_type}_rel\n dsl = #{clazz}.decl_relationships[:'#{rel_type.to_s}']\n r = Neo4j::Relationships::HasN.new(self, dsl).rels\n [*r][0]\n end}, __FILE__, __LINE__)\n\n decl_relationships[rel_type.to_sym] = Neo4j::Relationships::DeclRelationshipDsl.new(rel_type, params)\n end",
"title": ""
},
{
"docid": "56e1bceb58be4adc8817eaaefa8dbc2f",
"score": "0.4939293",
"text": "def set_user_relationship\n @user_relationship = UserRelationship.find(params[:id])\n end",
"title": ""
},
{
"docid": "8e6e5a7e2f9328baa7b0f65b4b38ca2e",
"score": "0.4937428",
"text": "def require!\n @required = true\n end",
"title": ""
},
{
"docid": "8e6e5a7e2f9328baa7b0f65b4b38ca2e",
"score": "0.4937428",
"text": "def require!\n @required = true\n end",
"title": ""
},
{
"docid": "dabae118278249846a6bd594327a495b",
"score": "0.49204654",
"text": "def belongs_to(*attrs)\n define_rid_method = attrs[1].try(:delete, :rid)\n super.tap do\n if define_rid_method != false\n relationship_name = attrs[0]\n rel = reflections[relationship_name] || reflections[relationship_name.to_s]\n\n return if rel.options[:polymorphic] # If we don't know the class, we cannot find the record by rid.\n\n class_name = rel.options[:class_name] || relationship_name.to_s.classify\n related_class = class_name.constantize\n define_rid_accessors(related_class, relationship_name) if related_class.attribute_names.include? \"rid\"\n end\n end\n end",
"title": ""
},
{
"docid": "e02f7a36a7706ce084543493850b055b",
"score": "0.49167988",
"text": "def set_association\n @association = Association.find(params[:id])\n end",
"title": ""
},
{
"docid": "e894e5b1c38aaf5b5152d8708fb0fc9b",
"score": "0.4916093",
"text": "def belongs_to name, opts={}\n opts.merge! :type => :belongs_to, :from => self\n relation = FAP::Relation.new name, opts\n self.relations << relation\n define_relation_getter relation\n end",
"title": ""
},
{
"docid": "fce3e6fa83f20475f76539bc286d586a",
"score": "0.49125242",
"text": "def requires!(*args)\n self.class.requires!(*args)\n end",
"title": ""
},
{
"docid": "bdd72ad6f14b3e7f843ed091ab74d33f",
"score": "0.49065194",
"text": "def change_suggested_relationship_state\n if self.new_record?\n rel = self.startup_relationship\n if self.interested?\n rel.approve! # turns it to pending state\n else\n rel.reject_or_pass! # sets it as passed\n end\n end\n true\n end",
"title": ""
},
{
"docid": "fad2805cd000ba89f208df3a95c0059b",
"score": "0.48984194",
"text": "def set_relation(name, relation)\n instance_variable_set(\"@_#{name}\", relation)\n end",
"title": ""
},
{
"docid": "44b6d3a6df7a7784654067a1e8478380",
"score": "0.489798",
"text": "def relation\n if relation_name\n rom.relations[relation_name]\n else\n raise \"relation must be specified to use uniqueness validation\"\n end\n end",
"title": ""
},
{
"docid": "80402cf345bd7caba07d478e40ce9f0c",
"score": "0.48860213",
"text": "def association(name)\n if reflection = _scope.reflect_on_association(name)\n Association.new(self, reflection)\n else\n raise AssociationNotFoundError.new(_scope.model_name, name)\n end\n end",
"title": ""
},
{
"docid": "82350c5013d54402e50e5e37ed700dac",
"score": "0.488549",
"text": "def belongs_to(direction, name = nil, options = { type: nil })\n if name.is_a?(Hash)\n options.merge(name)\n name = direction\n direction = nil\n elsif name.is_a?(Proc)\n name = direction\n direction = nil\n elsif name.nil?\n name = direction\n end\n reflections[name] = { direction: direction, type: options[:type], kind: :belongs_to }\n\n define_method(\"promise_#{name}\") do\n @fetch_states[name] = 'i'\n self.class._promise_get(\"#{self.class.resource_base_uri}/#{self.id}/relations/#{name}.json?timestamp=#{`Date.now() + Math.random()`}\").then do |response|\n @relations[name] = if response.json[self.class.to_s.underscore][name]\n self.class._convert_json_hash_to_record(response.json[self.class.to_s.underscore][name])\n else\n nil\n end\n @fetch_states[name] = 'f'\n _notify_observers\n @relations[name]\n end.fail do |response|\n error_message = \"#{self.class.to_s}[#{self.id}].#{name}, a belongs_to association, failed to fetch records!\"\n `console.error(error_message)`\n response\n end\n end\n # @!method [name] get records of the relation\n # @return [HyperRecord::Collection] either a empty one, if the data has not been fetched yet, or the\n # collection with the real data, if it has been fetched already\n define_method(name) do\n _register_observer\n if @fetch_states.has_key?(name) && 'fi'.include?(@fetch_states[name])\n @relations[name]\n elsif self.id\n send(\"promise_#{name}\")\n @relations[name]\n else\n @relations[name]\n end\n end\n # @!method update_[name] mark internal structures so that the relation data is updated once it is requested again\n # @return nil\n define_method(\"update_#{name}\") do\n @fetch_states[name] = 'u'\n nil\n end\n # TODO\n # define_method(\"#{name}=\") do |arg|\n # _register_observer\n # @relations[name] = arg\n # @fetch_states[name] = 'f'\n # @relations[name]\n # end\n end",
"title": ""
},
{
"docid": "78146bfc54ec1e00624d5fda2780a767",
"score": "0.4877323",
"text": "def set_aoo_ref\n @aoo_ref = AooRef.find(params[:id])\n end",
"title": ""
},
{
"docid": "95c0b2d197f779f829717229d3079c77",
"score": "0.4876665",
"text": "def relation_of(field)\n meta = meta_of(field)\n meta ? meta.relation : nil\n end",
"title": ""
},
{
"docid": "44a728f553018e120eb68ccdbe96aa4b",
"score": "0.48709762",
"text": "def relationship_for_isolated_root\n Relationship.new(:resource => self)\n end",
"title": ""
},
{
"docid": "a5c6f4cc333d69477bf16752c60215b7",
"score": "0.48709506",
"text": "def relationship\n return @relationship\n end",
"title": ""
},
{
"docid": "04fc8daff79318f405e0646b5cb011ca",
"score": "0.48680112",
"text": "def set_relation\n @relation = Relation.find(params[:id])\n end",
"title": ""
},
{
"docid": "04fc8daff79318f405e0646b5cb011ca",
"score": "0.48680112",
"text": "def set_relation\n @relation = Relation.find(params[:id])\n end",
"title": ""
},
{
"docid": "2c5a56688617824c14805c032024e425",
"score": "0.4867102",
"text": "def add_association(type, class_name, name)\n define_method(name) do\n Associations::Factory.create(type, name, self)\n end\n define_method(\"#{name}=\") do |object|\n object.parentize(self, name)\n @attributes[name] = object.mongoidize\n end\n end",
"title": ""
},
{
"docid": "f0ee182f61ba22805ffbcc0d9a361c00",
"score": "0.48669916",
"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": "461531d691ce1b442407a7290fc9e0a8",
"score": "0.48654377",
"text": "def relation\n relation = nodes.reduce(root) do |a, e|\n a.associations[e.name.key].join(:join, a, e)\n end\n schema.(relation)\n end",
"title": ""
},
{
"docid": "ff6d7ef85f4c6b92aa86c4b207c195f1",
"score": "0.48649275",
"text": "def set_relation_with(other_id, action, nick)\n\t\treturn OWN if other_id == id\n\t\t#cant use find_or_create_by, final status unknown\n\t\trelation = Relation.new(user_id: id, friend_id: other_id) unless relation = Relation.relates(id, other_id)\n\t\tcase action\n\t\twhen ALIAS\n\t\t\trelation.set_alias(nick)\n\t\twhen FRIEND\n\t\t\trelation.accepts(nick)\n\t\twhen REQUEST\n\t\t\trelation.request(nick)\n\t\twhen STRANGER\n\t\t\trelation.unfriend\n\t\twhen BLOCKED\n\t\t\trelation.block(nick)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "e1c01ed122c0c0a1503a01825ce9f02f",
"score": "0.48642436",
"text": "def association\n a = element.dataset[:association]\n # send is spoopy, make sure the message you're sending is actually an association\n return unless safe?(session[:model], a)\n\n session[:model].send(a)\n end",
"title": ""
},
{
"docid": "032d5cf81d8710f5fa1c4945f2134acf",
"score": "0.4862799",
"text": "def _set_associated_object(opts, o)\n a = associations[opts[:name]]\n return if a && a == o && !set_associated_object_if_same?\n run_association_callbacks(opts, :before_set, o)\n remove_reciprocal_object(opts, a) if a\n send(opts._setter_method, o)\n associations[opts[:name]] = o\n add_reciprocal_object(opts, o) if o\n run_association_callbacks(opts, :after_set, o)\n o\n end",
"title": ""
},
{
"docid": "b5f76b2cddcb8f616da87ec1f73910c2",
"score": "0.48556542",
"text": "def set_party_relationship_type\n @party_relationship_type = PartyRelationshipType.find(params[:id])\n end",
"title": ""
},
{
"docid": "75c2a6dcf357cde8ef9a671d095de2f5",
"score": "0.48518175",
"text": "def related?\n self.rel == \"related\"\n end",
"title": ""
},
{
"docid": "2dafb813424e3baa3b34659dfd78ef72",
"score": "0.48380244",
"text": "def association_for(ass_name)\n ass = relation.all_associations.detect { |ass| ass.name == ass_name }\n ass.scope = {} # no scope can be determined by SQL reflection\n ass.resolver = self.class.new(ass.associated_table)\n ass\n end",
"title": ""
},
{
"docid": "705bb1cc13c04eb20c897825436dca11",
"score": "0.48316482",
"text": "def set_pending_relation(name, aliased, value)\n if stored_as_associations.include?(name)\n pending_relations[aliased] = value\n else\n pending_relations[name] = value\n end\n end",
"title": ""
},
{
"docid": "d9f07db76d106fc9898b074e4a750a26",
"score": "0.48312134",
"text": "def rel(rels)\n # rel must be an array.\n data[:rel] = Array(rels)\n end",
"title": ""
},
{
"docid": "66fa04f0cb2cd9e07a0b0a52377f10d2",
"score": "0.48256055",
"text": "def set_requisition\n @resquisition = Requisition.find(params[:id])\n end",
"title": ""
},
{
"docid": "8e77d281b58ea26beb72938321379a02",
"score": "0.48250422",
"text": "def has_one(association_name, options = {})\n database.schema[self].associations << HasManyAssociation.new(self, association_name, options)\n end",
"title": ""
},
{
"docid": "b28d7fca085505837d9c18877a9dd8f5",
"score": "0.48234224",
"text": "def model_relationships; end",
"title": ""
},
{
"docid": "068d7fa6e107b584c6cba9e25f2dc256",
"score": "0.48189214",
"text": "def set_correspondence\n @correspondence = Correspondence.find(params[:id])\n end",
"title": ""
},
{
"docid": "3f52dc24daace2ff55a437fff76535a0",
"score": "0.48178852",
"text": "def get_relation(name, metadata, object, reload = false)\n if !reload && (value = ivar(name)) != false\n value\n else\n _building do\n _loading do\n if object && needs_no_database_query?(object, metadata)\n __build__(name, object, metadata)\n else\n __build__(name, attributes[metadata.key], metadata)\n end\n end\n end\n end\n end",
"title": ""
}
] |
42ea3b6e336f89295dad55383c36d8e3 | init brush data and brush image | [
{
"docid": "2224ad0b702628ef5279f0fbaf6f91ce",
"score": "0.6624973",
"text": "def init(size_enable = true)\r\n unless size_enable\r\n @size = 1\r\n end\r\n @w, @h = @size, @size\r\n\r\n cname = get_chr_set_name\r\n @brush_data = MapData.new(@w, @h, $fg_color, $bg_color, cname, $chr_idx)\r\n @erase_data = MapData.new(@w, @h, [0,0,0,0], [0,0,0,0], $def_chr_set, 0)\r\n @brush_img = @brush_data.create_image(cname)\r\n @guide_img = make_guide_img(@brush_img.width, @brush_img.height)\r\n end",
"title": ""
}
] | [
{
"docid": "c3070fcbbb31fba0b98f44e5d0e70871",
"score": "0.5845732",
"text": "def set_carbon_brush\n @carbon_brush = CarbonBrush.find(params[:id])\n end",
"title": ""
},
{
"docid": "af21cbc891080aa33acb880ab48278ff",
"score": "0.58397686",
"text": "def brush(*args)\n canvas_pattern(Sass::Script::String.new(Compass::Canvas::Actions::BRUSH), *args)\n end",
"title": ""
},
{
"docid": "a243a790bd469cd46280d9482b2d23a9",
"score": "0.57859117",
"text": "def init\n cleanup\n draw\n end",
"title": ""
},
{
"docid": "ed2e9ce5c04b0817238d46307b11598f",
"score": "0.5716721",
"text": "def set_bitmap\n #self.bitmap = Bitmap.new(32,32)\n #self.bitmap.fill_rect(0,0,32,32,Color.new(0,0,0))\n #return;\n if @iso\n if FileTest.exist?('Graphics/Pictures/GTBS/iso_cursor.png')\n self.bitmap = Cache.picture(\"GTBS/iso_cursor\")\n else\n #iso cursor draw method\n bmp = Bitmap.new(62,32)\n color = Color.new(255,255,255)\n for x in 0..62\n uy = (16 - x * (0.51)).to_i\n dy = (16 + x * (0.51)).to_i\n if x >= 31\n uy += 31\n dy -= 31\n end\n bmp.set_pixel(x,uy,color)\n bmp.set_pixel(x,dy,color)\n end\n self.bitmap = bmp\n end\n else\n if FileTest.exist?('Graphics/Pictures/GTBS/cursor.png')\n self.bitmap = Cache.picture(\"GTBS/cursor\")\n else\n #create cursor manually\n bmp = Bitmap.new(32,32)\n # B B B B B B\n # B W W W W B\n # B W b b b b\n # B W b\n # B W b\n # B B b\n \n #upper left corner\n bmp.fill_rect(0,0,15,15,Color.new(0,0,0,255))#B\n bmp.fill_rect(1,1,13,13,Color.new(255,255,255,255))#W\n bmp.fill_rect(4,4,10,10,Color.new(0,0,0,255))#b\n bmp.fill_rect(5,5,13,13,Color.new(0,0,0,0))# blank\n #lower right corner\n bmp.fill_rect(18,18,15,15,Color.new(0,0,0,255))\n bmp.fill_rect(19,19,12,12,Color.new(255,255,255,255))\n bmp.fill_rect(18,18,10,10,Color.new(0,0,0,255))\n bmp.fill_rect(18,18,9,9,Color.new(0,0,0,0))\n #lower left corner\n bmp.fill_rect(0,18,15,15,Color.new(0,0,0,255))\n bmp.fill_rect(1,19,13,12,Color.new(255,255,255,255))\n bmp.fill_rect(4,18,10,10,Color.new(0,0,0,255))\n bmp.fill_rect(5,18,10,9,Color.new(0,0,0,0))\n #upper right corner\n bmp.fill_rect(18,0,15,15,Color.new(0,0,0,255))\n bmp.fill_rect(19,1,12,13,Color.new(255,255,255,255))\n bmp.fill_rect(18,4,10,10,Color.new(0,0,0,255))\n bmp.fill_rect(18,5,9,10,Color.new(0,0,0,0))\n self.bitmap = bmp\n end\n end\n end",
"title": ""
},
{
"docid": "d15bd3d937e6bc3158161ff2570fd044",
"score": "0.5699389",
"text": "def init_snow\n return if @snow_bitmap && !@snow_bitmap.disposed?\n color1 = Color.new(255, 255, 255, 255)\n color2 = Color.new(255, 255, 255, 128)\n @snow_bitmap = Bitmap.new(6, 6)\n @snow_bitmap.fill_rect(0, 1, 6, 4, color2)\n @snow_bitmap.fill_rect(1, 0, 4, 6, color2)\n @snow_bitmap.fill_rect(1, 2, 4, 2, color1)\n @snow_bitmap.fill_rect(2, 1, 2, 4, color1)\n @snow_bitmap.update\n end",
"title": ""
},
{
"docid": "5285a8cbff65b47dfb6064b13a961c6f",
"score": "0.56296545",
"text": "def create\n\t\t\tif !@fill.nil?\n\t\t\t\tbackpixel = Pixel.new(@fill.fg,@fill.bg,@fill.symbol)\n\t\t\t\tobj = Array.new(@height){ Array.new(@width) { backpixel } }\n\t\t\telse\n\t\t\t\tobj = Array.new(@height){ Array.new(@width) }\n\t\t\tend\n\n\t\t\t(@width-2).times do |i|\n\t\t\t\tobj[0][i+1] = @horizontal\n\t\t\t\tobj[@height-1][i+1] = @horizontal\n\t\t\tend\n\n\t\t\t(@height-2).times do |i|\n\t\t\t\tobj[i+1][0] = @vertical\n\t\t\t\tobj[i+1][@width-1] = @vertical\n\t\t\tend\n\n\t\t\tobj[0][0] = @corner\n\t\t\tobj[0][@width-1] = @corner\n\t\t\tobj[@height-1][0] = @corner\n\t\t\tobj[@height-1][@width-1] = @corner\n\n\t\t\t@height = obj.size\n\t\t\t@width = obj[0].size\n\t\t\t@obj = obj\n\t\tend",
"title": ""
},
{
"docid": "16a1cb0a1fb783367f29e1dc60a56de5",
"score": "0.5597483",
"text": "def render \n @draw = CustomDraw.new\n @draw.fill('black')\n @draw.fill_opacity(0)\n @draw.stroke('black')\n @draw.stroke_width(1)\n \n @draw.font = @font_path\n @draw.pointsize = @font_size\n @draw.font_family = \"Courier New\"\n \n @image = Image.new(@width + 2, height + @padding) do\n self.background_color = 'white'\n end\n \n @root.render_at(\n [@padding + 1, @width - @padding - 1],\n @padding + 1\n )\n\n @draw.draw @image\n\n image_data\n end",
"title": ""
},
{
"docid": "b9a1567ab7a306868bf73416dba8ac83",
"score": "0.5579582",
"text": "def fill_setup(graphics_context)\n @obj.apply_fill(graphics_context)\n end",
"title": ""
},
{
"docid": "c3e62dff002ab23d4b83af190b54acb3",
"score": "0.55724466",
"text": "def setup\n [ :focus, :selected, :disabled, :hover ].inject('') do | out, extra_img |\n if send(extra_img)\n out << \"#{var_name}.bitmap_#{extra_img} = \"\n out << \" Wx::Bitmap.new('#{send(extra_img)}')\\n\"\n end\n out\n end\n end",
"title": ""
},
{
"docid": "44b16f7b99134dda6d057b03f8286bd6",
"score": "0.5565794",
"text": "def initialize(data, h = TTY::Screen.height)\n @rows = h\n @color = Pastel.new\n\n @selected = 0\n update!(data)\n end",
"title": ""
},
{
"docid": "65c45d27047d8539509baa39fc509dc4",
"score": "0.55576926",
"text": "def initialize(x, y, w_top, w_bot, h)\n super()\n if w_top > w_bot \n raise ArgumentError, \"wtop (#{w_top}) > wbot (#{w_bot})\"\n end\n w_in = (w_bot - w_top) / 2\n @rect = Rect.new(x,y-h, w_bot, h )\n @image = Surface.new([w_bot, h])\n @image.set_colorkey([0,0,0]) # TODO: need to base on backround\n @image.draw_polygon_s([[0,h], [w_in,0], [w_in + w_top, 0], [w_bot,h], [0,h]],[100,100,100]) # TODO: fix color\n end",
"title": ""
},
{
"docid": "65c45d27047d8539509baa39fc509dc4",
"score": "0.55576926",
"text": "def initialize(x, y, w_top, w_bot, h)\n super()\n if w_top > w_bot \n raise ArgumentError, \"wtop (#{w_top}) > wbot (#{w_bot})\"\n end\n w_in = (w_bot - w_top) / 2\n @rect = Rect.new(x,y-h, w_bot, h )\n @image = Surface.new([w_bot, h])\n @image.set_colorkey([0,0,0]) # TODO: need to base on backround\n @image.draw_polygon_s([[0,h], [w_in,0], [w_in + w_top, 0], [w_bot,h], [0,h]],[100,100,100]) # TODO: fix color\n end",
"title": ""
},
{
"docid": "96cb71d51ca9f91dfe7a6f3acadbc6ed",
"score": "0.5535401",
"text": "def initialize(width, height, background = [255,255,255])\r\n @height = height\r\n @width = width\r\n @data = Array.new(@height) { |x| Array.new(@width, background) }\r\n end",
"title": ""
},
{
"docid": "c32cccd786a832fa98a1e5e04d6952fa",
"score": "0.55240107",
"text": "def draw\n #Background gradient\n fill_gradient(:from => Color::BLUE, :to => Color::CYAN)\n #Draw rectangle bar\n fill_rect([128, 592, 768, 16], Color::YELLOW)\n #Draw cleared image\n @cleared_image.draw(456, 116, 100, 3, 3)\n super\n end",
"title": ""
},
{
"docid": "f1c0d1ba14d0805f9d77b784911140b3",
"score": "0.55118245",
"text": "def initialize(img, color_hex, font_size, coord_x, coord_y, text_value)\n @img, @color_hex, @font_size, @coord_x, @coord_y, @text = img, color_hex, font_size, coord_x, coord_y, text_value\n end",
"title": ""
},
{
"docid": "0f84ac3630ab8710a1162cf56766caba",
"score": "0.5510547",
"text": "def initialize(x, y, width, height)\n super(x, y, width, height)\n self.contents = Bitmap.new(width - 32, height - 32)\n self.opacity = 0\n self.back_opacity = 0\n self.contents_opacity = 0\n self.visible = true\n self.active = true\n #@id = id\n refresh\n @faded_in = false\n end",
"title": ""
},
{
"docid": "f67682107a85e72bca6cf692338a0fa1",
"score": "0.54881895",
"text": "def setup_drawing\n calculate_spread\n calculate_increment\n set_colors\n normalize\n setup_graph_measurements\n sort_norm_data if @sorted_drawing # Sort norm_data with avg largest values set first (for display)\n end",
"title": ""
},
{
"docid": "4ecc468a084be11268a87e4707f11626",
"score": "0.547061",
"text": "def initialize(window, rect, bitmap, src_rect, align=0, opacity=255, \n valign=0, border=0, border_color=nil,\n active=true, visible=true)\n super(active, visible)\n \n if border > 0 && !border_color.nil?\n vertices = [[rect.x, rect.y],[rect.x+rect.width, rect.y],\n [rect.x+rect.width, rect.y+rect.height],\n [rect.x, rect.y+rect.height]]\n @cBorders = CPolygon.new(window, vertices, nil, false, nil,\n border, border_color)\n rect = Rect.new(rect.x + border, rect.y + border, \n rect.width - border*2, rect.height - border*2)\n end\n \n @cImage = CImage.new(window, rect, bitmap, src_rect, align, opacity, valign)\n end",
"title": ""
},
{
"docid": "9abe310b3a3a825545e848a1882d33c6",
"score": "0.5424139",
"text": "def initProg\n # REF: def build_image \\\n # (width=20, height=10, hex_color=\"000000\", hex_offset=\"100\", x_multiplier=10, y_multiplier=100, orientation=\"horiz\") \\\n # - build an image up from one pixel\n\n setStyleSheet \"QWidget { background-color: #000000 }\"\n ### REF: \n #\n # Creates initial images\n #\n \n calculate_board if $game_board==true\n calculate_board_persp if $persp_board == true\n build_image_arrays\n build_lines\n \n \n \n # Build patterns from the orginial images, and pass to separate arrays for display later.\n patterns($orig_images[0], $active_images) \n patterns($orig_images[1], $active_images_2) \n \n # This was used as part of the build process, might get rid of it, or reincorporate.\n #\n if $oneimage != 1\n $active_images.push $orig_images[0].mirrored(true,false)\n $active_images.push $orig_images[0].rgbSwapped\n $active_images.push build_image(20, 10, \"#0000FF\", \"F\", 5, 10)\n $active_images.push build_image(10, 20, \"#00FF00\", \"F\", 1, 5)\n $active_images.push build_image(10, 20, \"#FF0000\", \"F\", 10, 5)\n # $active_images.push $active_images[3].invertPixels\n \n # outputs to console, shows attributes\n print \"Our Image, W:\", $orig_images[0].width, \", H:\", $orig_images[0].height, \"\\n\"\n puts $orig_imagess[0].color(0)\n @test_abc=$orig_images[0].copy(0,0,5,5)\n print \"@test_abc, W:\", @test_abc.width, \", H:\", @test_abc.height, \"\\n\"\n print \"Pixel(2,3): \",@test_abc.pixel(2,3), \"\\n\"\n @redColor = Qt::Color.new 255, 175, 175\n print \"@redColor: \", @redColor, \"\\n\"\n else\n print \"*** One Image Only *** \\n\"\n\n end\n end",
"title": ""
},
{
"docid": "9e0cb09620afdf344cf6a269fb649a33",
"score": "0.5419186",
"text": "def execute\n fail MissingBitmap if app.bitmap.nil?\n @saved_data = app.bitmap[x, y]\n fill(app.bitmap, x, y, app.bitmap[x, y], colour)\n end",
"title": ""
},
{
"docid": "181f56ee52ae6e887dc91f72b85a8292",
"score": "0.5388728",
"text": "def initialize canvas\n @height = canvas.height\n @width = canvas.width\n @bits = 8\n @data = canvas.data\n end",
"title": ""
},
{
"docid": "9399b94dcb38ab9c939b783590758378",
"score": "0.53735924",
"text": "def initialize()\n @drawingArray = []\n @currentIndex = 0\n end",
"title": ""
},
{
"docid": "24f306b3090d8652aa7893c4f7434d35",
"score": "0.53735",
"text": "def initialize\n @back = Sprite.new\n @icons = []\n @cursor = Sprite.new\n @item_index = 0\n \n @border_color = Border_Color\n @back_color = Back_Color\n @box_color = Box_Color\n \n refresh\n end",
"title": ""
},
{
"docid": "e7e0a14ed6195b87b6a0beca12f19c7e",
"score": "0.53487647",
"text": "def initialize(parent, background=\"/../../../Assets/Backgrounds/fond_low_poly.png\")\n screen = Constants::SCREEN\n @parent=parent\n \t@buffer = GdkPixbuf::Pixbuf.new(file: File.dirname(__FILE__) + background)\n @buffer=@buffer.scale(screen.width,screen.height)\n end",
"title": ""
},
{
"docid": "504c4ece17cfa5106f217ff8d9fa89ae",
"score": "0.53318465",
"text": "def set_image(widget, pixbuf)\n widget.pixbuf = pixbuf\n end",
"title": ""
},
{
"docid": "f99744a7177b213eccbc88bf41f61822",
"score": "0.53256387",
"text": "def initialize options\n\t\t\t@x = options[:x]\n\t\t\t@y = options[:y]\n\t\t\t@width = options[:width]\n\t\t\t@height = options[:height]\n\n\t\t\treturn if @x.nil? or @y.nil? or @width.nil? or @height.nil?\n\n\t\t\t@fill = options[:fill]\n\n\t\t\t@vertical = options[:vertical]\n\t\t\t@horizontal = options[:horizontal]\n\t\t\t@corner \t= options[:corner]\n\t\t\tref = Theme.get(:border)\n\t\t\t@horizontal = Pixel.new(ref.fg,ref.bg,\"-\") if options[:horizontal].nil?\n\t\t\t@vertical = Pixel.new(ref.fg,ref.bg,\"|\") if options[:vertical].nil?\n\t\t\t@corner = Pixel.new(ref.fg,ref.bg,\"*\") if options[:corner].nil?\n\n\t\t\t@width = 3 if @width < 3\n\t\t\t@height = 3 if @height < 3\n\n\t\t\tcreate\n\t\tend",
"title": ""
},
{
"docid": "459acc05c2265b90b0c5ea9c56134c25",
"score": "0.5297662",
"text": "def generate_image\n UIGraphicsBeginImageContextWithOptions(@image_size.to_a, false, 0.0)\n context = UIGraphicsGetCurrentContext()\n setup_context(context)\n @colour.set\n if @original_points.length == 1\n draw_sole_point(context)\n else\n draw_path_of_points(context)\n end\n @image = UIGraphicsGetImageFromCurrentImageContext()\n UIGraphicsEndImageContext()\n end",
"title": ""
},
{
"docid": "5ef6d8cc6101f49d9ecd48134e95a6ba",
"score": "0.5286559",
"text": "def initialize (color, top_left, bottom_right)\n super\n @shapes = []\n end",
"title": ""
},
{
"docid": "ca44541f612786df7c69f319aad5090a",
"score": "0.52820593",
"text": "def initialize(window, image)\n @canvas_calls = []\n @window = window\n @image = image\n end",
"title": ""
},
{
"docid": "bb3dd016f71d0d396e95138408615032",
"score": "0.5264262",
"text": "def execute\n fail MissingBitmap if app.bitmap.nil?\n @saved_data = app.bitmap[x, y]\n app.bitmap[x, y] = colour\n end",
"title": ""
},
{
"docid": "ef563d93626227f88a3c81e64cf4e5ea",
"score": "0.52532965",
"text": "def meter_setup\n # Get the pixmap from the gtk image on the meter window\n @mpix = Gdk::Pixmap.new(@meter.window, IMAGE_WIDTH, 52, -1) # 52 = 16*2+8*2+1*4\n\n # Get the image graphic context and set the foreground color to white\n @gc = Gdk::GC.new(@meter.window)\n\n # Get the meter image, unlit and lit images from their files\n scale = GdkPixbuf::Pixbuf.new(file: Cfg.icons_dir+\"k14-scaleH.png\")\n @dark = GdkPixbuf::Pixbuf.new(file: Cfg.icons_dir+\"k14-meterH0.png\")\n @bright = GdkPixbuf::Pixbuf.new(file: Cfg.icons_dir+\"k14-meterH1.png\")\n\n # Start splitting the meter image to build the definitive bitmap as the scale image\n # is not the final image onto which we draw\n # draw_pixbuf(gc, pixbuf, src_x, src_y, dest_x, dest_y, width, height, dither, x_dither, y_dither)\n @mpix.draw_pixbuf(nil, scale, 0, 4, 0, 0, 469, 16, Gdk::RGB::DITHER_NONE, 0, 0)\n\n @mpix.draw_pixbuf(nil, @dark, 0, 0, 0, 16, 469, 8, Gdk::RGB::DITHER_NONE, 0, 0)\n\n @mpix.draw_pixbuf(nil, scale, 0, 0, 0, 24, 469, 4, Gdk::RGB::DITHER_NONE, 0, 0)\n\n @mpix.draw_pixbuf(nil, @dark, 0, 0, 0, 28, 469, 8, Gdk::RGB::DITHER_NONE, 0, 0)\n\n @mpix.draw_pixbuf(nil, scale, 0, 0, 0, 36, 469, 16, Gdk::RGB::DITHER_NONE, 0, 0)\n # At this point, @mpix contains the definitive bitmap\n\n # Draw the bitmap on screen\n @meter.set(@mpix, nil)\n end",
"title": ""
},
{
"docid": "05e9297168acd824b300fd6de711e2cd",
"score": "0.52516836",
"text": "def initialize(image_path)\n @metadata = {}\n @bands = []\n @raw_gdalinfo = `#{GDALInfoWrapper.gdalinfo_exe} -hist #{image_path}`.split(\"\\n\")\n @total_bands = 0\n i = 0 \n while i < @raw_gdalinfo.length do\n line = @raw_gdalinfo[i]\n case line\n when /Size is/\n m = /(\\d+), (\\d+)/.match(line)\n @width = m[1].to_i\n @height = m[2].to_i\n when /Coordinate System is:/\n @coordinate_system = \"\"\n i += 1\n while !(@raw_gdalinfo[i] =~ /Origin = /) do\n @coordinate_system += @raw_gdalinfo[i]\n i += 1\n end\n i -= 1\n when /Origin = /\n m = Util::POINT_REGEX.match(line)\n @origin_point = Point.new(m[1].to_f, m[2].to_f)\n when /Pixel Size = /\n m = Util::POINT_REGEX.match(line)\n @pixel_size = Point.new(m[1].to_f, m[2].to_f)\n when /Metadata:/\n i += 1 \n while m = Util::METADATA_REGEX.match(@raw_gdalinfo[i]) do\n @metadata[m[1]] = m[2]\n i += 1\n end\n i -= 1\n when /Corner Coordinates:/\n i += 1\n while m = /(((Upper|Lower)\\s*(Left|Right))|(Center))\\s*#{Util::POINT_REGEX}/.match(@raw_gdalinfo[i]) do\n instance_variable_set(\"@#{Util.underscore(m[1])}\", Point.new(m[6].to_f, m[7].to_f))\n i += 1\n end\n i -= 1\n when /Band \\d+/\n @total_bands += 1\n j = i + 1\n j += 1 while j < @raw_gdalinfo.length && !(/Band \\d+/ =~ @raw_gdalinfo[j])\n\n # band line\n m = /(Band \\d+).+?Type=(.+?),\\s*ColorInterp=(\\S+)/.match(line)\n band_variable_name = Util.underscore(m[1]).gsub(\"_\", \"\")\n self.class.send(:attr_accessor, band_variable_name)\n band = Band.new()\n band.type = m[2]\n band.color_interp = m[3]\n\n # We now have our array for our band\n while i < j do\n line = @raw_gdalinfo[i]\n case line\n when /\\A(\\d|\\s)+\\Z/\n # just buckets\n band.buckets = @raw_gdalinfo[i].split(\" \").map(&:to_i)\n when /Overviews: (.+?)/\n band.overviews = $~[1]\n when /Metadata:/\n i += 1 \n while m = Util::METADATA_REGEX.match(@raw_gdalinfo[i]) do\n band.metadata[m[1]] = m[2]\n i += 1\n end\n i -= 1\n end\n i += 1\n end\n i -= 1\n instance_variable_set(\"@#{band_variable_name}\", band)\n end\n i += 1 \n end\n end",
"title": ""
},
{
"docid": "8ab64185a76824f04b5591941f53f176",
"score": "0.5244085",
"text": "def execute\n fail MissingBitmap if app.bitmap.nil?\n @saved_data = \"\"\n (y1..y2).each do |y|\n @saved_data << app.bitmap[x, y]\n app.bitmap[x, y] = colour\n end\n end",
"title": ""
},
{
"docid": "bb76159d760255efb92030e5aff0f7a1",
"score": "0.52434057",
"text": "def initialize(canvas)\n @canvas = canvas\n @bounds = @canvas.get_bounds_in_local\n @gc = @canvas.get_graphics_context2_d\n @pen_color = COLOR\n @pen_size = PEN_SIZE\n @dot_color = COLOR\n @dot_size = DOT_SIZE\n @background = BACKGROUND\n home\n pen_down\n end",
"title": ""
},
{
"docid": "1f28398202482f6286f4355135624624",
"score": "0.5234611",
"text": "def initialize(*args)\n raise \"Need 4 arguments\" unless args.length == 4\n bitmap = BITMAP_TEMPLATE.dup\n args.each_with_index do |colour, index|\n bitmap[OFFSETS[index]+2] = colour[0..1] # R\n bitmap[OFFSETS[index]+1] = colour[2..3] # G\n bitmap[OFFSETS[index]] = colour[4..5] # B\n end\n @bitmap = bitmap.map(&:hex).pack('C*')\n end",
"title": ""
},
{
"docid": "a19ce8ee54c1a643fef5a9102e472c5c",
"score": "0.52256477",
"text": "def initialize(window, x1, y1, x2, y2, x3, y3, color1, filled=true, \n color2=color1, border=0, br_color1=color1, br_color2=br_color1,\n active=true, visible=true)\n super(window, color1, filled, color2, \n border, br_color1, br_color2, \n active, visible)\n self.x1 = x1\n self.y1 = y1\n self.x2 = x2\n self.y2 = y2\n self.x3 = x3\n self.y3 = y3\n end",
"title": ""
},
{
"docid": "a19ce8ee54c1a643fef5a9102e472c5c",
"score": "0.52256477",
"text": "def initialize(window, x1, y1, x2, y2, x3, y3, color1, filled=true, \n color2=color1, border=0, br_color1=color1, br_color2=br_color1,\n active=true, visible=true)\n super(window, color1, filled, color2, \n border, br_color1, br_color2, \n active, visible)\n self.x1 = x1\n self.y1 = y1\n self.x2 = x2\n self.y2 = y2\n self.x3 = x3\n self.y3 = y3\n end",
"title": ""
},
{
"docid": "8f249382ddb62091a445b6f1df0e4341",
"score": "0.5222704",
"text": "def set_data_sprite(data_hash)\n @picture.mirror = true if data_hash[:mirror]\n @picture.x = data_hash[:start_x] if data_hash[:start_x]\n @picture.y = data_hash[:start_y] if data_hash[:start_y]\n @start_x = data_hash[:re_x] ? data_hash[:re_x] : 0\n @start_y = data_hash[:re_y] ? data_hash[:re_y] : 0\n @picture.wave_amp = data_hash[:wave_amp] if data_hash[:wave_amp]\n @picture.wave_length = data_hash[:wave_length] if data_hash[:wave_length]\n @picture.wave_speed = data_hash[:wave_speed] if data_hash[:wave_speed]\n @picture.wave_phase = data_hash[:wave_phase] if data_hash[:wave_phase]\n @x_speed = data_hash[:move_x] ? data_hash[:move_x] : 0\n @y_speed = data_hash[:move_y] ? data_hash[:move_y] : 0\n @x_state = 0\n @y_state = 0\n end",
"title": ""
},
{
"docid": "2dd667a61d7467c562c8d4f63bbc3c54",
"score": "0.5208832",
"text": "def initialize(rows, cols, color = \"O\")\n @rows = rows.to_i # ensure it's an integer\n @cols = cols.to_i\n @bitmap = solid_canvas(color)\n end",
"title": ""
},
{
"docid": "2ba0cd6145c3f5440b2a0cb8550c2468",
"score": "0.5195433",
"text": "def initialize\n @bitmap = BitmapEditor::Bitmap.new\n end",
"title": ""
},
{
"docid": "2e1bbd70a32dd87daaba63c19ade0ed7",
"score": "0.5192007",
"text": "def initialize(file)\n\t\t@buffer= GdkPixbuf::Pixbuf.new(file: file)\n\tend",
"title": ""
},
{
"docid": "01f9fe097f762a1b79f58e3dd4225aec",
"score": "0.5190034",
"text": "def initialize(skin, line_number)\n @line_number = line_number\n @skin = skin\n @width = @skin.width\n @height = @skin.height / @line_number\n @line = 1\n @amount = 0\n @atb_visible = false\n @base_sprite.dispose if @base_sprite != nil\n @base_sprite = Sprite.new\n @base_sprite.bitmap = @skin\n @base_sprite.src_rect.set(0, 0, @width, @height)\n super()\n self.bitmap = @skin\n self.line = 1\n self.opacity = 0 if @line_number == 3\n end",
"title": ""
},
{
"docid": "82351db3246dc795fd14001142a5cbd2",
"score": "0.5188836",
"text": "def yuri_draw_blt_window\r\n xm=@window_builder[0]\r\n ym=@window_builder[1]\r\n wm=@window_builder[2]\r\n hm=@window_builder[3]\r\n sbmp=@windowskin\r\n bmp=@window.bitmap\r\n ws=sbmp.width\r\n hs=sbmp.height\r\n wt=@width\r\n ht=@height\r\n rect=Rect.new(0,0,0,0)\r\n #>Calcul et équilibrage du dessin sur la largeur\r\n w3=ws-xm-wm\r\n w1=xm\r\n delta_w=wt-w1-w3\r\n if(delta_w<0)\r\n delta_w/=2\r\n w1+=delta_w\r\n w3+=delta_w\r\n delta_w=wt-w1-w3\r\n end\r\n nb2=delta_w/wm\r\n delta_w=delta_w-(nb2*wm) #Le chouilla qui reste sur le milieu\r\n #>Calcul et équilibrage du dessin sur la hauteur\r\n h1=ym\r\n h7=hs-hm-ym\r\n delta_h=ht-h1-h7\r\n if(delta_h<0)\r\n delta_h/=2\r\n h1+=delta_h\r\n h7+=delta_h\r\n delta_h=ht-h1-h7\r\n end\r\n nb4=delta_h/hm\r\n delta_h=delta_h-(nb4*hm)\r\n #>Dessin des 4 bords\r\n #[ 1, ..., ...] / [ ..., ..., ...] / [ ..., ..., ...]\r\n rect.set(0,0,w1,h1)\r\n bmp.blt(0,0,sbmp,rect)\r\n #[ ..., ..., 3] / [ ..., ..., ...] / [ ..., ..., ...]\r\n rect.set(ws-w3,0,w3,h1)\r\n bmp.blt(wt-w3,0,sbmp,rect)\r\n #[ ..., ..., ...] / [ ..., ..., ...] / [ 7, ..., ...]\r\n rect.set(0,hs-h7,w1,h7)\r\n bmp.blt(0,ht-h7,sbmp,rect)\r\n #[ ..., ..., ...] / [ ..., ..., ...] / [ ..., ..., 9]\r\n rect.set(ws-w3,hs-h7,w3,h7)\r\n bmp.blt(wt-w3,ht-h7,sbmp,rect)\r\n #>Dessin des contours de la fenêtre\r\n # [ ..., 2, ...] / [ ..., ..., ...] / [ ..., ..., ...]\r\n ax=w1\r\n rect.set(xm,0,wm,h1)\r\n nb2.times do\r\n bmp.blt(ax,0,sbmp,rect)\r\n ax+=wm\r\n end\r\n rect.set(xm,0,delta_w,h1)\r\n bmp.blt(ax,0,sbmp,rect) if delta_w>0\r\n # [ ..., ..., ...] / [ 4, ..., ...] / [ ..., ..., ...]\r\n ay=h1\r\n rect.set(0,ym,w1,hm)\r\n nb4.times do \r\n bmp.blt(0,ay,sbmp,rect)\r\n ay+=hm\r\n end\r\n rect.set(0,ym,w1,delta_h)\r\n bmp.blt(0,ay,sbmp,rect) if delta_h>0\r\n # [ ..., ..., ...] / [ ..., ..., 6] / [ ..., ..., ...]\r\n ax=wt-w3\r\n ay=h1\r\n rect.set(ws-w3,ym,w3,hm)\r\n nb4.times do\r\n bmp.blt(ax,ay,sbmp,rect)\r\n ay+=hm\r\n end\r\n rect.set(ws-w3,ym,w3,delta_h)\r\n bmp.blt(ax,ay,sbmp,rect) if delta_h>0\r\n # [ ..., ..., ...] / [ ..., ..., ...] / [ ..., 8, ...]\r\n ax=w1\r\n ay=ht-h7\r\n rect.set(xm,hs-h7,wm,h7)\r\n nb2.times do\r\n bmp.blt(ax,ay,sbmp,rect)\r\n ax+=wm\r\n end\r\n rect.set(xm,hs-h7,delta_w,h7)\r\n bmp.blt(ax,ay,sbmp,rect) if delta_w>0\r\n #>Dessin de l'intérieur\r\n # [ ..., ..., ...] / [ ..., 5|m , ...] / [ ..., ..., ...]\r\n ax=w1\r\n ay=h1\r\n rect.set(xm,ym,wm,hm)\r\n nb2.times do\r\n nb4.times do\r\n bmp.blt(ax,ay,sbmp,rect)\r\n ay+=hm\r\n end\r\n ax+=wm\r\n ay=h1\r\n end\r\n ay+=(hm*nb4)\r\n if(delta_w>0 and delta_h>0)\r\n rect.set(xm,ym,delta_w,delta_h)\r\n bmp.blt(ax,ay,sbmp,rect)\r\n end\r\n if(delta_h>0)\r\n ax=w1\r\n rect.set(xm,ym,wm,delta_h)\r\n nb2.times do\r\n bmp.blt(ax,ay,sbmp,rect)\r\n ax+=wm\r\n end\r\n end\r\n if(delta_w>0)\r\n ay=h1\r\n rect.set(xm,ym,delta_w,hm)\r\n nb4.times do\r\n bmp.blt(ax,ay,sbmp,rect)\r\n ay+=hm\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "e1d04b282f1905c7295c980627ca636a",
"score": "0.518838",
"text": "def initialize\n super(192, 0, 448, 352)\n self.contents = Bitmap.new(width - 32, height - 32)\n self.index = -1\n self.active = false\n @item_max = 10\n @mode = 0\n @top_id = 1\n refresh\n end",
"title": ""
},
{
"docid": "e1d04b282f1905c7295c980627ca636a",
"score": "0.518838",
"text": "def initialize\n super(192, 0, 448, 352)\n self.contents = Bitmap.new(width - 32, height - 32)\n self.index = -1\n self.active = false\n @item_max = 10\n @mode = 0\n @top_id = 1\n refresh\n end",
"title": ""
},
{
"docid": "53ac78ee70946ba8222d1b4cc71b22dc",
"score": "0.5176438",
"text": "def paint_scanlineseedfill(x, y, fg, bg, chr_set, code, flg)\r\n @refresh_list = []\r\n return if flg & 0x07 == 0\r\n\r\n src = { :fg => fg, :bg => bg, :chr_set => chr_set, :code => code }\r\n w = @data[0].length\r\n h = @data.length\r\n\r\n col = read_point_deep(x, y)\r\n return if col == src\r\n\r\n buf = []\r\n buf.push({ :lx => x, :rx => x, :y => y, :oy => y })\r\n\r\n while buf.length > 0\r\n d = buf.pop\r\n lx = d[:lx]\r\n rx = d[:rx]\r\n ly = d[:y]\r\n oy = d[:oy]\r\n\r\n lxsav = lx - 1\r\n rxsav = rx + 1\r\n\r\n next if read_point(lx, ly) != col\r\n\r\n while lx > 0\r\n break if read_point(lx - 1, ly) != col\r\n lx -= 1\r\n end\r\n\r\n while rx < w - 1\r\n break if read_point(rx + 1, ly) != col\r\n rx += 1\r\n end\r\n\r\n (lx..rx).each do |x|\r\n write_data(x, ly, src, flg)\r\n end\r\n\r\n if ly - 1 >= 0\r\n if ly - 1 == oy\r\n scanline(lx, lxsav, ly - 1, ly, col, buf)\r\n scanline(rxsav, rx, ly - 1, ly, col, buf)\r\n else\r\n scanline(lx, rx, ly - 1, ly, col, buf)\r\n end\r\n end\r\n\r\n if ly + 1 <= h - 1\r\n if ly + 1 == oy\r\n scanline(lx, lxsav, ly + 1, ly, col, buf)\r\n scanline(rxsav, rx, ly + 1, ly, col, buf)\r\n else\r\n scanline(lx, rx, ly + 1, ly, col, buf)\r\n end\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "902e654224fd6fc2099dd28d629db62f",
"score": "0.51705366",
"text": "def initialize(args)\n @canvas = []\n args_format = [:x_coordinate, :y_coordinate]\n validate(args_format, args)\n\n @width = args[0].to_i\n @height = args[1].to_i\n colour = 'O'\n\n for y in 1..height do\n row = []\n for x in 1..width do\n row << colour\n end\n @canvas << row\n end\n @canvas\n end",
"title": ""
},
{
"docid": "28585868c89d2225b19c5c4afea2b766",
"score": "0.51538223",
"text": "def initialize(*)\n super\n\n @baseline_x_color = @baseline_y_color = 'red'\n @baseline_x_value = @baseline_y_value = nil\n @circle_radius = nil\n @disable_significant_rounding_x_axis = false\n @enable_vertical_line_markers = false\n @marker_x_count = nil\n @maximum_x_value = @minimum_x_value = nil\n @stroke_width = nil\n @use_vertical_x_labels = false\n @x_axis_label_format = nil\n @x_label_margin = nil\n @y_axis_label_format = nil\n end",
"title": ""
},
{
"docid": "37eb3c5c81efac8db4f8b74a6b4fd3fa",
"score": "0.51459086",
"text": "def draw\n make_stacked if @stacked\n setup_drawing()\n \n # Subclasses will do some drawing here...\n #@d.draw(@base_image)\n end",
"title": ""
},
{
"docid": "a2bdf01c53c654a0703a6a66a7577a46",
"score": "0.5141246",
"text": "def initialize(window, rect, img_bitmap, src_rect, align=0, opacity=255, \n valign=0, active=true, visible=true)\n super(window, active, visible)\n self.rect = rect\n self.img_bitmap = img_bitmap\n self.src_rect = src_rect\n self.align = align\n self.opacity = opacity\n self.valign = valign\n end",
"title": ""
},
{
"docid": "d19880988c64a06d0117c72082f35290",
"score": "0.5137473",
"text": "def create_default_move_highlight\n self.bitmap = Bitmap.new(32, 32)\n self.bitmap.fill_rect(0,0,32,32,Color.new(23,52,123))\n color_border(Color.new(28,91,145))\n @default = true\n end",
"title": ""
},
{
"docid": "9726ca20d58954fc4f65f9a84c7d6ee6",
"score": "0.51267827",
"text": "def initialize(*args, &content)\n @args = args\n @parent_proxy = nil\n if @args.first.is_a?(WidgetProxy)\n @parent_proxy = @args.shift\n @parent = @parent_proxy.swt_widget\n end\n options = @args.last.is_a?(Hash) ? @args.delete_at(-1) : {}\n options[:swt_image] = @args.first if @args.size == 1 && @args.first.is_a?(Image)\n @file_path = @args.first if @args.first.is_a?(String)\n @args = @args.first if @args.size == 1 && @args.first.is_a?(Array)\n if options&.keys&.include?(:swt_image)\n @swt_image = options[:swt_image]\n @original_image_data = @image_data = @swt_image.image_data\n elsif args.size == 1 && args.first.is_a?(ImageProxy)\n @swt_image = @args.first.swt_image\n @original_image_data = @image_data = @swt_image.image_data\n elsif @file_path\n @original_image_data = @image_data = ImageData.new(input_stream || @file_path)\n @swt_image = Image.new(DisplayProxy.instance.swt_display, @image_data)\n width = options[:width]\n height = options[:height]\n height = (@image_data.height.to_f / @image_data.width.to_f)*width.to_f if !width.nil? && height.nil?\n width = (@image_data.width.to_f / @image_data.height.to_f)*height.to_f if !height.nil? && width.nil?\n scale_to(width, height) unless width.nil? || height.nil?\n elsif !@args.first.is_a?(ImageProxy) && !@args.first.is_a?(Image)\n @args.prepend(DisplayProxy.instance.swt_display) unless @args.first.is_a?(Display)\n @swt_image = Image.new(*@args)\n @original_image_data = @image_data = @swt_image.image_data\n end\n proxy = self\n # TODO consider adding a get_data/set_data method to conform with other SWT widgets\n @swt_image.singleton_class.define_method(:dispose) do\n proxy.clear_shapes\n super()\n end\n post_add_content if content.nil?\n end",
"title": ""
},
{
"docid": "88fe3133f25b7dc9d51ec07517c5f23c",
"score": "0.51265925",
"text": "def initialize(*args)\n if args.first.is_a?(Path)\n path = args.shift\n @points = *path.map { |point| Point.new(point) }\n @lw = path.lw\n @fill = path.fill?\n else\n @fill = args.pop\n @lw = args.pop.to_f\n @points = *args.map { |point| Point.new(point) }\n end\n end",
"title": ""
},
{
"docid": "76cddd6055897ce0a2ecec28d9d0af06",
"score": "0.51227444",
"text": "def initialize(number, color,shading, shape)\n @number=number\n @color=color\n @shape=shape\n @shading=shading\nend",
"title": ""
},
{
"docid": "c681e555c787650812a2decd6cc6d5f5",
"score": "0.512226",
"text": "def create_battleback1\n @back1_sprite = []\n setup = get_bb1_settings\n strip = Earthbound_Back.new(@viewport1)\n #set strip boys\n strip.config = setup\n strip.blend_type = setup[\"blend\"]\n strip.bb_num = 1\n #get strip image\n strip.bitmap = battleback1_bitmap\n strip.z = 1\n strip.orig_bitmap = battleback1_bitmap\n center_sprite_x(strip)\n @back1_sprite.push(strip)\n end",
"title": ""
},
{
"docid": "1b041098c717f8238fec57015ad3ece3",
"score": "0.5121281",
"text": "def initialize(key, a=220 , b=250, c=80)\n super(0, a, b, c)\n self.contents = Bitmap.new(width - 32, height - 32)\n self.back_opacity = 160 # semi-transparent\n self.z = 0 # display in the back than the progress bar\n @key = key\n @key_count = 0\n refresh\n end",
"title": ""
},
{
"docid": "188d4faf439d180a42868192144fa477",
"score": "0.51209897",
"text": "def initialize(x, y, width, height, image)\n super(x, y, width, height)\n \n @ucImage = UCBackgroundImage.new(self, \"\", 1, 128, 1)\n \n window_update(image)\n end",
"title": ""
},
{
"docid": "2362ce11c1352c89cb751ac1c59d211b",
"score": "0.51022923",
"text": "def initialize(window, x, y, a, b, color1, filled=true, color2=color1, \n border=0, br_color1=color1, br_color2=br_color1,\n active=true, visible=true)\n super(window, color1, filled, color2, \n border, br_color1, br_color2, \n active, visible)\n self.x = x\n self.y = y\n self.a = a\n self.b = b\n end",
"title": ""
},
{
"docid": "2573daa73d596ecfb64cdcbbe3113fe6",
"score": "0.51019007",
"text": "def initialize(x, y, width, height, actor)\n super(x, y, width, height)\n @cBackCharImage = CResizableImage.new(self, Rect.new(0, 0, self.contents.width, self.contents.height), \n nil, nil, 0, 255, 2, 3)\n window_update(actor)\n end",
"title": ""
},
{
"docid": "15b207db9091a955c6c6de40d55fb057",
"score": "0.51005995",
"text": "def setup\n # get the sprite file name\n @combo_sprite = ''\n @combo_sprite = @character.character_name_org if @character.combo.extension\n @combo_sprite += @character.combo.sprite\n # get the animation id\n @loop_animation_id = @character.combo.animation\n # if sprite\n if @combo_sprite != ''\n # load bitmap\n self.bitmap = RPG::Cache.character(@combo_sprite, 0)\n # no sprite\n else\n # dummy bitmap\n self.bitmap = Bitmap.new(1, 1)\n end\n # get dimesions\n @cw = bitmap.width / @character.combo.animation_frames.size\n @ch = bitmap.height / 4\n # set offsets accordingly\n self.ox = @cw / 2\n self.oy = @ch / 2 + 16\n # set source rectangle\n self.src_rect.set(0, 0, @cw, @ch)\n end",
"title": ""
},
{
"docid": "de94c87d11526f1ded9f83841289fa18",
"score": "0.51004344",
"text": "def startShape\n\t\ts =0.chr\t\t\t\t\t\t\t\t\t\t# No fill styles\n\t\ts+=2.chr\t\t\t\t\t\t\t\t\t\t# Two line styles\n\t\ts+=packUI16(0) + 0.chr + 255.chr + 255.chr\t\t# Width 5, RGB #00FFFF\n\t\ts+=packUI16(0) + 255.chr + 0.chr + 255.chr\t\t# Width 5, RGB #FF00FF\n\t\ts+=34.chr\t\t\t\t\t\t\t\t\t\t# 2 fill, 2 line index bits\n\t\ts\n\tend",
"title": ""
},
{
"docid": "a389aadad4951cf6046b799180085c3b",
"score": "0.50984174",
"text": "def process(data)\n @figure, @x, @y, raw_glass, next_str = data_to_params(data)\n @next_figures = next_str.split('')\n @glass.update_state(raw_glass)\n end",
"title": ""
},
{
"docid": "0db46ddf66d9f8d1f1a210d27107fe37",
"score": "0.5097527",
"text": "def initialize(demographics_data)\n set_attributes demographics_data\n end",
"title": ""
},
{
"docid": "a337ab5edc4844b216f927be2dd989cc",
"score": "0.50974107",
"text": "def initialize *args\n @x = 0\n @y = 0\n @z = 0\n @ox = 0\n @oy = 0\n @angle = 0\n @zoom_x = 1\n @zoom_y = 1\n @opacity = 100\n @color = Color.gray 255\n @visible = false\n @blend_type = 0\n case args.size\n when 0 # Default\n self.bitmap = Bitmap.new\n Ruby2D::Graphics.main_frame << self\n when 1\n case args[0]\n when Frame\n args[0] << self\n @belongs_to = args[0]\n self.bitmap = Bitmap.new\n when Bitmap\n self.bitmap = args[0]\n Ruby2D::Graphics.main_frame << self\n else\n fail TypeError\n end\n when 2\n args[0] << self\n @belongs_to = args[0]\n self.bitmap = args[1]\n else\n fail ArgumentError, 'wrong number of arguments'\n end\n @rect = Rect.new(0, 0, @bitmap.width, @bitmap.height)\n create_id\n @visible = true\n end",
"title": ""
},
{
"docid": "e8f6a1c782dfb7109bd52cde0485f82d",
"score": "0.50959635",
"text": "def background(r,g,b,a)\n #@canvas.set_source_color(color)\n @canvas.set_source_rgba(r,g,b,a)\n @canvas.paint\nend",
"title": ""
},
{
"docid": "2a3bfc84ac8205d261bb0302c9794cee",
"score": "0.50955456",
"text": "def draw_normal image_path=nil\n\t\t@main.clear do\n\t\t\tbackground white .. plum, angle: 90\n\t\t\tborder black\n\t\t\t@pic = image_path if image_path\n\t\t\timage @pic, height: 600, width: 600\n\t\tend\n\tend",
"title": ""
},
{
"docid": "3fe1137c063084bbac61554038ec6627",
"score": "0.5090069",
"text": "def setup\n size 640, 480\n a = color 165, 167, 20\n b = color 77, 86, 59\n c = color 42, 106, 105\n d = color 165, 89, 20\n e = color 146, 150, 127 \t\n no_stroke \t\n draw_band [a, b, c, d, e], 0, 4\n draw_band [c, a, d, b, e], height/2, 4\nend",
"title": ""
},
{
"docid": "1a36bffaaf63c72204e5c42b1fa2ab3d",
"score": "0.50881326",
"text": "def setup_drawing\n # Maybe should be done in one of the following functions for more granularity.\n unless @has_data\n draw_no_data()\n return\n end\n \n normalize()\n setup_graph_measurements()\n sort_norm_data() # Sort norm_data with avg largest values set first (for display)\n \n draw_legend()\n setup_graph_height()\n draw_line_markers()\n draw_title\n end",
"title": ""
},
{
"docid": "7e39d33c7196758ebbde2b571d5932b6",
"score": "0.50815326",
"text": "def initialize(readRenderer, writeRenderer); @r = readRenderer; @w = writeRenderer end",
"title": ""
},
{
"docid": "e3cc1fde83e0c7bdf3a0dcaf25b6549b",
"score": "0.50705224",
"text": "def activate\n # The Sketchup::InputPoint class is used to get 3D points from screen\n # positions. It uses the SketchUp inferencing code.\n # In this tool, we will collect two points \n @ip1 = Sketchup::InputPoint.new\n @ip2 = Sketchup::InputPoint.new\n @ip = Sketchup::InputPoint.new\n @drawn = false\n \t@num_pegs = 0 \n \t@prev_pt1 = nil\n \t@prev_pt2 = nil\n \t@lp1 = Geom::Point3d.new\t# input points in local coordinates\n \t@lp2 = Geom::Point3d.new\n\n # This sets the label for the VCB\n Sketchup::set_status_text \"Offsets (x,y)\", SB_VCB_LABEL\n \n self.reset(nil)\n \t\t\n \tunless sel_is_tenon? \n \t\treturn\n \tend\t\n end",
"title": ""
},
{
"docid": "36af585a21ce0a80500d913caeb021ee",
"score": "0.506885",
"text": "def draw_setup(graphics_context)\n @obj.apply_stroke(graphics_context)\n end",
"title": ""
},
{
"docid": "0689900e62ed05b421c32f6e2fb99a33",
"score": "0.5068142",
"text": "def initialize\n @row_count = 1\n @col_count = 1\n @image = [[nil]]\n end",
"title": ""
},
{
"docid": "077dd8f2d599c23bcd776ee3aa390bcd",
"score": "0.5062868",
"text": "def constructImage(x,y,z,type)\n\t\tend",
"title": ""
},
{
"docid": "caa2bad3e94e13b426822796491f7486",
"score": "0.50620174",
"text": "def initialize(cell, drag, colorsHyp, picross)\n\t\tsuper()\n\t\t@cell = cell\n\t\t@drag = drag\n\t\t@colorsHyp = colorsHyp\n\t\t@picross = picross\n\n\t\t# The content of this cell is just a blank image\n\t\t@widget = Gtk::Image.new()\n\n\t\t# Add the CSS to the button\n\t\tcss_provider = Gtk::CssProvider.new\n\t\tcss_provider.load(data: self.css)\n\t\t@style_context = @widget.style_context\n\t\t@style_context.add_provider(css_provider, Gtk::StyleProvider::PRIORITY_USER)\n\t\t@widget.visible = true\n\n\t\tself.setEvents\n\t\tself.setAttributes\n\t\tself.add(@widget)\n\tend",
"title": ""
},
{
"docid": "62165e459a383a0463653e4d58b96b28",
"score": "0.5059842",
"text": "def initialize\n @state = []\n @color = 0\n @width, @height = :auto, :auto\n @xlimits, @ylimits = :auto, :auto\n @type = :braille\n @legend = []\n @title, @xlabel = nil, nil\n @xlines, @ylines = [], []\n end",
"title": ""
},
{
"docid": "02902615b29c630fe76237efcfd3b419",
"score": "0.50510675",
"text": "def setup data\n\n\t\t#set the background\n\t\t@shoes.background @bg\n\n\t\tunless @scale\n\t\t\t#calculate the scale factor\n\t\t\t@max_distance = data.map { |h| h[:distance] || 0 }.max\n\t\t\t#half the height should be equal to the max distance\n\t\t\t@scale = @height/(2*@max_distance*1.1)\n\t\t\tp \">>scale : #{@scale}\" if @debug\n\t\tend\n\n\t\t#create the Planet objects\n\t\tdata.each do |a|\n\t\t\tnext if a[:enabled] == false\n\t\t\ta[:app] = @shoes; a[:scale] = @scale\n\t\t\ta[:center_x] = @center_x; a[:center_y] = @center_y\n\t\t\tp = Planet.new a\n\t\t @planets << p\n \t\tp.draw\n\t end\n\tend",
"title": ""
},
{
"docid": "fb048d06e23694bcf1e6a4732bbe3c7f",
"score": "0.50486696",
"text": "def initialize(width, height)\n super\n\n @adapter = OSX::AQTAdapter.alloc.init\n @adapter.openPlotWithIndex 1\n @adapter.setPlotSize [@width, @height]\n @adapter.setPlotTitle 'Memory Map'\n\n @adapter.setColormapEntry_red_green_blue 0, 0.0, 0.0, 0.0 # black\n @adapter.setColormapEntry_red_green_blue 1, 1.0, 1.0, 1.0 # white\n @adapter.setColormapEntry_red_green_blue 2, 1.0, 0.0, 0.0 # red\n @adapter.setColormapEntry_red_green_blue 3, 0.0, 1.0, 0.0 # green\n @adapter.setColormapEntry_red_green_blue 4, 0.7, 0.7, 0.7 # gray\n end",
"title": ""
},
{
"docid": "97b55289559ba5e85f4b481ade17709d",
"score": "0.5045254",
"text": "def initialize(viewport)\n super(viewport)\n self.bitmap = Bitmap.new(20, 20)\n rect = self.bitmap.rect\n self.bitmap.fill_rect(rect, Color.new(255, 255, 255))\n self.z = 1000\n reset\n end",
"title": ""
},
{
"docid": "67e0fde52818d335fc3ec9b347799f7c",
"score": "0.5028664",
"text": "def initialize(chart, options = {})\n @xData, @yData, @bubbleSize = nil\n super(chart, options)\n @xData = AxDataSource.new(tag_name: :xVal, data: options[:xData]) unless options[:xData].nil?\n @yData = NumDataSource.new({ tag_name: :yVal, data: options[:yData] }) unless options[:yData].nil?\n @bubbleSize = NumDataSource.new({ tag_name: :bubbleSize, data: options[:bubbleSize] }) unless options[:bubbleSize].nil?\n end",
"title": ""
},
{
"docid": "47be90a69ea99771d4d9f6b400c3ca4d",
"score": "0.50262153",
"text": "def apply_drawing_call\n end",
"title": ""
},
{
"docid": "487d756ab60edd5fcb5af1d1ee56f750",
"score": "0.50257754",
"text": "def setup_drawing\n # Maybe should be done in one of the following functions for more granularity.\n unless @has_data\n draw_no_data()\n return\n end\n\n normalize()\n setup_graph_measurements()\n sort_norm_data() if @sort # Sort norm_data with avg largest values set first (for display)\n\n draw_legend()\n draw_line_markers()\n draw_axis_labels()\n draw_title\n end",
"title": ""
},
{
"docid": "140b7475d35b0200104935ba5b198abe",
"score": "0.50209725",
"text": "def draw\n fill_background\n color = BLACK\n last_color = color\n x = 0\n y = 0\n\n @mem_inspect.walk do |address, size, object|\n x, y = coords_for address\n\n color = case object\n when :__free then GRAY\n when :__node then RED\n when :__varmap, :__scope, :__unknown then WHITE\n else GREEN\n end\n\n @adapter.takeColorFromColormapEntry color unless color == last_color\n @adapter.moveToPoint [x, y] if x == 0\n @adapter.addLineToPoint [x + 1, y + 1]\n last_color = color\n end\n\n ensure # coords_for raises when out-of-bounds\n @adapter.renderPlot\n end",
"title": ""
},
{
"docid": "d4adbb655174f548ddb9f799421250d5",
"score": "0.50205725",
"text": "def initialize( defaultstyle =Std_style, defaultfont = Std_font, pos1 = [72, 72], pos2 = [72*10,72*10])\n\n xw, yw = 800, 1200\n\n @dis = Xlib::Display.new\n @win=@dis.root.new_window(xw, yw)\n @win.show\n @canvas = @win.new_gc\n\n @canvas.fg = @dis.alloc_color 'black'\n @canvas.bg = @dis.alloc_color 'white'\n @win.clear\n\n @canvaswidth, @canvasheight = xw, yw\n @canvas.fg = @dis.alloc_color 'white'\n @canvas.fill_rect(0,0, xw-1, yw-1)\n @canvas.fg = @dis.alloc_color 'black'\n\n @fastp = false # default is style works\n\n @pos1_whole, @pos2_whole = pos1, pos2\n @style = defaultstyle.dup\n @font = defaultfont.dup\n\n @defaultstyle = @style.dup\n @defaultfont = @font.dup\n @at0 = @defaultstyle\n\n set_style(@style)\n set_font(@font)\n @defaultsymsize = 0.015\n\n setposition(pos1, pos2)\n # set_style(@style)\n # set_font(@font)\n if block_given? then\n yield(self)\n closer\n after_hook\n end\n\n end",
"title": ""
},
{
"docid": "4829c0b6d23af9740b684086e1a4396d",
"score": "0.50084376",
"text": "def initialize(dataset, options={}, &colorfkt)\n @an = dataset.an\n @bn = (dataset.respond_to?(:bn) && dataset.bn) || nil\n @tn = dataset.tn\n\n @amarks = options[:amarks] || options[:marks] || {}\n @bmarks = options[:bmarks] || options[:marks] || {}\n \n @dataset = dataset\n @colorfkt = colorfkt\n \n @fontfamily = options[:font_family] || 'Times New Roman'\n @fontsize = options[:font_size] || 10\n @fontcolor = options[:font_color] || '#000'\n\n @backgroundcolor = options[:background] || '#eee'\n\n sep = options[:sep] \n @xsep = options[:xsep] || sep || 0.2 * @fontsize\n @ysep = options[:ysep] || @xsep\n \n omode = options[:outer_mode] || if @bn\n :matrix\n else\n :lines\n end\n case omode\n when :matrix\n# raise 'second dimension missing' unless @bn\n create_matrix(options)\n when :lines\n create_lines(options)\n else\n raise \"outer mode ':#{omode}' unknown/not implemented!\"\n end\n\n end",
"title": ""
},
{
"docid": "a84b33d26a0cbc3723a652c9bfdde456",
"score": "0.5003784",
"text": "def draw()\n if !@cBorders.nil?\n @cBorders.draw()\n end\n @cImage.draw()\n end",
"title": ""
},
{
"docid": "242bfe59c9bda5a597233ce01942c001",
"score": "0.50006956",
"text": "def initialize x=0, y=0, color=:white\n @x=x\n @y=y\n @color=color\n end",
"title": ""
},
{
"docid": "46b401efe710993e20540aaf590b1d76",
"score": "0.49995762",
"text": "def initialize(data)\n #returns the avtive model material list\n @model = Sketchup.active_model\n @entities = @model.active_entities\n @selection = @model.selection\n @definition_list = @model.definitions\n @materials = @model.materials\n @material_names = @materials.map {|color| color.name}\n\n view = @model.active_view\n @ip1 = nil\n @ip2 = nil\n @xdown = 0\n @ydown = 0\n\n @@beam_name = data[:name] #String 'W(height_class)X(weight_per_foot)'\n @@height_class = data[:height_class] #String 'W(number)'\n @@beam_data = data[:data] #Hash {:d=>4.16, :bf=>4.06, :tf=>0.345, :tw=>0.28, :r=>0.2519685039370079, :width_class=>4}\"\n @@placement = data[:placement] #String 'TOP' or 'BOTTOM'\n @@has_holes = data[:has_holes] #Boolean\n @@hole_spacing = data[:stagger] #Integer 16 or 24\n @@cuts_holes = data[:cuts_holes] #Boolean\n @@has_stiffeners = data[:stiffeners] #Boolean\n @@has_shearplates = data[:shearplates] #Boolean\n @@stiff_thickness = data[:stiff_thickness] #String '1/4' or '3/8' or '1/2'\n @@shearpl_thickness = data[:shearpl_thickness] #String '1/4' or '3/8' or '1/2'\n @@force_studs = data[:force_studs]\n @@flange_type = data[:flange_type]\n\n values = data[:data]\n @hc = data[:height_class].split('W').last.to_i #this gets just the number in the height class\n @h = values[:d].to_f\n @w = values[:bf].to_f\n @tf = values[:tf].to_f\n @tw = values[:tw].to_f\n @wc = values[:width_class].to_f\n @r = values[:r].to_f\n @number_of_sheer_holes = (((((@h - ((2*@tf) + (@r*2))) - (MIN_BIG_HOLE_DISTANCE_FROM_KZONE*2)) / 3).to_i) +1)\n\n\n #the thirteen points on a beam\n @points = [\n pt1 = [0,0,0],\n pt2 = [@w,0,0],\n pt3 = [@w,0,@tf],\n pt4 = [(0.5*@w)+(0.5*@tw)+@r, 0, @tf],\n pt5 = [(0.5*@w)+(0.5*@tw), 0, (@tf+@r)],\n pt6 = [(0.5*@w)+(0.5*@tw), 0, (@h-@tf)-@r],\n pt7 = [(0.5*@w)+(0.5*@tw)+@r, 0, @h-@tf],\n pt8 = [@w,0,@h-@tf],\n pt9 = [@w,0,@h],\n pt10= [0,0,@h],\n pt11= [0,0,@h-@tf],\n pt12= [(0.5*@w)-(0.5*@tw)-@r, 0, @h-@tf],\n pt13= [(0.5*@w)-(0.5*@tw), 0, (@h-@tf)-@r],\n pt14= [(0.5*@w)-(0.5*@tw), 0, @tf+@r],\n pt15= [(0.5*@w)-(0.5*@tw)-@r, 0, @tf],\n pt16= [0,0,@tf]\n ]\n\n @x_red = @model.axes.axes[0]\n @y_green = @model.axes.axes[1]\n @z_blue = @model.axes.axes[2]\n\n if @@flange_type == FLANGE_TYPE_COL\n @is_column = true\n else\n @is_column = false\n end\n\n @nine_sixteenths_holes = []\n check_for_preselect(@selection, @model.active_view)\n self.reset(view)\n end",
"title": ""
},
{
"docid": "3413850d95e56a0320df5d7deebcc864",
"score": "0.49905038",
"text": "def image() @composite; end",
"title": ""
},
{
"docid": "46542e21c6a814010f2f5f7e91621b34",
"score": "0.4989763",
"text": "def initialize(worksheet)\n DataTypeValidator.validate \"Drawing.worksheet\", Worksheet, worksheet\n @worksheet = worksheet\n @worksheet.workbook.drawings << self\n @anchors = SimpleTypedList.new [TwoCellAnchor, OneCellAnchor]\n end",
"title": ""
},
{
"docid": "006577add992a3669ac52c87bab4815f",
"score": "0.49885482",
"text": "def plot_img; end",
"title": ""
},
{
"docid": "bc54622cff88a33cc6c80225eabc1c1f",
"score": "0.498777",
"text": "def set_bitmap\n self.bitmap = Bitmap.new(32, 32)\n if @character.is_a?(Game_Event) && (@character && @character.team_id != 0)\n color = DND::COLOR::Red\n #draw_sight\n else\n color = DND::COLOR::Blue\n end\n self.bitmap.draw_circle( 16, 16, 13, color, 2)\n update_position\n end",
"title": ""
},
{
"docid": "bc54622cff88a33cc6c80225eabc1c1f",
"score": "0.498777",
"text": "def set_bitmap\n self.bitmap = Bitmap.new(32, 32)\n if @character.is_a?(Game_Event) && (@character && @character.team_id != 0)\n color = DND::COLOR::Red\n #draw_sight\n else\n color = DND::COLOR::Blue\n end\n self.bitmap.draw_circle( 16, 16, 13, color, 2)\n update_position\n end",
"title": ""
},
{
"docid": "73cedd3476f5da6af294832111e96c8e",
"score": "0.498649",
"text": "def initialize(with = 0, height = 0)\n @with = with.to_i\n @height = height.to_i\n\n draw_image\n end",
"title": ""
},
{
"docid": "d7fd21698ef64fdf2960a1980eeb33cf",
"score": "0.4984874",
"text": "def initialize(dynamic_filter_selection = false)\n @bitmap = Bitmap.new\n @rows = nil\n @comment = \"\"\n @dynamic_filter_selection = dynamic_filter_selection\n end",
"title": ""
},
{
"docid": "527c96da625596fe0efb519e4784a303",
"score": "0.4982992",
"text": "def fill(args)\n args_format = [:x_coordinate, :y_coordinate, :colour]\n validate(args_format, args)\n\n x_coordinate = args[0].to_i - 1\n y_coordinate = args[1].to_i - 1\n colour = args[2]\n\n iterate_region(x_coordinate, y_coordinate)\n\n @canvas.each_index do |row|\n @canvas[row].each_index do |column|\n @canvas[row][column] = colour if @canvas[row][column] == '$'\n end\n end\n \n end",
"title": ""
},
{
"docid": "56429f8027b51bfc933d72c1d4ff57e6",
"score": "0.49829775",
"text": "def gui_init\n # @gui_opts must be provided if this shape is responsible for\n # drawing itself. If this shape is part of another shape, then\n # @gui_opts should be nil\n if @gui_opts\n @gui_container = @gui_opts[:container]\n @gui_paint_callback = lambda do |event|\n gc = event.gc\n gc.set_antialias ::Swt::SWT::ON\n gc.set_background self.fill.to_native\n gc.fill_oval(@left, @top, @width, @height)\n gc.set_foreground self.stroke.to_native\n gc.set_line_width self.style[:strokewidth]\n gc.draw_oval(@left, @top, @width, @height)\n end\n @gui_container.add_paint_listener(@gui_paint_callback)\n end\n end",
"title": ""
},
{
"docid": "01ececf1f46b2b982ab0883ad7a05fe5",
"score": "0.49774095",
"text": "def drawing\n @drawing || @drawing = Axlsx::Drawing.new(self)\n end",
"title": ""
},
{
"docid": "0a31ff2ba10c5c68391dd888efc57e03",
"score": "0.4976904",
"text": "def initialize(drawing, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "0a31ff2ba10c5c68391dd888efc57e03",
"score": "0.4976904",
"text": "def initialize(drawing, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "dc14de596f2e41dbcd8602b5d861f770",
"score": "0.4974823",
"text": "def initialize(options = {})\n \n options = {\n :canvas => nil,\n :scale => 1,\n :origin => Location.new(0, 0),\n :erase_flag => true,\n :background_color => Color.black\n }.merge(options)\n @canvas = options[:canvas]\n self.scale = options[:scale]\n self.origin = options[:origin]\n self.erase_flag = options[:erase_flag]\n \n end",
"title": ""
}
] |
04a5c6e325c08d09f58125ae135484dc | Public: Initialize the collection. parent The object that owns this collection. as The name of the relationship between the collection's items and the parent. model_class The class of the model this collection represents. service The service that implements remote calls. | [
{
"docid": "22260eae9a23105a7014437ad9568e90",
"score": "0.6013313",
"text": "def initialize(parent, as, model_class, service)\n @parent = parent\n @as = as\n @model_class = model_class\n @service = service\n end",
"title": ""
}
] | [
{
"docid": "f07238122535a65937ab99c7a7a9aef0",
"score": "0.6780549",
"text": "def initialize\n @coll=self.class.collection\n end",
"title": ""
},
{
"docid": "f07238122535a65937ab99c7a7a9aef0",
"score": "0.6780549",
"text": "def initialize\n @coll=self.class.collection\n end",
"title": ""
},
{
"docid": "f07238122535a65937ab99c7a7a9aef0",
"score": "0.6780549",
"text": "def initialize\n @coll=self.class.collection\n end",
"title": ""
},
{
"docid": "dfac5a45526c71d34597e87396a0ba14",
"score": "0.67347574",
"text": "def initialize()\n super(:namespace=>\"collection\")\n self.type = \"Collection\"\n end",
"title": ""
},
{
"docid": "aa7745e5ccc1f372c83216f5d94ca6da",
"score": "0.6574253",
"text": "def new_collection(parsed_data)\n Her::Model::Attributes.initialize_collection(@klass, parsed_data)\n end",
"title": ""
},
{
"docid": "121435b53942e5d29444c3ce4d70293f",
"score": "0.6541811",
"text": "def load!\n collection = @service.all(@parent)\n collection.each { |el| set_parent(el) }\n __setobj__(collection)\n self\n end",
"title": ""
},
{
"docid": "fb3a399d2f3ce6add3e161027cc6a3ad",
"score": "0.65241456",
"text": "def collection\n new.collection\n end",
"title": ""
},
{
"docid": "fb3a399d2f3ce6add3e161027cc6a3ad",
"score": "0.65241456",
"text": "def collection\n new.collection\n end",
"title": ""
},
{
"docid": "1d0e136d6d1bdf2ed25c2f7f91693c51",
"score": "0.64949095",
"text": "def initialize(collection)\n @collection = collection\n end",
"title": ""
},
{
"docid": "9c66d8b9d6a9ea601d91fc3aa59b5c0f",
"score": "0.6479855",
"text": "def initialize(collection={}, model = Occi::Model.new)\n collection = Hashie::Mash.new(collection) unless collection.kind_of? Occi::Collection\n\n @kinds = Occi::Core::Kinds.new\n @mixins = Occi::Core::Mixins.new\n @actions = Occi::Core::Actions.new\n @resources = Occi::Core::Resources.new\n @links = Occi::Core::Links.new\n\n self.model = model if model\n\n @kinds.merge collection.kinds.to_a.collect { |kind| Occi::Core::Kind.new(kind.scheme, kind.term, kind.title, kind.attributes, kind.related, kind.actions) }\n @mixins.merge collection.mixins.to_a.collect { |mixin| Occi::Core::Mixin.new(mixin.scheme, mixin.term, mixin.title, mixin.attributes, mixin.related, mixin.actions) }\n @actions.merge collection.actions.to_a.collect { |action| Occi::Core::Action.new(action.scheme, action.term, action.title, action.attributes) }\n @resources.merge collection.resources.to_a.collect { |resource| Occi::Core::Resource.new(resource.kind, resource.mixins, resource.attributes, resource.links) }\n @links.merge collection.links.to_a.collect { |link| Occi::Core::Link.new(link.kind, link.mixins, link.attributes) }\n @action = Occi::Core::ActionInstance.new(collection.action, collection.attributes) if collection.action\n end",
"title": ""
},
{
"docid": "0581840338cd6a1bfa9388f5e3fe9f3c",
"score": "0.64632833",
"text": "def initialize(collection = EMPTY_ARRAY)\n klass = self.class\n @model = klass.model\n @attributes = klass.attributes\n @collection = collection\n end",
"title": ""
},
{
"docid": "6438062e666b12e4008bf9fc77a54efd",
"score": "0.64416414",
"text": "def initialize(collection = [], parent = nil, name = nil)\n @collection = collection\n @parent = parent\n @name = name\n end",
"title": ""
},
{
"docid": "6438062e666b12e4008bf9fc77a54efd",
"score": "0.64416414",
"text": "def initialize(collection = [], parent = nil, name = nil)\n @collection = collection\n @parent = parent\n @name = name\n end",
"title": ""
},
{
"docid": "bf530892ce9f1ce5ee42bdd7c7aa4358",
"score": "0.64232117",
"text": "def collection_for(model)\n retrieve_class(model, :collection)\n end",
"title": ""
},
{
"docid": "3a37897f46321286a8ce4f5490f229d3",
"score": "0.64048135",
"text": "def collection\n klass.collection\n end",
"title": ""
},
{
"docid": "01fe39d1c50d1a70bd1dc55d51f2ea1c",
"score": "0.6401314",
"text": "def collection\n self.class.collection()\n end",
"title": ""
},
{
"docid": "4994128be7fab5dc34f871a98fd1594d",
"score": "0.63655466",
"text": "def initialize_collection\n set_item_urls\n end",
"title": ""
},
{
"docid": "99cdccb2f85f3e7ded05fe4ddce6252e",
"score": "0.6365192",
"text": "def collection\n @collection_resource ||= Collection.new(@client)\n end",
"title": ""
},
{
"docid": "0b8e7c1a66056fdfe3c9866734cc019f",
"score": "0.6346798",
"text": "def collection_with_parent_collection=(_arg0); end",
"title": ""
},
{
"docid": "0b8e7c1a66056fdfe3c9866734cc019f",
"score": "0.6346798",
"text": "def collection_with_parent_collection=(_arg0); end",
"title": ""
},
{
"docid": "dcb3bdd2e9a0c098cbf145b21daae684",
"score": "0.6301067",
"text": "def collection\n self.class.collection\n end",
"title": ""
},
{
"docid": "dcb3bdd2e9a0c098cbf145b21daae684",
"score": "0.6301067",
"text": "def collection\n self.class.collection\n end",
"title": ""
},
{
"docid": "f08828d31041db15773e31a6840bc557",
"score": "0.629881",
"text": "def new_collection(collection_data) # {{{\n Her::Model::ORM.initialize_collection(self.to_s.underscore, collection_data)\n end",
"title": ""
},
{
"docid": "62d713263380e4c53c5f643c52e2a781",
"score": "0.6266974",
"text": "def initialize\n @collection = []\n end",
"title": ""
},
{
"docid": "62d713263380e4c53c5f643c52e2a781",
"score": "0.6266974",
"text": "def initialize\n @collection = []\n end",
"title": ""
},
{
"docid": "d3ab0952affbe454ca94e290c7290594",
"score": "0.6239358",
"text": "def initialize_collection(collection_data,url=nil)\n collection_data.map do |c| \n o = self.new({self.resource_name => c})\n o.collection_url = url\n o\n end \n end",
"title": ""
},
{
"docid": "732b25445ccc840d1ab939f895219b0d",
"score": "0.6215529",
"text": "def collection\n model.collection\n end",
"title": ""
},
{
"docid": "733565cc7c5af30e2a6fd8c52972e5cc",
"score": "0.6204632",
"text": "def modelitem_init_parent(obj)\n @parent_obj = obj\n end",
"title": ""
},
{
"docid": "0aeec454042d8afdbc4c5dce4f2dd4fd",
"score": "0.62033206",
"text": "def modelitem_init\n @comments = AuthoredComments.new\n @tags = TagList.new\n # NOTE: @properties is created lazily\n @properties = nil\n @parent_obj = nil\n end",
"title": ""
},
{
"docid": "82e551feeb492f9cdf612129ce4d35f3",
"score": "0.62022746",
"text": "def _collection\n collection\n end",
"title": ""
},
{
"docid": "5daa120e35e0763fe924a7edf1a01416",
"score": "0.61681426",
"text": "def fetch\n @_fetch ||= begin\n path = @parent.build_request_path(@parent.collection_path, @params)\n method = @parent.method_for(:find)\n @parent.request(@params.merge(:_method => method, :_path => path, :_headers => request_headers, :_options => request_options)) do |parsed_data, _|\n @parent.new_collection(parsed_data)\n end\n end\n end",
"title": ""
},
{
"docid": "4cf766313743b6163ae016d7775074fb",
"score": "0.61446583",
"text": "def collection_with_parent_collection; end",
"title": ""
},
{
"docid": "4cf766313743b6163ae016d7775074fb",
"score": "0.61446583",
"text": "def collection_with_parent_collection; end",
"title": ""
},
{
"docid": "38493630fe07a98b32ec237b15a85aa9",
"score": "0.6097369",
"text": "def collections\n Collections.new(**parent_params).collections\n end",
"title": ""
},
{
"docid": "02bfb825b979161b01da641cc9020ac1",
"score": "0.6082638",
"text": "def items(collection = [])\n model.collection = collection\n end",
"title": ""
},
{
"docid": "02bfb825b979161b01da641cc9020ac1",
"score": "0.6082638",
"text": "def items(collection = [])\n model.collection = collection\n end",
"title": ""
},
{
"docid": "01ed65ef9d641fc79fd6b112147d6953",
"score": "0.60683465",
"text": "def collection\n get_collection_ivar || set_collection_ivar( parent.managed_repository{ resource_class.all } )\n end",
"title": ""
},
{
"docid": "58d608fc53cf2a589b669e6b3b21050c",
"score": "0.60521466",
"text": "def initialize()\n super\n @odata_type = \"#microsoft.graph.listItem\"\n end",
"title": ""
},
{
"docid": "8836dea42825b4febcc55a3cb64f3c62",
"score": "0.60439324",
"text": "def crud_onetomany(model_class, parent_model_class, opts={})\n \n name = model_class.instance_exec { underscore(demodulize(self.name)) }\n name_plural = model_class.instance_exec { pluralize(underscore(demodulize(self.name))) }\n parent_name = parent_model_class.instance_exec { underscore(demodulize(self.name)) }\n parent_name_plural = parent_model_class.instance_exec { pluralize(underscore(demodulize(self.name))) }\n urlname = opts[:urlname] || name_plural\n default_newitem = lambda { |parent_item| model_class.new() }\n\n on urlname do\n \n with_all_directories do |dirs|\n \n ary = dirs.split(/\\//)\n \n if ary.last =~ /(\\d+)-([^\\/]+)/\n parent_id = $1.to_i\n parent_url_title = $2\n else\n raise \"weird parent in url\"\n end\n \n filter = ary[0..-2].join('/')\n filter = ::Iconv.new('ascii//translit', 'utf-8').iconv(filter) # otherwise \"napady\" != \"napady\" \n filter.gsub!(/^\\/+/,'')\n filter.gsub!(/\\/+$/,'')\n scope.instance_variable_set(\"@filter_#{parent_name}\", filter) # used in named routes; has to work only among own named routes\n $log.debug \"filter is: #{filter}\"\n \n parent = parent_model_class.where(Sequel[parent_name_plural.to_sym][:id]=>parent_id).first\n halt(404, \"Sorry, no item found (#5)\") unless parent\n halt 404, 'Sorry, no item found (#6)' if parent_url_title != parent.url_title\n\n # working on parent\n on 'new' do \n \n # new\n get do\n opts[:before].call(:new, parent, nil, filter) if opts[:before]\n item = opts[:new_item] ? opts[:new_item].call(parent) : default_newitem.call(parent)\n \n scope.instance_variable_set(\"@#{parent_name}\", parent) # for displaying parent's title, etc.\n scope.instance_variable_set(\"@#{name}\", item)\n html do\n scope.view \"#{name}-newedit\"\n end\n json do\n # TODO\n end\n end\n \n # create (add)\n post do \n opts[:before].call(:create, parent, nil, filter) if opts[:before] \n item = opts[:new_item] ? opts[:new_item].call(parent) : default_newitem.call(parent)\n \n begin\n $log.debug(\"going to create\", self['model'])\n self['model'].delete('submit')\n item.update(self['model'])\n parent.send(\"add_#{name}\", item)\n rescue\n $log.error $!, $!.backtrace\n json do\n {'form_errors'=>BS3Form::xsubmit_form_errors(item), 'flash_error'=>'Jsou tam chyby.'}\n end\n html do\n '' # TODO\n end \n else\n path = scope.send(\"#{name_plural}_path\", parent) #<< '#' << item.id.to_s\n scope.flash[:notice] = \"Uloženo jest.\"\n json do\n {'location'=>path}\n end\n html do \n redirect path\n end\n end\n end\n \n end\n \n # list: matches both / and /list.json\n get /(list)?/ do \n opts[:before].call(:list, parent, nil, filter) if opts[:before]\n\n dtst = parent.send(name_plural) # get a model_class\n \n if opts[:list_dataset_filter] # to set up other instance vars\n dtst = opts[:list_dataset_filter].call(dtst) \n end \n \n new_item = opts[:new_item] ? opts[:new_item].call(parent) : default_newitem.call(parent)\n \n scope.instance_variable_set(\"@#{parent_name}\", parent) # for displaying parent's title, etc.\n scope.instance_variable_set(\"@#{name}\", new_item) # to be able to display a new form inside the list\n scope.instance_variable_set(\"@#{name_plural}\", dtst)\n \n html do\n scope.view(name_plural)\n end\n json do\n # TODO\n end\n end\n \n # working on item\n on /(\\d+)-(.+?)(_\\w+)?/ do |id, url_title, sub_action|\n\n item = model_class.where(Sequel[name_plural.to_sym][:id]=>id).first\n halt 404, 'Sorry, no item found (#1)' unless item\n halt 404, 'Sorry, no item found (#2)' if url_title != item.url_title\n\n sub_action = sub_action.to_s.empty? ? nil : sub_action[1..-1].to_sym\n \n on sub_action==:edit do\n \n # edit\n get do\n opts[:before].call(:edit, parent, item, filter) if opts[:before]\n scope.instance_variable_set(\"@#{parent_name}\", parent) # for displaying parent's title, etc.\n scope.instance_variable_set(\"@#{name}\", item)\n html do\n scope.view \"#{name}-newedit\"\n end\n json do\n # TODO\n end\n end\n \n # update\n put do\n opts[:before].call(:update, parent, item, filter) if opts[:before]\n\n if self['model']\n # delete upload if checkbox \"delete?\"\n self['model'].dup.each do |k,v|\n if k =~ /(.*?)-delete_upload$/\n self['model'].delete(k)\n col = $1\n self['model'][col] = nil\n end\n end\n else\n # nothing has changed? (if there is just a file input and you let it empty, self['model'] is not sent at all \n path = scope.send(\"#{name_plural}_path\", parent) << '#' << item.id.to_s\n json do\n {'location'=>path}\n end\n html do \n redirect path\n end\n end\n \n # TODO: change position only\n \n begin\n $log.debug(\"going to update\", self['model'])\n self['model'].delete('submit') \n item.update(self['model'])\n rescue\n $log.error $!, $!.backtrace\n json do\n {'form_errors'=>BS3Form::xsubmit_form_errors(item), 'flash_error'=>'Jsou tam chyby.'}\n end\n html do\n '' # TODO\n end\n else\n path = scope.send(\"#{name_plural}_path\", parent) << \"?#{Time.now.to_i}\" << '#' << item.id.to_s\n scope.flash[:notice] = \"Uloženo jest.\"\n json do\n {'location'=>path}\n end\n html do \n redirect path\n end\n end\n end\n \n end\n \n on !sub_action do\n \n # show\n get do\n opts[:before].call(:show, parent, item, filter) if opts[:before]\n scope.instance_variable_set(\"@#{name}\", item)\n html do\n scope.view \"#{name}-show\"\n end\n json do\n # TODO\n end\n end \n \n # delete\n delete do \n opts[:before].call(:delete, parent, item, filter) if opts[:before]\n item.destroy\n html do\n # TODO\n end\n json do\n {'html'=>{\"##{id}\"=>''}, 'flash_notice'=>'Smazáno jest.'}\n end\n end\n \n end\n \n if block_given?\n opts[:before].call(sub_action, parent, item, filter) if opts[:before]\n yield(sub_action, parent, item, filter)\n end\n \n end\n \n end\n \n end\n\n end",
"title": ""
},
{
"docid": "26270946c6020fe5022000777195faac",
"score": "0.6038669",
"text": "def collection(parent = nil)\n persistence_context.collection(parent)\n end",
"title": ""
},
{
"docid": "35b9c51211574dc2b9855bcf89b797fc",
"score": "0.602587",
"text": "def collection\n self.class.collection_builder_strategy.collection(self)\n end",
"title": ""
},
{
"docid": "5bd81652a5b382767d260865b21d2da8",
"score": "0.601955",
"text": "def initialize(collection)\n @attributes = {}\n end",
"title": ""
},
{
"docid": "e0dfabf21a97326ed44427f17dcafa8f",
"score": "0.6018089",
"text": "def collection\n @collection ||= build_collection\n end",
"title": ""
},
{
"docid": "68255cf53f07be12737df5dea6f825bd",
"score": "0.60122484",
"text": "def collection_class_for(model_name)\n CIMI::Model::Collection.generate(CIMI::Model.const_get(model_name.to_s.camelize))\n end",
"title": ""
},
{
"docid": "2022954dc877c4d1ca91cc5d5446174f",
"score": "0.60074985",
"text": "def collection\n fetch_collection\n end",
"title": ""
},
{
"docid": "a0a1ded805a5e97bb2c644d0e32d7286",
"score": "0.6006186",
"text": "def collection\n self.class.instance_variable_get(:@collection)\n end",
"title": ""
},
{
"docid": "fd85f38d9f2bcb14b15648d229db836f",
"score": "0.599834",
"text": "def parent\n CollectionReference.from_path parent_path, client\n end",
"title": ""
},
{
"docid": "0b45532a123f59ba69d4705504e9313b",
"score": "0.5969142",
"text": "def make_collection ; @isCollection=true; end",
"title": ""
},
{
"docid": "223debc127b8ae62d522f2158460916b",
"score": "0.5966367",
"text": "def initialize\n super\n populate\n end",
"title": ""
},
{
"docid": "ce45bcfbda0363cc5c1e5ecbaaa6902e",
"score": "0.5957983",
"text": "def collection(instance = nil)\n @info.collection(@parent_info, instance)\n end",
"title": ""
},
{
"docid": "1663d723d186892a09488f85ed95a079",
"score": "0.5947744",
"text": "def collection\n return nil unless is_item?\n @collection ||= SolrDocument.new(\n Blacklight.solr.select(\n :params => {\n :fq => \"#{SolrDocument.unique_key}:\\\"#{self[blacklight_config.collection_member_identifying_field].first}\\\"\"\n }\n )[\"response\"][\"docs\"].first\n )\n end",
"title": ""
},
{
"docid": "4b8deed0a67630101e4d9396f576ae89",
"score": "0.5940244",
"text": "def new\n @collection = params[:collection]\n\n locked(@collection); return if performed?\n\n @object = DRI::Batch.with_standard :qdc\n @object.creator = ['']\n\n if params[:is_sub_collection].present? && params[:is_sub_collection] == 'true'\n @object.object_type = ['Collection']\n @object.type = ['Collection']\n end\n\n supported_licences\n end",
"title": ""
},
{
"docid": "88323e1ead14d6f616a65d676b24a143",
"score": "0.5938338",
"text": "def relate_collection(type, name, options)\n name = name.to_s\n\n define_method(name) do\n type.new(self, name, options)\n end\n end",
"title": ""
},
{
"docid": "65f27194b7e590754d371383fe0be7f4",
"score": "0.5934424",
"text": "def initialize model\n @model = model\n end",
"title": ""
},
{
"docid": "1c1e8789d63ba8f9925a2288c714bd79",
"score": "0.5932568",
"text": "def collection\n @collection ||= make_collection\n end",
"title": ""
},
{
"docid": "56beb063f8c632f175ba96463da63790",
"score": "0.58765316",
"text": "def collections\n Collections.new(parent_params).collections\n end",
"title": ""
},
{
"docid": "183cf6531536a5fd127da8d4fd90b87c",
"score": "0.586181",
"text": "def create_collection\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "9b78d22d6a1c12cfaa88e853b639923b",
"score": "0.58511263",
"text": "def initialize(parent, response)\n super(parent)\n @response = response\n @model = parent.model\n end",
"title": ""
},
{
"docid": "c4c9920e48b7c77cd650e267fc0b107f",
"score": "0.58490765",
"text": "def build(attrs = {})\n resource = target_class.new(parent.client, :attrs => attrs, parent.to_sym => parent)\n collection << resource\n resource\n end",
"title": ""
},
{
"docid": "b78189faefe9b0366b8b5ea7dcf82bd5",
"score": "0.5838311",
"text": "def initialize(collection)\n @collection = collection\n @records = []\n end",
"title": ""
},
{
"docid": "18ae9b77ef75dc2fc7dd6dc15aeab090",
"score": "0.58369476",
"text": "def new_collection(parsed_data)\n instantiate_collection(self, parsed_data)\n end",
"title": ""
},
{
"docid": "18ae9b77ef75dc2fc7dd6dc15aeab090",
"score": "0.58369476",
"text": "def new_collection(parsed_data)\n instantiate_collection(self, parsed_data)\n end",
"title": ""
},
{
"docid": "df5e094fea8019e01a3fdc563c1d6dbf",
"score": "0.5829002",
"text": "def collection(name, &block)\n @current_nest = Nests::Collection.new(name, @current_nest)\n #@current_collection = name\n self.instance_eval &block\n #@current_collection = :root\n @current_nest = @current_nest.parent\n end",
"title": ""
},
{
"docid": "5284fe0f2b8985cfe8b8e93151064db1",
"score": "0.58265835",
"text": "def set_collection\n self.collection = build_collection if collection.nil? && !@no_collection\n end",
"title": ""
},
{
"docid": "e4396d0d5bcde58a6f85f5f21471202d",
"score": "0.58043534",
"text": "def get_model(model_collection)\n # build model\n Occi::Model.new(model_collection)\n end",
"title": ""
},
{
"docid": "263264905d90da56a8e187debc20fa64",
"score": "0.57979834",
"text": "def collection_presenter_for(pagination_array, context=self)\n Collection.new(pagination_array, context)\n end",
"title": ""
},
{
"docid": "dd99af8cb3b371abfde6950873dcbab7",
"score": "0.5796535",
"text": "def initialize(collection = nil)\n @collection = collection || []\n end",
"title": ""
},
{
"docid": "9f19dfa5e64cb96f8397faa9eda34552",
"score": "0.5794061",
"text": "def collection\n return nil unless is_item?\n @collection ||= SolrDocument.new(\n Blacklight.default_index.connection.select(\n :params => {\n :fq => \"#{SolrDocument.unique_key}:\\\"#{self[blacklight_config.collection_member_identifying_field].first}\\\"\"\n }\n )[\"response\"][\"docs\"].first\n )\n end",
"title": ""
},
{
"docid": "a4e7bb3fd59b72e3d35c0650c7a578c5",
"score": "0.5784519",
"text": "def build(attributes)\n o = self.new(attributes)\n o.collection_url = self.collection_url\n o\n end",
"title": ""
},
{
"docid": "55067bce86f075130cad6d10fb291ce9",
"score": "0.5778565",
"text": "def set_nested_resource\n @nested_resource = request_collection.klass\n end",
"title": ""
},
{
"docid": "edd5b5f3033d03f81f73b1159c64a4c6",
"score": "0.57654667",
"text": "def fetch\n path = @parent.build_request_path(@params)\n method = @parent.method_for(:find)\n @parent.request(@params.merge(:_method => method, :_path => path)) do |parsed_data, response|\n @parent.new_collection(parsed_data)\n end\n end",
"title": ""
},
{
"docid": "da920826e9ed2425876a6ab587e3202e",
"score": "0.57623696",
"text": "def initialize(collection={ })\n collection = Hashie::Mash.new(collection) unless collection.kind_of? Occi::Collection\n @kinds = []\n @mixins = []\n @actions = []\n @resources = []\n @links = []\n @kinds = collection.kinds.collect { |kind| Occi::Core::Kind.new(kind.scheme, kind.term, kind.title, kind.attributes, kind.related, kind.actions) } if collection.kinds.instance_of? Array\n @mixins = collection.mixins.collect { |mixin| Occi::Core::Mixin.new(mixin.scheme, mixin.term, mixin.title, mixin.attributes, mixin.related, mixin.actions) } if collection.mixins.instance_of? Array\n @actions = collection.actions.collect { |action| Occi::Core::Action.new(action.scheme, action.term, action.title, action.attributes) } if collection.actions.instance_of? Array\n @resources = collection.resources.collect { |resource| Occi::Core::Resource.new(resource.kind, resource.mixins, resource.attributes, resource.links) } if collection.resources.instance_of? Array\n @links = collection.links { |link| Occi::Core::Link.new(link.kind, link.mixins, link.attributes) } if collection.links.instance_of? Array\n @action = Occi::Core::Action.new(collection.action.scheme, collection.action.term, collection.action.title, collection.action.attributes) if collection.action\n end",
"title": ""
},
{
"docid": "73b95b3d46314d2de45ce9e17b495a6c",
"score": "0.5756686",
"text": "def create\n # Manual load and authorize necessary because Cancan will pass in all\n # form attributes. When `permissions_attributes` are present the\n # collection is saved without a value for `has_model.`\n @collection = ::Collection.new\n authorize! :create, @collection\n # Coming from the UI, a collection type gid should always be present. Coming from the API, if a collection type gid is not specified,\n # use the default collection type (provides backward compatibility with versions < Hyrax 2.1.0)\n @collection.collection_type_gid = params[:collection_type_gid].presence || default_collection_type.gid\n @collection.attributes = collection_params.except(:members, :parent_id, :collection_type_gid)\n @collection.assign_attributes({'displays_in' => ['trove']}) # Added for Trove\n @collection.apply_depositor_metadata(current_user.user_key)\n add_members_to_collection unless batch.empty?\n @collection.visibility = @collection.collection_type_gid == helpers.course_gid ?\n Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC :\n Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE # Changed for Trove\n if @collection.save\n after_create\n else\n after_create_error\n end\n end",
"title": ""
},
{
"docid": "a7696a1d8e94fd98d454360d951c9ea3",
"score": "0.5755303",
"text": "def initialize(model)\n\t\t@model = model\n\tend",
"title": ""
},
{
"docid": "ac5aef2e911fd87797e6442e59e7fe3c",
"score": "0.57430214",
"text": "def initialize(model)\n\t\t\t@model = model\n\t\tend",
"title": ""
},
{
"docid": "59bc2398d57779922d63dd0556f67bf8",
"score": "0.5737173",
"text": "def initialize_custom_attributes_collections(parent_collection, sections)\n type = parent_collection.model_class.base_class.name\n relation = parent_collection.full_collection_for_comparison\n sections.each do |section|\n query = CustomAttribute.where(\n :resource_type => type,\n :resource_id => relation,\n :section => section.to_s\n )\n @collections[[:custom_attributes_for, type, section.to_s]] =\n ::ManagerRefresh::InventoryCollection.new(\n shared_options.merge(\n :model_class => CustomAttribute,\n :name => \"custom_attributes_for_#{parent_collection.name}_#{section}\".to_sym,\n :arel => query,\n :manager_ref => [:resource, :section, :name],\n :parent_inventory_collections => [parent_collection.name],\n )\n )\n end\n end",
"title": ""
},
{
"docid": "40a6df42cfbc4a026eec09712014dd39",
"score": "0.57280713",
"text": "def collection\n @collection ||= self.client.collection(self.collection_name)\n end",
"title": ""
},
{
"docid": "2bba131c6c07c195f9f950ba6fc6eb07",
"score": "0.57254493",
"text": "def initialize parent, name\n @coll = parent\n @name = name\n @save = !name.blank? && name[0] != \"(\"\n @userExtendible = true\n end",
"title": ""
},
{
"docid": "f127ec29ac281385cfe8262a0ce0f7ee",
"score": "0.57241344",
"text": "def collection; end",
"title": ""
},
{
"docid": "f127ec29ac281385cfe8262a0ce0f7ee",
"score": "0.57241344",
"text": "def collection; end",
"title": ""
},
{
"docid": "f127ec29ac281385cfe8262a0ce0f7ee",
"score": "0.57241344",
"text": "def collection; end",
"title": ""
},
{
"docid": "f127ec29ac281385cfe8262a0ce0f7ee",
"score": "0.57241344",
"text": "def collection; end",
"title": ""
},
{
"docid": "f127ec29ac281385cfe8262a0ce0f7ee",
"score": "0.57241344",
"text": "def collection; end",
"title": ""
},
{
"docid": "f127ec29ac281385cfe8262a0ce0f7ee",
"score": "0.57241344",
"text": "def collection; end",
"title": ""
},
{
"docid": "f127ec29ac281385cfe8262a0ce0f7ee",
"score": "0.57241344",
"text": "def collection; end",
"title": ""
},
{
"docid": "f127ec29ac281385cfe8262a0ce0f7ee",
"score": "0.5723228",
"text": "def collection; end",
"title": ""
},
{
"docid": "f127ec29ac281385cfe8262a0ce0f7ee",
"score": "0.5723228",
"text": "def collection; end",
"title": ""
},
{
"docid": "1bd11b9534e9bcec47c1482c474b8c8e",
"score": "0.5709577",
"text": "def initialize(parent, klass, endpoint, prefix = {})\n @parent = parent\n @klass = klass\n @endpoint = \"#{parent.resource_path}/#{endpoint}\"\n @prefix = prefix\n @collection = load_collection\n end",
"title": ""
},
{
"docid": "97591d3c73f2d17e78a59af1add5597f",
"score": "0.5708687",
"text": "def create\n # get an id\n # POST mixed/multipart\n # update ids\n run_callbacks :create do\n connection.put(collection_path, encode, self.class.headers.merge(instance_create_headers)).tap do |response|\n self.id = collection_path\n #load_attributes_from_response(response)\n end\n end\n end",
"title": ""
},
{
"docid": "74bed00b078afdf150841535bb8917c1",
"score": "0.57056195",
"text": "def initialize(collection)\n @collection = Array(collection)\n end",
"title": ""
},
{
"docid": "47b7cff5814430839c287dbe8546d810",
"score": "0.56882405",
"text": "def set_collection\n @collection = Collection.friendly.find(params[:id])\n end",
"title": ""
},
{
"docid": "47b7cff5814430839c287dbe8546d810",
"score": "0.56882405",
"text": "def set_collection\n @collection = Collection.friendly.find(params[:id])\n end",
"title": ""
},
{
"docid": "1ba11cf959a709cea1e2a400f9a141de",
"score": "0.5687032",
"text": "def initialize\n @collection = []\n @klasses_and_namespaces = {}\n end",
"title": ""
},
{
"docid": "01bb03a00b50597e91eab283b3b503ac",
"score": "0.5686973",
"text": "def add_model_to_list\n Resources::Models.add self unless abstract_class\n end",
"title": ""
},
{
"docid": "de1a2ddfdf3ab9ecfc3682e005adc3cc",
"score": "0.5685779",
"text": "def initialize\n\n @_bluzelle = Swarmclient::Communication.new endpoint: ENDPOINT, port: PORT, uuid: UUID\n\n @_user_collection = Collection::User.new bluzelle: @_bluzelle, collection_key: 'users'\n @_conversation_collection = Collection::Conversation.new bluzelle: @_bluzelle, collection_key: 'conversations'\n @_message_collection = Collection::Message.new bluzelle: @_bluzelle, collection_key: 'messages'\n\n init_collection\n end",
"title": ""
},
{
"docid": "ca872754f186687f2c0151a41421e2f5",
"score": "0.5679169",
"text": "def initialize(parent, relation_set, connection)\n @parent = parent\n @relation_set = relation_set\n @connection = connection\n @associations = {}\n end",
"title": ""
},
{
"docid": "ada1d3962b8c66b4042b59c2c4ff0cf3",
"score": "0.5677098",
"text": "def initialize(collection, attrs)\n @collection = collection\n @attrs = attrs\n end",
"title": ""
},
{
"docid": "0857697a15b50aa19c0c7c4e1fb79bfb",
"score": "0.5668453",
"text": "def collection\n raise Errors::InvalidCollection.new(self) if embedded\n self._collection ||= Mongoid::Collection.new(self, self.collection_name)\n add_indexes; self._collection\n end",
"title": ""
},
{
"docid": "3592f55b7062ae74836248e724afb478",
"score": "0.5665928",
"text": "def find_collection\n @def_items = Def_Items\n @list_items = List_Items + Base_Altering_Items\n @menu_items = Menu_Items\n\n @collection = Corner.find :all, \n :page => current_page, \n :scope => \":self\",\n :conditions => \"parent_run_id IS NULL OR parent_run_id = 0\",\n :order => \"fullseq\"\n end",
"title": ""
},
{
"docid": "ef71e95698fd39decb280637bb417b3e",
"score": "0.5665696",
"text": "def new_collection\n self.class.primitive.new\n end",
"title": ""
}
] |
3b24c6fb53ce39438434db260268d735 | GET /sliders/new GET /sliders/new.json | [
{
"docid": "004132cf2f9ae0042775f4ed7bce3ea8",
"score": "0.8056779",
"text": "def new\n @slider = Slider.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slider }\n end\n end",
"title": ""
}
] | [
{
"docid": "15a8aa221ad102fd40dc343478ccdc02",
"score": "0.7739046",
"text": "def new\n @slider = Slider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json=>@slider}\n end\n end",
"title": ""
},
{
"docid": "7f2c4f3b862a3e8f7150b92a79c7ed38",
"score": "0.7527516",
"text": "def new\n @slider = Slider.new\n\n respond_to do |format|\n format.html { render \"edit\" }\n format.json { render json: @slider }\n end\n end",
"title": ""
},
{
"docid": "289f29fffb0e04f04ca7d3466cdfe2ac",
"score": "0.7526132",
"text": "def new\n @image_slider = ImageSlider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_slider }\n end\n end",
"title": ""
},
{
"docid": "8e2b0ca0156780b99c23fe748f779391",
"score": "0.72508824",
"text": "def new\n @slide_new = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @slide }\n end\n end",
"title": ""
},
{
"docid": "2693757d21f6cadbda1682891716198f",
"score": "0.7183224",
"text": "def new\n @feature_slider = FeatureSlider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feature_slider }\n end\n end",
"title": ""
},
{
"docid": "a48a8f5abcada6a4a53dfcb675407427",
"score": "0.71696323",
"text": "def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"title": ""
},
{
"docid": "a48a8f5abcada6a4a53dfcb675407427",
"score": "0.71693283",
"text": "def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"title": ""
},
{
"docid": "20abd6660d188ad34385003ccccd72d8",
"score": "0.70938355",
"text": "def create\n @slider = Admin::Slider.new(slider_params)\n\n respond_to do |format|\n if @slider.save\n format.html { redirect_to admin_sliders_path, notice: 'Slider was successfully created.' }\n format.json { render :show, status: :created, location: @slider }\n else\n format.html { render :new }\n format.json { render json: @slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5cef5ac642a07b81e8bf6125c9677133",
"score": "0.70665777",
"text": "def create\n @slider = Admin::Slider.new(slider_params)\n\n if @slider.save\n render json: @slider, status: :created\n else\n render json: @slider.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "33ffc09cdad6204b3c24de49328749b9",
"score": "0.70306116",
"text": "def create\n @slider = Slider.new(slider_params)\n\n respond_to do |format|\n if @slider.save\n format.html { redirect_to @slider, :notice=>\"Slider was successfully created.\" }\n format.json { render :json=>@slider, :status=>:created, :location=>@slider }\n else\n format.html { render :action=>\"new\" }\n format.json { render :json=>@slider.errors, :status=>:unprocessable_entry }\n end\n end\n end",
"title": ""
},
{
"docid": "1d3a500e3c75611c2135de3417c94698",
"score": "0.6943332",
"text": "def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"title": ""
},
{
"docid": "bde37aa1c81c9b5dbf3a63933b81f059",
"score": "0.6939905",
"text": "def create\n @slider = Slider.new(params[:slider])\n \n respond_to do |format|\n if @slider.save\n format.html { redirect_to @slider, notice: 'Slider was successfully created.' }\n format.json { render json: @slider, status: :created, location: @slider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e286f9b717a2ac07bab96d8dbf847764",
"score": "0.6883704",
"text": "def new\n @slide_item = SlideItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide_item }\n end\n end",
"title": ""
},
{
"docid": "eccbb519ecb6d28db28f07af868f97cd",
"score": "0.6804994",
"text": "def new\n @slide_show = SlideShow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide_show }\n end\n end",
"title": ""
},
{
"docid": "cbba6ad47adef5e0378cb4f14f6c62db",
"score": "0.6671446",
"text": "def new\n @slider = Slider.new\n render :layout => false\n end",
"title": ""
},
{
"docid": "e5335a4c8eca25789f57ca879e6b89a7",
"score": "0.666565",
"text": "def create\n @image_slider = ImageSlider.new(params[:image_slider])\n\n respond_to do |format|\n if @image_slider.save\n format.html { redirect_to @image_slider, notice: 'Image slider was successfully created.' }\n format.json { render json: @image_slider, status: :created, location: @image_slider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image_slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f5334640577913eecb933caf568fcbf6",
"score": "0.66597563",
"text": "def new\n @slideshow_image = SlideshowImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow_image }\n end\n end",
"title": ""
},
{
"docid": "663a92f528f07ada223c6fe041b8ba81",
"score": "0.66335565",
"text": "def new\n @slideshow_attrib = SlideshowAttrib.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow_attrib }\n end\n end",
"title": ""
},
{
"docid": "6c3609f862d6da620b0c50becc4343ba",
"score": "0.66135347",
"text": "def new\n @lens = Lens.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lens }\n end\n end",
"title": ""
},
{
"docid": "93795fae0ba2e58502c8e44872e73d2d",
"score": "0.6602037",
"text": "def create\n slider = Slider.new(slider_params)\n sliderall = Slider.all\n if sliderall.present?\n sliderlast = Slider.last\n sort_number = sliderlast.sort_number.to_i\n sort_numbers = sort_number + 1\n else\n sort_number = 0\n sort_numbers = sort_number + 1\n end\n if slider.save\n slider.update(sort_number: sort_numbers)\n slider.reload\n render json: { status: 'OK', results: slider, error: nil },\n status: :created\n else\n render json: {\n status: 'FAIL', results: nil, error: 'data fail created'\n }, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "081a625633f03506b1aa057910e0f2eb",
"score": "0.65915906",
"text": "def new\n @pi = Pi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pi }\n end\n end",
"title": ""
},
{
"docid": "bf9a6d7a5e9222751f7a016011c159c7",
"score": "0.658154",
"text": "def new\n @slide = Slide.new\n @slide.save()\n respond_to do |format|\n format.html { redirect_to :action => \"show\", :id => @slide.id }\n format.json { render json: @slide }\n end\n end",
"title": ""
},
{
"docid": "9e015cc7894d67cf75f762f0d89f2f5c",
"score": "0.6554596",
"text": "def new\n @involve = Involve.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @involve }\n end\n end",
"title": ""
},
{
"docid": "548f0f8523f8dbf0bb20675472de1f1c",
"score": "0.65501213",
"text": "def create\n @slider = Slider.new(slider_params)\n @slider.user = current_user\n respond_to do |format|\n if @slider.save\n format.html { redirect_to sliders_path, notice: 'Slider was successfully created.' }\n format.json { render :show, status: :created, location: @slider }\n else\n format.html { render :new }\n format.json { render json: @slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "36fb821d6f1b8ae057fb1b7a17057635",
"score": "0.6541055",
"text": "def new\n @homeslider = Homeslider.new\n respond_to do |format|\n format.html # new.html.erb\n format.js\n end\n end",
"title": ""
},
{
"docid": "73bd16ff3054bf9cf88be482c5902af5",
"score": "0.6526993",
"text": "def new\n @pick = Pick.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pick }\n end\n end",
"title": ""
},
{
"docid": "849777449cced5669430788c0cf8becf",
"score": "0.6517481",
"text": "def new\n @spl = Spl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @spl }\n end\n end",
"title": ""
},
{
"docid": "fc1c620c18275f398adbf0fefb2bcc86",
"score": "0.65113175",
"text": "def create\n @slider = Slider.new(params[:slider])\n\n respond_to do |format|\n if @slider.save\n format.html { redirect_to (params[:commit] == \"Сохранить\" ? [:admin,:sliders] : [:edit,:admin,@slider]), notice: 'Слайдер успешно создан.' }\n format.json { render json: @slider, status: :created, location: @slider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6f2b5197571ddeb1e875fcc01a5c495a",
"score": "0.65016985",
"text": "def new\n @swim = Swim.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @swim }\n end\n end",
"title": ""
},
{
"docid": "2257784629b6e17b3235010a2004b3a0",
"score": "0.6496734",
"text": "def create\n @lider = Lider.new(lider_params)\n\n respond_to do |format|\n if @lider.save\n format.html { redirect_to @lider, notice: 'Lider was successfully created.' }\n format.json { render :show, status: :created, location: @lider }\n else\n format.html { render :new }\n format.json { render json: @lider.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "04b35a369b698c772be87108e7d4adb1",
"score": "0.64751357",
"text": "def new\n @interp_item = InterpItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interp_item }\n end\n end",
"title": ""
},
{
"docid": "27e6680274dce59b18c575d2921eac89",
"score": "0.645275",
"text": "def create\n @slider_restum = SliderRestum.new(slider_restum_params)\n\n respond_to do |format|\n if @slider_restum.save\n format.html { redirect_to @slider_restum, notice: 'Slider restum was successfully created.' }\n format.json { render :show, status: :created, location: @slider_restum }\n else\n format.html { render :new }\n format.json { render json: @slider_restum.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a5c7bdf6ffbf6fffc208bf44165a01f4",
"score": "0.64419264",
"text": "def new\n @rating_scale = RatingScale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rating_scale }\n end\n end",
"title": ""
},
{
"docid": "0d001ee0216e6a9563b75b7d77c5814a",
"score": "0.6424805",
"text": "def new\n @rol = Rol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rol }\n end\n end",
"title": ""
},
{
"docid": "39c8d6905ca05fce8f8672f357fd163b",
"score": "0.64142364",
"text": "def new\n @rol = Rol.new\n\n respond_to do |format|\n format.json { render json: @rol }\n end\n end",
"title": ""
},
{
"docid": "6608b039eb611b10e27e25dbda37264c",
"score": "0.6404276",
"text": "def new\n @relapse = Relapse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @relapse }\n end\n end",
"title": ""
},
{
"docid": "95fad400c738f62545f7ed5860bcf78a",
"score": "0.64037657",
"text": "def new\n @templage = Templage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @templage }\n end\n end",
"title": ""
},
{
"docid": "722ab74ab97ff695e02b56024832851f",
"score": "0.6395442",
"text": "def new\n @sick = Sick.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sick }\n end\n end",
"title": ""
},
{
"docid": "43dfe4de9797b94340ed0d02dade2e17",
"score": "0.6393569",
"text": "def new\n @snipet = Snipet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @snipet }\n end\n end",
"title": ""
},
{
"docid": "87eca24ba5f6ba9104148ed973c1e085",
"score": "0.6392225",
"text": "def new\n @presentation_pslide = PresentationsPslide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presentation_pslide }\n end\n end",
"title": ""
},
{
"docid": "a95e9116789f25a9572e07d9d84d7e8a",
"score": "0.6390231",
"text": "def new\n @rider = Rider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rider }\n end\n end",
"title": ""
},
{
"docid": "a95e9116789f25a9572e07d9d84d7e8a",
"score": "0.6390231",
"text": "def new\n @rider = Rider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rider }\n end\n end",
"title": ""
},
{
"docid": "d1b3596f930a6afc680445209d1e9b09",
"score": "0.6388504",
"text": "def new\n @slide_show_item = SlideShowItem.new\n @settings = SettingUtility.settings\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide_show_item }\n end\n end",
"title": ""
},
{
"docid": "d89d88dcb488b2acf0e3af27a9893512",
"score": "0.63867867",
"text": "def new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: ''}\n end\n end",
"title": ""
},
{
"docid": "25e3b22e9cee3e09d10f5b6668d61b7f",
"score": "0.63733256",
"text": "def new\n @carousel_item = CarouselItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @carousel_item }\n end\n end",
"title": ""
},
{
"docid": "29d873fbc76bc40f0154a4dd285716b7",
"score": "0.63706803",
"text": "def new\n @pool = Pool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pool }\n end\n end",
"title": ""
},
{
"docid": "29d873fbc76bc40f0154a4dd285716b7",
"score": "0.63706803",
"text": "def new\n @pool = Pool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pool }\n end\n end",
"title": ""
},
{
"docid": "ff776ab942cf80b20cf468535b6dc67a",
"score": "0.6357004",
"text": "def new\n @serv = Serv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serv }\n end\n end",
"title": ""
},
{
"docid": "da0923f8ee363c0cddf18b9e6a141a3a",
"score": "0.63544786",
"text": "def create\n slider_image = SliderImage.new(params[:image])\n @slider = Slider.new(params[:slider])\n slider_image.slider = @slider\n\n respond_to do |format|\n if @slider.save && slider_image.save\n format.html { redirect_to :back, :notice => t('notice.successfully_created') }\n format.json { render :json => @slider, :status => :created, :location => @slider }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @slider.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "daecb22d856953fd72a8fc59875d708d",
"score": "0.635341",
"text": "def new\n logger.info\"PARAMS in new #{params.inspect}\"\n @widget = Widget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @widget }\n end\n end",
"title": ""
},
{
"docid": "ceee4ba6910af2cfdd5af07ef2195c12",
"score": "0.63441986",
"text": "def new\n @lt = Lt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lt }\n end\n end",
"title": ""
},
{
"docid": "2799c05ff543af091379c07094d497ae",
"score": "0.6338173",
"text": "def new\r\n @pool = Pool.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @pool }\r\n end\r\n end",
"title": ""
},
{
"docid": "6ee56034493e8702b879a50cc1e54193",
"score": "0.6337282",
"text": "def new\n @carousel = @carousel_animation.carousels.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @carousel }\n end\n end",
"title": ""
},
{
"docid": "0a9747c36522510ebf32f69e404e1f84",
"score": "0.6336089",
"text": "def new\n @shelter = Shelter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shelter }\n end\n end",
"title": ""
},
{
"docid": "9f0a1b653eeccaf591a028b131bcefbc",
"score": "0.63280267",
"text": "def new\n @series = Series.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @series }\n end\n end",
"title": ""
},
{
"docid": "07131dbd7f4247bd891c2868fef048a1",
"score": "0.6323274",
"text": "def show\n render json: @slider\n end",
"title": ""
},
{
"docid": "a7e3365ecea38a193003bdf5ee6b03b5",
"score": "0.6322645",
"text": "def new\n @setting_sl = SettingSl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @setting_sl }\n end\n end",
"title": ""
},
{
"docid": "f748daa93124a20f06f42ab41c6ab262",
"score": "0.6321932",
"text": "def create\n @slide = Slide.create(slide_params)\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to '/administrator/sliders', notice: 'Информация обновлена' }\n format.json { render :show, status: :created, location: @slide }\n else\n format.html { render :new }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b14e7636969d6a4e299d05eeca7b151a",
"score": "0.6311467",
"text": "def new(options) \n Client.get(\"/lovers/new\", :query => options)\n end",
"title": ""
},
{
"docid": "94636c7a4c457d764794cf2f8e85111a",
"score": "0.6309202",
"text": "def new\n @lifting = Lifting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lifting }\n end\n end",
"title": ""
},
{
"docid": "f5c7f136929b7058eecf544a0f1ef0a6",
"score": "0.63069403",
"text": "def new\n @interval = Interval.new\n\n\t@date = Date.today\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interval }\n end\n end",
"title": ""
},
{
"docid": "f4af8c1b317d974267961bf949eaf585",
"score": "0.6306492",
"text": "def new\n @serie = Serie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serie }\n end\n end",
"title": ""
},
{
"docid": "360aaf8a9d1a2c9a0afefcbf7ddb48f0",
"score": "0.6304199",
"text": "def index\n @sliders = Slider.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=>@sliders} \n end\n end",
"title": ""
},
{
"docid": "da2005f3d553f2e4bd6bf04dd0c97184",
"score": "0.6301709",
"text": "def new\n @newrelic = Newrelic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newrelic }\n end\n end",
"title": ""
},
{
"docid": "a2927420f6d7bd24a8066a0d6ae09dc6",
"score": "0.63002706",
"text": "def new\n @series = Serie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @series }\n end\n end",
"title": ""
},
{
"docid": "2afddec3f4dde45b6fdb06c812b18d8b",
"score": "0.6299086",
"text": "def new\n @api_wmall_slide_picture = Wmall::SlidePicture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_wmall_slide_picture }\n end\n end",
"title": ""
},
{
"docid": "4c022ec6ca29153b05002784776e5a14",
"score": "0.62980527",
"text": "def create\n @slide = @slider.slides.build(slide_params)\n\n if @slide.save\n render json: @slide, status: :created\n else\n render json: @slide.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "ad0a0d1b4b13343fc89f582ae3ca2c16",
"score": "0.629201",
"text": "def new\n @thumb = Thumb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @thumb }\n end\n end",
"title": ""
},
{
"docid": "e1a775e22775c35a906bb69fb64adc01",
"score": "0.62909937",
"text": "def new\n @collage = Collage.new\n get_all_categories\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @collage }\n end\n end",
"title": ""
},
{
"docid": "07bd886d0406d7bf416e33d6180ea791",
"score": "0.6286092",
"text": "def new\n unless current_user.try(:admin?)\n redirect_to \"/\"\n end\n @page = \"pieces\"\n @gallery = Gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gallery }\n end\n end",
"title": ""
},
{
"docid": "2bbbf6629ea077f29f22280713d18651",
"score": "0.6285466",
"text": "def new\n @pilot = Pilot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pilot }\n end\n end",
"title": ""
},
{
"docid": "2bbbf6629ea077f29f22280713d18651",
"score": "0.6285466",
"text": "def new\n @pilot = Pilot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pilot }\n end\n end",
"title": ""
},
{
"docid": "0b85412dc8ddf53a6ce4acb1e8b567a8",
"score": "0.62822133",
"text": "def new\n @livre = Livre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @livre }\n end\n end",
"title": ""
},
{
"docid": "8c1727fa1c0a3f8c41f1f8ea2ec3a98b",
"score": "0.62805754",
"text": "def new\n @ratio = Ratio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ratio }\n end\n end",
"title": ""
},
{
"docid": "2da4f0acaf290557e9674b23fead22d4",
"score": "0.6279869",
"text": "def new\n @spectrum_range = SpectrumRange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spectrum_range }\n end\n end",
"title": ""
},
{
"docid": "fe78bc333eae458a5339c3b61d4fbbaa",
"score": "0.6278076",
"text": "def new\n @counter = Counter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @counter }\n end\n end",
"title": ""
},
{
"docid": "23f15cf88fa8c5aac913c099a0678698",
"score": "0.62778836",
"text": "def new\n @light = Light.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @light }\n end\n end",
"title": ""
},
{
"docid": "a1938073044e2df386839d2998edbc4d",
"score": "0.62749946",
"text": "def new\n @viper = Viper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @viper }\n end\n end",
"title": ""
},
{
"docid": "430ccb232dc892a1cc91b5f728de296a",
"score": "0.6271395",
"text": "def new\n @loop = Loop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loop }\n end\n end",
"title": ""
},
{
"docid": "e4b86c9fd1d76958cf15bec1db35efcd",
"score": "0.6270847",
"text": "def new\n @gallery = Gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gallery }\n end\n end",
"title": ""
},
{
"docid": "e4b86c9fd1d76958cf15bec1db35efcd",
"score": "0.6270847",
"text": "def new\n @gallery = Gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gallery }\n end\n end",
"title": ""
},
{
"docid": "e4b86c9fd1d76958cf15bec1db35efcd",
"score": "0.6270847",
"text": "def new\n @gallery = Gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gallery }\n end\n end",
"title": ""
},
{
"docid": "e4b86c9fd1d76958cf15bec1db35efcd",
"score": "0.6270847",
"text": "def new\n @gallery = Gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gallery }\n end\n end",
"title": ""
},
{
"docid": "6896a9621cdda5c440308dc2322b7ab4",
"score": "0.6270349",
"text": "def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll }\n end\n end",
"title": ""
},
{
"docid": "6896a9621cdda5c440308dc2322b7ab4",
"score": "0.6270349",
"text": "def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll }\n end\n end",
"title": ""
},
{
"docid": "6896a9621cdda5c440308dc2322b7ab4",
"score": "0.6270349",
"text": "def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll }\n end\n end",
"title": ""
},
{
"docid": "6896a9621cdda5c440308dc2322b7ab4",
"score": "0.6270349",
"text": "def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @poll }\n end\n end",
"title": ""
},
{
"docid": "08c629f7d0e55379f33be6a1cb3b4601",
"score": "0.62681496",
"text": "def new\n @life_pulse = LifePulse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @life_pulse }\n end\n end",
"title": ""
},
{
"docid": "e2c5493c7e4babc0e6cc65ed39e252ea",
"score": "0.62643284",
"text": "def list\n @sliders = Admin::Slider.names\n\n render json: { sliders: @sliders }\n end",
"title": ""
},
{
"docid": "7a1190f62fb618719c3db52da9c85676",
"score": "0.6259319",
"text": "def new\n @lunch = Lunch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lunch }\n end\n end",
"title": ""
},
{
"docid": "effe4c72ab644b38fe0d18f207c43da5",
"score": "0.6252511",
"text": "def create\n @feature_slider = FeatureSlider.new(params[:feature_slider])\n\n respond_to do |format|\n if @feature_slider.save\n format.html { redirect_to @feature_slider, notice: 'Feature slider was successfully created.' }\n format.json { render json: @feature_slider, status: :created, location: @feature_slider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feature_slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ad8c55913bcdd2f0f0e87d543dc5ce41",
"score": "0.625117",
"text": "def new\n @lectivo = Lectivo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lectivo }\n end\n end",
"title": ""
},
{
"docid": "08a745703518d4e463ef9be481abf386",
"score": "0.62509453",
"text": "def new\n @sleep = Sleep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sleep }\n end\n end",
"title": ""
},
{
"docid": "08a745703518d4e463ef9be481abf386",
"score": "0.62509453",
"text": "def new\n @sleep = Sleep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sleep }\n end\n end",
"title": ""
},
{
"docid": "a847274046cb410dfce7034e6e0bbf43",
"score": "0.6243548",
"text": "def new\n @sellable_item = SellableItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sellable_item }\n end\n end",
"title": ""
},
{
"docid": "232a02c8834c30e8e1f8d04eb6690a74",
"score": "0.62420255",
"text": "def new\n @lop = Lop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lop }\n end\n end",
"title": ""
},
{
"docid": "b4b9196de111fc37d7c2992e5457d55e",
"score": "0.62403214",
"text": "def new\n @rise = Rise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rise }\n end\n end",
"title": ""
},
{
"docid": "25ea04cc7a1fee66db455e1270a5e28b",
"score": "0.62366945",
"text": "def new\n @splash = Splash.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @splash }\n end\n end",
"title": ""
},
{
"docid": "35d02c7362d8e2ec434a3426df560ff0",
"score": "0.623482",
"text": "def new\n @spider_url = SpiderUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spider_url }\n end\n end",
"title": ""
},
{
"docid": "8c68aa4224501b86847b47563af187d4",
"score": "0.62339157",
"text": "def new\n @selection = Selection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @selection }\n end\n end",
"title": ""
}
] |
ae12b1a41b55e3a82302dec7b46d230c | Capitalizes all the words and replaces some characters in the string to create a nicer looking title. Titleize is meant for creating pretty output. It is not used in the Rails internals. titleize is also aliased as as titlecase Examples "man from the boondocks".titleize => "Man From The Boondocks" "xmen: the last stand".titleize => "X Men: The Last Stand" | [
{
"docid": "2f1ce9b88e367a44668d21f3b0a63d89",
"score": "0.7725214",
"text": "def titleize(word)\n humanize(underscore(word)).gsub(/\\b([a-z])/) { $1.capitalize }\n end",
"title": ""
}
] | [
{
"docid": "f93c755a2b21399d06a91f84a224962f",
"score": "0.84019774",
"text": "def titleize string\n string.gsub(/\\w+/) do |word|\n word.capitalize\n end\n end",
"title": ""
},
{
"docid": "02ecb972c5549ac304dae18fa492cc59",
"score": "0.8178111",
"text": "def titleize\n downcase.gsub(/\\b\\S/u).each { _1.upcase }\n end",
"title": ""
},
{
"docid": "51eaf7f3d8474137511fa5869fb3735a",
"score": "0.81718165",
"text": "def titlecase\n small_words = %w(a an and as at but by en for if in of on or the to v v. via vs vs.)\n\n x = split(\" \").map do |word|\n # note: word could contain non-word characters!\n # downcase all small_words, capitalize the rest\n small_words.include?(word.gsub(/\\W/, \"\").downcase) ? word.downcase! : word.smart_capitalize!\n word\n end\n # capitalize first and last words\n x.first.smart_capitalize!\n x.last.smart_capitalize!\n # small words after colons are capitalized\n x.join(\" \").gsub(/:\\s?(\\W*#{small_words.join(\"|\")}\\W*)\\s/) { \": #{$1.smart_capitalize} \" }\n end",
"title": ""
},
{
"docid": "51eaf7f3d8474137511fa5869fb3735a",
"score": "0.81718165",
"text": "def titlecase\n small_words = %w(a an and as at but by en for if in of on or the to v v. via vs vs.)\n\n x = split(\" \").map do |word|\n # note: word could contain non-word characters!\n # downcase all small_words, capitalize the rest\n small_words.include?(word.gsub(/\\W/, \"\").downcase) ? word.downcase! : word.smart_capitalize!\n word\n end\n # capitalize first and last words\n x.first.smart_capitalize!\n x.last.smart_capitalize!\n # small words after colons are capitalized\n x.join(\" \").gsub(/:\\s?(\\W*#{small_words.join(\"|\")}\\W*)\\s/) { \": #{$1.smart_capitalize} \" }\n end",
"title": ""
},
{
"docid": "7a05f284315951d61147f8e51bdf8571",
"score": "0.81252956",
"text": "def titleize(title)\n\t\tleave_lower = [\"the\", \"a\", \"an\", \"and\", \"but\", \"or\", \"at\", \"of\", \"on\", \"in\", \"to\", \"with\"]\n\n\t\ttitle.capitalize!\n\n\t\ttitle.split.each do |word|\n\t\t\tword.capitalize! unless leave_lower.include?(word)\n\t\tend.join(\" \")\n\tend",
"title": ""
},
{
"docid": "2e901209b2515f29a1e192be006b11bc",
"score": "0.8113052",
"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": "e2d4c6c5eb59eafb4dad021e8c27fe5b",
"score": "0.81041384",
"text": "def titleize(string)\n words = string.split\n words.each{|word| word.capitalize!}\n words.join(' ')\nend",
"title": ""
},
{
"docid": "25f9661f7e4610f24efd1930aa002238",
"score": "0.8101708",
"text": "def titleize(string)\n title = string.split.each do |word|\n word.capitalize!\n end\n title.join(' ')\nend",
"title": ""
},
{
"docid": "46666578a9a9b062734e211f9b818a50",
"score": "0.80897474",
"text": "def titleize(words)\n words.split.map {|word| word.capitalize }.join(\" \") # use of split, map, capitalize and join\n end",
"title": ""
},
{
"docid": "84dafaadf61d56beb5de0180d6b729f3",
"score": "0.8088014",
"text": "def titleize(string)\n string_array = string.split(\" \")\n string_array.each { |word| word.capitalize!() }\n string = string_array.join(\" \")\nend",
"title": ""
},
{
"docid": "2dde8ad38fbf6cfe53d90e4a86de5d02",
"score": "0.8084025",
"text": "def titleize(title)\n\twords = title.split.map do |word|\n\t\tno_caps = %w{and the over}\n\t\tif no_caps.include?(word)\n\t\t\tword\n\t\telse\n\t\t\tword.capitalize\n\t\tend\n\tend\n\t# Always capitalize first word\n\twords[0].capitalize!\n\twords.join(' ')\nend",
"title": ""
},
{
"docid": "5618086189092dfd08e84efb87472019",
"score": "0.8077104",
"text": "def titleize(s)\n words = s.split\n caps = []\n words.each do |word|\n caps << word.capitalize\n end\n caps.join \" \"\nend",
"title": ""
},
{
"docid": "d075ff45cfc2acb085e0cc1ac0bc444f",
"score": "0.80518246",
"text": "def titleize!(string)\n temp = string.split\n temp.each do |word|\n word.capitalize!\n end\n string = temp.join(\" \")\nend",
"title": ""
},
{
"docid": "186abe58ed070381258d4c9958919ed8",
"score": "0.8018802",
"text": "def my_titleize(words)\n words.split.map { |word| word.capitalize! }.join(' ')\nend",
"title": ""
},
{
"docid": "c6a09e83b504192d26cbd89bef3e7367",
"score": "0.80038583",
"text": "def titleize(str)\n words = str.split\n capitalized = words.map { |word| word.capitalize }\n capitalized.join(' ')\nend",
"title": ""
},
{
"docid": "8410bc8e61384f2eae3332615425c389",
"score": "0.799705",
"text": "def titleize!\n replace(titleize)\n end",
"title": ""
},
{
"docid": "f3cc9838682508389b3e033723fc47d5",
"score": "0.79922676",
"text": "def titleize(string)\n keep_lowercase = [\"the\",\"and\",\"over\"]\n title = string.split\n\n title.each do |word|\n \tword.capitalize! unless keep_lowercase.include? word\n end\n\n title[0].capitalize!\n title.join(\" \")\nend",
"title": ""
},
{
"docid": "dc2b69612da74e500c9cbaa55b36e5ea",
"score": "0.7987519",
"text": "def titleize(str)\n words = str.split\n for word in words \n word.capitalize!\n end\n words.join(' ')\nend",
"title": ""
},
{
"docid": "fcd06d4caa6ee843563d26db82b60b8d",
"score": "0.79768515",
"text": "def titleize(s)\n #get array of words in the s\n words_in_s = s.split \" \"\n\n #make a string with all the words capitalized\n titlized_s = \"\"\n words_in_s.each do |w|\n titlized_s << w.capitalize\n titlized_s << \" \"\n end \n\n #remove the last space\n titlized_s.chop!\n\n return titlized_s\nend",
"title": ""
},
{
"docid": "228584a5fc5a5ba3d2ac2108f3cc6188",
"score": "0.7969922",
"text": "def titleize(string)\n\n\twords = string.split(\" \")\n\tcapitals = \"\"\n\tlittle_words = [\"and\", \"if\", \"the\", \"or\", \"a\", \"is\", \"an\", \"over\", \"in\", \"of\", \"on\"]\n\t\n\twords.each do |word|\n\t\tif little_words.include?(word)\n\t\t\tword.downcase!\n\t\telse\n\t\t\tword.capitalize!\n\t\tend\n\tend\n\n\twords[0].capitalize!\n\n\twords.each do |word|\n\t\tcapitals += word + \" \"\n\tend\n\n\treturn capitals.strip\nend",
"title": ""
},
{
"docid": "5a717192ec7b57398cc5bd14e7b65a7c",
"score": "0.7963847",
"text": "def titleize(string)\n title = \"\"\n string.split(\" \").each do |word|\n word.capitalize!\n title << word + \" \"\n end\n title\n end",
"title": ""
},
{
"docid": "052161a81bf040aeca797de718a30ea7",
"score": "0.7955039",
"text": "def titleize(string)\n a = string.split(\" \")\n a.each { |word| word.capitalize! }\n a.join(\" \")\nend",
"title": ""
},
{
"docid": "0c093d23ca0d56e49af18d9d25d48b5f",
"score": "0.795125",
"text": "def titleize!(string)\n words = string.split(' ')\n words.each { |word| word.capitalize! }\n words.join(' ')\n # words.split.map { |word| word.capitalize }.join(' ')\nend",
"title": ""
},
{
"docid": "ebe1b2884e72de4becef00d765068ef3",
"score": "0.7950409",
"text": "def titleize(str)\n str.split.each{ |word| word.capitalize! }.join(' ')\nend",
"title": ""
},
{
"docid": "8a62239c9cef5982bc38a11519223c2b",
"score": "0.7934882",
"text": "def titleize_a_string(string)\n words_to_not_capitilize = ['the', 'a', 'and']\n array = string.split\n array.each { |e| e.capitalize! if ! words_to_not_capitilize.include? e }\n array.first.capitalize!\n array.join(' ')\nend",
"title": ""
},
{
"docid": "45682380189f3b54676b1d71c7261f7f",
"score": "0.79342943",
"text": "def titleize(title)\n capitalized_title = []\n uncapitalized_words = %w[a and of over the]\n title.split(' ').each.with_index do |word, idx|\n if uncapitalized_words.include?(word)\n if idx == 0\n capitalized_title.push(word[0].upcase + word[1..-1])\n else\n capitalized_title.push(word)\n end\n else\n capitalized_title.push(word[0].upcase + word[1..-1])\n end\n end\n capitalized_title.join(' ')\nend",
"title": ""
},
{
"docid": "73c785314af1e43fce035a1f1973ddc5",
"score": "0.7915235",
"text": "def titlecase\n return if self.empty?\n\n # traverse each word and upcase all non-small words\n title = self.split(' ').map! do |word|\n if SMALL_WORDS.include?(word.downcase.gsub(/\\W/,''))\n word.downcase!\n else\n word.capitalize!\n end\n word\n end\n\n # capitalize first and last words\n title.first.capitalize!\n title.last.capitalize!\n\n # join parts together\n title = title.join(' ')\n\n # find any small word after a semi-colon and upcase it\n\n if /:\\s?(#{SMALL_WORDS.join('|').gsub('.', '\\.')})\\s+/ =~ title\n i = title.index($1)\n title[i] = title[i].upcase\n end\n\n # return title\n title\n end",
"title": ""
},
{
"docid": "f36a0c1cf5e28f2b0a4470ce073bb792",
"score": "0.79131484",
"text": "def titleize(str)\n words = str.split\n words.map! { |word| word.capitalize }\n str = words.join(\" \")\nend",
"title": ""
},
{
"docid": "f196a18b89623df30d1502dd79f78f72",
"score": "0.79130256",
"text": "def titleize(s)\n words = s.split.map do |word|\n if %w(the and over).include?(word)\n word\n else\n word.capitalize\n end\n end\n words.first.capitalize!\n words.join(\" \")\nend",
"title": ""
},
{
"docid": "0cd886d3f02604f31c7c945694432454",
"score": "0.79117566",
"text": "def titleize(s)\n s.split.map(&:capitalize).join(' ')\nend",
"title": ""
},
{
"docid": "107cb6c10e800c135c85e96352fb51e6",
"score": "0.7910236",
"text": "def titleize(string)\n string.split.map { |word| word.downcase.capitalize }.join(' ')\nend",
"title": ""
},
{
"docid": "04dd00f020cff6c5218cbeb9016a6d5f",
"score": "0.79097944",
"text": "def titleize(str)\n str.split(\" \").each {|word| word.capitalize!}.join(\" \")\nend",
"title": ""
},
{
"docid": "c9abc4048d3608901dc19f06d64075a9",
"score": "0.78968847",
"text": "def titleize(sentence)\n sentence.split.each { |word| word.capitalize! }.join(\" \")\nend",
"title": ""
},
{
"docid": "7be1d9cff3c95119c5f932813a0eb46b",
"score": "0.7884535",
"text": "def titleize(title)\n title = title.split\n new_title = \"\"\n lowercase = [\"over\", \"and\", \"the\"]\n #iterate over each string\n \"#{title.capitalize}\"\nend",
"title": ""
},
{
"docid": "fa9a1e0b90707ff4a7f3c3fdf770f3f0",
"score": "0.7883389",
"text": "def capitalise_first_word\n @title = @title.slice(0,1).upcase + @title.slice(1..-1)\n end",
"title": ""
},
{
"docid": "768a174587fa7818ea0314e1a35eda5a",
"score": "0.7882128",
"text": "def titleize(string)\n string.split.map {|word| word.capitalize!}.join(' ')\nend",
"title": ""
},
{
"docid": "653f3900aadc5b4887df42b6f0cc17a7",
"score": "0.7878031",
"text": "def titleize(string)\n string.split(' ').map(&:capitalize).join(' ')\nend",
"title": ""
},
{
"docid": "088119ba6c2e26d815cb0df97ef21bb7",
"score": "0.7875951",
"text": "def titleize(text)\n text.split.each{|i| i.capitalize!}.join(' ')\nend",
"title": ""
},
{
"docid": "95921ef011e648b927eb16ee456da5d0",
"score": "0.78756994",
"text": "def titleize(string)\n\nstring.split(' ').each {|i| i.capitalize!}.join(\" \")\n\nend",
"title": ""
},
{
"docid": "9951fb851e23adbd5e5f89cfe68b339e",
"score": "0.7868071",
"text": "def titleize\n arr = ['a', 'an', 'the', 'by', 'to']\n upcase_arr = ['DX', 'EDA', 'AEDG', 'LPD', 'COP', 'GHLEP', 'ZEDG', 'QAQC', 'PV']\n r = tr('_', ' ').gsub(/\\w+/) do |match|\n match_result = match\n if upcase_arr.include?(match.upcase)\n match_result = upcase_arr[upcase_arr.index(match.upcase)]\n elsif arr.include?(match)\n match_result = match\n else\n match_result = match.capitalize\n end\n match_result\n end\n\n # fix a couple known camelcase versions\n r.gsub!('Energyplus', 'EnergyPlus')\n r.gsub!('Openstudio', 'OpenStudio')\n r\n end",
"title": ""
},
{
"docid": "9951fb851e23adbd5e5f89cfe68b339e",
"score": "0.7868071",
"text": "def titleize\n arr = ['a', 'an', 'the', 'by', 'to']\n upcase_arr = ['DX', 'EDA', 'AEDG', 'LPD', 'COP', 'GHLEP', 'ZEDG', 'QAQC', 'PV']\n r = tr('_', ' ').gsub(/\\w+/) do |match|\n match_result = match\n if upcase_arr.include?(match.upcase)\n match_result = upcase_arr[upcase_arr.index(match.upcase)]\n elsif arr.include?(match)\n match_result = match\n else\n match_result = match.capitalize\n end\n match_result\n end\n\n # fix a couple known camelcase versions\n r.gsub!('Energyplus', 'EnergyPlus')\n r.gsub!('Openstudio', 'OpenStudio')\n r\n end",
"title": ""
},
{
"docid": "c04014fe7466c489a5ffc3f548eedf72",
"score": "0.7859839",
"text": "def titleize(str)\n str.split(\" \").map(&:capitalize).join(\" \")\nend",
"title": ""
},
{
"docid": "c9c79324984e7551400a925879ab8523",
"score": "0.78578395",
"text": "def titleize(string)\n string.split.map { |word| word.capitalize }.join(' ')\nend",
"title": ""
},
{
"docid": "c9c79324984e7551400a925879ab8523",
"score": "0.78578395",
"text": "def titleize(string)\n string.split.map { |word| word.capitalize }.join(' ')\nend",
"title": ""
},
{
"docid": "c9c79324984e7551400a925879ab8523",
"score": "0.78578395",
"text": "def titleize(string)\n string.split.map { |word| word.capitalize }.join(' ')\nend",
"title": ""
},
{
"docid": "412e764290711aa448f2032082628843",
"score": "0.78514034",
"text": "def titleize(str_in)\n\tstr_arr = str_in.split(/\\s+/)\n\texcluded_words = %w(the in a an as and for over)\n\t# capitalize all words not in excluded_words\n\tstr_arr = str_arr.map { |elem| excluded_words.include?(elem) ? elem :\n\t\t\telem.capitalize }\n\tstr_arr[0] = str_arr[0].capitalize\n\tresult = str_arr.join(' ')\n\treturn result\nend",
"title": ""
},
{
"docid": "f5341ae5db791a48333034562405d221",
"score": "0.7850187",
"text": "def titleize(title)\n specical = %w(a and of over or the)\n\n words_arr = title.split(\" \").map do |word|\n !specical.include?(word) ? word.capitalize : word\n end\n\n words_arr[0].capitalize! if specical.include?(words_arr[0])\n words_arr.join(' ')\nend",
"title": ""
},
{
"docid": "9ee0f36b986d3d805e90fab74b066a3a",
"score": "0.78490275",
"text": "def title\n little_words = [\"a\", \"an\", \"the\", \"or\", \"and\", \"in\", \"of\"]\n words = [@title]\n words = @title.split(\" \")\n $i = 0\n\n while $i < words.length\n words[$i] = words[$i].capitalize() unless little_words.include? words[$i]\n $i += 1\n end\n words[0] = words[0].capitalize\n @title = words.join(\" \")\n return @title\n end",
"title": ""
},
{
"docid": "d8e6cf3f11347e874ac6f15b2ec4bce5",
"score": "0.7846654",
"text": "def titleize(s)\n word_array = s.split(/\\W+/)\n (word_array.map { |w| w.capitalize }).join(\" \")\nend",
"title": ""
},
{
"docid": "1a96a5a91b3a8962da9a547a334a956c",
"score": "0.78411615",
"text": "def titleize(str)\n str.split.map(&:capitalize).join(' ')\nend",
"title": ""
},
{
"docid": "a9ceb08fcaa966b02c6760afeda0d390",
"score": "0.78357756",
"text": "def titleize(str)\n formatted_string = str.split.map { |word| word.capitalize }.join(\" \") \n return formatted_string\nend",
"title": ""
},
{
"docid": "e384e03c90c13e150b20350f6a296050",
"score": "0.78314686",
"text": "def titleize(string)\n title = ''\n string.split(' ').each do |s|\n title << s.capitalize + ' '\n end\n title\n end",
"title": ""
},
{
"docid": "4b1f347053d44554d4c1c7fca1caacff",
"score": "0.782053",
"text": "def titleize(sentence)\n words = sentence.split\n titleized = words.map { |word| word.capitalize }.join(' ')\n\n titleized\nend",
"title": ""
},
{
"docid": "c04996ea73fd9356cb0a2afd6369faab",
"score": "0.7820447",
"text": "def titleize(string)\n string.split(' ').map { |s| s.capitalize }.join(' ')\nend",
"title": ""
},
{
"docid": "c49f9dfd9e78ea0616d3f088821c2c87",
"score": "0.78136307",
"text": "def titleize(str)\n str.split.map(&:capitalize)*' '\nend",
"title": ""
},
{
"docid": "ade08d702a81c54046cf4ae856265745",
"score": "0.78096837",
"text": "def titleize(title)\n sm_words = ['a', 'and', 'of', 'over', 'the']\n title.capitalize.split(\" \").map{ |wrd| sm_words.include?(wrd) ? wrd : wrd.capitalize }.join(\" \")\nend",
"title": ""
},
{
"docid": "fad6ce2db9417ebb5d8618d4d9baf6ab",
"score": "0.78066045",
"text": "def titleize(str)\n str.split.map { |word| word.capitalize }.join(' ')\nend",
"title": ""
},
{
"docid": "fad6ce2db9417ebb5d8618d4d9baf6ab",
"score": "0.78066045",
"text": "def titleize(str)\n str.split.map { |word| word.capitalize }.join(' ')\nend",
"title": ""
},
{
"docid": "90ae4c29f2881947269e8412f3c31813",
"score": "0.7805474",
"text": "def titleize(x)\n\tx.split.map(&:capitalize).join(' ').tr('A', 'a').gsub('The R', 'the R')\nend",
"title": ""
},
{
"docid": "7ba43db8b9f2450aa47d96e60ebcb1bb",
"score": "0.77922106",
"text": "def titleize(str)\n words = str.split('')\n words.map! do |word|\n word.capitalize\n end\n str = words.join(' ')\n \nend",
"title": ""
},
{
"docid": "323af4edfeee30eb337e7668aff31889",
"score": "0.77912825",
"text": "def titleize(sentence)\n\twords = sentence.split\n\t# shorties = %w{and over the}\n\t# adding words for use in later book exercise\n\tshorties = %w{and over the a an to in of}\n\twords.each_with_index do |word, index|\n\t\t(index == 0 || !shorties.include?(word)) ? word.capitalize! : word\n\tend\n\twords.join(\" \")\nend",
"title": ""
},
{
"docid": "5c6c14bde62ec89624fbe8e105c5c37f",
"score": "0.7787233",
"text": "def title_case(string)\n string.split.map(&:capitalize).join(\" \")\nend",
"title": ""
},
{
"docid": "39c956c48d20bdb43cb2f34082a4baef",
"score": "0.7774178",
"text": "def titleize(input)\n\n titleized_input = input.split(' ').map do |input| \n # Check input to see if it's fully lowercase \n if input == input.downcase \n input.gsub(/\\w+/) do |w|\n w.capitalize\n end\n else \n input.gsub(/\\W+/) do |w|\n w.capitalize\n end\n end\n end\n\n titleized_input.join(' ')\n end",
"title": ""
},
{
"docid": "c43a00fe8c5b5753005a435eda1b6565",
"score": "0.7773788",
"text": "def title=string\n small_words = %w[a an and if or in the of]\n words = string.split(\" \")\n \n words.map do |word|\n word.capitalize! unless small_words.include? word\n end\n\n words[0].capitalize!\n @title = words.join(\" \")\n end",
"title": ""
},
{
"docid": "fee98b47ad757d01a77b8700129dc92b",
"score": "0.7771625",
"text": "def titlecase(s)\n s.to_s.tr('_', ' ').split(/\\s+/).map(&:capitalize).join(' ')\n end",
"title": ""
},
{
"docid": "1d68410b449ca58e798916bbfafdba60",
"score": "0.77679116",
"text": "def titleize(w)\n w.split.map(&:capitalize).join(' ')\nend",
"title": ""
},
{
"docid": "86291d17e91d9b6cd51707e9b158fd01",
"score": "0.77656543",
"text": "def titleize(string)\n new_strings = []\n string.split.each do |word|\n new_strings << word.capitalize\n end\n new_strings.join(\" \")\nend",
"title": ""
},
{
"docid": "af2cb464e7310777581b1cb7bfd6391e",
"score": "0.77524436",
"text": "def titleize (phrase)\n phrase_arr = phrase.split(' ')\n phrase_arr.each { |word| word.capitalize! }\n phrase_arr.join(\" \")\nend",
"title": ""
},
{
"docid": "cea9cb131c84fb46c1873eba9640f709",
"score": "0.77514935",
"text": "def titleize(sentence)\n sentence.split(' ').map { |word| word.capitalize }.join(' ')\nend",
"title": ""
},
{
"docid": "b4c0d064d7042ef82c665e6b4a5a6457",
"score": "0.7740342",
"text": "def titleize(string)\n words = string.split\n words.each_with_index do |word, index|\n if word.length <=3 && index > 0\n word.downcase!\n elsif word.length >3 || index == 0\n word.capitalize!\n end\n end\n words_titleised = words.join(' ')\n return words_titleised\nend",
"title": ""
},
{
"docid": "8e1f330c68aeabf6b37d954fcfc1f79b",
"score": "0.7737478",
"text": "def titleize(your_string)\n\t\ts_array = your_string.split\n\t\tlittleuns = ['if','and','over','it','the','a','an','or','but','for','on','is']\n\n\t\ts_array.each do |x|\n\t\t\tif littleuns.include?(x)\n\t\t\t\tx\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\telse\n\t\t\tx.capitalize!\t\n\t\tend\t\n\n\tend\n\t\ts_array[0].capitalize!\n\t\ts_array.join \" \"\n\t\t\n\tend",
"title": ""
},
{
"docid": "5c4ac9fa29de24dc07b1d34873492453",
"score": "0.77334094",
"text": "def titleize(string)\n cap = []\n small_words = [\"and\", \"over\", \"the\"]\n string.split.each do |i|\n unless small_words.include?(i)\n cap << i.capitalize\n else\n cap << i\n end\n end\n cap[0] = cap[0].capitalize\n cap.join(\" \")\nend",
"title": ""
},
{
"docid": "bcec93fa2f233a1549c85fc2e00ee63f",
"score": "0.77250946",
"text": "def titleize string\n\twords = string.split\n\tcounter = 0\n\tresult = \"\"\n\twhile counter < words.length\n\t\tcurrentWord = words[counter].capitalize\n\t\t# Convert to lowercase if is not the first word and is a little word\n\t\tif counter != 0\n\t\t\tif (currentWord.downcase == \"and\" || \n\t\t\t currentWord.downcase == \"the\" ||\n\t\t\t currentWord.downcase == \"over\")\n\t\t\t\tcurrentWord = words[counter].downcase\n\t\t\tend\n\t\tend\n\t\tresult = result + currentWord\n\t\t# Add space if not on last word\n\t\tif counter < words.length-1\n\t\t\tresult = result + \" \"\n\t\tend\n\t\tcounter = counter + 1\n\tend\n\tresult\nend",
"title": ""
},
{
"docid": "9985d288c0e256bda378b3a58b0469b8",
"score": "0.7717526",
"text": "def titleize(string)\n string.split.map {|string| string.capitalize}.join(' ')\nend",
"title": ""
},
{
"docid": "baa0f7e54585f35ede4da12f58fb8d3c",
"score": "0.7714362",
"text": "def titlecase()\n capitalizer(TITLECASE_WORD_REGEXP, TITLECASE_ALL_LOWER, TITLECASE_ALL_CAPS).capitalize_first\n end",
"title": ""
},
{
"docid": "3470cb61ce3ff35edd3a35a6d010accb",
"score": "0.7713999",
"text": "def _titleize(word)\n _humanize(_underscore(word)).gsub(/\\b('?[a-z])/) { $1.capitalize }\n end",
"title": ""
},
{
"docid": "70c6dff30da8f13054a5b08a118efc34",
"score": "0.7709455",
"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": "88e6a068355b64843784cc093d9172ba",
"score": "0.7708147",
"text": "def titleize(words)\n\n words = words.downcase.split(\" \")\n\n #no_capital = words that should not be capitalized.\n #Unless they are the first or last words of the title.\n #These include Articles, Prepositions, Conjunctions, \n #and the Particle 'to'.\n #See: \n #http://grammartips.homestead.com/caps.html\n #http://www.englishclub.com/grammar/prepositions-list.htm\n #http://www.english-grammar-revolution.com/list-of-conjunctions.html\n\n no_capital = %w[the a an and aboard about above across after\n against along although amid among anti around as\n at because before behind below beneath beside\n besides between beyond both but by concerning\n considering despite down during except excepting\n excluding following for from if in inside into like\n minus near nor of off on once onto opposite or outside over\n\t past per plus regarding round save since so than that till \n\t though through to toward towards under underneath\n\t unlike unless until up upon versus via when whenever \n\t wherever while with within without yet] \n\n title_case = []\n i = 0\n\n while i < words.length\n if i == 0 || i == words.length - 1\n title_case << words[i].capitalize\n elsif !no_capital.include?(words[i])\n title_case << words[i].capitalize\n else\n title_case << words[i]\n end\n i += 1\n end\n\n title_case = title_case.join(\" \")\nend",
"title": ""
},
{
"docid": "e20e84ffa08c0c9793336ca13c678f5a",
"score": "0.7691227",
"text": "def titlecase\n\n\t\t# Split on word-boundaries\n\t\twords = self.to_s.split( /\\b/ )\n\n\t\t# Always capitalize the first and last words\n\t\twords.first.capitalize!\n\t\twords.last.capitalize!\n\n\t\t# Now scan the rest of the tokens, skipping non-words and capitalization\n\t\t# exceptions.\n\t\twords.each_with_index do |word, i|\n\n\t\t\t# Non-words\n\t\t\tnext unless /^\\w+$/.match( word )\n\n\t\t\t# Skip exception-words\n\t\t\tnext if TITLE_CASE_EXCEPTIONS.include?( word )\n\n\t\t\t# Skip second parts of contractions\n\t\t\tnext if words[i - 1] == \"'\" && /\\w/.match( words[i - 2] )\n\n\t\t\t# Have to do it this way instead of capitalize! because that method\n\t\t\t# also downcases all other letters.\n\t\t\tword.gsub!( /^(\\w)(.*)/ ) { $1.upcase + $2 }\n\t\tend\n\n\t\treturn words.join\n\tend",
"title": ""
},
{
"docid": "c5831b761193f750fbc56d5470f0ccdd",
"score": "0.7690501",
"text": "def title_case(sentence)\n lowercase_word = sentence.downcase\n word_array = lowercase_word.split(\" \")\n capitalize_word = word_array.map { |word| word.capitalize}.join(\" \")\nend",
"title": ""
},
{
"docid": "c5d65401d7fe1a58d554fed77b258482",
"score": "0.7688074",
"text": "def titleize(x)\n\t\n\tlittle_words = %w{the a by on for of are with and just but an and to over the my is in I has some}\n\n\tx = x.split(' ').map {|word| little_words.include?(word) ? word.downcase : word.capitalize}\n\n\tx[0] = x[0].capitalize\n\n\tx.join(' ')\nend",
"title": ""
},
{
"docid": "0a12b8d02dc35ae17e1f8cdc2caea335",
"score": "0.76842314",
"text": "def titleize(title)\n words = title.split\n little_words = ['the', 'and', 'of', 'over']\n newTitle = \"\"\n words.each_with_index do |word, index|\n if little_words.include?(word) \n if index == 0\n word = word.capitalize\n end\n else\n word = word.capitalize\n end\n newTitle += word \n if index != words.length - 1\n newTitle += \" \" \n end\n end\n return newTitle\nend",
"title": ""
},
{
"docid": "6ac80b8229726d4f714181f7c19305e2",
"score": "0.76821816",
"text": "def titleize(word)\n humanize(underscore(word)).gsub(/\\b([a-z])/) { $1.capitalize }\nend",
"title": ""
},
{
"docid": "96f5d8f5de9ced0b520d16f4765dfd9e",
"score": "0.76802",
"text": "def title\n neverCap = ['a', 'the', 'and', 'an', 'in', 'of', 'on']\n if @title.index(' ') != nil\n @title = @title.split(' ')\n @title.each do |word|\n if neverCap.index(word) != nil && word != @title[0]\n word.downcase!\n else\n word.capitalize!\n end\n end\n @title.join(' ')\n else\n @title.capitalize\n end\n end",
"title": ""
},
{
"docid": "1e6c6c7dd26e7add04bb568b652cb615",
"score": "0.7677298",
"text": "def titleize(str)\n str = str.slice(0, 1).capitalize + str.slice(1..-1)\n end",
"title": ""
},
{
"docid": "8015b6ab93ec47c62a34f8fb37ef6335",
"score": "0.76744694",
"text": "def titleize(str)\n\tlittle_words = [\"the\", \"and\", \"over\", \"as\", \"is\"]\n\twords = str.split\n\twords.each_index do |idx|\n\t\tif (idx == 0)\n\t\t\twords[0].capitalize!\n\t\telse\n\t\t\tif (not little_words.include?(words[idx].downcase))\n\t\t\t\twords[idx].capitalize!\n\t\t\tend\n\t\tend\n\tend\n\twords.join(\" \")\nend",
"title": ""
},
{
"docid": "c79aaf14d801b8f3d22f4fbcce65e0d4",
"score": "0.7668637",
"text": "def make_title(str)\n str.split(' ').map(&:capitalize).join(' ')\nend",
"title": ""
},
{
"docid": "b5d7f0a32602b419cacb71f5f493cea7",
"score": "0.7667933",
"text": "def titleize(word)\n humanize(underscore(word)).gsub(/\\b([a-z])/) { $1.capitalize }\n end",
"title": ""
},
{
"docid": "b616baa74963afb39bd872f821bf1b03",
"score": "0.76651675",
"text": "def titleize(words)\n words = words.split\n \n words.each_index do |index|\n words[index].capitalize! unless %w(the and over).include?(words[index])\n end\n \n words.first.capitalize!\n words.join(' ')\n \nend",
"title": ""
},
{
"docid": "2314e5a310098cc4d610085be5324fc7",
"score": "0.7661637",
"text": "def titlecase!(stopwords=DEFAULT_STOP_WORDS)\n stopwords.map!(&:downcase)\n self.gsub!(/\\w+/) do |w|\n stopwords.include?(w.downcase) ? w.downcase : w.capitalize\n end.gsub!(/^\\w/,&:capitalize)\n end",
"title": ""
},
{
"docid": "5e02f432ea50af078d162d8847d722c6",
"score": "0.76589626",
"text": "def titleize(str)\n str.split(\" \").map(&:capitalize).join(\" \").gsub(\"Ii\",\"II\")\n end",
"title": ""
},
{
"docid": "f6653cc7119bfabe52131c600e7236ab",
"score": "0.76503706",
"text": "def titleize(title)\n titleized_array = []\n title.split(\" \").each {|word| titleized_array << word.capitalize}\n titleized_array.join(\" \")\nend",
"title": ""
},
{
"docid": "d2becd17666cd08dbe06d4885d2a196f",
"score": "0.7648585",
"text": "def title() \n\n\t\t@title = @title.split(\" \").each_with_index.map {|word, i| \n\t\t\t\n\t\t\tif(@nonCapWords.include?(word) && i != 0) \n\t\t\t\tword\n\t\t\telse\n\t\t\t\tword.capitalize\n\t\t\tend\n\n\t\t\t}.join(\" \")\n\tend",
"title": ""
},
{
"docid": "bbb563767844eb3936427c295b1d55b0",
"score": "0.76431733",
"text": "def titleize(text)\n\t# If just one word\n\tif !text.match(\" \")\n\t\treturn text.capitalize\n\tend\n\n\t# Split into separate words, capitalize the first\n\ttext = text.split(\" \")\n\ttext[0] = text[0].capitalize\n\n\t# Iterator starts at 1 because first word is capitalized\n\titerator = 1\n\twhile iterator < text.length do\n\t\tif text[iterator] == \"and\" || text[iterator] == \"the\" || text[iterator] == \"over\"\n\t\telse\n\t\t\ttext[iterator] = text[iterator].capitalize\n\t\tend\n\t\titerator += 1\n\tend\n\treturn text.join(\" \")\nend",
"title": ""
},
{
"docid": "c9709f4e2fa3a9b90d2a01559b21d97b",
"score": "0.76421845",
"text": "def titleize(phrase)\n words = phrase.split\n words.each do |word|\n word.capitalize!\n end\n words.join(' ')\nend",
"title": ""
},
{
"docid": "752c2e58c309fc9121d5293b0b18432a",
"score": "0.76419884",
"text": "def titleize(s)\n small_words = %w[on the over and]\n s.split(' ').map.with_index do |w, i|\n unless (small_words.include? w) and (i > 0)\n w.capitalize\n else\n w\n end\n end.join(' ')\nend",
"title": ""
},
{
"docid": "afd1dfa9e275bac19502aa6e76cf8c09",
"score": "0.7630462",
"text": "def titleize(input)\n input.strip.split(/[[:space:]]/).map(&:capitalize).join(' ')\nend",
"title": ""
},
{
"docid": "6b1ff9a59fc1e24121a2308627864859",
"score": "0.7611051",
"text": "def titleize(str)\n str.titleize\n end",
"title": ""
},
{
"docid": "2620cb7c6802c625e7e635cf997f6a2d",
"score": "0.7604998",
"text": "def titleize(s)\n\twords_array = []\n\tlittle_words = [\"over\", \"under\", \"below\", \"etc\"]\n\t\ts.split.each do |w| \n\t\t\tif w.length > 3 && !(little_words.include? w)\n\t\t\t\twords_array << w.capitalize\n\t\t\telse\n\t\t\t\twords_array << w.downcase \n\t\t\tend\n\t\tend\n\t\t\twords_array[0].capitalize!\n\t\t\twords_array.join(\" \")\nend",
"title": ""
},
{
"docid": "bb8197e0858db1de7ada356114c7a958",
"score": "0.76042813",
"text": "def title_capitalize(title)\n # lowercase_words = %w{a an the and but or for nor of}\n lowercase_words = %w{a an and as at but by en for if in of on or the to v v. via vs vs.}\n puts title.split.each_with_index.map{|x, index| lowercase_words.include?(x) && index > 0 ? x : x.capitalize }.join(\" \")\nend",
"title": ""
}
] |
4105f6e955715c5429f4c06207f9335c | creates transcription line metadata file, returns location of the file | [
{
"docid": "3763ebab16d6de044db495535614ac91",
"score": "0.6950242",
"text": "def write_line_metadata_to_file\n file = Tempfile.new([\"transcription_line_metadata_#{@transcription.id}-\", '.csv'])\n\n CSV.open(file.path, 'wb') do |csv|\n transcription_line_metadata.each do |csv_line|\n csv << csv_line\n end\n end\n\n file.rewind\n file\n end",
"title": ""
}
] | [
{
"docid": "395beb53f7fecf420e02c8398be300c4",
"score": "0.60642195",
"text": "def transcription_line_metadata\n csv_lines = []\n csv_lines << line_metadata_csv_headers\n\n frame_regex = /^frame/\n frames = @transcription.text.filter { |key, _value| frame_regex.match(key) }\n if @transcription.frame_order.present?\n csv_lines = retrieve_line_data_by_frame_order(@transcription.frame_order, frames, csv_lines)\n else\n csv_lines = retrieve_line_data_by_default_order(frames, csv_lines)\n end\n\n csv_lines\n end",
"title": ""
},
{
"docid": "0ddb352506109cf0772da7d674f46c90",
"score": "0.60477567",
"text": "def create_mets_file\n File.open(metadata_filename, 'w') do |f|\n f.write(mets_header)\n f.write(dmd_sec)\n f.write(file_group)\n f.write(struct_map)\n f.write(mets_footer)\n end\n end",
"title": ""
},
{
"docid": "a2dc0f042e57dca482d15ccbd1556d5e",
"score": "0.5819583",
"text": "def create_metadata_file env\n File.open(File.join(env[\"export.temp_dir\"], \"metadata.json\"), \"w\") do |f|\n f.write(TemplateRenderer.render(\"metadata.json\", {\n template_root: template_root\n }))\n end\n end",
"title": ""
},
{
"docid": "02b90f30fcc5ad24b408b2e88bd03fea",
"score": "0.57490516",
"text": "def file_with_embedded_line; end",
"title": ""
},
{
"docid": "02b90f30fcc5ad24b408b2e88bd03fea",
"score": "0.57490516",
"text": "def file_with_embedded_line; end",
"title": ""
},
{
"docid": "848355803797150a51e522c240b00bcb",
"score": "0.56626546",
"text": "def location\n \"#{normalize(file)}:#{line}\"\n end",
"title": ""
},
{
"docid": "8dab9eaeaf7a1d5f0fe6b8fbde873e3e",
"score": "0.5658784",
"text": "def generate_file\n\t\tputs \"Realizando Tradução... / Loading Translate\"\n\t\tputs get_translation\n\t\ttime = Time.new\n\n \n\t\tfile = File.open(time.strftime(\"%m-%d-%Y.%H.%M.%S\") + \".txt\", 'w') do |fline|\n\t\t\tfline.puts @lang\n\t\t\tfline.puts (\"#############################\")\n\t\t\tfline.puts get_translation\n\t\t\tfline.puts (\"#############################\")\n\n\t\tend\n\tend",
"title": ""
},
{
"docid": "40aecccf864c0584c7426197472366b8",
"score": "0.5648173",
"text": "def plain_text_line(ext, filetype) # TODO Figure out if we will sr-cyrl to be generated again\n return \"\" if ['ar', 'fa', 'grc-x-ibycus', 'mn-cyrl-x-lmc'].include? @bcp47\n\n if @bcp47 =~ /^sh-/\n # TODO Warning AR 2018-09-12\n filename = sprintf 'hyph-sh-latn.%s.txt,hyph-sh-cyrl.%s.txt', ext, ext\n else\n filename = sprintf 'hyph-%s.%s.txt', @bcp47, ext\n filepath = File.join(PATH::TXT, filename)\n # check for existence of file and that it’s not empty\n unless File.file?(filepath) && File.read(filepath).length > 0\n # if the file we were looking for was a pattern file, something’s wrong\n if ext == 'pat'\n raise sprintf(\"There is some problem with plain patterns for language [%s]!!!\", @bcp47)\n else # the file is simply an exception file and we’re happy\n filename = '' # And we return and empty file name after all\n end\n end\n end\n\n sprintf \"file_%s=%s\", filetype, filename\n end",
"title": ""
},
{
"docid": "531808b211381e3b1879efe9afa45b4e",
"score": "0.56304264",
"text": "def generate_metadata_file\n @metadata_filename = @config.get(:tmp_directory) + '/versions.' + @config.environment_name + '.' + @config.instance_id + '.json'\n File.open(@metadata_filename, 'w') do |io|\n io.print @config.registry.to_s\n end\n if @config.group_ownership\n begin\n FileUtils.chown nil, @config.group_ownership, @metadata_filename\n FileUtils.chmod \"g+w\", @metadata_filename\n rescue ArgumentError, Errno::EPERM\n end\n end\n @log.debug 'Generated metadata file ' + @metadata_filename\n end",
"title": ""
},
{
"docid": "6b5f930fe4660d87ffa4885153bb0cb5",
"score": "0.55847514",
"text": "def create_copy_file_line(r)\n\n\tevent_type = get_event_type(r)\n\tif event_type.nil?\n\t\t# Sometimes cloudfront may get access logs that are not generated by Snowplow\n\t\t#puts \"WARNING: Couldn't get event type for #{r['evid']}\"\n\t\treturn\n\tend\n\n\ttable_name = \"_e_portal__#{event_type}\"\n\tfields = nil\n\n\tif event_type == \"login\"\n\t\tr[\"login_method\"] = \"#{get_se_param(r,'login_method')}\"\n\t\t@login_lines.push(get_line_from_fields(r, LOGIN_FIELDS))\n\telsif event_type == \"watch_video\"\n\t\tr[\"video_action\"] = \"#{get_se_param(r,'video_action')}\"\n\t\tr[\"video_name\"] = \"#{get_se_param(r,'video_name')}\"\t\t\n\t\t@watch_video_lines.push(get_line_from_fields(r, WATCH_VIDEO_FIELDS))\n\telsif event_type == \"add_to_cart\"\n\t\tr[\"sku\"] = \"#{get_se_param(r,'sku')}\"\n\t\t@add_to_cart_lines.push(get_line_from_fields(r, ADD_TO_CART_FIELDS))\n\telsif event_type == \"delete_from_cart\"\n\t\tr[\"sku\"] = \"#{get_se_param(r,'sku')}\"\n\t\t@delete_from_cart_lines.push(get_line_from_fields(r, DELETE_FROM_CART_FIELDS))\n\telsif event_type == \"cart_contents\"\n\t\tr[\"sku\"] = \"#{get_se_param(r,'sku')}\"\n\t\t@cart_contents_lines.push(get_line_from_fields(r, CART_CONTENTS_FIELDS))\n\telsif event_type == \"page_view\"\n\t\t@page_view_lines.push(get_line_from_fields(r, PAGE_VIEW_FIELDS))\n\tend\n\nend",
"title": ""
},
{
"docid": "12ac9c321691c85998fba858085c2924",
"score": "0.5558646",
"text": "def cts_sqlite_writeline(madhab, tafseer, line_no)\n current_txt = Pathname(\"../../corpora/altafsir_com/processed/plain/complete/%03d-%03d.txt\" % [madhab, tafseer])\n return unless File.exist? current_txt\n begin\n text = remove_specialchars(@hash['text'])\n if _urn = urn(line_no)\n CTSUnit.create(\n cts_urn: _urn,\n text: text,\n text_hash: Digest::MD5.hexdigest(text),\n label: @hash['aaya'],\n title: @hash['meta_title'],\n author_name: @hash['meta_author'],\n author_era: @hash['meta_year'],\n category_id: @hash['position_madhab'],\n author_id: @hash['position_tafsir'],\n sura_id: @hash['position_sura'].to_i,\n aaya_id: @hash['position_aaya'].to_i\n )\n end\n rescue Exception => e\n puts \"INSERT failed: #{e.inspect}\"\n return\n end\n end",
"title": ""
},
{
"docid": "fd294eec3be35c1549a87ebc094b0947",
"score": "0.5547687",
"text": "def populate_files_from_line_templates\n @line_templates.each do |x|\n new_name = x.sub(/_(\\d+)\\._{1}/, '')\n FileUtils.touch(FileUtils.join_paths(@install_path, @project_name, new_name))\n FileUtils.insert_text_at_line_number(FileUtils.join_paths(@template_path, x), FileUtils.join_paths(@install_path, @project_name, new_name), JumpStart::Base.get_line_number(x))\n end\n end",
"title": ""
},
{
"docid": "242e031e949b5cf01b1a24e5a821f7c2",
"score": "0.55184335",
"text": "def add_frontmatter(file, line)\n lines = File.readlines(file)\n head, *tail = lines\n lines = [head, \"#{line}\\n\"] + tail\n File.write(file, lines.join(\"\"))\nend",
"title": ""
},
{
"docid": "71d9901480ef4aead18606c1384668a6",
"score": "0.55104876",
"text": "def start_timestamp_file\n FilePath.new(@testrun_directory, \"testrun.begin\")\n end",
"title": ""
},
{
"docid": "e7c22e1fccee31e44707596e0d1155fe",
"score": "0.5500628",
"text": "def file_and_line; end",
"title": ""
},
{
"docid": "e7c22e1fccee31e44707596e0d1155fe",
"score": "0.5500628",
"text": "def file_and_line; end",
"title": ""
},
{
"docid": "65a670764d779b1fc8be764cf2e65bc3",
"score": "0.54789597",
"text": "def create_file(filename ='dta.txt')\n file = open( filename, 'w')\n file << create\n file.close()\n end",
"title": ""
},
{
"docid": "1a8f698e864a052c589ef81465d93013",
"score": "0.5475601",
"text": "def writeToInformationFile(line)\n File.open(@@informationFile.path, 'a') do |file|\n file.puts(line)\n line = nil\n file.close\n end\n end",
"title": ""
},
{
"docid": "a3c25e2920dca509d59b4b433166b709",
"score": "0.54586357",
"text": "def to_metadata_file\n logger.info(\"Writing to file #{metadata_file}\")\n File.write(metadata_file, to_s)\n end",
"title": ""
},
{
"docid": "ebe26a0a8e33f6eba1935ad61bf31f9e",
"score": "0.54562354",
"text": "def write_file(filename, line)\n uuid = SecureRandom.uuid #=> \"2d931510-d99f-494a-8c67-87feb05e1594\"\n outline = line + $/ + \"JENKINS_CREATE_UNIQUE_ARTIFACTS_RANDOM_STRING=\" + uuid \n # Create a new file and write to it \n File.open(filename, 'w') do |f| \n f.puts outline; \n end \nend",
"title": ""
},
{
"docid": "5f236a2db95fe649ef8107b6673687f4",
"score": "0.5438851",
"text": "def create_log_file(log_file)\n log_file.ensure_exists\n contents = <<~CONTENTS\n #{DiaryEntry::ENTRY_HEADER_MARKER} Biographical information\n\n #{@biography}\n\n #{DiaryEntry::ENTRY_HEADER_MARKER} Employment information\n\n Start date:: #{@start_date}\n Grade level:: #{@grade_level}\n\n CONTENTS\n new_file_entry = ObservationEntry.new(content: 'File generated by new-hire command').render('File created')\n contents += new_file_entry\n write_file(log_file.path, contents)\n print 'created'\n end",
"title": ""
},
{
"docid": "ad599080892c9d9addf41109f722f9bd",
"score": "0.5422585",
"text": "def create_metadata(file)\n accession_id = params[\"accession_id\"]\n accession_id ||= params[\"batch_id\"]\n Sufia::GenericFile::Actions.create_metadata(file, current_user, nil)\n set_accession(file,accession_id)\n end",
"title": ""
},
{
"docid": "4990945908437c25d5184488ca10f227",
"score": "0.5417739",
"text": "def metadata!(path, type = \"OBJECT\")\n File.open(File.expand_path(path), \"w\") do |f|\n f << metadata(type).read\n end\n end",
"title": ""
},
{
"docid": "fecd3650364a51c19d813101357fff22",
"score": "0.54114527",
"text": "def add_location(path, line); end",
"title": ""
},
{
"docid": "f43311c3aa50e3a18238a952d6550d3e",
"score": "0.5398061",
"text": "def outputFileCreationInfo(file)\n # Add the build information and header to the output file\n ccdd.writeToFileLn(file, \"/* Created : \" + ccdd.getDateAndTime() + \"\\n User : \" + ccdd.getUser() + \"\\n Project : \" + ccdd.getProject() + \"\\n Script : \" + ccdd.getScriptName())\n\n # Check if any table is associated with the script\n if ccdd.getTableNumRows() != 0\n ccdd.writeToFileLn(file, \" Table(s): \" + (\",\\n \").join(sorted(ccdd.getTableNames())))\n end\n\n # Check if any groups is associated with the script\n if ccdd.getAssociatedGroupNames().length != 0\n ccdd.writeToFileLn(file, \" Group(s): \" + (\",\\n \").join(sorted(ccdd.getAssociatedGroupNames())))\n end\n\n ccdd.writeToFileLn(file, \"*/\")\nend",
"title": ""
},
{
"docid": "91fade238e12576c523f421015df5479",
"score": "0.53922427",
"text": "def outputFileCreationInfo(file)\n # Add the build information and header to the output file\n ccdd.writeToFileLn(file, \"/* Created : \" + ccdd.getDateAndTime() + \"\\n User : \" + ccdd.getUser() + \"\\n Project : \" + ccdd.getProject() + \"\\n Script : \" + ccdd.getScriptName())\n\n # Check if any table is associated with the script\n if ccdd.getTableNumRows() != 0\n ccdd.writeToFileLn(file, \" Table(s): \" + ccdd.getTableNames().sort.to_a.join(\",\\n \"))\n end\n\n # Check if any groups is associated with the script\n if ccdd.getAssociatedGroupNames().length != 0\n ccdd.writeToFileLn(file, \" Group(s): \" + ccdd.getAssociatedGroupNames().sort.to_a.join(\",\\n \"))\n end\n\n ccdd.writeToFileLn(file, \"*/\\n\")\nend",
"title": ""
},
{
"docid": "91fade238e12576c523f421015df5479",
"score": "0.53922427",
"text": "def outputFileCreationInfo(file)\n # Add the build information and header to the output file\n ccdd.writeToFileLn(file, \"/* Created : \" + ccdd.getDateAndTime() + \"\\n User : \" + ccdd.getUser() + \"\\n Project : \" + ccdd.getProject() + \"\\n Script : \" + ccdd.getScriptName())\n\n # Check if any table is associated with the script\n if ccdd.getTableNumRows() != 0\n ccdd.writeToFileLn(file, \" Table(s): \" + ccdd.getTableNames().sort.to_a.join(\",\\n \"))\n end\n\n # Check if any groups is associated with the script\n if ccdd.getAssociatedGroupNames().length != 0\n ccdd.writeToFileLn(file, \" Group(s): \" + ccdd.getAssociatedGroupNames().sort.to_a.join(\",\\n \"))\n end\n\n ccdd.writeToFileLn(file, \"*/\\n\")\nend",
"title": ""
},
{
"docid": "91fade238e12576c523f421015df5479",
"score": "0.53922427",
"text": "def outputFileCreationInfo(file)\n # Add the build information and header to the output file\n ccdd.writeToFileLn(file, \"/* Created : \" + ccdd.getDateAndTime() + \"\\n User : \" + ccdd.getUser() + \"\\n Project : \" + ccdd.getProject() + \"\\n Script : \" + ccdd.getScriptName())\n\n # Check if any table is associated with the script\n if ccdd.getTableNumRows() != 0\n ccdd.writeToFileLn(file, \" Table(s): \" + ccdd.getTableNames().sort.to_a.join(\",\\n \"))\n end\n\n # Check if any groups is associated with the script\n if ccdd.getAssociatedGroupNames().length != 0\n ccdd.writeToFileLn(file, \" Group(s): \" + ccdd.getAssociatedGroupNames().sort.to_a.join(\",\\n \"))\n end\n\n ccdd.writeToFileLn(file, \"*/\\n\")\nend",
"title": ""
},
{
"docid": "91fade238e12576c523f421015df5479",
"score": "0.53922427",
"text": "def outputFileCreationInfo(file)\n # Add the build information and header to the output file\n ccdd.writeToFileLn(file, \"/* Created : \" + ccdd.getDateAndTime() + \"\\n User : \" + ccdd.getUser() + \"\\n Project : \" + ccdd.getProject() + \"\\n Script : \" + ccdd.getScriptName())\n\n # Check if any table is associated with the script\n if ccdd.getTableNumRows() != 0\n ccdd.writeToFileLn(file, \" Table(s): \" + ccdd.getTableNames().sort.to_a.join(\",\\n \"))\n end\n\n # Check if any groups is associated with the script\n if ccdd.getAssociatedGroupNames().length != 0\n ccdd.writeToFileLn(file, \" Group(s): \" + ccdd.getAssociatedGroupNames().sort.to_a.join(\",\\n \"))\n end\n\n ccdd.writeToFileLn(file, \"*/\\n\")\nend",
"title": ""
},
{
"docid": "bcd722f8e53c233263f5dc5794715a14",
"score": "0.5374051",
"text": "def write_file(metadata)\n File.open(create_full_path(@file_name_prefix), \"w\", DEFAULT_FILE_MODE) { |f| f.write(metadata.to_s) }\n end",
"title": ""
},
{
"docid": "151e828c4549ec76c5df08f77e16276b",
"score": "0.5373757",
"text": "def metadata(druid:, filepath:, version: nil)\n file(druid, 'metadata', filepath, version)\n end",
"title": ""
},
{
"docid": "e3281f4fb8a17e3e26a1df8b9089d9f1",
"score": "0.53575164",
"text": "def line_info(filename, idx)\n result = {}\n return result unless Notes.git?\n\n fields = Notes.blame(filename, idx+1)\n\n author = fields[\"author\"]\n result[:author] = author if author && !author.empty?\n\n time = fields[\"author-time\"] # ISO 8601\n result[:date] = Time.at(time.to_i).to_s if time && !time.empty?\n\n sha = fields[\"sha\"]\n result[:sha] = sha if sha\n\n result\n end",
"title": ""
},
{
"docid": "46389560a376e211743fd88068602d72",
"score": "0.5337122",
"text": "def build_file(filepath, title, link, timestamp)\n File.open(filepath, 'w') do |f|\n f << \"---\\n\"\n f << \"layout: post\\n\"\n f << \"title: \\\"#{title}\\\"\\n\"\n f << \"date: #{timestamp || Time.now.strftime('%Y-%m-%d')}\\n\"\n f << \"tags: ['New-Post', 'Tag']\\n\"\n f << \"---\\n\"\n f << \"\\n\"\n f << \"[see more details](#{link})\\n\\n#{DEFAULT_TEXT}\\n\"\n end\n puts \"Created: #{filepath}\"\nend",
"title": ""
},
{
"docid": "c6ab849deecdaf958cb0f28cbe1a8a45",
"score": "0.53134793",
"text": "def makeExifMeta(fileInput)\n targetDir = File.expand_path(fileInput)\n baseName = File.basename(targetDir)\n metadata_dir = \"#{targetDir}/metadata\"\n exifMeta = \"#{metadata_dir}/#{baseName}.json\"\n unless Dir.exist?(metadata_dir)\n Dir.mkdir(metadata_dir)\n end\n Dir.chdir(targetDir)\n exifCommand = \"exiftool -r -json ./\"\n exifOutput = `#{exifCommand}`\n File.write(exifMeta,exifOutput)\n log_premis_pass(fileInput,__method__.to_s)\nend",
"title": ""
},
{
"docid": "e5ef26ff4a5fe0201eb3c8f56f2addb2",
"score": "0.53075355",
"text": "def createInfo\n info = $PRGNAM + \".info\"\n infotext = [ \"PRGNAM=\\\"#{$PRGNAM}\\\"\",\n \"VERSION=\\\"#{$VERSION}\\\"\",\n \"HOMEPAGE=\\\"#{$HOMEPAGE}\\\"\",\n \"DOWNLOAD=\\\"#{$DOWNLOAD}\\\"\",\n \"MD5SUM=\\\"#{%x{/usr/bin/md5sum #{$SRC} | cut -d \\\\ -f 1}.chomp}\\\"\",\n\t \"DOWNLOAD_x86_64=\\\"\\\"\",\n\t \"MD5SUM_x86_64=\\\"\\\"\",\n \"MAINTAINER=\\\"#{$AUTHOR}\\\"\",\n \"EMAIL=\\\"#{$EMAIL}\\\"\",\n \"APPROVED=\\\"\\\"\" ]\n\n File.open info, \"w\" do |f|\n infotext.each do |t|\n f.puts t\n end\n end\nend",
"title": ""
},
{
"docid": "409d964506e0b1c00e43f7091d4f14ec",
"score": "0.5293591",
"text": "def test_generate_line\n # First just do each sample record one by one\n sample_records.each do |name, options|\n result = nil\n assert_nothing_raised(\"Could not generate #{name}: '#{options[:record]}'\") do\n result = @provider.to_line(options[:record])\n end\n assert_equal(options[:text], result, \"Did not generate correct text for #{name}\")\n end\n\n # Then do them all at once.\n records = []\n text = \"\"\n sample_records.each do |name, options|\n records << options[:record]\n text += options[:text] + \"\\n\"\n end\n\n result = nil\n assert_nothing_raised(\"Could not match all records in one file\") do\n result = @provider.to_file(records)\n end\n\n assert_header(result)\n\n assert_equal(text, result, \"Did not generate correct full crontab\")\n end",
"title": ""
},
{
"docid": "cf69c38d1b3d4c7d4ac1edf45b78aeed",
"score": "0.52910113",
"text": "def path_to_metadata_file(filename)\n File.join path_to_metadata_folder, filename\n end",
"title": ""
},
{
"docid": "839dc2e419718bb09ff9c7bf664fec24",
"score": "0.5282885",
"text": "def write_metadata(content)\n write_file 'cookbooks/example/metadata.rb', content.strip\n end",
"title": ""
},
{
"docid": "364f0516df59a41acb810603f5ba4932",
"score": "0.5279814",
"text": "def create_endnote_files\n # this has 5 references in it \n @file_with_many = File.read(File.dirname(__FILE__) + '/../fixtures/test_files/simpleendnote_test.txt')\n\n @file_with_one = \"%0 Journal Article\n %T Something great happened Here\n %A OhBrother, F.\n %J Journal of Hymenoptera Research\n %V 3\n %P 1-222\n %D 1972\"\n end",
"title": ""
},
{
"docid": "d3e2190050e417a030089b8844cd216f",
"score": "0.5278248",
"text": "def line_info(line, file)\n line ? \"(on line #{line} in #{file})\" : \"\"\n end",
"title": ""
},
{
"docid": "3a9fe771a6545eec27b2ceeb78e7e4ee",
"score": "0.5254253",
"text": "def write_file(metadata, subpath)\n File.open(create_full_path(@file_name_prefix, subpath), \"w\", DEFAULT_FILE_MODE) { |f| f.write(metadata.to_s) }\n end",
"title": ""
},
{
"docid": "2aa6c796c883de35bc42e5e90530c247",
"score": "0.5251533",
"text": "def generated_at_line\n \"vernissage.rb #{timestamp}\"\n end",
"title": ""
},
{
"docid": "4d4f671a4921c9532172d8c9306d5524",
"score": "0.5244539",
"text": "def test_set_description_file\n FilePath.new(@testrun_directory, \"test-set-description.txt\")\n end",
"title": ""
},
{
"docid": "bbaa62d8dbbd921d0796cfc51326279e",
"score": "0.5215355",
"text": "def generate_technical_metadata\n create_technical_metadata\n write_technical_metadata\n end",
"title": ""
},
{
"docid": "1365bfc92086c3f588d2cc8c97c55bd8",
"score": "0.51913583",
"text": "def save_to_file(line); end",
"title": ""
},
{
"docid": "1365bfc92086c3f588d2cc8c97c55bd8",
"score": "0.51913583",
"text": "def save_to_file(line); end",
"title": ""
},
{
"docid": "08b90c13a992385fd51010ba2c083083",
"score": "0.5182747",
"text": "def write_file(metadata)\n return unless @formatter.can_format?(metadata)\n flat_metadata = @formatter.format(metadata)\n\n # write the cached file variant if the code-generation command line was passed.\n env_file_name = @generation_command ? \"#{@file_name_prefix}-cache\" : @file_name_prefix\n env_file_path = create_full_path(env_file_name)\n File.open(env_file_path, \"w\", DEFAULT_FILE_MODE) do |f|\n f.puts RUBY_HEADER\n flat_metadata.each do |k, v|\n # escape backslashes and single quotes.\n v = self.class.escape_single_quotes(v)\n f.puts \"ENV['#{k}']='#{v}'\"\n end\n end\n \n # write the generation command, if given.\n if @generation_command\n File.open(create_full_path(@file_name_prefix), \"w\", DEFAULT_FILE_MODE) do |f|\n f.puts RUBY_HEADER\n f.puts \"raise 'ERROR: unable to fetch metadata' unless system(\\\"#{@generation_command}\\\")\"\n f.puts \"require '#{env_file_path}'\"\n end\n end\n true\n end",
"title": ""
},
{
"docid": "268c853b751145f2ffe86230e77da6ac",
"score": "0.5170647",
"text": "def compile_transcription_metadata(transcriptions, group_folder)\n metadata_rows = []\n transcriptions.each do |transcription|\n # Assumes that all transcription metadata files exist, since this step always comes after\n # a full download and we don't want the db/storage costs of checking/downloading\n metadata_filename = \"#{ group_folder }/transcription_#{ transcription.id }/transcription_metadata_#{ transcription.id }.csv\"\n rows = CSV.read(metadata_filename)\n # add header if it's the first transcription being added\n metadata_rows << rows[0] if metadata_rows.empty?\n # add content regardless\n metadata_rows << rows[1]\n end\n\n metadata_rows\n end",
"title": ""
},
{
"docid": "f8f8cba22b0f948c19eab60dbd3a14fe",
"score": "0.5160525",
"text": "def create_file_asset(hypatia_ftk_item, ftk_file_intermed)\n filepath = \"#{@file_dir}/#{ftk_file_intermed.export_path}\"\n if (File.exists?(filepath))\n file = File.new(filepath)\n file_asset = FileAsset.new\n # the label value ends up in DC dc:title and descMetadata title ??\n file_asset.label=\"FileAsset for FTK file #{ftk_file_intermed.filename}\"\n file_asset.add_relationship(:is_part_of, hypatia_ftk_item)\n \n if (ftk_file_intermed.mimetype)\n file_asset.add_file_datastream(file, {:dsid => \"content\", :label => ftk_file_intermed.filename, :mimeType => ftk_file_intermed.mimetype})\n else\n file_asset.add_file_datastream(file, {:dsid => \"content\", :label => ftk_file_intermed.filename})\n end\n\n if @display_derivative_dir \n html_filepath = \"#{@display_derivative_dir}/#{ftk_file_intermed.display_deriv_fname}\"\n if File.file?(html_filepath)\n html_file = File.new(html_filepath)\n # NOTE: if mime_type is not set explicitly, Fedora does it ... but it's not testable\n derivative_ds = ActiveFedora::Datastream.new(:dsID => \"derivative_html\", :dsLabel => ftk_file_intermed.display_deriv_fname, :mimeType => \"text/html\", :blob => html_file, :controlGroup => 'M')\n file_asset.add_datastream(derivative_ds)\n# else\n# @logger.warn \"Couldn't find expected display derivative file #{html_filepath}\"\n end\n end\n\n file_asset.save\n return file_asset\n end # if file exists\n return nil\n end",
"title": ""
},
{
"docid": "5b2d730027e098c2d234c31739138fe0",
"score": "0.51542246",
"text": "def corresponding_subtitle_import_txt_file\n return nil if !File.exist?(corresponding_subtitle_import_txt_filename)\n r = RFile::Text.new(\n File.read(corresponding_subtitle_import_txt_filename),\n language,\n corresponding_subtitle_import_txt_filename,\n content_type\n )\n if as_of_git_commit_attrs\n r.as_of_git_commit(*as_of_git_commit_attrs)\n else\n r\n end\n end",
"title": ""
},
{
"docid": "be59e186fac6ab1a6139fca87000b8c7",
"score": "0.51495904",
"text": "def metadata_file\n 'metadata.yml'\n end",
"title": ""
},
{
"docid": "e3e0bed08f0d7229a9b83ee76d34bb31",
"score": "0.51480615",
"text": "def add_line_details(line_doc)\n id = parse_xml(line_doc/'id') if (line_doc/'id').first\n line = items(line_doc.name,id) ||nil\n line.apply_attributes(line_doc) if line\n line\n end",
"title": ""
},
{
"docid": "d79492964f94d2dc88f56ab9fe3f515b",
"score": "0.5130113",
"text": "def create_timeline_files\n template \"timeline.rb\", \"#{Activr.config.app_path}/timelines/#{file_name}_timeline.rb\"\n end",
"title": ""
},
{
"docid": "83079e6d0372ce740cb2859d82384d85",
"score": "0.51274145",
"text": "def create\n\n \n @record = Record.new(record_params)\n @name = @record.name\n @record.transcript = @record.transcript.gsub(@name, 'John Doe')\n\n\n file = File.open(\"transcript.txt\", \"w\")\n file.puts @record.transcript\n file.close\n\n @language = @record.language\n\n\n file = File.open(\"language.txt\", \"w\")\n file.puts @record.language\n file.close\n\n @email = @record.email\n\n file = File.open(\"email.txt\", \"w\")\n file.puts @record.email\n file.close\n\n\n file = File.open(\"language.txt\", \"w\")\n file.puts @record.language\n file.close\n\n\n\n respond_to do |format|\n if @record.save\n format.html { redirect_to @record, notice: 'Record was successfully created.' }\n format.json { render :show, status: :created, location: @record }\n else\n format.html { render :new }\n format.json { render json: @record.errors, status: :unprocessable_entity }\n end\n end\n\n \n end",
"title": ""
},
{
"docid": "10a538282bd94c6469748e587cc710d6",
"score": "0.512046",
"text": "def insert_license_text(target_file, line)\r\n ends = line.split(MAGIC_STRING)\r\n if ends.size != 2\r\n raise (\"Can't parse this license line: #{line}\")\r\n end\r\n\r\n target_file.print \"#{ends[0].strip}\\n\"\r\n\r\n @license_text.each do |text|\r\n target_file.print \"#{text.rstrip}\\n\"\r\n end\r\n\r\n target_file.print \"#{ends[1].strip}\\n\"\r\n end",
"title": ""
},
{
"docid": "2013b06644a48856c62c8d87184c233a",
"score": "0.5114807",
"text": "def add_line_to_file file_path,line\n return \"echo #{line} >> #{file_path}\"\n end",
"title": ""
},
{
"docid": "a0cf04890fb9407c75d28eba96625c51",
"score": "0.5102242",
"text": "def end_timestamp_file\n FilePath.new(@testrun_directory, \"testrun.end\")\n end",
"title": ""
},
{
"docid": "880e9b06e9cf5268084979436a6073e2",
"score": "0.5100557",
"text": "def story_line\n puts '''Now that we\\'ve opened your file lets pretend we input data into the file by typing stuff in and saved it.'''\nend",
"title": ""
},
{
"docid": "b53818ba6cb75ed3c84551104e62dfe9",
"score": "0.50990224",
"text": "def add_data(line)\n File.open(\"#{filename}\", \"a\") { |file1| file1.puts line }\n end",
"title": ""
},
{
"docid": "a8054bc57e26d5ecb3769e93a8afcc24",
"score": "0.50940436",
"text": "def generate_audio_info mp3\n audioInfo = File.basename(mp3, File.extname(mp3)) + \".txt\"\n puts \"hey \"+ File.absolute_path(audioInfo)\n puts \"generating Audio info #{audioInfo}\"\n if !system(\"mediainfo --Inform='General;%Title% - %Artist% ' #{mp3} >> #{audioInfo}\")\n raise \"generating audio info #{audioInfo} failed\"\n end\n return audioInfo\n end",
"title": ""
},
{
"docid": "a8c16db14adb971fd9d48061b5bceadf",
"score": "0.5093386",
"text": "def file_line=(_arg0); end",
"title": ""
},
{
"docid": "f754be30781385b59ab9ee24aa49f054",
"score": "0.5067941",
"text": "def file_name_and_line\n file, line = log.file_name_and_line(true)\n \"#{file}:#{line}\" if file\n end",
"title": ""
},
{
"docid": "c7f8826a22632dd52437e01a0240cf6f",
"score": "0.5067395",
"text": "def generate_metadata\n\t\t\treturn @metadata.generate(@indent)\n\t\tend",
"title": ""
},
{
"docid": "ce91565ad48e2475c71c1984eb305bf4",
"score": "0.50610197",
"text": "def create_timestamp_file\n timestamp = Time.now.utc\n timestamp_file = File.new(report_timing_file, 'w')\n timestamp_file.puts(timestamp)\n timestamp_file.close\n end",
"title": ""
},
{
"docid": "e35967ed82fa9966e0a689e22cc6a8a4",
"score": "0.5059552",
"text": "def generate_location(io, metadata: {}, **options)\n # assumes we're only used with OralHistoryContent model, that has a work_id\n work_id = options[:record].work_id\n original_uuid = super\n\n orig_filename = File.basename(metadata[\"filename\"] || \"\", \".*\")\n \"#{work_id}/#{orig_filename}_#{original_uuid}\"\n end",
"title": ""
},
{
"docid": "ada9fbf51bf118da9c9bab2354bdb946",
"score": "0.5057074",
"text": "def line_contents; end",
"title": ""
},
{
"docid": "ada9fbf51bf118da9c9bab2354bdb946",
"score": "0.5057074",
"text": "def line_contents; end",
"title": ""
},
{
"docid": "022764dc0b35d62a7f6fcc7df37eb7d9",
"score": "0.50569504",
"text": "def setup(file, line=nil)\n @file = file\n @line = line\n end",
"title": ""
},
{
"docid": "315604d4899bb360321518cde4a7de3b",
"score": "0.5056024",
"text": "def create_line_in_cf(line_dump)\n line_title = line_dump['title'].parameterize\n line_description = line_dump['description']\n line_department = line_dump['department']\n line_public = line_dump['public']\n line = CF::Line.new(line_title, line_department, {:description => line_description, :public => line_public})\n return line if line.errors.present?\n\n # Creation of InputFormat from yaml file\n input_formats = line_dump['input_formats']\n input_formats.each_with_index do |input_format, index|\n if input_format['valid_type']\n @attrs = {\n :name => input_format['name'],\n :required => input_format['required'],\n :valid_type => input_format['valid_type']\n }\n elsif input_format['valid_type'].nil?\n @attrs = {\n :name => input_format['name'],\n :required => input_format['required'],\n :valid_type => input_format['valid_type']\n }\n end\n input_format_for_line = CF::InputFormat.new(@attrs)\n input_format = line.input_formats input_format_for_line\n line.errors = input_formats[index].errors and return line if line.input_formats[index].errors.present?\n end\n\n # Creation of Station\n stations = line_dump['stations']\n stations.each_with_index do |station_file, s_index|\n type = station_file['station']['station_type']\n index = station_file['station']['station_index']\n input_formats_for_station = station_file['station']['input_formats']\n batch_size = station_file['station']['batch_size']\n if type == \"tournament\"\n jury_worker = station_file['station']['jury_worker']\n auto_judge = station_file['station']['auto_judge']\n acceptance_ratio = station_file['station']['acceptance_ratio']\n station_params = {:line => line, :type => type, :jury_worker => jury_worker, :auto_judge => auto_judge, :input_formats => input_formats_for_station, :batch_size => batch_size, :acceptance_ratio => acceptance_ratio}\n else\n station_params = {:line => line, :type => type, :input_formats => input_formats_for_station, :batch_size => batch_size}\n end\n station = CF::Station.create(station_params) do |s|\n line.errors = s.errors and return line if s.errors.present?\n # For Worker\n worker = station_file['station']['worker']\n number = worker['num_workers']\n reward = worker['reward']\n worker_type = worker['worker_type']\n if worker_type == \"human\"\n skill_badges = worker['skill_badges']\n stat_badge = worker['stat_badge']\n if stat_badge.nil?\n human_worker = CF::HumanWorker.new({:station => s, :number => number, :reward => reward})\n else\n human_worker = CF::HumanWorker.new({:station => s, :number => number, :reward => reward, :stat_badge => stat_badge})\n end\n\n if worker['skill_badges'].present?\n skill_badges.each do |badge|\n human_worker.badge = badge\n end\n end\n line.errors = human_worker.errors and return line if human_worker.errors.present?\n elsif worker_type =~ /robot/\n settings = worker['settings']\n robot_worker = CF::RobotWorker.create({:station => s, :type => worker_type, :settings => settings})\n\n line.errors = robot_worker.errors and return line if robot_worker.errors.present?\n else\n line.errors = [\"Invalid worker type: #{worker_type}\"]\n return line\n end\n\n # Creation of Form\n # Creation of TaskForm\n if station_file['station']['task_form'].present?\n title = station_file['station']['task_form']['form_title']\n instruction = station_file['station']['task_form']['instruction']\n form = CF::TaskForm.create({:station => s, :title => title, :instruction => instruction}) do |f|\n\n # Creation of FormFields\n line.errors = f.errors and return line if f.errors.present?\n\n station_file['station']['task_form']['form_fields'].each do |form_field|\n form_field_params = form_field.merge(:form => f)\n field = CF::FormField.new(form_field_params.symbolize_keys)\n\n line.errors = field.errors and return line if field.errors.present?\n end\n\n end\n\n elsif station_file['station']['custom_task_form'].present?\n # Creation of CustomTaskForm\n title = station_file['station']['custom_task_form']['form_title']\n instruction = station_file['station']['custom_task_form']['instruction']\n\n html_file = station_file['station']['custom_task_form']['html']\n html = File.read(\"#{line_source}/station_#{station_file['station']['station_index']}/#{html_file}\")\n css_file = station_file['station']['custom_task_form']['css']\n css = File.read(\"#{line_source}/station_#{station_file['station']['station_index']}/#{css_file}\") if File.exist?(\"#{line_source}/station_#{s_index+1}/#{css_file}\")\n js_file = station_file['station']['custom_task_form']['js']\n js = File.read(\"#{line_source}/station_#{station_file['station']['station_index']}/#{js_file}\") if File.exist?(\"#{line_source}/station_#{s_index+1}/#{js_file}\")\n form = CF::CustomTaskForm.create({:station => s, :title => title, :instruction => instruction, :raw_html => html, :raw_css => css, :raw_javascript => js})\n\n line.errors = form.errors and return line if form.errors.present?\n end\n\n end\n end\n\n output_formats = line_dump['output_formats'].presence\n if output_formats\n output_format = CF::OutputFormat.new(output_formats.merge(:line => line))\n\n line.errors = output_format.errors if output_format.errors.present?\n end\n\n return line\n end",
"title": ""
},
{
"docid": "3eabfdaa06e5a7c387f1ac144d3e7732",
"score": "0.50548786",
"text": "def file_name\n \"create_notes\"\n end",
"title": ""
},
{
"docid": "075b342045dee4eb1b8c38703324366a",
"score": "0.504781",
"text": "def metadatafile\n @tagdir + '/' + @name + '.json'\n end",
"title": ""
},
{
"docid": "7d5adc531d19c997c3363caaeef27225",
"score": "0.5045542",
"text": "def create_txt_file(checks)\n begin\n method_to_call = \"file_name_#{client_name}_txt\"\n file_name = send(method_to_call, checks)\n output_dir_indexed_image = \"private/data/#{facility_name}/#{Date.today.to_s}/txt\"\n if file_name\n FileUtils.mkdir_p(output_dir_indexed_image)\n end\n File.open(\"#{output_dir_indexed_image}/#{file_name}\", 'w+') do |file|\n file << OutputText::Document.new(checks).generate\n puts \"Output generated sucessfully, file is written to:\"\n puts \"#{output_dir_indexed_image}/#{file_name}\"\n end\n rescue Exception => e\n OutputText.log.error \"Exception => \" + e.message\n OutputText.log.error e.backtrace.join(\"\\n\")\n end \n end",
"title": ""
},
{
"docid": "41b68efa7b5c9db237ec94713a2399fc",
"score": "0.50446725",
"text": "def create_txt_file(filename, tweet)\n\t\t@txt_file = File.new(filename,\"w\")\n\t\tclean_tweet(tweet['tweet'], tweet['quoted_text'])\n\tend",
"title": ""
},
{
"docid": "eaf6227f397cdc02b8f487f302f0a673",
"score": "0.50428855",
"text": "def create_header\r\n system(\"mc #{@mc_file}\")\r\n end",
"title": ""
},
{
"docid": "423f0098e8894fe5ff4b21b1a34160b2",
"score": "0.50259405",
"text": "def add_tcga_source(filepath)\n m = filepath.match(/(biospecimen|clinical)\\_(.*)\\_(\\w+)\\.txt$/)\n return nil if m.nil?\n name = [m[1], m[2]].join(\"_\")\n @h[name] = ClinicalMetadata.new(filepath)\n headerAry = @h[name].getHeader\n headerAry.each{|fstr| @feature_h.has_key?(fstr) ? @feature_h[fstr].push(name) : @feature_h[fstr] = [name] }\n end",
"title": ""
},
{
"docid": "fab8605fe6724bfc670603274a55e9bf",
"score": "0.50147605",
"text": "def metadata(options = {})\n path = options[:path] || File.dirname(filepath)\n\n metadata_path = File.expand_path(File.join(path, 'metadata.rb'))\n metadata = Ridley::Chef::Cookbook::Metadata.from_file(metadata_path)\n\n name = metadata.name.presence || File.basename(File.expand_path(path))\n\n add_source(name, nil, { path: path, metadata: true })\n end",
"title": ""
},
{
"docid": "33d32f75869a435d161356ba004ee0ce",
"score": "0.50146455",
"text": "def createFileWithHeader \n # TODO - See about using !File.exist?(\"music_db.txt\")\n if File.exist?(\"music_db.txt\")\n else\n open('music_db.txt', 'w') { |z|\n }\n end \n end",
"title": ""
},
{
"docid": "9970df58e4be98172135e55009fbd9d5",
"score": "0.5013784",
"text": "def create_textline(text)\n Handle::Textline.create(text, self)\n end",
"title": ""
},
{
"docid": "6c1866a9c8c3d4fa1f014b87cdb3cddf",
"score": "0.5006269",
"text": "def create_file(file_name, file_content)\n require 'fileutils'\n file_name = file_name + \".rb\"\n somefile = File.open(file_name, \"w\") #File.open is same as File.new, it creates a new file...\n comment_1 = \"#select array within Plot.create(), then click: Packages > Pretty JSON > Prettify\\n\"\n plot_content = \"plot = Plot.create([{\\\"genre_id\\\": \\\"null\\\", \\\"title\\\": \\\"#{file_name}\\\", \\\"author\\\": \\\"null\\\"}])\\n\\n\" #note: need to escape all double quotes within double quotes, for interpolated file name, and need double quotes for all key values anyway\n\n comment_2 = \"#note: when adding new plots, need to redo do each plot's ID\\n\n #seeding database will give each plot an id, from first folder to last folder\\n\n #so Halloween will be plot ID #1, because it's the first plot in the first folder.\\n\n #ALSO: need to figure out how to reseed plots without deleting all users, and all their stories!!!\\n\n #need to JUST drop Plots table, and then migrate / seed Plots table.\\n\\n\"\n\n comment_3 = \"#select array within Paragraph.create(), then click: Packages > Pretty JSON > Prettify\\n\"\n\n paragraph_content = file_content.join(\",\")\n paragraph_content = \"paragraphs = Paragraph.create([\" + paragraph_content + \"])\"\n\n final_file_content = comment_1 + plot_content + comment_2 + comment_3 + paragraph_content\n #adding comma to end of each hash, now just need to put it all in brackets! <<<<-----!!!!!\n somefile.puts final_file_content\n somefile.close\n puts \"created file...\"\n return \"created file...!!!!!\"\n end",
"title": ""
},
{
"docid": "1da8b407ab89b61d2266d25ce12bcb0c",
"score": "0.49986583",
"text": "def create_file\n @file = File.new(@path+'.tcx', \"w\")\n end",
"title": ""
},
{
"docid": "1ff3bfbdbfd8191204789911ab9f0027",
"score": "0.49968737",
"text": "def make_entry()\n header = @filehandler.readline.chomp\n\n sequence = \"\"\n # f.each do |line|\n @filehandler.each do |line|\n unless line.include? \">\"\n sequence += line.chomp\n else\n break\n end\n end\n\n FastaEntry.new(header,sequence)\n end",
"title": ""
},
{
"docid": "ef99d172d71c15e0aa36e93e8cf5259d",
"score": "0.49852836",
"text": "def new_recipe_file(recipe_name, ingredients, methods)\n filename = \"./recipes/#{recipe_name}.txt\"\n target = open(filename, 'w+')\n new_file = File.new(filename, \"w+\")\n new_file\n target.write(\"#{recipe_name}\")\n target.write(\"\\n\")\n target.write(\"#{ingredients}\")\n target.write(\"\\n\")\n target.write(\"#{methods}\")\n target.close\n end",
"title": ""
},
{
"docid": "7b178e3351f9e82ecdf69bc9a2f48c47",
"score": "0.49842376",
"text": "def get_rt_line\n delete_tied = ''\n\n if @addshow_config['rtorrent']['delete_tied'] == 'true'\n delete_tied = ',d.delete_tied='\n end\n \n @rt_config_lines = \"\\n\\n## #{@title}\\nschedule = watch_directory_#{@digit},5,5,\\\"load_start=#{@watch}/*.torrent,d.set_custom1=#{@dest}/#{delete_tied}\\\"\"\nend",
"title": ""
},
{
"docid": "dd63a5f578ae4803bccf4eedbfeebdc1",
"score": "0.49837118",
"text": "def create_file(file)\n @generic_file = GenericFile.new\n @generic_file.batch_id = object.batch.pid\n @generic_file.add_file(file.read, 'content', file.name)\n @generic_file.apply_depositor_metadata(object.edit_users.first)\n @generic_file.date_uploaded = Time.now.ctime\n @generic_file.date_modified = Time.now.ctime\n @generic_file.save\n end",
"title": ""
},
{
"docid": "ae6d4c8f614705a01b72a53aa2798d06",
"score": "0.49812204",
"text": "def raw_text\n raw_text = File.read(file_name)\n #raw_text = File.read(\"tmp/insert_sexual_lines.txt\")\n #raw_text = File.read(\"tmp/insert_internals_hash.txt\")\n end",
"title": ""
},
{
"docid": "112122f9f8e4660fd3bd7c2351fe904d",
"score": "0.49794275",
"text": "def write_file(metadata)\n return unless @formatter.can_format?(metadata)\n flat_metadata = @formatter.format(metadata)\n\n env_file_path = create_full_path(@file_name_prefix)\n File.open(env_file_path, \"w\", DEFAULT_FILE_MODE) do |f|\n f.puts(WINDOWS_SHELL_HEADER)\n flat_metadata.each do |k, v|\n # ensure value is a single line (multiple lines could be interpreted\n # as subsequent commands) by truncation since windows shell doesn't\n # have escape characters.\n v = self.class.first_line_of(v)\n f.puts \"set #{k}=#{v}\"\n end\n end\n true\n end",
"title": ""
},
{
"docid": "176f05407a52c57614bdb41d0936efa7",
"score": "0.49747163",
"text": "def metadata_path\n \"#{path}/metadata\"\n end",
"title": ""
},
{
"docid": "176f05407a52c57614bdb41d0936efa7",
"score": "0.49747163",
"text": "def metadata_path\n \"#{path}/metadata\"\n end",
"title": ""
},
{
"docid": "ca19396a4c19a41ce59961aa55264547",
"score": "0.49688092",
"text": "def add_line_details(line_doc)\n id = parse_xml(line_doc/'/id') if (line_doc/'/id').first\n line = invoice_line(line_doc.name,id) || nil\n line.apply_attributes(line_doc) if line\nend",
"title": ""
},
{
"docid": "12c33413d8b5ac95f3abe40d759d54bb",
"score": "0.49615675",
"text": "def file_name\n file_name = (\"./tmp/insert_externals.txt\")\n end",
"title": ""
},
{
"docid": "804e79f02272bd4cb104fd11840feece",
"score": "0.4959784",
"text": "def mkfile(name, contents, log, description='', branch_tag='')\n raise NotImplementedError.new\n end",
"title": ""
},
{
"docid": "0da910997693957bf25e7e3ed9ff85a6",
"score": "0.4950711",
"text": "def generate(playlist)\n text = ''\n playlist.calculate_start_times\n text += generate_line(0, 'TITLE', playlist.title)\n text += generate_line(\n 0, 'FILE', format_filename(playlist.media_location), false\n )\n playlist.tracks.each_with_index do |track, index|\n text += generate_track(track, index + 1)\n end\n text\n end",
"title": ""
},
{
"docid": "6cd5c4596544fbc415d71c472cf888ed",
"score": "0.49488464",
"text": "def create_turplefile!\n # get new template name based on the first directory of the destination\n turplefile_path = File.join(@destination, 'Turplefile')\n turplefile_object = Turple.turpleobject.deep_merge({\n template: @template.name,\n :created_on => Date.today.to_s\n })\n\n # convert object to yaml\n turplefile_contents = turplefile_object.deep_stringify_keys.to_yaml\n\n # Overwrite the original file if it exists with the processed file\n File.open turplefile_path, 'w' do |f|\n f.write turplefile_contents\n end\n end",
"title": ""
},
{
"docid": "2d653552bb6205698e896f2324535c0e",
"score": "0.49352932",
"text": "def make_file(command)\n lines = OpenSCAD::expand('model_base.scad')\n lines << command\n f = Tempfile.new('models.scad')\n f.write lines.join\n f.close\n f.path\nend",
"title": ""
},
{
"docid": "1d12e596dd0f9c00ec8945ed1f55aaa6",
"score": "0.49335384",
"text": "def create_file(src_type, dest_type, output_file, target_lang)\n file = nil\n done = false\n begin\n # Create the file in overwrite mode\n file = File.open(output_file, \"w\")\n\n # Dump the initial info into the file to start off with\n case dest_type\n when AllFather::TYPE_SCC\n file.write(\"Scenarist_SCC V1.0\\n\\n\")\n\n when AllFather::TYPE_SRT\n file.write(\"NOTE #{CREDITS}\\n\\n\")\n\n when AllFather::TYPE_VTT\n file.write(\"WEBVTT\\n\\n\")\n file.write(\"NOTE #{CREDITS}\\n\\n\")\n\n when AllFather::TYPE_TTML\n target_lang ||= \"\"\n # TODO: Move this to a template file and load from there !!\n data = <<-EOF\n<tt xml:lang=\"\" xmlns=\"http://www.w3.org/ns/ttml\">\n <head>\n <metadata xmlns:ttm=\"http://www.w3.org/ns/ttml#metadata\">\n <ttm:desc>#{CREDITS}</ttm:desc>\n </metadata>\n </head>\n <body>\n <div xml:lang=\\\"#{target_lang}\\\">\n EOF\n file.write(data)\n\n when AllFather::TYPE_DFXP\n target_lang ||= \"\"\n data = <<-EOF\n<tt xml:lang=\"\" xmlns=\"http://www.w3.org/2004/11/ttaf1\">\n <head>\n <meta xmlns:ttm=\"http://www.w3.org/2004/11/ttaf1#metadata\">\n <ttm:desc>#{CREDITS}</ttm:desc>\n </meta>\n </head>\n <body>\n <div xml:lang=\\\"#{target_lang}\\\">\n EOF\n file.write(data)\n else\n raise AllFather::InvalidInputException.new(\"Not a valid type; Failed to create output file for type #{type}\")\n end\n done = true\n ensure\n file.close if file rescue nil\n end\n done\n end",
"title": ""
},
{
"docid": "a95f98c93a4ea33abf9ce9aa0332972b",
"score": "0.4933535",
"text": "def insert_file(type, opts={})\n case type.to_sym \n when :file\n node = Hydra::ResourceInfoMetadata.file_template\n nodeset = self.find_by_terms(:person)\n else\n ActiveFedora.logger.warn(\"#{type} is not a valid argument for Hydra::ResourceInfoMetadata.insert_file\")\n node = nil\n index = nil\n end\n \n unless nodeset.nil?\n if nodeset.empty?\n self.ng_xml.root.add_child(node)\n index = 0\n else\n nodeset.after(node)\n index = nodeset.length\n end\n self.dirty = true\n end\n \n return node, index\n end",
"title": ""
},
{
"docid": "7e9806e889ac11725becdec1951036a6",
"score": "0.49323875",
"text": "def metadata_log(metadata_log:, metadata:)\n File.open(metadata_log, 'a+') do |fd|\n fd.puts metadata.to_json\n end\n end",
"title": ""
},
{
"docid": "83af0ebdf7f162951ecdf3ab8ddabae1",
"score": "0.493161",
"text": "def metadata_file_for url\n File.join(Ydl::CONFIG.directory, \"metadata\", url.md5ify + \".info.json\")\n end",
"title": ""
},
{
"docid": "24ef00a2a35b47de36381706f813e7e9",
"score": "0.49225864",
"text": "def create_technical_metadata\n return unless content_md_creation == 'smpl_cm_style'\n\n tm = Nokogiri::XML::Document.new\n tm_node = Nokogiri::XML::Node.new('technicalMetadata', tm)\n tm_node['objectId'] = pid\n tm_node['datetime'] = Time.now.utc.strftime('%Y-%m-%d-T%H:%M:%SZ')\n tm << tm_node\n\n # find all technical metadata files and just append the xml to the combined technicalMetadata\n current_directory = Dir.pwd\n FileUtils.cd(File.join(bundle_dir, container_basename))\n Dir.glob('**/*_techmd.xml').sort.each do |filename|\n tech_md_xml = Nokogiri::XML(File.open(File.join(bundle_dir, container_basename, filename)))\n tm.root << tech_md_xml.root\n end\n FileUtils.cd(current_directory)\n self.technical_md_xml = tm.to_xml\n end",
"title": ""
},
{
"docid": "95166c84b6fcbbc032ac86ef53d52384",
"score": "0.49180132",
"text": "def create_unique_tx_index(cremul_msg, cremul_msg_line, cremul_tx)\n file_hash = @cremul_file_hash[0, 8].force_encoding('utf-8')\n \"#{file_hash}:msg#{cremul_msg.message_index}:line#{cremul_msg_line.line_index}:tx#{cremul_tx.tx_index}\"\n end",
"title": ""
}
] |
231a646e06ef088d6889017f300f9530 | DELETE /home_configurations/1 DELETE /home_configurations/1.json | [
{
"docid": "c8187d677944528e1c039b3c8dbc7840",
"score": "0.7240707",
"text": "def destroy\n @home_configuration = HomeConfiguration.find(params[:id])\n @home_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to home_configurations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] | [
{
"docid": "ab7b8c6dbb9cd3a3a11f2294c8b1bc82",
"score": "0.69235146",
"text": "def destroy\n @am_configuration = AmConfiguration.find(params[:id])\n @am_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to am_configurations_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d84ec80ad667ab8a348676d8233a8551",
"score": "0.6907244",
"text": "def destroy\n @app_configuration.destroy\n respond_to do |format|\n format.html { redirect_to app_configurations_url, notice: 'App configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c27b8a260bc8147d367f4dcbd62e5cae",
"score": "0.68488413",
"text": "def destroy\n @config.destroy\n respond_to do |format|\n format.html { redirect_to configs_url, notice: 'Configuration was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "32cf550efd37392c2406b908a150e0ad",
"score": "0.6806904",
"text": "def destroy\n @config1 = Config1.find(params[:id])\n @config1.destroy\n\n respond_to do |format|\n format.html { redirect_to config1s_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "756f45b0cdde8e56343848406050d163",
"score": "0.67920303",
"text": "def destroy\n @host_config.destroy\n respond_to do |format|\n format.html { redirect_to host_configs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8833ea66c4e8ba2f90b9bb805a4f0b0b",
"score": "0.67799675",
"text": "def destroy\n @app_config = AppConfig.find(params[:id])\n @app_config.destroy\n\n respond_to do |format|\n format.html { redirect_to app_configs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "206ac72db39b799e57568806e1da117d",
"score": "0.67737275",
"text": "def destroy\n @otg_config.destroy\n respond_to do |format|\n format.html { redirect_to otg_configs_url, notice: 'Otg config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "70de7cfb8e0bfedd7805048ca371ac62",
"score": "0.67352253",
"text": "def destroy\n @config_file.destroy\n respond_to do |format|\n format.html { redirect_to config_files_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b606c0ca85c5c9b86becddc9f94542b0",
"score": "0.66940355",
"text": "def destroy\n @config.destroy\n respond_to do |format|\n format.html { redirect_to configs_path, notice: '记录已经删除!' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "09755fcee1912e2b0b5214238ec01fe4",
"score": "0.66925144",
"text": "def destroy\n @oa_config.destroy\n respond_to do |format|\n format.html { redirect_to oa_configs_url, notice: 'Oa config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "351075d752d7e0efb2061d9d76b6eb13",
"score": "0.6647408",
"text": "def destroy\n Admin::DbConfiguration.using(master_db).destroy(@admin_db_configuration.id)\n respond_to do |format|\n format.html { redirect_to admin_db_configurations_url, notice: 'Db configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df35664c545d4e33e4649e8af9607ed",
"score": "0.6632021",
"text": "def destroy\n @project_configuration = ProjectConfiguration.find(params[:id])\n @project_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to project_configurations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6ffaf4a8bb7bf3a7c536a73201022499",
"score": "0.66222644",
"text": "def destroy\n @game_configuration.destroy\n respond_to do |format|\n format.html { redirect_to game_configurations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c2aef5da3309aac7b8846db3d4c763ea",
"score": "0.661705",
"text": "def destroy\n @config.destroy\n respond_to do |format|\n format.html { redirect_to configs_url, notice: 'Config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c2aef5da3309aac7b8846db3d4c763ea",
"score": "0.661705",
"text": "def destroy\n @config.destroy\n respond_to do |format|\n format.html { redirect_to configs_url, notice: 'Config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c2aef5da3309aac7b8846db3d4c763ea",
"score": "0.661705",
"text": "def destroy\n @config.destroy\n respond_to do |format|\n format.html { redirect_to configs_url, notice: 'Config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "32850b09125344184492d627e34f233b",
"score": "0.6611101",
"text": "def destroy\n @config.destroy\n respond_to do |format|\n format.html { head :no_content}\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "51e814b30a8d4b2cc455165d0f03d133",
"score": "0.66015655",
"text": "def destroy\n @configuration = Configuration.find(params[:id])\n @configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to(configurations_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "51e814b30a8d4b2cc455165d0f03d133",
"score": "0.66015655",
"text": "def destroy\n @configuration = Configuration.find(params[:id])\n @configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to(configurations_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d27882902c1dd67e0de4ab984c9ba391",
"score": "0.6596446",
"text": "def destroy\n @sys_configuration = SysConfiguration.find(params[:id])\n @sys_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to sys_configurations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "35623223b1c2a17613999f7914e6054c",
"score": "0.65804094",
"text": "def destroy\n @cdist_configuration = CdistConfiguration.find(params[:id])\n @cdist_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to cdist_configurations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a46841b038ccd1977325a903ff487b2a",
"score": "0.6556234",
"text": "def destroy\n @account_configuration.destroy\n respond_to do |format|\n format.html { redirect_to account_configurations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6b1613ad025370c41e281cbf8617163a",
"score": "0.6542243",
"text": "def delete_configuration()\n File.delete(CONFIG_FILE) if File.exist? CONFIG_FILE\nend",
"title": ""
},
{
"docid": "082ac7078ce9d147ebb657e0c09b44e3",
"score": "0.654146",
"text": "def destroy\n @admin_config = Admin::Config.find(params[:id])\n @admin_config.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_configs_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "07223c4dd5b1707af09b21e1a295c85e",
"score": "0.6529853",
"text": "def destroy\n @configdb.destroy\n respond_to do |format|\n format.html { redirect_to configdbs_url, notice: 'Configdb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f61167753fcc2d7e390c3bbce50cbffb",
"score": "0.6529441",
"text": "def destroy\n @scrapy_config.destroy\n respond_to do |format|\n format.html { redirect_to scrapy_configs_url, notice: 'Scrapy config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1f66cbf6d65c6d426eaf2f28d3aa4b8e",
"score": "0.65122575",
"text": "def destroy\n name = @admin_configuration.display_name\n @admin_configuration.destroy\n respond_to do |format|\n format.html { redirect_to admin_configurations_path, notice: \"Admin configuration: #{name} was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "58163074f9afdadd2669d6162b47f77d",
"score": "0.6493551",
"text": "def destroy\n @admin_configuration.destroy\n respond_to do |format|\n format.html { redirect_to admin_configurations_path, notice: \"Configuration option '#{@admin_configuration.config_type}' was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f397a8a40c84d2395cff633402b99af2",
"score": "0.6492282",
"text": "def destroy\n @system_configuration.destroy\n respond_to do |format|\n format.html { redirect_to system_configurations_url, notice: \"System configuration was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2f6f57031dbc16815e7efd40f35063d1",
"score": "0.64812",
"text": "def destroy\n @config = Config.find(params[:id])\n @config.destroy\n \n respond_to do |format|\n format.html { redirect_to configs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7fcf5d00b168577139151ca6b23165f6",
"score": "0.6474237",
"text": "def destroy\n @test_configuration.update_attribute('status',4)\n respond_to do |format|\n format.html { redirect_to test_configurations_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ab8f2cf6b6bbe20ccbc0de5339981070",
"score": "0.64709026",
"text": "def destroy\n if @configuration_detail_type.destroy\n head :ok\n end\n end",
"title": ""
},
{
"docid": "26d7dd7a4bcffeee97a1178d5a0483df",
"score": "0.64689124",
"text": "def destroy\n @deployment_configuration = DeploymentConfiguration.find(params[:id])\n @deployment_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to deployment_configurations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f4f51ddb8740eba0dc27cb33ded83b65",
"score": "0.6468616",
"text": "def destroy\n @configure.destroy\n respond_to do |format|\n format.html { redirect_to configures_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f4f51ddb8740eba0dc27cb33ded83b65",
"score": "0.6468616",
"text": "def destroy\n @configure.destroy\n respond_to do |format|\n format.html { redirect_to configures_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d3d01e5f9753b870c0d0d77bfdeeda81",
"score": "0.6448369",
"text": "def destroy\n @config_file.destroy\n respond_to do |format|\n format.html { redirect_to config_files_url, notice: 'Configuração foi apagada com sucesso.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1cac335c27b9c469dd77fc8c0a280609",
"score": "0.64402735",
"text": "def destroy\n @admin_config.destroy\n respond_to do |format|\n format.html { redirect_to admin_configs_url, notice: 'Config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "98dcfbfbcb0654ea3a68b904ac84dd2f",
"score": "0.64215523",
"text": "def destroy\n @configuration_server = Cnf::Server.find(params[:id])\n @configuration_server.destroy\n\n respond_to do |format|\n format.html { redirect_to config_servers_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7d1a8e549f979442a0c9d6709bd368da",
"score": "0.64213353",
"text": "def destroy\n @device.destroy\n if File.exist?(Rails.root.to_s + \"/config/device_configs/device_#{@device.id}.json\")\n File.delete(Rails.root.to_s + \"/config/device_configs/device_#{@device.id}.json\") \n end\n\n respond_to do |format|\n format.html { redirect_to [@project, :devices], notice: 'Device was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5f2137b5730ce971b48de533d3a9db6e",
"score": "0.64077014",
"text": "def destroy\n @braid_config.destroy\n respond_to do |format|\n format.html { redirect_to braid_configs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f30c11e20ba83ecd10408d7783d0ab91",
"score": "0.6405421",
"text": "def destroy\n @admin_config.destroy\n respond_to do |format|\n format.html { redirect_to admin_configs_url, notice: t(:config_notice_destroyed) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "667aad4a41c22cd5e9a3b6e0239878f6",
"score": "0.6398783",
"text": "def destroy\n @config.destroy\n delete_svn_config_file @config\n @recordlog = @config\n respond_to do |format|\n format.html { redirect_to configs_url, notice: \"Config was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e73f9b130cd5cdfb8f6d3fcb8b37f282",
"score": "0.63973117",
"text": "def destroy\n @admin_banner_config.destroy\n respond_to do |format|\n format.html { redirect_to admin_banner_configs_url, notice: 'Banner config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a88b557141f68eb551cb5288ea59899c",
"score": "0.63887227",
"text": "def destroy\n @testconfig.destroy\n respond_to do |format|\n format.html { redirect_to testconfigs_url, notice: 'Config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bc1f6e8d639d3c53954b80e1a3cb0051",
"score": "0.63798964",
"text": "def destroy\n @am_module_configuration = AmModuleConfiguration.find(params[:id])\n @am_module_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to am_module_configurations_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "51ebeba3f20ad7da9fc5e65c4edcf6c9",
"score": "0.63752925",
"text": "def destroy\n @test_config.destroy\n respond_to do |format|\n format.html { redirect_to test_configs_url, notice: 'Test config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "224a83c61de1bfa748c11fbbdad3a273",
"score": "0.6365103",
"text": "def destroy\n @game_config.destroy\n respond_to do |format|\n format.html { redirect_to game_configs_url, notice: 'Game config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2dcb921ff3425940e05eb7d75a8835d0",
"score": "0.6361465",
"text": "def destroy\n @administrator_configuration.destroy\n respond_to do |format|\n format.html { redirect_to administrator_configurations_url, notice: 'La imagen del carrucel fue eliminada exitosamente' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e5540d8e613674054d4d505b49ea3d7b",
"score": "0.6354431",
"text": "def destroy\n @configuracion = Configuracion.find(params[:id])\n @configuracion.destroy\n\n respond_to do |format|\n format.html { redirect_to configuracions_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7600abe7aa426ab479b301466b07421b",
"score": "0.6351912",
"text": "def destroy\n\t\t@config.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to configs_url, notice: 'Config was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "7600abe7aa426ab479b301466b07421b",
"score": "0.6351912",
"text": "def destroy\n\t\t@config.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to configs_url, notice: 'Config was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "eb8191cf74cf393a87787e40f2476b47",
"score": "0.633761",
"text": "def delete_configuration\n super\n end",
"title": ""
},
{
"docid": "eb8191cf74cf393a87787e40f2476b47",
"score": "0.633761",
"text": "def delete_configuration\n super\n end",
"title": ""
},
{
"docid": "eb8191cf74cf393a87787e40f2476b47",
"score": "0.633761",
"text": "def delete_configuration\n super\n end",
"title": ""
},
{
"docid": "eb8191cf74cf393a87787e40f2476b47",
"score": "0.633761",
"text": "def delete_configuration\n super\n end",
"title": ""
},
{
"docid": "eb8191cf74cf393a87787e40f2476b47",
"score": "0.633761",
"text": "def delete_configuration\n super\n end",
"title": ""
},
{
"docid": "33ae3fbaabb68170de9f95477c22d5d1",
"score": "0.6330894",
"text": "def delete_json(path)\n retries = 0\n begin\n return resource(path).delete()\n rescue => e\n if e.kind_of?(RestClient::Exception) and e.http_code == 503 and retries < RETRY_503_MAX\n # the G5K REST API sometimes fail with error 503. In that case we should just wait and retry\n puts(\"G5KRest: DELETE #{path} failed with error 503, retrying after #{RETRY_503_SLEEP} seconds\")\n retries += 1\n sleep RETRY_503_SLEEP\n retry\n end\n handle_exception(e)\n end\n end",
"title": ""
},
{
"docid": "46ef36f15f2b9a98b243ea36319eff03",
"score": "0.63303715",
"text": "def destroy\n @customer_configuration.destroy\n respond_to do |format|\n format.html { redirect_to customer_configurations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "957cc988b91cae93741e9f670a998a74",
"score": "0.6329723",
"text": "def destroy\n @admin_site_config.destroy\n respond_to do |format|\n format.html { redirect_to admin_site_configs_url, notice: 'Site config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "957cc988b91cae93741e9f670a998a74",
"score": "0.6329723",
"text": "def destroy\n @admin_site_config.destroy\n respond_to do |format|\n format.html { redirect_to admin_site_configs_url, notice: 'Site config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b1a17c1ee1af05c79fe156622df44818",
"score": "0.632851",
"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": "f35ed2ca1924458cf52e3b925a4e77b4",
"score": "0.632521",
"text": "def delete_all_configurations\n super\n end",
"title": ""
},
{
"docid": "f35ed2ca1924458cf52e3b925a4e77b4",
"score": "0.632521",
"text": "def delete_all_configurations\n super\n end",
"title": ""
},
{
"docid": "f35ed2ca1924458cf52e3b925a4e77b4",
"score": "0.632521",
"text": "def delete_all_configurations\n super\n end",
"title": ""
},
{
"docid": "f35ed2ca1924458cf52e3b925a4e77b4",
"score": "0.632521",
"text": "def delete_all_configurations\n super\n end",
"title": ""
},
{
"docid": "a24369ade1e32b3891073e69b7fa2a11",
"score": "0.6319979",
"text": "def destroy\n @pims_config.destroy\n respond_to do |format|\n format.html { redirect_to pims_configs_url, notice: 'Pims config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "81b0e2910eef341077f162fe315c195b",
"score": "0.63169974",
"text": "def destroy\n @data_config = DataConfig.find(params[:id])\n @data_config.destroy\n\n respond_to do |format|\n format.html { redirect_to :back } #data_configs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fa5b5877e7d77d90fc3be8e242201ede",
"score": "0.6316135",
"text": "def destroy\n @config_vehi.destroy\n respond_to do |format|\n format.html { redirect_to config_vehis_url, notice: 'Config vehi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d3f737cb54fd2816fbeea01b3c8adddf",
"score": "0.6305905",
"text": "def destroy\n @store_configuration = StoreConfiguration.find(params[:id])\n @store_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to store_configurations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e018490464ebd8afab4882c01038d4e1",
"score": "0.6303769",
"text": "def destroy\n @configline.destroy\n respond_to do |format|\n format.html { redirect_to configlines_url, notice: 'Configline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fe4bb91827f9980137315a7717a73b31",
"score": "0.6300036",
"text": "def destroy\n @calculation_config.destroy\n respond_to do |format|\n format.html { redirect_to calculation_configs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3bd97d16fb0f21f5ad4aab7d45e82cda",
"score": "0.63000077",
"text": "def destroy\n @config_pack = ConfigPack.find(params[:id])\n @config_pack.destroy\n\n respond_to do |format|\n format.html { redirect_to config_packs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "edc3a4f1e548513d8a4afb4a69978550",
"score": "0.62986565",
"text": "def destroy\n @switch_initial_config.destroy\n respond_to do |format|\n format.html { redirect_to switch_initial_configs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b0fd6e2a680d5b8c0803001aff7783c6",
"score": "0.6296315",
"text": "def destroy\n if @cluster_configuration.specifier != nil\n @cluster_configuration.delete_template\n end\n @cluster_configuration.destroy\n respond_to do |format|\n format.html { redirect_to cluster_configurations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2426889bf5c36f7035aa82a21fa4db83",
"score": "0.6295573",
"text": "def destroy\n @broker_configuration = BrokerConfiguration.find(params[:id])\n @broker_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to broker_configurations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "338b2104294cc41d0eabb83f5bef6da6",
"score": "0.6294866",
"text": "def destroy\n @analytic_instance_config.destroy\n respond_to do |format|\n format.html { redirect_to analytic_instance_configs_url, notice: 'Analytic instance config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "06450f9ac9687f40bbbe51056d31b993",
"score": "0.62674594",
"text": "def destroy\n @seguridad_configuracion = Seguridad::Configuracion.find(params[:id])\n @seguridad_configuracion.destroy\n\n respond_to do |format|\n format.html { redirect_to seguridad_configuracions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "61777f0c9a0fdffe17d07a9ae6242d1f",
"score": "0.62674344",
"text": "def destroy\r\n @conf = Conf.find(params[:id])\r\n @conf.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(confs_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"title": ""
},
{
"docid": "79d4c002317dd1da10925f8f73044a06",
"score": "0.6259569",
"text": "def destroy\n @configuration = Configuration.find(params[:id])\n @configuration.destroy\n\n respond_to do |format|\n flash[:notice] = \"Configuration was successfully destroyed\"\n format.html { redirect_to(configurations_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "b8b48d1c46fa284a616357dff308c923",
"score": "0.6246965",
"text": "def destroy\n @user_config = UserConfig.find(params[:id])\n @user_config.destroy\n\n respond_to do |format|\n format.html { redirect_to user_configs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f2543716692231f3ca4a47e24492a546",
"score": "0.6238969",
"text": "def destroy\n @supply_food_configuration.destroy\n respond_to do |format|\n format.html { redirect_to supply_food_configurations_url, notice: 'Supply food configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5fbb183a8dcd0536debfb6d9341c5253",
"score": "0.6237164",
"text": "def destroy\n @config_setting.destroy\n respond_to do |format|\n format.html { redirect_to config_settings_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5610dd3e3d440b13dac97e1b0f17e76e",
"score": "0.6235393",
"text": "def destroy\n @grade_config.destroy\n respond_to do |format|\n format.html { redirect_to grade_configs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a57e424602977a554fb1ae650fef2262",
"score": "0.62345326",
"text": "def destroy\n @adapter_configuration = AdapterConfiguration.find(params[:id])\n @adapter_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to adapter_configurations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ce43fa5d99cd1713b6ef84f6d3223d26",
"score": "0.622797",
"text": "def destroy\n @configuracion.destroy\n respond_to do |format|\n format.html { redirect_to configuracions_url, notice: 'Configuracion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bdd127dba9051ef97bcba47160e4d957",
"score": "0.6223821",
"text": "def destroy\n @database_config = DatabaseConfig.find(params[:id])\n @database_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(database_configs_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "fdae54fd8ee0e8be8fe5194726162078",
"score": "0.6222046",
"text": "def destroy\n @field_config = FieldConfig.find(params[:id])\n @field_config.destroy\n\n respond_to do |format|\n format.html { redirect_to field_configs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "73f5dc0c7e26681ab0003302fff565d8",
"score": "0.6220486",
"text": "def destroy\n @auction_configuration.destroy\n respond_to do |format|\n format.html { redirect_to auction_configurations_url, notice: 'Auction configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c24ebafaed6e657ec91de5e99e37cc96",
"score": "0.62182796",
"text": "def destroy\n @table_config.destroy\n respond_to do |format|\n format.html { redirect_to table_configs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f7825f2676ad4c85fd0d8beaefb43058",
"score": "0.61990416",
"text": "def destroy\n @user_conf = UserConf.find(params[:id])\n @user_conf.destroy\n\n respond_to do |format|\n format.html { redirect_to user_confs_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "41590704c6b46c6752bcf5e79cc043d6",
"score": "0.61853826",
"text": "def destroy\n @params_config.destroy\n respond_to do |format|\n format.html { redirect_to params_configs_url, notice: 'Params config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aa4b2d9b87ad20cadfa765d9faf7e32a",
"score": "0.617685",
"text": "def destroy\n @hr_config_initial.destroy\n respond_to do |format|\n format.html { redirect_to hr_config_initials_url, notice: 'Initial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6aeef463763d991155b0991076477468",
"score": "0.61751467",
"text": "def destroy\n @auth_config = AuthConfig.find(params[:id])\n @auth_config.destroy\n\n respond_to do |format|\n format.html { redirect_to auth_configs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5e9d618a95d6f1ae3517bcf29cce0fe2",
"score": "0.61735547",
"text": "def destroy\n @configuration_file = ConfigurationFile.find(params[:id])\n @configuration_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(configuration_files_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "49f78e71e98889319e90f7327b013271",
"score": "0.61723024",
"text": "def delete(key)\n configuration.delete(key)\n end",
"title": ""
},
{
"docid": "49f78e71e98889319e90f7327b013271",
"score": "0.61723024",
"text": "def delete(key)\n configuration.delete(key)\n end",
"title": ""
},
{
"docid": "49f78e71e98889319e90f7327b013271",
"score": "0.61723024",
"text": "def delete(key)\n configuration.delete(key)\n end",
"title": ""
},
{
"docid": "6aaac5a9e2153a21be6b55491d8cba0c",
"score": "0.617224",
"text": "def action_delete\n config_file.run_action(:delete)\n new_resource.created = false\n end",
"title": ""
},
{
"docid": "b9d3acfd3a569c1a8dfb36b789a016ca",
"score": "0.61686134",
"text": "def destroy\n @store_configuration.destroy\n respond_to do |format|\n format.html { redirect_to store_configurations_url, notice: 'Store configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2a90772e54559ea454a88229a498756d",
"score": "0.61672723",
"text": "def destroy\n @risk_configuration = RiskConfiguration.find(params[:id])\n @risk_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to(risk_configurations_url) }\n format.json { head :ok }\n end\n end",
"title": ""
}
] |
ab13daee93b33519efa7f6181a9f5308 | Get the canonic type name, for type comparison. | [
{
"docid": "65dca294ddafb98a174ca54726299117",
"score": "0.82153815",
"text": "def canonic_type\n t = type.to_s.downcase.to_sym\n CANONIC_TYPES[ t ] || t\n end",
"title": ""
}
] | [
{
"docid": "0fc5c930754903b194097657314a72cd",
"score": "0.7761256",
"text": "def readable_type_name(type)\n return TYPE_MAPPING.fetch(type, type)\n end",
"title": ""
},
{
"docid": "66b76296f234eb7aca36146b211cb10b",
"score": "0.7651721",
"text": "def type_name\n @type_name ||= name.underscore\n end",
"title": ""
},
{
"docid": "73f69386a9aeabaa666f637b31e2c22b",
"score": "0.7601751",
"text": "def type_name\n @type_name ||= StringHelpers.underscore(StringHelpers.demodulize(@value.class.name)).to_sym\n end",
"title": ""
},
{
"docid": "39ee6d2cd586ee6b1554c980811d5a8f",
"score": "0.75507283",
"text": "def name\n @type_name\n end",
"title": ""
},
{
"docid": "38f1a906bc82bdefe2eded46cc1cc5e8",
"score": "0.738525",
"text": "def type_name\n @type_name ||= determine_type_name(descriptor)\n end",
"title": ""
},
{
"docid": "a067ece7b1eeade584bb72c23e16be23",
"score": "0.73349047",
"text": "def type_str\n Types.type_str(type)\n end",
"title": ""
},
{
"docid": "a13a1f313a4168d4ddf63ae713c9dd24",
"score": "0.7333108",
"text": "def type_name\n @type_name ||= self.name.demodulize.underscore\n end",
"title": ""
},
{
"docid": "b3f7fbd95c6db37bc29b6c03d1205921",
"score": "0.72897494",
"text": "def type_name(type)\n case type\n when 'i'\n return _INTL('int')\n when 'b'\n return _INTL('bool')\n when 'f'\n return _INTL('float')\n when 's'\n return _INTL('str')\n else\n return _INTL('arg')\n end\n end",
"title": ""
},
{
"docid": "f0f3946dcf12ea723d324b8ce9a06250",
"score": "0.72184193",
"text": "def get_type_name\n\t\treturn campaign_type.type_name\n\tend",
"title": ""
},
{
"docid": "596579f97120a78ac3be4d3c63c44440",
"score": "0.71745",
"text": "def type_name\n self['type_name']\n end",
"title": ""
},
{
"docid": "f49e1f24f250e0672e0f4f162a33e08c",
"score": "0.7091434",
"text": "def type_name; end",
"title": ""
},
{
"docid": "f49e1f24f250e0672e0f4f162a33e08c",
"score": "0.7091434",
"text": "def type_name; end",
"title": ""
},
{
"docid": "f49e1f24f250e0672e0f4f162a33e08c",
"score": "0.7091434",
"text": "def type_name; end",
"title": ""
},
{
"docid": "f49e1f24f250e0672e0f4f162a33e08c",
"score": "0.7091434",
"text": "def type_name; end",
"title": ""
},
{
"docid": "f49e1f24f250e0672e0f4f162a33e08c",
"score": "0.7091434",
"text": "def type_name; end",
"title": ""
},
{
"docid": "f49e1f24f250e0672e0f4f162a33e08c",
"score": "0.7091434",
"text": "def type_name; end",
"title": ""
},
{
"docid": "f49e1f24f250e0672e0f4f162a33e08c",
"score": "0.7091434",
"text": "def type_name; end",
"title": ""
},
{
"docid": "f49e1f24f250e0672e0f4f162a33e08c",
"score": "0.7091434",
"text": "def type_name; end",
"title": ""
},
{
"docid": "f49e1f24f250e0672e0f4f162a33e08c",
"score": "0.7091434",
"text": "def type_name; end",
"title": ""
},
{
"docid": "f49e1f24f250e0672e0f4f162a33e08c",
"score": "0.7091434",
"text": "def type_name; end",
"title": ""
},
{
"docid": "f49e1f24f250e0672e0f4f162a33e08c",
"score": "0.7091434",
"text": "def type_name; end",
"title": ""
},
{
"docid": "f49e1f24f250e0672e0f4f162a33e08c",
"score": "0.7091434",
"text": "def type_name; end",
"title": ""
},
{
"docid": "f49e1f24f250e0672e0f4f162a33e08c",
"score": "0.7091434",
"text": "def type_name; end",
"title": ""
},
{
"docid": "f49e1f24f250e0672e0f4f162a33e08c",
"score": "0.7091434",
"text": "def type_name; end",
"title": ""
},
{
"docid": "f49e1f24f250e0672e0f4f162a33e08c",
"score": "0.7091434",
"text": "def type_name; end",
"title": ""
},
{
"docid": "72b85e6e595b9eaeadf10bd2bd2b2b9a",
"score": "0.70798904",
"text": "def name\n name = '(' << @types.map{|e| e.name }.join('|') << ')'\n name\n end",
"title": ""
},
{
"docid": "88148531d714f9a3f9cdb91fcf8966a5",
"score": "0.70623106",
"text": "def type_name\n @values['typeName']\n end",
"title": ""
},
{
"docid": "5ba859a470cb636c7c1118695cac2392",
"score": "0.705979",
"text": "def name\n type.to_s.capitalize\n end",
"title": ""
},
{
"docid": "584a8f364dabfbd28f808ad7752c9e98",
"score": "0.70197886",
"text": "def type_str\n self.class.const_get(:TYPE_STR)\n end",
"title": ""
},
{
"docid": "d35e85850a670547f5778b14c73bb428",
"score": "0.6968899",
"text": "def type_name\n self.class.name.split('::').last.upcase\n end",
"title": ""
},
{
"docid": "55221dc9a568770bd94eefbcd8d1b0dd",
"score": "0.6887019",
"text": "def type_to_s\n self.class.to_s.split(':').last.downcase\n end",
"title": ""
},
{
"docid": "399273e078d4565f03002d737bd49c70",
"score": "0.68825805",
"text": "def type\n @type.name\n end",
"title": ""
},
{
"docid": "4c64cd0067247fdd24c4c990d08f8158",
"score": "0.6880526",
"text": "def readable_name\n \"(#{@type}) #{@name}\"\n end",
"title": ""
},
{
"docid": "b9eca8e90242e8344c610a7202638be6",
"score": "0.68726265",
"text": "def type_label\n @type.underscore.humanize.titleize\n end",
"title": ""
},
{
"docid": "b9eca8e90242e8344c610a7202638be6",
"score": "0.68726265",
"text": "def type_label\n @type.underscore.humanize.titleize\n end",
"title": ""
},
{
"docid": "a794d6b203b486912d4956501565aa00",
"score": "0.68678063",
"text": "def type\n @type.to_s\n end",
"title": ""
},
{
"docid": "2e183d06bbb70340bf0588c4fdfcdb4c",
"score": "0.6865892",
"text": "def type_name( type )\n @type_name_cache[type] ||= begin\n type = \"\" if type.nil?\n type = $1 if type =~ /^(.*?)\\(/\n type.upcase\n end\n end",
"title": ""
},
{
"docid": "4458922927316b3c398d35bf9f52b8f4",
"score": "0.6823651",
"text": "def get_type(type)\n TYPES[type.downcase]\n end",
"title": ""
},
{
"docid": "831cf6de87d17b25e62003ed7d644767",
"score": "0.67791754",
"text": "def type\n self.class.to_s.downcase\n end",
"title": ""
},
{
"docid": "61528caba1ddc05ea8c6d8484271322e",
"score": "0.6769606",
"text": "def compute_type(type_name)\n type_name.constantize\n end",
"title": ""
},
{
"docid": "1020a400af3fce73bf769a06eb670b0c",
"score": "0.6769405",
"text": "def human_type\n Core::TYPES_DESC[type]\n end",
"title": ""
},
{
"docid": "e1165829fc669f0e2204dfa2d5400940",
"score": "0.6757475",
"text": "def get_type_name(type)\n type_name = TypeName.new get_class_name(type), get_class_module_path(type), get_class_file_name(type), get_class_file_path(type)\n type_name.parent = make_parents get_class_module_path(type)\n type_name\n end",
"title": ""
},
{
"docid": "9332acaeeec4c3f4af6abaaeda147917",
"score": "0.67414206",
"text": "def get_type_name\n @@TYPE_ENUM.keys.each do |kkk|\n if @@TYPE_ENUM[kkk] == self.transaction_type\n return kkk\n end\n end\n return nil\n end",
"title": ""
},
{
"docid": "32fce471e566e63e2dac679cd9cbd51d",
"score": "0.67246383",
"text": "def cstype(generic_type)\n CS_TYPES[generic_type] || camelcasetype(generic_type)\nend",
"title": ""
},
{
"docid": "abfdd021ab9d59289977286cc8b936d6",
"score": "0.6716265",
"text": "def type\n self.class.class_name.downcase\n end",
"title": ""
},
{
"docid": "96cfcc067df00932519f9ef8e931f242",
"score": "0.6695658",
"text": "def input_name_from_type(type); end",
"title": ""
},
{
"docid": "257de99d5ce9edfff83915b02653dda8",
"score": "0.6674338",
"text": "def type\n self.class.name.split(':').last.downcase\n end",
"title": ""
},
{
"docid": "062ce566116b98ed53e7b53db1cdc2d5",
"score": "0.6625149",
"text": "def to_s\n TYPES[type.to_sym]\n end",
"title": ""
},
{
"docid": "7ceebcc1dfc231e0a7558165f833efc9",
"score": "0.6604234",
"text": "def type\n self.class.name.downcase\n end",
"title": ""
},
{
"docid": "a206763b15015dfc5ae04af6c788b541",
"score": "0.65855217",
"text": "def type\n Type.new(type_param).yard_type_string\n end",
"title": ""
},
{
"docid": "6acd12ee4103fd5e3d4ceee4331e7192",
"score": "0.658007",
"text": "def type_name\n TYPE_NAMES[self.question_type]\n end",
"title": ""
},
{
"docid": "db46bfb7ab7e2ed437838db6be21c449",
"score": "0.65787077",
"text": "def my_type(type)\n case type\n when /bond/i\n \"Bonds\"\n when /stock/i\n \"Stocks\"\n when /alternative/i\n \"Alternatives\"\n else\n \"Unclassified\"\n end\n end",
"title": ""
},
{
"docid": "ecfa0ca7c18c6ebe70899383fbda2fb6",
"score": "0.65480703",
"text": "def type\n _type.split(\"::\").last.downcase\n end",
"title": ""
},
{
"docid": "304097075fe9875a5433de7736dfe10d",
"score": "0.6538933",
"text": "def type\n self.class.to_s.split('::').last.downcase.to_sym\n end",
"title": ""
},
{
"docid": "a2b3be18fb980b0ad0a184e7f987bd40",
"score": "0.6524523",
"text": "def type_as_symbol\n underscore(self.type).intern\n end",
"title": ""
},
{
"docid": "ec4bcefd398eeb29a94595047f0fd819",
"score": "0.6521304",
"text": "def type_key\n type.demodulize.underscore\n end",
"title": ""
},
{
"docid": "feea96c5186250a45c5dc28a06affad9",
"score": "0.65157986",
"text": "def type_name\n File.basename(@path, '.rb').to_sym\n end",
"title": ""
},
{
"docid": "078bcbb1aaab633eabe125bdb23c8b7c",
"score": "0.65015817",
"text": "def caprese_type\n self.name.underscore\n end",
"title": ""
},
{
"docid": "31e8ce30fe3f338cd75aac3c622324c8",
"score": "0.6500792",
"text": "def type\n self_class.to_s.to_sym\n end",
"title": ""
},
{
"docid": "bf692fb330122fcea31df96c94295877",
"score": "0.6497374",
"text": "def name\n [cc_type, last_digits].join(' - ')\n end",
"title": ""
},
{
"docid": "7cf410f539f46fb02981165c94b12c6e",
"score": "0.64972275",
"text": "def type\n self.class.type_to_string(self)\n end",
"title": ""
},
{
"docid": "03fda4e6ab8ef126d4b2906e1934cfb7",
"score": "0.64751184",
"text": "def yard_type_string\n if association?(ast)\n yard_type_from_association(ast)\n elsif collection?(ast)\n yard_type_from_collection(ast)\n elsif ast.ref?\n yard_type_from_reference(ast)\n elsif !ast[0].nil?\n Type.new(ast[0]).yard_type_string\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "a96ef5e6e67a08e87955acbaa578fce9",
"score": "0.6453672",
"text": "def type_name\n MESSAGE_TYPE[self.type_id-1][0]\n end",
"title": ""
},
{
"docid": "4032df354aff56fa802b491cfe613316",
"score": "0.6443202",
"text": "def type_code\n type.try(:code)\n end",
"title": ""
},
{
"docid": "c4f33fdd7d8c3f016e533865f6d5895b",
"score": "0.6407867",
"text": "def get_category_type_name\n category_type ? category_type.short_name : '?'\n end",
"title": ""
},
{
"docid": "5dbbb54e18152d5075905176dc65d484",
"score": "0.6393174",
"text": "def human_type\n self[:type].to_human\n end",
"title": ""
},
{
"docid": "0ef803da60197833c0082f44e02debce",
"score": "0.6386054",
"text": "def type\n name = self.class.name.split('::').last\n return '<type>' if name == 'Record'\n name\n end",
"title": ""
},
{
"docid": "c964544d444a4ad7fd53b3e5cb38c2f7",
"score": "0.6380904",
"text": "def type\n return @type if @type != \"unknown\"\n info\n @type\n end",
"title": ""
},
{
"docid": "19f5e219d6717ca5fbdc816cd60d0d39",
"score": "0.63754404",
"text": "def to_type_name(name, namespace = '')\n return namespace + to_type_name(name) unless namespace.blank?\n name = name.to_s\n name = name.camelize(:upper) if Rails.config.camel_case\n name = name.gsub(/\\W/, '_')\n name\n end",
"title": ""
},
{
"docid": "111dc469067669735e8b6324e8c00ddc",
"score": "0.63698626",
"text": "def class_name\n (self.type.to_s || self.class.name).demodulize\n end",
"title": ""
},
{
"docid": "3b07c0e33ea26c08ad5f58e7067b044a",
"score": "0.63632524",
"text": "def type_value\n master_class.base_class.name if polymorphic_type\n end",
"title": ""
},
{
"docid": "422e61e84c9ec9dfe830c87b4a18a251",
"score": "0.6362941",
"text": "def get_coerce_type_symbol( typ )\n \n case typ\n\n when Symbol then typ\n\n when Class\n\n base_name = typ.to_s.split( /::/ )[ -1 ] # Get last name part\n str =\n base_name.gsub( /(^[A-Z])|([A-Z])/ ) do |m| \n ( $2 ? \"_\" : \"\" ) + m.downcase \n end\n\n str.to_sym\n \n else raise \"Unexpected coerce type indicator: #{typ}\"\n end\n end",
"title": ""
},
{
"docid": "27b8580b5909b8e6c998b4afc5d24c29",
"score": "0.6359768",
"text": "def to_s\n type\n end",
"title": ""
},
{
"docid": "cfa18947ca1c7a119312d4e68231d632",
"score": "0.6352504",
"text": "def kind\n type.to_s.underscore[5..-1]\n end",
"title": ""
},
{
"docid": "aa04b560fdc3e35f1544331c6aa84fb5",
"score": "0.63523495",
"text": "def type_c\n @type_c ||= type[1]\n end",
"title": ""
},
{
"docid": "5de1077fc68daa70751b4d9eec324c6d",
"score": "0.6342919",
"text": "def get_type\n\n end",
"title": ""
},
{
"docid": "ea686e939847c5c4af4f6b1135c7846e",
"score": "0.63394433",
"text": "def typeName\n case ftype\n when FTYPE_TEST\n return 'test'\n when FTYPE_SHEET\n return 'mathsheet'\n else # \n return 'generic'\n end\n end",
"title": ""
},
{
"docid": "c9dda83d31659cdabf80aed52f7b7fd9",
"score": "0.6327141",
"text": "def name()\n utype\n end",
"title": ""
},
{
"docid": "cfb517f26c43e63ac1bec6e5c1b93658",
"score": "0.6325793",
"text": "def getTypeName(var)\r\n if (var.vtype != nil)\r\n return @langProfile.getTypeName(var.vtype)\r\n else\r\n return CodeNameStyling.getStyled(var.utype, @langProfile.classNameStyle)\r\n end\r\n end",
"title": ""
},
{
"docid": "0dcef2e61201630631cbea420e66f1e3",
"score": "0.6314137",
"text": "def type\n TYPES[@type_id]\n end",
"title": ""
},
{
"docid": "f801a8fe3129c032e6734afb77b3907d",
"score": "0.63073003",
"text": "def type\n @type ||= \"#{as}_type\" if polymorphic?\n end",
"title": ""
},
{
"docid": "07b247614ed6bdbd85f268b022692b98",
"score": "0.62880176",
"text": "def name_with_type\n\t\t\"#{type}: #{name}\"\n\tend",
"title": ""
},
{
"docid": "c23584deec466777c48e796bd215307e",
"score": "0.6254688",
"text": "def type\n read_attr :type, :to_sym\n end",
"title": ""
},
{
"docid": "f765fe723850522595fe6f804859d277",
"score": "0.6254426",
"text": "def type\n self.class.name.split(/#{NSEP}/).last.gsub(/Object$/, '').downcase.to_sym\n end",
"title": ""
},
{
"docid": "029e1a81bdd31c09163a8884fe8aacf3",
"score": "0.62517494",
"text": "def type_name\n activity_types(true)[self.activity_type]\n end",
"title": ""
},
{
"docid": "9ce05a372aab789267fecd4b044f24f2",
"score": "0.62492543",
"text": "def type\n obj_name = self.class.name.split('::').last\n obj_name.gsub!(/Object$/, '')\n obj_name.downcase!\n obj_name.to_sym\n end",
"title": ""
},
{
"docid": "254783427018cb129064a0d53a4097fa",
"score": "0.6243771",
"text": "def _type\n self.class.to_s\n end",
"title": ""
},
{
"docid": "16c3b32d75d9de2e25946b5868cf0467",
"score": "0.6233424",
"text": "def type_category_string\n result = \"Manifestation\"\n result = \"Score\" if is_a_score?\n result = \"Recording\" if is_a_recording?\n result = \"Media on Demand\" if is_a_sounzmedia?\n result\n end",
"title": ""
},
{
"docid": "40f98656d5b5f3fc475f0c8c691c09de",
"score": "0.62287855",
"text": "def to_s\n\t\treturn @type.nom\n\tend",
"title": ""
},
{
"docid": "69dba37169963c1629992df1e2827f37",
"score": "0.6222502",
"text": "def type\n return nil if checktype.nil?\n checktype.name \n end",
"title": ""
},
{
"docid": "2bb600ce2764811706bfe1d20c3305c1",
"score": "0.6204929",
"text": "def [](qname)\n if qname.is_a?(Loader::TypedName)\n return nil unless qname.type == :type && qname.name_authority == @name_authority\n qname = qname.name\n end\n\n type = @types[qname] || @types[@dc_to_cc_map[qname.downcase]]\n if type.nil? && !@references.empty?\n segments = qname.split(TypeFormatter::NAME_SEGMENT_SEPARATOR)\n first = segments[0]\n type_set_ref = @references[first] || @references[@dc_to_cc_map[first.downcase]]\n if type_set_ref.nil?\n nil\n else\n type_set = type_set_ref.type_set\n case segments.size\n when 1\n type_set\n when 2\n type_set[segments[1]]\n else\n segments.shift\n type_set[segments.join(TypeFormatter::NAME_SEGMENT_SEPARATOR)]\n end\n end\n else\n type\n end\n end",
"title": ""
},
{
"docid": "6e8b3ee580d90d6f9b21ed5c53725627",
"score": "0.61881185",
"text": "def getTypeName(var)\n if (var.vtype == \"String\")\n if (var.arrayElemCount > 9999)\n return(\"TEXT\")\n else\n return(\"VARCHAR(\" + var.arrayElemCount.to_s + \")\")\n end\n else\n if (var.vtype == \"StringUNC16\")\n if (var.arrayElemCount > 9999)\n return(\"NTEXT\")\n else\n return(\"NVARCHAR(\" + var.arrayElemCount + \")\")\n end\n end\n end\n\n return @langProfile.getTypeName(var.vtype)\n end",
"title": ""
},
{
"docid": "511f3ad2a043d4bbb76ccba1b488be9b",
"score": "0.61872196",
"text": "def get_category_type_short_name\n category_type ? category_type.short_name : '?'\n end",
"title": ""
},
{
"docid": "862b6d5bb80d71c33e2ea7de757cdb76",
"score": "0.6168535",
"text": "def name\n self.class.name || self.class.to_s\n end",
"title": ""
},
{
"docid": "5e5d645ba24ff3e98a0829f937df836f",
"score": "0.61673373",
"text": "def type\n return @type if defined? @type\n\n @type = self.to_s.gsub(/.*::/, '')\n end",
"title": ""
},
{
"docid": "02cd142a29a4fff64bb7c63a6587ed9c",
"score": "0.61634946",
"text": "def type\n klass = self.class.name\n if sep = klass.rindex('::')\n klass[(sep+2)..-1]\n else\n klass\n end.underscore.to_sym\n end",
"title": ""
},
{
"docid": "129f4b7305f379956c7c7ae311b72801",
"score": "0.61583483",
"text": "def typedname include_type=false, include_ref=false\n return name unless include_type\n type_label =\n if include_ref && meaning\n \"#{meaning.model_name.human} ##{meaning.id}\"\n else\n typename\n end\n %Q{#{name} [#{type_label}]}\n end",
"title": ""
},
{
"docid": "4eff9278fdb9bfef7f406d9ed7d14117",
"score": "0.6136634",
"text": "def es_type_name\n self.name.pluralize.downcase\n end",
"title": ""
},
{
"docid": "36357898b31ec27606f7fce89f599c25",
"score": "0.61283094",
"text": "def vehicle_type_name\n return Vehicle::VEHICLE_TYPES_NAMES[self.vehicle_type]\n end",
"title": ""
},
{
"docid": "bb3e35599e37dd89d97f3f04461b0d34",
"score": "0.6126401",
"text": "def compute_type(type_name)\n type_name_with_module(type_name).split(\"::\").inject(Object) do |final_type, part| \n final_type = final_type.const_get(part)\n end\n end",
"title": ""
}
] |
aa30c52471e615993e886c7f13ae1ecc | DELETE /deals/1 DELETE /deals/1.json | [
{
"docid": "480457959003f480464d119f33482f4c",
"score": "0.6965093",
"text": "def destroy\n @deal = Deal.find(params[:id])\n @deal.destroy\n\n respond_to do |format|\n format.html { redirect_to deals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] | [
{
"docid": "c8dac8b47666fe727f4c94208d8ed6b5",
"score": "0.741138",
"text": "def destroy\n @deal = Deal.find(params[:id])\n @deal.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_deals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "dfa80f2d645b0058205424d807708a6e",
"score": "0.7288193",
"text": "def destroy\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "189efcd7cd5e877c8ae641016bdd0692",
"score": "0.7272368",
"text": "def destroy\n @meal.destroy\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "189efcd7cd5e877c8ae641016bdd0692",
"score": "0.7272368",
"text": "def destroy\n @meal.destroy\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "189efcd7cd5e877c8ae641016bdd0692",
"score": "0.7272368",
"text": "def destroy\n @meal.destroy\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "189efcd7cd5e877c8ae641016bdd0692",
"score": "0.7272368",
"text": "def destroy\n @meal.destroy\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "21b602d8137c9df0445fb4c7c0ae77a2",
"score": "0.7203884",
"text": "def destroy\n @meal = Meal.find(params[:id])\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "916b3061ea9efabebee360a738abd2c0",
"score": "0.7202434",
"text": "def destroy\n @meal = Meal.find(params[:id])\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "21bbaf88ef530ed3060af1a44c219cde",
"score": "0.71465594",
"text": "def destroy\n @meal = Meal.find(params[:id])\n @meal.destroy\n render json: {id: params[:id], msg: \"DELETED\"}\n end",
"title": ""
},
{
"docid": "5ad0cb8fe0989c089cf4aa28e6329517",
"score": "0.71426964",
"text": "def destroy\n @hold_deal.destroy\n respond_to do |format|\n format.html { redirect_to hold_deals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "be4325c5c38a4724281cc4147903c9eb",
"score": "0.7107",
"text": "def destroy\n if @meal.destroy\n head :no_content, status: 204\n else\n render json: @meal.errors, status: 405\n end\n end",
"title": ""
},
{
"docid": "8eeaece31cbce0b75078a4f6c829c62c",
"score": "0.7077742",
"text": "def destroy\n @apeal = Apeal.find(params[:id])\n @apeal.destroy\n\n respond_to do |format|\n format.html { redirect_to apeals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b1a17c1ee1af05c79fe156622df44818",
"score": "0.70703983",
"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": "535cf382725bd2684ecfbcd62726e607",
"score": "0.7059312",
"text": "def destroy\n if @item_meal.destroy\n head :no_content, status: 204\n else\n render json: @item_meal.errors, status: 405\n end\n end",
"title": ""
},
{
"docid": "437126e79024df479b971c7a9861b0e4",
"score": "0.7025399",
"text": "def destroy\n @deal = Deal.find(params[:id])\n @deal.destroy\n\n respond_to do |format|\n format.html { redirect_to business_deals_url(@business) }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "feb05fa712cede2232b7a79bf0cdeb56",
"score": "0.70174205",
"text": "def delete\n render json: Entry.delete(params[\"id\"])\n end",
"title": ""
},
{
"docid": "e9a5f3fd4d7e7b7e372cadae5048d0f3",
"score": "0.6989234",
"text": "def destroy\n @deal = Deal.find(params[:id])\n @deal.destroy\n\n respond_to do |format|\n format.html { redirect_to(deals_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e9a5f3fd4d7e7b7e372cadae5048d0f3",
"score": "0.6989234",
"text": "def destroy\n @deal = Deal.find(params[:id])\n @deal.destroy\n\n respond_to do |format|\n format.html { redirect_to(deals_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "da110daa39d95e2cbfbf30394bad89c8",
"score": "0.69877815",
"text": "def destroy\n @meal = Meal.find(params[:id])\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to(meals_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7388fc75dc03592611452bf8655b0baa",
"score": "0.6977248",
"text": "def destroy\n @meal = Meal.find(params[:id])\n @meal.destroy\n respond_to do |format|\n format.html { redirect_to meals_url, notice: 'Meal was successfully destroyed.', only_path: true }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6ec435f160d8c27cb469f82d606ff8a2",
"score": "0.69671035",
"text": "def destroy\n @meal.destroy\n respond_to do |format|\n format.html { redirect_to meals_url, notice: \"Meal was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8e21a659948b93c86bf3aa9306324fb9",
"score": "0.6966382",
"text": "def destroy\n @my_meal.destroy\n respond_to do |format|\n format.html { redirect_to my_meals_url, notice: 'My meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6d028295a0f0d51ab6353e17f531263f",
"score": "0.6962123",
"text": "def destroy\n @meal.destroy\n respond_to do |format|\n format.html { redirect_to meals_url, notice: 'Meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6d028295a0f0d51ab6353e17f531263f",
"score": "0.6962123",
"text": "def destroy\n @meal.destroy\n respond_to do |format|\n format.html { redirect_to meals_url, notice: 'Meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "75a785bddc2252b3dfe08070dcb44399",
"score": "0.6946832",
"text": "def delete(args)\n if args[:json]\n post(args.merge(method: :delete))\n else\n get(args.merge(method: :delete))\n end\n end",
"title": ""
},
{
"docid": "57e4aae856609f2178f6d0cf729f5c7b",
"score": "0.6943117",
"text": "def destroy\n @meal.destroy\n respond_to do |format|\n format.html { redirect_to meals_path, notice: 'Meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b445c184893647d3482f8fbc6a507a52",
"score": "0.693827",
"text": "def delete(path, params = {})\n path += '.json'\n res = @connection.delete(path, @header)\n parse_response(res)\n end",
"title": ""
},
{
"docid": "76fcfdc7ce61e2cfe29c2b2ab41a495e",
"score": "0.69302404",
"text": "def destroy\n @driver_meal.destroy\n respond_to do |format|\n format.html { redirect_to driver_meals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c1ffc37b2fc26df4f8def136991baf4e",
"score": "0.69247764",
"text": "def destroy\r\n @daily_deal = DailyDeal.find(params[:id])\r\n @daily_deal.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to daily_deals_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"title": ""
},
{
"docid": "4867ae91c02fb38a069577e3f05712a6",
"score": "0.6913713",
"text": "def destroy\n @dude = Dude.find(params[:id])\n @dude.destroy\n\n respond_to do |format|\n format.html { redirect_to dudes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e46da2bfb7d99a17f28e2e83e509a300",
"score": "0.69136447",
"text": "def destroy\n @meal.destroy\n respond_to do |format|\n format.html { redirect_to meals_url, notice: 'Le repas a bien été supprimé.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "12b1ab38a844db8a10e30907d2fca1b8",
"score": "0.6912346",
"text": "def destroy\n @meal.destroy!\n respond_to do |format|\n format.html { redirect_to meals_url, notice: \"Meal was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d3853e0625a72efac995561e0b5eede7",
"score": "0.6884887",
"text": "def destroy\n @create_meal.destroy\n respond_to do |format|\n format.html { redirect_to create_meals_url, notice: 'Create meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0e1ac9b51f04ac07f1e1629e8d683c36",
"score": "0.68810195",
"text": "def destroy\n @list_of_deal = ListOfDeal.find(params[:id])\n @list_of_deal.destroy\n\n respond_to do |format|\n format.html { redirect_to list_of_deals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "47de889ff7d75721b35546a9c6489913",
"score": "0.6868422",
"text": "def destroy\n @deal = Deal.find(params[:id])\n @deal.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_deals_path }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "1ba444b61e4eca0a8566cd8d772d2a7c",
"score": "0.68544084",
"text": "def destroy\n @component_meal.destroy\n respond_to do |format|\n format.html { redirect_to component_meals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d16c9655eb84e5df0d3a698585f3c3f0",
"score": "0.6852114",
"text": "def destroy\n meal = Meal.find(params[:id])\n meal.destroy\n render json: {message: \"#{meal.name} has been deleted.\"}\n end",
"title": ""
},
{
"docid": "5c181505ac0deedddfba684db419e428",
"score": "0.68489176",
"text": "def delete\n render json: Own.delete(params[\"id\"])\n end",
"title": ""
},
{
"docid": "9cb41ea1d83296521e5e25315d92948b",
"score": "0.68427247",
"text": "def destroy\n @salad.destroy\n respond_to do |format|\n format.html { redirect_to salads_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a164809602fa5b0525f56a4a63ca46c6",
"score": "0.6842308",
"text": "def destroy\n @deal.destroy\n respond_to do |format|\n format.html { redirect_to deals_url, notice: 'Deal was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "822ddea2e45bf78350003645efcbdb54",
"score": "0.68374187",
"text": "def delete uri, args = {}; Request.new(DELETE, uri, args).execute; end",
"title": ""
},
{
"docid": "c7e6543a4055391682a6ed4bb78a1b4f",
"score": "0.6817675",
"text": "def destroy\n @dealocity_deal = DealocityDeal.find(params[:id])\n @dealocity_deal.destroy\n\n respond_to do |format|\n format.html { redirect_to dealocity_deals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "341cf2721a26cc9601f872b7b99b56f9",
"score": "0.6814633",
"text": "def delete_meal(meal_id)\n delete(\"user/#{user_id}/meals/#{meal_id}.json\")\n end",
"title": ""
},
{
"docid": "608e5948fb1074e563b3a50800c6ac8b",
"score": "0.68120867",
"text": "def destroy\n @steal = Steal.find(params[:id])\n @steal.destroy\n\n respond_to do |format|\n format.html { redirect_to steals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0f4679e2de1f3680d6118fddf20717f9",
"score": "0.6811172",
"text": "def destroy\n @mandal = Mandal.find(params[:id])\n @mandal.destroy\n\n respond_to do |format|\n format.html { redirect_to mandals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c53a7ddfb5f66bdab62b1fc4305a0473",
"score": "0.68065655",
"text": "def delete *args\n make_request :delete, *args\n end",
"title": ""
},
{
"docid": "801ce71e01586dcd396138c7836d4a07",
"score": "0.68033725",
"text": "def destroy\n @drumy = Drumy.find(params[:id])\n @drumy.destroy\n\n respond_to do |format|\n format.html { redirect_to drumies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0a68c9e420cb3492de3e62ad83169ca0",
"score": "0.67946017",
"text": "def destroy\n @gupiao_deal = GupiaoDeal.find(params[:id])\n @gupiao_deal.destroy\n\n respond_to do |format|\n format.html { redirect_to gupiao_deals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6e08506514e546a9fdad6886f76a7da8",
"score": "0.67927134",
"text": "def destroy\n @addendum = Addendum.find(params[:id])\n @addendum.destroy\n\n respond_to do |format|\n format.html { redirect_to addendums_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5f265d4ec898e96fc96bddfb1cb14522",
"score": "0.678887",
"text": "def destroy\n @deal.destroy\n respond_to do |format|\n format.html { redirect_to team_deals_url(@team) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5ef68d930bcebd3655ec31316535395c",
"score": "0.6783601",
"text": "def destroy\n @deal = Deal.find_by_id(params[:id])\n @deal.deals_wizard.destroy if @deal.deals_wizard.present?\n @deal.target_rule.destroy if @deal.target_rule.present?\n @deal.destroy\n\n\n respond_to do |format|\n format.html { redirect_to deals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7452c4d15daf08108aaa5a1b728adb31",
"score": "0.6781676",
"text": "def destroy\n @json.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "4a5b5aa48e5d0330557d8401a8bddc4b",
"score": "0.67713916",
"text": "def destroy\n @deal_detail = DealDetail.find(params[:id])\n @deal_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to deal_details_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d181b1ecccd374bc9e2956491ee96062",
"score": "0.6766517",
"text": "def destroy\n @idea_deal = IdeaDeal.find(params[:id])\n @idea_deal.destroy\n\n respond_to do |format|\n format.html { redirect_to idea_deals_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "5b50eb023ecf8106c4dc9c7be2776ed6",
"score": "0.6760594",
"text": "def destroy\n @meal_record.destroy\n respond_to do |format|\n format.html { redirect_to meal_records_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "619f454f38cf2b82a8be429cf8a224a0",
"score": "0.6757114",
"text": "def destroy\n \tdeal = Deal.find(params[:id])\n deal.destroy\n respond_to do |format|\n format.html { redirect_to request.referer, notice: 'Deal was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e37859947bc0a41020e831cbd76e9023",
"score": "0.6752811",
"text": "def destroy\n @deal.destroy\n respond_to do |format|\n format.html { redirect_to deals_url, notice: 'Deal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e37859947bc0a41020e831cbd76e9023",
"score": "0.6752811",
"text": "def destroy\n @deal.destroy\n respond_to do |format|\n format.html { redirect_to deals_url, notice: 'Deal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e37859947bc0a41020e831cbd76e9023",
"score": "0.6752811",
"text": "def destroy\n @deal.destroy\n respond_to do |format|\n format.html { redirect_to deals_url, notice: 'Deal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e37859947bc0a41020e831cbd76e9023",
"score": "0.6752811",
"text": "def destroy\n @deal.destroy\n respond_to do |format|\n format.html { redirect_to deals_url, notice: 'Deal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "49eece02a642e6a07c6cb0e976f18a76",
"score": "0.6749464",
"text": "def destroy\n @meal.destroy\n respond_to do |format|\n format.html { redirect_to edit_diet_url(@meal.diet), :flash => { :success => \"Se ha eliminado la comida.\" } }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "06fef863c112a33f08dff857a712ea91",
"score": "0.67402387",
"text": "def destroy\n food = Food.find(params[:id])\n food.destroy\n head :no_content\n end",
"title": ""
},
{
"docid": "bacb7d80e0d5a1966e8da1d64f74e14a",
"score": "0.673056",
"text": "def destroy\n @tryal = Tryal.find(params[:id])\n @tryal.destroy\n\n respond_to do |format|\n format.html { redirect_to tryals_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ae399dd670c07323d09036b4594ea009",
"score": "0.6727926",
"text": "def destroy\n @detall = Detall.find(params[:id])\n @detall.destroy\n\n respond_to do |format|\n format.html { redirect_to detalls_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "61268d9564f877d2ed3714419c7af07b",
"score": "0.6725559",
"text": "def destroy\n @recital_ad.destroy\n\n respond_to do |format|\n format.html { redirect_to recital_ads_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cfea572d114948e2ea084b545c3be8cd",
"score": "0.6723148",
"text": "def destroy\n request = RestClient.delete File.join(API_SERVER,\"rest-api/departments\",params['id'])\n redirect_to :action => :index\t\n end",
"title": ""
},
{
"docid": "6fec0e4b0542ff34bb85cc22244e1fe4",
"score": "0.67204964",
"text": "def destroy\n @rental.destroy\n respond_to do |format|\n format.html { redirect_to rentals_url, notice: I18n.t('controller.rentals.destroy') }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "54b19377a50f23787bcf27ba2c9d509d",
"score": "0.67197",
"text": "def destroy\n @diary = Diary.find(params[:id])\n @diary.destroy\n\n respond_to do |format|\n format.html { redirect_to :action=>'index' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4342c53595d1e5bc0d2be94e6b0e56c7",
"score": "0.6717102",
"text": "def destroy\n @diary = Diary.find(params[:id])\n @diary.destroy\n\n respond_to do |format|\n format.html { redirect_to diaries_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d8893bcd8e00a094bb46c1a38c69c489",
"score": "0.6714888",
"text": "def destroy\n @ledger.destroy\n respond_to do |format|\n format.html { redirect_to ledgers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b321293acde53fd82c0374f37be8db98",
"score": "0.6712938",
"text": "def destroy\n @meal.destroy\n respond_to do |format|\n format.html { redirect_to meal_url, notice: 'meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9dba31566d0b3f8909a70c22eb973c22",
"score": "0.6710401",
"text": "def destroy\n @meal = Meal.find(params[:id],:conditions => [\"uid=?\",@uid])\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to(meals_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8693991288e64282e962b8998c066a90",
"score": "0.6706103",
"text": "def destroy\n @line_debt.destroy\n respond_to do |format|\n format.html { redirect_to line_debts_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3b3d290ef2f60e6ef73d3b4b440ebe89",
"score": "0.6705584",
"text": "def destroy\n @food_de = FoodDe.find(params[:id])\n @food_de.destroy\n\n respond_to do |format|\n format.html { redirect_to food_des_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "96e25f4766aea355b1d566c0aaa66bb1",
"score": "0.6705244",
"text": "def destroy\n @appeal = Appeal.find(params[:id])\n @appeal.destroy\n\n respond_to do |format|\n format.html { redirect_to(appeals_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "bdf25647b9ce3507eb81844bb9be893f",
"score": "0.67002255",
"text": "def destroy\n @alum = Alum.find(params[:id])\n @alum.destroy\n\n respond_to do |format|\n format.html { redirect_to alums_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9106867cee9e8775ba817195d3bc2020",
"score": "0.66996074",
"text": "def delete_rest(path) \n run_request(:DELETE, create_url(path)) \n end",
"title": ""
},
{
"docid": "0a651aadd3dd6399f2618a6b09427b7d",
"score": "0.6693693",
"text": "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0a651aadd3dd6399f2618a6b09427b7d",
"score": "0.6693693",
"text": "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f2f44bf6dd24c630c050257e6a3a0a9c",
"score": "0.66919625",
"text": "def destroy\n fetch_by_id\n singular.destroy\n head :no_content\n end",
"title": ""
},
{
"docid": "fe82513a2d2842f191e9b98fa175f5dd",
"score": "0.6690707",
"text": "def destroy\n @my_diamond.destroy\n respond_to do |format|\n format.html { redirect_to my_diamonds_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0598fec4a56368326391cfd6beabbd0d",
"score": "0.66884214",
"text": "def destroy\r\n\r\n @child.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to meals_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"title": ""
},
{
"docid": "f562b0a90fffa969926e3f6d7f4b4daf",
"score": "0.6682273",
"text": "def destroy\n @wholesaler = Wholesaler.find(params[:id])\n @wholesaler.destroy\n\n respond_to do |format|\n format.html { redirect_to wholesalers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cfa2373d4b4b26acae3b9bd393a0c323",
"score": "0.6678067",
"text": "def destroy\n @deposit.destroy\n respond_to do |format|\n format.html { redirect_to deposits_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ae0626ea3c4594f2fd6bfff81dafbc09",
"score": "0.66749626",
"text": "def destroy\n @itemholdon.destroy\n respond_to do |format|\n format.html { redirect_to itemholdons_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1087372d9005a11f4b326d3535ee99e9",
"score": "0.66700095",
"text": "def destroy\n @alcohol.destroy\n respond_to do |format|\n format.html { redirect_to alcohols_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9ce7ddf5d066fb17a696b6064ab5a83c",
"score": "0.66699433",
"text": "def destroy\n @alrt = Alrt.find(params[:id])\n @alrt.destroy\n\n respond_to do |format|\n format.html { redirect_to alrts_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9ce7ddf5d066fb17a696b6064ab5a83c",
"score": "0.66699433",
"text": "def destroy\n @alrt = Alrt.find(params[:id])\n @alrt.destroy\n\n respond_to do |format|\n format.html { redirect_to alrts_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "15ed3415f57779c7aaca0e388e4258af",
"score": "0.66698116",
"text": "def destroy\n @venue = Venue.find(params[:venue_id])\n @deal = @venue.deals.find(params[:id])\n @deal.destroy\n respond_to do |format|\n format.html { redirect_to venue_deals_path(@venue.id), notice: 'Deal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "92ac56a794bfd973253be2e85349f8e9",
"score": "0.6665183",
"text": "def destroy\n @single.destroy\n respond_to do |format|\n format.html { redirect_to singles_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "187033e7ee32247e040f3fd9681a31bc",
"score": "0.6659104",
"text": "def destroy\n @lease = Lease.find(params[:id])\n @lease.destroy\n\n respond_to do |format|\n format.html { redirect_to leases_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "187033e7ee32247e040f3fd9681a31bc",
"score": "0.6659104",
"text": "def destroy\n @lease = Lease.find(params[:id])\n @lease.destroy\n\n respond_to do |format|\n format.html { redirect_to leases_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cc8610d2752711fd5cca801ba4f3252a",
"score": "0.6658129",
"text": "def destroy\n @resturant = Resturant.find(params[:id])\n @resturant.destroy\n self.headers.merge!('Content-Type' => 'application/json' )\n self.response_body = {status: \"Deleted\"}\n end",
"title": ""
},
{
"docid": "94a71e3c04ff4abd826e24775290f8c3",
"score": "0.66564304",
"text": "def destroy\n @advertising = Advertising.find(params[:id])\n @advertising.destroy\n\n respond_to do |format|\n format.html { redirect_to advertisings_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "f0b282e8944d406d3ea5e0dc164ce40e",
"score": "0.6642986",
"text": "def destroy\n @lead = Lead.find(params[:id])\n @lead.delete\n\n respond_to do |format|\n format.html { redirect_to leads_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "457d8f40f9e5cf21d490632d357b6395",
"score": "0.6642173",
"text": "def destroy\n @lease.destroy\n respond_to do |format|\n format.html { redirect_to leases_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
f00a7644c50c339c865d249f953ebccc | DELETE /billing_infos/1 DELETE /billing_infos/1.xml | [
{
"docid": "6fbfb6194c9d84565f99bde01acd6aea",
"score": "0.7474267",
"text": "def destroy\n @billing_info = BillingInfo.find(params[:id])\n @billing_info.destroy\n\n respond_to do |format|\n format.html { redirect_to(billing_infos_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"title": ""
}
] | [
{
"docid": "fdcca1bbca199c6c90dca71de1fdb797",
"score": "0.72502524",
"text": "def destroy\n @billing_info = BillingInfo.find(params[:id])\n @billing_info.destroy\n\n respond_to do |format|\n format.html { redirect_to billing_infos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2de14183c25c52112d8f4d0b099faaff",
"score": "0.7150622",
"text": "def destroy\n @billing_info.destroy\n respond_to do |format|\n format.html { redirect_to billing_infos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f209ed00f05093390b88c2f03f791adb",
"score": "0.7080013",
"text": "def destroy\n @billing_entry = BillingEntry.find(params[:id])\n @billing_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(billing_entries_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "f023d58fe8a2bde26a7fee303f645eea",
"score": "0.7003516",
"text": "def destroy\n @payable_billing = PayableBilling.find(params[:id])\n @payable_billing.destroy\n\n respond_to do |format|\n format.html { redirect_to(payable_billings_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6ae174f3668304065f3ce53201cffa3b",
"score": "0.69592863",
"text": "def destroy\n @billing_info.destroy\n respond_to do |format|\n format.html { redirect_to select_plan_path }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "630e8ae152892212192b41717d8e3330",
"score": "0.68855083",
"text": "def destroy\n @billing_plan = BillingPlan.find(params[:id])\n @billing_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(billing_plans_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "cb425006006889e63c547c4328555d6e",
"score": "0.66665196",
"text": "def destroy\n @purchase_bill.destroy\n\n respond_to do |format|\n format.html { redirect_to(purchase_bills_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "49a94f10762c87ffe59743ee2a705912",
"score": "0.665663",
"text": "def destroy\n @bill = Bill.find(params[:id])\n @bill.deleted = 1\n @bill.save\n\n respond_to do |format|\n format.html { redirect_to(customer_path(@bill.customer)) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7ad4bf67965d010d9dc37e4e08ddb9c8",
"score": "0.6535688",
"text": "def destroy\n @billing_address = BillingAddress.find(params[:id])\n @billing_address.destroy\n\n respond_to do |format|\n format.html { redirect_to billing_addresses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "eac8c0e153a13179731fa701a89a87dc",
"score": "0.6511127",
"text": "def destroy\n #@bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to(bills_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "09a82df94f838294f27fad64a1140dab",
"score": "0.65074116",
"text": "def destroy\n @bill = Bill.find(params[:id])\n \n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to(bills_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "76ed9513a35a69cb09ee65e012b1f197",
"score": "0.64994276",
"text": "def destroy\n @az_bill = AzBill.find(params[:id])\n @az_bill.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_bills_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2e047289d20e551c8220479db328cc6a",
"score": "0.64643997",
"text": "def destroy\n @purchase_information = PurchaseInformation.find(params[:id])\n @purchase_information.destroy\n\n respond_to do |format|\n format.html { redirect_to(purchase_informations_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6e2e66280bb49383d116789aef7ed281",
"score": "0.64610785",
"text": "def destroy\n @billing.destroy\n respond_to do |format|\n format.html { redirect_to billings_url, notice: 'Billing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3bbe532f009f1a184b0c02732cbe4aaf",
"score": "0.6456707",
"text": "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"title": ""
},
{
"docid": "f2f611f4745f6c1b24abefb410909ceb",
"score": "0.64519787",
"text": "def destroy\n @billing.destroy\n respond_to do |format|\n format.html { redirect_to billings_url, notice: \"Billing was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "47ba5b93a9f1df23511ba7ee45e5f834",
"score": "0.64514273",
"text": "def destroy\n @customer_info = CustomerInfo.find(params[:id])\n @customer_info.destroy\n\n respond_to do |format|\n format.html { redirect_to(customer_infos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "f7c8cd5abd51998f6d1d3f45dcc77b49",
"score": "0.6417814",
"text": "def destroy\n @billitem = Billitem.find(params[:id])\n @billitem.destroy\n\n respond_to do |format|\n format.html { redirect_to(billitems_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2c5d96de7338782aec83b5cd08451f77",
"score": "0.6378447",
"text": "def destroy\r\n @invoice = Invoice.find(params[:id])\r\n @retail_plan = RetailPlan.find(@invoice.retail_plan_id)\r\n billing_site_id = @retail_plan.billing_site_id\r\n @invoice.destroy\r\n redirect_to billing_site_url(billing_site_id), notice: 'Invoice has been destroyed successfully !'\r\n end",
"title": ""
},
{
"docid": "69b205c158f7212cc750ed38fc878f1c",
"score": "0.6354196",
"text": "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"title": ""
},
{
"docid": "cd6b080f5b0b79861278cf6dee827565",
"score": "0.631469",
"text": "def destroy\n @billing_plan.destroy\n respond_to do |format|\n format.html { redirect_to billing_plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e19aea6ea08dd10d8638195cd5b9494d",
"score": "0.63103485",
"text": "def destroy\n @bill_detail_info.destroy\n respond_to do |format|\n format.html { redirect_to bill_detail_infos_url, notice: 'Bill detail info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "652aeef89bfc76acff7a25100c15c0d4",
"score": "0.62867785",
"text": "def destroy\n requires :customer_gateway_id\n \n service.delete_customer_gateway(customer_gateway_id)\n true\n end",
"title": ""
},
{
"docid": "fc76f709f7a9146f8c742aa9381f3e50",
"score": "0.6279709",
"text": "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "59fe290f348d9ac88298d9e5347d73a1",
"score": "0.6258736",
"text": "def destroy\n @reqinfo = Reqinfo.find(params[:id])\n @reqinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reqinfos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2d8764b1f2f25110816a17f73f497f0e",
"score": "0.62444913",
"text": "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"title": ""
},
{
"docid": "5951e2b8d88c17c5728b598b44a06d2c",
"score": "0.62368",
"text": "def destroy\n @shipping_detail = ShippingDetail.find(params[:id])\n @shipping_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(shipping_details_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "044651fc8cf731a7b6d818acaecd8f90",
"score": "0.62304306",
"text": "def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "76e5398af143fe39b500e5d64d70e7de",
"score": "0.6212584",
"text": "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to(bills_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "cc3bf21e77d56214ba6e5ba85227f355",
"score": "0.6209288",
"text": "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end",
"title": ""
},
{
"docid": "e1d6f603cb5ea1e475ea71422432aeae",
"score": "0.6186913",
"text": "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"title": ""
},
{
"docid": "9d379264177bca6e3e020b29d926490f",
"score": "0.61544764",
"text": "def destroy\n @bill = Bill.find(params[:bill_id])\n @billed_call = @bill.billed_calls.find(params[:id])\n @billed_call.destroy\n \n @bill.billed_taxes.each do |billed_tax|\n billed_tax.recalculate\n end\n #We have to save the flag here, other wise it woun't reflect when the landing page is loaded\n @bill.pending_flag = true\n @bill.save\n call_rake :regenerate_bill, :bill_id => params[:bill_id]\n flash[:notice] = 'Bill is being re-generated.'\n \n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c1592c9a7c989d01a99d8c2f4e789eab",
"score": "0.6152104",
"text": "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"title": ""
},
{
"docid": "0e933da9dcdf02c6c822b9292ffe1482",
"score": "0.6143068",
"text": "def destroy\n @customer_bill = CustomerBill.find(params[:id])\n @customer_bill.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_bills_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c48f8db109e3c5e864621546b7502c55",
"score": "0.6133696",
"text": "def destroy\n @az_invoice = AzInvoice.find(params[:id])\n @az_invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_invoices_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "21e1dc31ff54e8ff3328d7129be11f37",
"score": "0.6130471",
"text": "def destroy\n @shipping_cost = ShippingCost.find(params[:id])\n @shipping_cost.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_shipping_costs_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "f0c678163aad8eac39823cf0ade4faa3",
"score": "0.61272913",
"text": "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_purchases_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c084b83caf74560cb0831553eea0097f",
"score": "0.6113963",
"text": "def destroy\n @admin_bill_detail.destroy\n respond_to do |format|\n format.html { redirect_to admin_bill_details_url, notice: t(:bill_details_destroyed_success) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7a0b152c7ea48835af09962c8d058af2",
"score": "0.6111181",
"text": "def destroy\n @payment_information = PaymentInformation.find(params[:id])\n @payment_information.destroy\n\n respond_to do |format|\n format.html { redirect_to(payment_informations_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "38bdeac7c7a6ffb6e2c8052e1fceb583",
"score": "0.61071",
"text": "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to(purchase_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "59c9d97d9b0061460400a790b6444312",
"score": "0.6082543",
"text": "def destroy\n @bixo = Bixo.find(params[:id])\n @bixo.destroy\n\n respond_to do |format|\n format.html { redirect_to(bixos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8e8018b2fbfda0ef14de4e4d330bdea0",
"score": "0.60796076",
"text": "def destroy\n @bill = Bill.find(params[:id])\n offer = @bill.offer\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to(offer) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "37e5edd987d4b944ffa70623fe0dc2b2",
"score": "0.6066067",
"text": "def destroy\n @bp_request = BpRequest.find(params[:id])\n @bp_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(bp_requests_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e13c6b115404450ea23718256a23ee9e",
"score": "0.6060673",
"text": "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e13c6b115404450ea23718256a23ee9e",
"score": "0.6060673",
"text": "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e13c6b115404450ea23718256a23ee9e",
"score": "0.6060673",
"text": "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e13c6b115404450ea23718256a23ee9e",
"score": "0.6060673",
"text": "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e13c6b115404450ea23718256a23ee9e",
"score": "0.6060673",
"text": "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e8eb30a0416aa087718565c31a341437",
"score": "0.6052134",
"text": "def destroy\n @backup_check = BackupCheck.find(params[:id])\n internal_check = InternalCheck.find(params[:internal_check_id])\n @backup_check.destroy\n\n respond_to do |format|\n format.html { redirect_to internal_check }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "45a4681339f94a034fd50f354857d71c",
"score": "0.60474104",
"text": "def destroy\n @panel_billing = Panel::Billing.find(params[:id])\n @panel_billing.destroy\n\n respond_to do |format|\n format.html { redirect_to(panel_billings_url) }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "54f32a016034b98e90e41916028b7ee0",
"score": "0.60438794",
"text": "def destroy\n @payment_gateway = PaymentGateway.find(params[:id])\n @payment_gateway.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_payment_gateways_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e385e8630149d1f1cb2a317625fd2062",
"score": "0.60392475",
"text": "def destroy\n @reconciliation_detail = AccountingReconciliationDetail.find(params[:id])\n @reconciliation_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(accounting_reconciliation_details_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "0eb4da9729b63c1827f284756ca6c25b",
"score": "0.6038245",
"text": "def delete\n @one.info\n @one.delete\n end",
"title": ""
},
{
"docid": "1173250c8536e204b7837c1f6fd6c3e2",
"score": "0.6031655",
"text": "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "07a8bb7e091ac98c021f02884bc0b7fb",
"score": "0.6020882",
"text": "def destroy\n @final_bill = FinalBill.find(params[:id])\n @final_bill.destroy\n\n respond_to do |format|\n format.html { redirect_to(final_bills_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "3673f5b4865916f6278654b20718ce9e",
"score": "0.6020505",
"text": "def delete_account\n @connection.request({\n :method => 'DELETE'\n }) \n end",
"title": ""
},
{
"docid": "ec185fa1bb9a14555d5a8cddcd846447",
"score": "0.60159373",
"text": "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(plans_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "689d5a07a403c4b765ba178e4aff08a3",
"score": "0.6015511",
"text": "def delete\n client.delete(\"/#{id}\")\n end",
"title": ""
},
{
"docid": "9b4f912b2116f94d7ecdf9a00beefcf8",
"score": "0.6014846",
"text": "def destroy\n @bap = Bap.find(params[:id])\n @bap.destroy\n\n respond_to do |format|\n format.html { redirect_to(baps_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "f266251f161cb2cde78ea2a533db2ec2",
"score": "0.60120624",
"text": "def destroy\n @gstr_advance_receipts = GstrAdvanceReceipt.find_by_id_and_company_id(params[:id], @company.id)\n @gstr_advance_receipts.delete_gstr_one_entry \n @gstr_advance_receipts.delete\n respond_to do |format|\n @gstr_advance_receipts.register_delete_action(request.remote_ip, @current_user, 'deleted')\n format.html { redirect_to(gstr_advance_receipts_url, :notice =>\"Gstr Advance Receipt has been succesfully deleted\") }\n format.xml {head :ok}\n \n end\n end",
"title": ""
},
{
"docid": "08025276bdcfcef8b2faf42cc5f34d00",
"score": "0.6008722",
"text": "def destroy\n @user_bill = UserBill.find(params[:id])\n @user_bill.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_bills_url, :notice => \"User bill was successfully removed\") }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "04b71cdcf7370e4eadedb36df559b30e",
"score": "0.60011333",
"text": "def deleteEntityFax( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/fax\",params)\n end",
"title": ""
},
{
"docid": "6c16230e621a30a19f3abd065ed99548",
"score": "0.6000436",
"text": "def destroy\n @member_info = MemberInfo.find(params[:id])\n @member_info.destroy\n\n respond_to do |format|\n format.html { redirect_to(member_infos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6d4db9d1512f30356c3ada2d0724fb6f",
"score": "0.59927434",
"text": "def destroy\r\n @bill = Bill.find(params[:id])\r\n @bill.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to bills_url, only_path: true }\r\n format.json { head :no_content }\r\n end\r\n end",
"title": ""
},
{
"docid": "b478c74d64927bdfcb092e7f3e81d08c",
"score": "0.598879",
"text": "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n redirect_to admins_path\n end",
"title": ""
},
{
"docid": "e70fed707168e40405efac5703ca652f",
"score": "0.5986288",
"text": "def destroy\n @cost_item = CostItem.find(params[:id])\n @cost_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(cost_items_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "60e8a5ee6819db00b2960c809b0e08d3",
"score": "0.5982777",
"text": "def destroy\n @merchant.destroy\n head :no_content\n end",
"title": ""
},
{
"docid": "db4e2dc9dda148812e364ef58164783c",
"score": "0.598194",
"text": "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to account_path(@bill.account_id) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "136dde944e008f269d7867d138146a40",
"score": "0.59686935",
"text": "def destroy\n @referral_charge = ReferralCharge.find(params[:id])\n @referral_charge.destroy\n\n respond_to do |format|\n format.html { redirect_to(referral_charges_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "09e11fed17cad612797b84848d3d17ce",
"score": "0.59680074",
"text": "def destroy\n @charge_transaction = ChargeTransaction.find(params[:id])\n @charge_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to charge_transactions_url }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "1eaf7cfaad82a4550b24a2e6ed65479a",
"score": "0.5961384",
"text": "def destroy\n @invoice = Invoice.find(params[:id])\n\n @customer = Customer.find_by_id(params[:customer_id])\n #@invoice.customer_id = @customer.id\n\n\n\n @invoice.destroy\n\n# respond_to do |format|\n# format.html { redirect_to (customer_path(@invoice.customer_id), :notice => 'Invoice was successfully deleted.') }\n# format.xml { head :ok }\n# end\n end",
"title": ""
},
{
"docid": "0069ba394c5057afa1413bc6fa391114",
"score": "0.59600353",
"text": "def delete(contactname)\n\n end",
"title": ""
},
{
"docid": "27ae06138fa8e7b93fbc225cbd70f10c",
"score": "0.5958482",
"text": "def destroy\n @invoice.destroy\n end",
"title": ""
},
{
"docid": "7918da8f0318b97a22a217c415ff2c6f",
"score": "0.5951599",
"text": "def destroy\n @service_plan = ServicePlan.find(params[:id])\n @service_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_plans_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6f4ac563184b99209b99c4d3eb45d045",
"score": "0.5950332",
"text": "def destroy\n @bill = Bill.find(params[:id])\n # TODO: \"un-updateEnergyGoals\" related to this bill\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9410f5d5c06a5d4acee3b61e4f080658",
"score": "0.59475815",
"text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"title": ""
},
{
"docid": "9410f5d5c06a5d4acee3b61e4f080658",
"score": "0.59475815",
"text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"title": ""
},
{
"docid": "9410f5d5c06a5d4acee3b61e4f080658",
"score": "0.59475815",
"text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"title": ""
},
{
"docid": "9410f5d5c06a5d4acee3b61e4f080658",
"score": "0.59475815",
"text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"title": ""
},
{
"docid": "c149712f1b8fbacfd238590b88221593",
"score": "0.59447694",
"text": "def destroy\n @discharge = Discharge.find(params[:id])\n @discharge.destroy\n\n respond_to do |format|\n format.html { redirect_to(discharges_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "357abc7df56e8f799f7befef2a14e346",
"score": "0.59396166",
"text": "def destroy\n @ofx_transaction.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "af0f43f4984cdebc8f95a3fa830329cc",
"score": "0.5930452",
"text": "def destroy\n @plan.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "b6cd677a0c2c60faa43ba40e2659cf16",
"score": "0.5928926",
"text": "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b6cd677a0c2c60faa43ba40e2659cf16",
"score": "0.5928926",
"text": "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b6cd677a0c2c60faa43ba40e2659cf16",
"score": "0.5928926",
"text": "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2211ade05bb1f35e4860ee364ae3e5fa",
"score": "0.59188217",
"text": "def destroy\n @req_breakdown = ReqBreakdown.find(params[:id])\n @req_breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_req_breakdowns_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e3298fd09a319978d5706f52d9d0c842",
"score": "0.59143925",
"text": "def destroy\n\n @fedex_bill_check.destroy\n respond_to do |format|\n format.html { redirect_to fedex_bill_checks_url, notice: 'Fedex bill check was successfully destroyed.' }\n format.json { head :no_content }\n end\n\n end",
"title": ""
},
{
"docid": "8d2fcdeb757770c63383fff3fc4d5d24",
"score": "0.5913935",
"text": "def destroy\n find_customer\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to('/customers/overview') }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ebf22710c3ea1654634c25b711c7f782",
"score": "0.5912472",
"text": "def destroy\n requires :id\n \n service.delete_nat_gateway(id)\n true\n end",
"title": ""
},
{
"docid": "0aabfd70910b8480a97cffeb53be8800",
"score": "0.59081215",
"text": "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"title": ""
},
{
"docid": "d6f9474f5968ccc76cd256fa7d6333be",
"score": "0.59059423",
"text": "def delete_sip_account(id)\n @cloudvox_api[\"/phones/#{id}.json\"].delete\n end",
"title": ""
},
{
"docid": "5764392c21d0c3dd67674bb10b058381",
"score": "0.59050715",
"text": "def destroy\n @service_check_detail = ServiceCheckDetail.find(params[:id])\n @service_check_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_check_details_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c1698f865e46f4c8dec2165e2cebb28f",
"score": "0.59007007",
"text": "def destroy\n @retailorderdetail = Retailorderdetail.find(params[:id])\n @retailorderdetail.destroy\n\n respond_to do |format|\n format.html { redirect_to(retailorderdetails_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "0fa75a701db1b3796f00835ca92165f7",
"score": "0.59005135",
"text": "def destroy\n @consultationcharge = Consultationcharge.find(params[:id])\n @consultationcharge.destroy\n\n respond_to do |format|\n format.html { redirect_to(consultationcharges_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "0426e97f4d3e7d2f825b3295c6e3a741",
"score": "0.5899044",
"text": "def destroy\n @cost = Cost.find(params[:id])\n @cost.destroy\n\n respond_to do |format|\n format.html { redirect_to(:controller => \"home\") }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d2dffef3e7acbacafd72c3f5a8e1895e",
"score": "0.5896354",
"text": "def destroy\n @pricing_plan = PricingPlan.find(params[:id])\n @pricing_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(pricing_plans_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "4630371d54092d9aaa6f62c4a1e7f2dc",
"score": "0.58948827",
"text": "def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ae004e47e49fb3031c486e91518fa54e",
"score": "0.5892504",
"text": "def destroy\n @shipping_unit = ShippingUnit.find(params[:id])\n @shipping_unit.destroy\n\n respond_to do |format|\n format.html { redirect_to(shipping_units_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "fdd3547fa773dfca5f8cd806595d0cd8",
"score": "0.58859134",
"text": "def destroy\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_path }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9688fca50b74e0d2afd85c83aae42122",
"score": "0.58851683",
"text": "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
b239ff1c25fdd6fe151a4cb23c866f5f | creation de methode caverne | [
{
"docid": "74dfd66739d440d87ebb4cfe9f622695",
"score": "0.0",
"text": "def caverne\n self.class.get('/monstre_caverne.json')\n end",
"title": ""
}
] | [
{
"docid": "40769f9969d33ad71cb2389a7e574114",
"score": "0.7542297",
"text": "def institucional\n\t\t\n\tend",
"title": ""
},
{
"docid": "c4c797f4e170e07198b939f09207cad2",
"score": "0.7537907",
"text": "def construct; end",
"title": ""
},
{
"docid": "fdd8f361e27003effc27abc16ab6412e",
"score": "0.73632246",
"text": "def criar\n\n\tend",
"title": ""
},
{
"docid": "fe813c3e1fdaa795994fc415daa33168",
"score": "0.7223281",
"text": "def creator; end",
"title": ""
},
{
"docid": "53bf91c47e0d5ba4d22e790f94f1c866",
"score": "0.7106398",
"text": "def creator=(_arg0); end",
"title": ""
},
{
"docid": "cfa08c71c616cdc11ac3715b69147db0",
"score": "0.68402565",
"text": "def new\n \n end",
"title": ""
},
{
"docid": "cfa08c71c616cdc11ac3715b69147db0",
"score": "0.68402565",
"text": "def new\n \n end",
"title": ""
},
{
"docid": "cfa08c71c616cdc11ac3715b69147db0",
"score": "0.68402565",
"text": "def new\n \n end",
"title": ""
},
{
"docid": "cfa08c71c616cdc11ac3715b69147db0",
"score": "0.68402565",
"text": "def new\n \n end",
"title": ""
},
{
"docid": "a32e830a53d1143dd3fac919742f016b",
"score": "0.6796395",
"text": "def new\n \t\tsuper\n \tend",
"title": ""
},
{
"docid": "7fa10fced75e39527100936cddd56f5c",
"score": "0.6771676",
"text": "def create #:doc:\r\n end",
"title": ""
},
{
"docid": "66fe98cea91c3e4573640a669a3c00e3",
"score": "0.675729",
"text": "def create\n\t end",
"title": ""
},
{
"docid": "80e5b37354dda57fb3616a06af8ae64b",
"score": "0.6715166",
"text": "def create\n \n end",
"title": ""
},
{
"docid": "62143a33a78aeaf1c723ed971cc32bc9",
"score": "0.6678753",
"text": "def creatable?; end",
"title": ""
},
{
"docid": "81a16a451f36dd7bf87a3d75fb315f85",
"score": "0.6660934",
"text": "def factory; end",
"title": ""
},
{
"docid": "85821b7c901833285eb68d70d01fd111",
"score": "0.6660721",
"text": "def create\n \n end",
"title": ""
},
{
"docid": "85821b7c901833285eb68d70d01fd111",
"score": "0.6660721",
"text": "def create\n \n end",
"title": ""
},
{
"docid": "85821b7c901833285eb68d70d01fd111",
"score": "0.6660721",
"text": "def create\n \n end",
"title": ""
},
{
"docid": "85821b7c901833285eb68d70d01fd111",
"score": "0.6660721",
"text": "def create\n \n end",
"title": ""
},
{
"docid": "3d4e0c94710e6b85807d075e46c7d0c8",
"score": "0.6652383",
"text": "def create; end",
"title": ""
},
{
"docid": "3d4e0c94710e6b85807d075e46c7d0c8",
"score": "0.6652383",
"text": "def create; end",
"title": ""
},
{
"docid": "3d4e0c94710e6b85807d075e46c7d0c8",
"score": "0.6652383",
"text": "def create; end",
"title": ""
},
{
"docid": "3d4e0c94710e6b85807d075e46c7d0c8",
"score": "0.6652383",
"text": "def create; end",
"title": ""
},
{
"docid": "3d4e0c94710e6b85807d075e46c7d0c8",
"score": "0.6652383",
"text": "def create; end",
"title": ""
},
{
"docid": "3d4e0c94710e6b85807d075e46c7d0c8",
"score": "0.6652383",
"text": "def create; end",
"title": ""
},
{
"docid": "3bcd882268911f03b8c342c03668c47b",
"score": "0.66464",
"text": "def new; end",
"title": ""
},
{
"docid": "3bcd882268911f03b8c342c03668c47b",
"score": "0.66464",
"text": "def new; end",
"title": ""
},
{
"docid": "3bcd882268911f03b8c342c03668c47b",
"score": "0.66464",
"text": "def new; end",
"title": ""
},
{
"docid": "3bcd882268911f03b8c342c03668c47b",
"score": "0.66464",
"text": "def new; end",
"title": ""
},
{
"docid": "3bcd882268911f03b8c342c03668c47b",
"score": "0.66464",
"text": "def new; end",
"title": ""
},
{
"docid": "3bcd882268911f03b8c342c03668c47b",
"score": "0.66464",
"text": "def new; end",
"title": ""
},
{
"docid": "3bcd882268911f03b8c342c03668c47b",
"score": "0.66464",
"text": "def new; end",
"title": ""
},
{
"docid": "3bcd882268911f03b8c342c03668c47b",
"score": "0.66464",
"text": "def new; end",
"title": ""
},
{
"docid": "3bcd882268911f03b8c342c03668c47b",
"score": "0.66464",
"text": "def new; end",
"title": ""
},
{
"docid": "3bcd882268911f03b8c342c03668c47b",
"score": "0.66464",
"text": "def new; end",
"title": ""
},
{
"docid": "3bcd882268911f03b8c342c03668c47b",
"score": "0.66464",
"text": "def new; end",
"title": ""
},
{
"docid": "3bcd882268911f03b8c342c03668c47b",
"score": "0.66464",
"text": "def new; end",
"title": ""
},
{
"docid": "3bcd882268911f03b8c342c03668c47b",
"score": "0.66464",
"text": "def new; end",
"title": ""
},
{
"docid": "3bcd882268911f03b8c342c03668c47b",
"score": "0.66464",
"text": "def new; end",
"title": ""
},
{
"docid": "3bcd882268911f03b8c342c03668c47b",
"score": "0.66464",
"text": "def new; end",
"title": ""
},
{
"docid": "3bcd882268911f03b8c342c03668c47b",
"score": "0.66464",
"text": "def new; end",
"title": ""
},
{
"docid": "3bcd882268911f03b8c342c03668c47b",
"score": "0.66464",
"text": "def new; end",
"title": ""
},
{
"docid": "5ecdc1a0f50f0aa80a64fcbecfa08f2c",
"score": "0.66440517",
"text": "def created=(_arg0); end",
"title": ""
},
{
"docid": "18250542a2b1999be90588db1d071d92",
"score": "0.6626748",
"text": "def initialize\n\t\t\n\tend",
"title": ""
},
{
"docid": "748bd7b5149abf972e7b72dfbb61e623",
"score": "0.66195905",
"text": "def initialize\t\n\t\tend",
"title": ""
},
{
"docid": "61b6b9d8fcb3309d77069188f63cab0b",
"score": "0.6610046",
"text": "def create; super; end",
"title": ""
},
{
"docid": "04497f34329faddde1da11685d15e45d",
"score": "0.6601536",
"text": "def new; end",
"title": ""
},
{
"docid": "30db4e5d165a6098d1aeb8f8dd7b66e8",
"score": "0.659026",
"text": "def initialize() end",
"title": ""
},
{
"docid": "30db4e5d165a6098d1aeb8f8dd7b66e8",
"score": "0.659026",
"text": "def initialize() end",
"title": ""
},
{
"docid": "51eff41d9602633128ee3c4d7b354410",
"score": "0.65797156",
"text": "def initialize c\n\t\t@cadena = c\n\tend",
"title": ""
},
{
"docid": "a83980d1953a1624afdb6684da64ec09",
"score": "0.65744776",
"text": "def initialize(); end",
"title": ""
},
{
"docid": "e2b31d60b2b5b380040a867c381a1b70",
"score": "0.65654206",
"text": "def new\n \n end",
"title": ""
},
{
"docid": "e2b31d60b2b5b380040a867c381a1b70",
"score": "0.65654206",
"text": "def new\n \n end",
"title": ""
},
{
"docid": "e2b31d60b2b5b380040a867c381a1b70",
"score": "0.65654206",
"text": "def new\n \n end",
"title": ""
},
{
"docid": "e2b31d60b2b5b380040a867c381a1b70",
"score": "0.65654206",
"text": "def new\n \n end",
"title": ""
},
{
"docid": "d9d398dac06879e920e2a69ed03b3873",
"score": "0.6564619",
"text": "def initialize(name)\n @name = name\n @nota\n #declaracion v instancia\n end",
"title": ""
},
{
"docid": "1cbe40a616aff57de850d7af265a5eef",
"score": "0.655016",
"text": "def initialize \n\n\n\tend",
"title": ""
},
{
"docid": "98e9dbf70428de60b6486cbe14aa7f59",
"score": "0.6548755",
"text": "def create\n\t\t\n\tend",
"title": ""
},
{
"docid": "53969dca56fd3184c671683606452d3e",
"score": "0.6519936",
"text": "def create()\n end",
"title": ""
},
{
"docid": "53969dca56fd3184c671683606452d3e",
"score": "0.6519936",
"text": "def create()\n end",
"title": ""
},
{
"docid": "53969dca56fd3184c671683606452d3e",
"score": "0.6519936",
"text": "def create()\n end",
"title": ""
},
{
"docid": "53969dca56fd3184c671683606452d3e",
"score": "0.6519936",
"text": "def create()\n end",
"title": ""
},
{
"docid": "8ab7b1caf2cb4e077357cd569b34f71c",
"score": "0.65192175",
"text": "def init\n\t\t\t\t\t\t\t\tend",
"title": ""
},
{
"docid": "41faa708112da8b2ad80d289774cd72c",
"score": "0.6509497",
"text": "def create\n \t\n end",
"title": ""
},
{
"docid": "41faa708112da8b2ad80d289774cd72c",
"score": "0.6509497",
"text": "def create\n \t\n end",
"title": ""
},
{
"docid": "62bacde31fe33c97af331a962d3b69ce",
"score": "0.65057373",
"text": "def initialize \n\n\n\n\tend",
"title": ""
},
{
"docid": "413eb7a7781383c931819b4af16b7ad0",
"score": "0.6471497",
"text": "def initialize\n \n end",
"title": ""
},
{
"docid": "413eb7a7781383c931819b4af16b7ad0",
"score": "0.6471497",
"text": "def initialize\n \n end",
"title": ""
},
{
"docid": "b352075350f623a31f636ea2861a5915",
"score": "0.64620584",
"text": "def new()\n\nend",
"title": ""
},
{
"docid": "a747cf4388fb3d14718cf9dda73c555f",
"score": "0.64544964",
"text": "def initalize; end",
"title": ""
},
{
"docid": "a747cf4388fb3d14718cf9dda73c555f",
"score": "0.64544964",
"text": "def initalize; end",
"title": ""
},
{
"docid": "9ca31d298982546fb50198fae21b9ace",
"score": "0.6452037",
"text": "def create\n\t\tsuper\n \tend",
"title": ""
},
{
"docid": "56494fa488862ced32593eb7a742d435",
"score": "0.64456445",
"text": "def initialize(name, surn, gen, age, w, size, c_cint, c_cad)\n\t\tsuper(name,surn,gen,age)\n\t\t@w, @size, @c_cint, @c_cad = w, size, c_cint, c_cad\n\tend",
"title": ""
},
{
"docid": "6b743a6cb0ddccb498e83fd664ce950c",
"score": "0.64365584",
"text": "def construct(*args)\n end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.63997555",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.63997555",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.63997555",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.63997555",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.63997555",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.63997555",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.63997555",
"text": "def init; end",
"title": ""
},
{
"docid": "02d55518370e795dcef2ad863faa25bc",
"score": "0.63963443",
"text": "def new\n\t\t\n\tend",
"title": ""
},
{
"docid": "02d55518370e795dcef2ad863faa25bc",
"score": "0.63963443",
"text": "def new\n\t\t\n\tend",
"title": ""
},
{
"docid": "02d55518370e795dcef2ad863faa25bc",
"score": "0.63963443",
"text": "def new\n\t\t\n\tend",
"title": ""
},
{
"docid": "edefb41e6036fd69564480d350745cb1",
"score": "0.6371296",
"text": "def new\n # Nothing to see here, atm\n end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.63651127",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.63651127",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.63651127",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.63651127",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.63651127",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.63651127",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.63651127",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.63651127",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.63651127",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.63651127",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.63651127",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.63651127",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.63651127",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.63651127",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.63651127",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.63651127",
"text": "def initialize; end",
"title": ""
}
] |
5b8cc642b7baf9c627346b7274b70285 | Create URLs for uploading and downloading source. Deprecated in favor of `POST /sources` | [
{
"docid": "2eb300169937c1f0e854ae188c341ef0",
"score": "0.0",
"text": "def create_deprecated(app_id_or_app_name)\n @client.source.create_deprecated(app_id_or_app_name)\n end",
"title": ""
}
] | [
{
"docid": "61faf833abc8b61a55dee8e9e534683f",
"score": "0.76066417",
"text": "def generate_sources_endpoints\n response = HTTPClient.post @heroku_app_sources_endpoint, nil, HerokuApiHelpers.default_headers\n data = JSON.parse response.body\n @heroku_get_url = data[\"source_blob\"][\"get_url\"]\n @heroku_put_url = data[\"source_blob\"][\"put_url\"]\n end",
"title": ""
},
{
"docid": "435341a39e44b90651e7090e1d447f9e",
"score": "0.6820687",
"text": "def source_urls\n get_urls( source_url, source_mirrors, source_reference, source_type, 'source')\n end",
"title": ""
},
{
"docid": "9683c91c34d07b1a94be907b8b1447b6",
"score": "0.66932094",
"text": "def create_source(options = {})\n post(:sources, sources: [options]).pop\n end",
"title": ""
},
{
"docid": "26038832d67f45164154fccb2a96d4d5",
"score": "0.6644794",
"text": "def prepare(source_url); end",
"title": ""
},
{
"docid": "3f4ced8eaf2bfc54a3ac2b97a258288f",
"score": "0.6371244",
"text": "def download_sources(source = nil)\n if source\n IO.instance.storage_download_info(source)\n source[:path].each do |path|\n download_youtube(YouTubeAddy.extract_video_id(path), path)\n end\n else\n @sources.each { |src| download_sources(src) }\n end\n end",
"title": ""
},
{
"docid": "7979823eddb5f7c3dd1e22d62e88187a",
"score": "0.6342491",
"text": "def sources\n \turl = URI.parse(\"#{@base_url}#{@api_version}/sources\")\n \t request = Net::HTTP::Get.new(url.request_uri)\n\n \t @headers.each {|k, v| request[k] = v }\n\n \t response = Net::HTTP.start(url.hostname, url.port, :use_ssl => url.scheme == 'https') do |http|\n \t\t http.request(request)\n \t end\t\n\n \t JSON.parse(response.body)[\"sources\"].collect {|source| CallAction::Source.new source }\n end",
"title": ""
},
{
"docid": "1df9f023b7a402900d1a3e740648b5c4",
"score": "0.6249339",
"text": "def sources(params={})\n path = '/sources'\n response = @client.get path, params\n Source.new path, @client, response\n end",
"title": ""
},
{
"docid": "9dd7eb5d0b954116ed2f3b52ba2f7868",
"score": "0.618919",
"text": "def create\n if params['sources']\n params['sources'].each do |source|\n @source = Source.new(title: source['title'], url: source['url'], feed_url: source['feed_url'], description: source['description'], author: current_user)\n if(!@source.save)\n redirect_to sources_path, notice: 'One or more feeds were already available.' and return\n else\n redirect_to sources_path and return\n end\n end\n end\n end",
"title": ""
},
{
"docid": "2eb2fe28523405f71ebd37db2bbccfc4",
"score": "0.61524266",
"text": "def create_sources( source_array )\n log_message( \"Creating sources from JSON data...\" ) unless @logging == false\n resp = @connection.post( \"source\", source_array )\n JSON.parse(resp) \n end",
"title": ""
},
{
"docid": "ff91bd74d043041281e85e2fb044533e",
"score": "0.61161053",
"text": "def convert_public_sources(engine_name, type, sources)\n options = sources.last.is_a?(Hash) ? sources.pop.stringify_keys : { }\n new_sources = []\n \n case type\n when :javascript\n type_dir = \"javascripts\"\n ext = \"js\"\n when :stylesheet\n type_dir = \"stylesheets\"\n ext = \"css\"\n end\n \n engine = Engines.get(engine_name)\n \n default = \"#{engine.public_dir}/#{type_dir}/#{engine_name}\"\n if defined?(RAILS_ROOT) && File.exists?(File.join(RAILS_ROOT, \"public\", \"#{default}.#{ext}\"))\n new_sources << default\n end\n \n sources.each { |name| \n new_sources << \"#{engine.public_dir}/#{type_dir}/#{name}\"\n }\n\n new_sources << options \n end",
"title": ""
},
{
"docid": "7086e5d5f3f44a818c4d0e32ba79d00b",
"score": "0.6109898",
"text": "def add_source!\n result['sources'] ||= []\n result['sources'] << {\n 'url' => response.env.url.to_s,\n 'note' => response.class.name.rpartition('::')[2],\n }\n result\n end",
"title": ""
},
{
"docid": "9d9ea5e82f19027e13a55b79c6d7bfaa",
"score": "0.60703933",
"text": "def public_url(uri, sourcemap_directory); end",
"title": ""
},
{
"docid": "f8d7edfa9ca3108fbba53a4d55d5a08f",
"score": "0.60167503",
"text": "def source(url); end",
"title": ""
},
{
"docid": "c23c6772cb2a278bd4a7111fa60aa563",
"score": "0.59792745",
"text": "def sources\n full_path(normalize(@source))\n end",
"title": ""
},
{
"docid": "2537b0f3bb1d47cb13cf306d5041cfe1",
"score": "0.5964833",
"text": "def import_sources\n \n require 'open-uri'\n url = 'https://newsapi.org/v2/sources?'\\\n 'language=en&country=us&'\\\n \"apiKey=#{Figaro.env.NEWS_API_KEY}\"\n req = open(url)\n response_body = req.read\n\n \n\n params[\"data\"].each do |data|\n data[\"facebook_id\"] = data[\"id\"]\n SomeRecordClass.create(data)\n end\n\n # puts response_body\n # sources = newsapi.get_sources(country: 'us', language: 'en')\n redirect_to \"/\"\n end",
"title": ""
},
{
"docid": "4f20439dd829b56250a68dbafca540f1",
"score": "0.59459704",
"text": "def source_params\n params.require(:source).permit(:url, :lookup)\n end",
"title": ""
},
{
"docid": "d121ddfa70a866677c3bc5e08f62b003",
"score": "0.5940542",
"text": "def sources\n @sources ||= profiles.values.map{|profile| url(profile) }\n end",
"title": ""
},
{
"docid": "8a55ea6dfcd0cbf622c3321614a8009f",
"score": "0.5938592",
"text": "def sources\n (metadata['sources'] || []).map do |x| \n Source.new(:label => x['name'], :resource => x['web'])\n end\n end",
"title": ""
},
{
"docid": "0f6b61059ecef7f5ea0cc5a08da8358d",
"score": "0.59127176",
"text": "def add_sources(urls)\n results = {}.compare_by_identity\n urls.each { |link| results[link.split(\"/\")[2]] = link}\n results\n end",
"title": ""
},
{
"docid": "06e3d95e1d65fa05a18747c75ff9e5a4",
"score": "0.58941376",
"text": "def update_sources\n required_fields.each do |field, options|\n send(:\"#{field}=\", options[:source].call(self)) if options[:source] rescue nil\n end if required_fields\n end",
"title": ""
},
{
"docid": "8b91eaf43ca1c2065fe889d2d8a9aca2",
"score": "0.5883022",
"text": "def source_params\n params.require(:source).permit(:name, :url, :title_path, :image_path, :content_path, :url_path, :post_path, :breaking_post_path, :breaking_url_path, :breaking_title_path, :breaking_image_path)\n end",
"title": ""
},
{
"docid": "6139cf85bec3e8c2e391a612484c2049",
"score": "0.5880712",
"text": "def try_multiple_sources(sources)\n sources = sources.dup\n source = sources.shift\n begin\n uri = if Chef::Provider::RemoteFile::Fetcher.network_share?(source)\n source\n else\n as_uri(source)\n end\n raw_file = grab_file_from_uri(uri)\n rescue SocketError, Errno::ECONNREFUSED, Errno::ENOENT, Errno::EACCES, Timeout::Error, Net::HTTPClientException, Net::HTTPFatalError, Net::FTPError, Errno::ETIMEDOUT => e\n logger.warn(\"#{@new_resource} cannot be downloaded from #{source}: #{e}\")\n if source = sources.shift\n logger.info(\"#{@new_resource} trying to download from another mirror\")\n retry\n else\n raise e\n end\n end\n raw_file\n end",
"title": ""
},
{
"docid": "7a3f7f40b69a8101e93e2d57e743bab7",
"score": "0.5873138",
"text": "def create\n chomp = /[\\r\\n]+/\n urls_str = params[\"urls\"]\n\n site_id = 1#params[\"site_id\"]\n\n if urls_str\n\n urls = urls_str.strip.split(chomp)\n puts urls.inspect\n if urls\n urls.each do |url|\n puts url\n Site.read_one_link(site_id, url)\n end \n end\n\n respond_to do |format|\n \n format.html { redirect_to '/wait_audit', notice: 'Source was successfully created.' }\n end\n\n end\n end",
"title": ""
},
{
"docid": "b4e96b09df51d1ce7f9f6b8680fb568f",
"score": "0.5830903",
"text": "def source_params\n params.require(:source).permit(:name, :href)\n end",
"title": ""
},
{
"docid": "059d27e45a7b412312461a38d4babe29",
"score": "0.58206856",
"text": "def urls\n @gapi.source_uris\n end",
"title": ""
},
{
"docid": "9311a88ebbca7ec6a886e4509bd7c9fa",
"score": "0.58113486",
"text": "def sources_from(source, progressor = nil, base_url=nil)\n reader = self.new(source)\n reader.base_file_url = base_url if(base_url)\n reader.progressor = progressor\n reader.sources\n end",
"title": ""
},
{
"docid": "c6760e8313d3a87f8c19ffc9ae1af9ee",
"score": "0.58055896",
"text": "def initialize urls, destination\n @urls = urls\n @destination = destination\n end",
"title": ""
},
{
"docid": "d5bd799225883012ce96a276616a6c07",
"score": "0.5790495",
"text": "def build_source_url(filename)\n File.join url_prefix, self['picture']['source'], filename\n end",
"title": ""
},
{
"docid": "aaf29d6be2671f6a849db2a55046d6df",
"score": "0.5762686",
"text": "def source_params\n params.require(:source).permit(:name, :url, :rss_url, :picture)\n end",
"title": ""
},
{
"docid": "8011265598b97a3b5ede47a4013000a7",
"score": "0.5759301",
"text": "def list_sources\n TwList.get_or_create(\"#{@account.username} # sources\")\n end",
"title": ""
},
{
"docid": "96a90be79ebc79761ac85a691b5d6628",
"score": "0.574405",
"text": "def submission_url_file\n expose Deliverable.create_url_or_file_submission(@oauth_token, params[:membername].strip,\n params[:challenge_id].strip, params) \n end",
"title": ""
},
{
"docid": "719b0756a46896d8a62d370759157d01",
"score": "0.5735",
"text": "def create\n @source = Source.new(source_params)\n\n if @source.save\n render json: @source, status: :created, location: api_source_url(@source)\n else\n render json: @source.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "7ace70ebd5090123c34f94fe841ad0c5",
"score": "0.57323503",
"text": "def asset_create_external(source_url, args = { })\n params = {\n :source => source_url\n }\n add_params = [ :projectid, :folderid, :proxy, :thumbnailsmall, :thumbnaillarge, :height, :width, :durationseconds ]\n\n params = merge_additional_parameters(params, add_params, args)\n call_method('Asset.CreateExternal', params)\n end",
"title": ""
},
{
"docid": "1b54861b8b52afeae3005263556ebba8",
"score": "0.57278204",
"text": "def download!(source_url, destination_file); end",
"title": ""
},
{
"docid": "52d96ecb240510aa449d4f5753bb85a9",
"score": "0.5726168",
"text": "def upload source, dest\n @uploads ||= []\n @uploads << { :source => source, :dest => dest }\n end",
"title": ""
},
{
"docid": "459107fb217a3c8225a25186d1f643fc",
"score": "0.5686811",
"text": "def add_sources(urls)\n urls.each_with_object( {}.compare_by_identity ) do |link, pairs|\n pairs[root_url(link)] = link\n end\n end",
"title": ""
},
{
"docid": "3567910a5edd8d5c683ceee676ae2b54",
"score": "0.5673941",
"text": "def initialize\n @sources = Sources.instance.sources\n dir = Config.instance.options['sources']['download']['dir']\n @dir = File.expand_path(dir) + '/'\n @method = Config.instance.options['sources']['download']['method']\n end",
"title": ""
},
{
"docid": "7f74132a47100cba3d2ae52ca7603147",
"score": "0.5669148",
"text": "def source(_options = {})\n 'HttpSource'\n end",
"title": ""
},
{
"docid": "e17bc775cb170b716da4649e2ebb3c30",
"score": "0.5668916",
"text": "def get_file_uri(source)\n return File.join(File.dirname(__FILE__), 'files/') + source if ENV['RAILS_TEMPLATE_DEBUG'].present?\n return 'https://raw.githubusercontent.com/spotwise/railyard/master/files/' + source\nend",
"title": ""
},
{
"docid": "834714e0d13de2fb85d5cef0edb793e0",
"score": "0.5653208",
"text": "def create\n\t\t@source = current_user.sources.new(params[:source])\n\n\t\trespond_to do |format|\n\t\t\tif @source.save\n\t\t\t\tformat.html { redirect_to(@source, :notice => 'Source was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @source, :status => :created, :location => @source }\n\t\t\t\tformat.json { render :json => @source, :status => :created, :location => @source }\n\t\t\t\tformat.yaml { render :text => @source.to_yaml, :content_type => 'text/yaml', :status => :created, :location => @source }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @source.errors, :status => :unprocessable_entity }\n\t\t\t\tformat.json { render :json => @source.errors, :status => :unprocessable_entity }\n\t\t\t\tformat.yaml { render :text => @source.errors.to_yaml, :content_type => 'text/yaml', :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "e9609fc54c5e2a3c67e1d9952153888c",
"score": "0.56524986",
"text": "def source_url\n metadata.source_url\n end",
"title": ""
},
{
"docid": "5b9475e992be5b6404931eb5150edce9",
"score": "0.5649615",
"text": "def sources; end",
"title": ""
},
{
"docid": "566cb3cab004784160f0397c87f1ff16",
"score": "0.56464136",
"text": "def source_url=(url)\n return nil if not url\n http_getter = Net::HTTP\n uri = URI.parse(url)\n response = http_getter.start(uri.host, uri.port) {|http|\n http.get(uri.path)\n }\n case response\n when Net::HTTPSuccess\n file_data = response.body\n return nil if file_data.nil? || file_data.size == 0\n self.content_type = response.content_type\n self.temp_data = file_data\n self.filename = uri.path.split('/')[-1]\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "9d000c76427981d8dcc0ded040e08fdb",
"score": "0.5643699",
"text": "def asset_url(source, options = {})\n path_to_asset(source, options.merge(:protocol => :request))\n end",
"title": ""
},
{
"docid": "82848c8c8d2b2d1e2d5d2041762c8f09",
"score": "0.5637502",
"text": "def fake_url\n return source.to_s + pub_date.to_s + headline.to_s\n end",
"title": ""
},
{
"docid": "3b7710852558485a34249dc83d3221c3",
"score": "0.5630197",
"text": "def urls; end",
"title": ""
},
{
"docid": "3b7710852558485a34249dc83d3221c3",
"score": "0.5630197",
"text": "def urls; end",
"title": ""
},
{
"docid": "14a5c4238e6243432ff8687e01438ff3",
"score": "0.56282264",
"text": "def asset_url(source, options = {})\n path_to_asset(source, options.merge(protocol: :request))\n end",
"title": ""
},
{
"docid": "cd4b304e53a94726e1362078c6e8f6a4",
"score": "0.5627515",
"text": "def source_tag_urls\n urls 'source', 'src'\n end",
"title": ""
},
{
"docid": "5c05736a7cd1421cc9412603a8e5f2dd",
"score": "0.5625701",
"text": "def image_url source\n path_to_url image_path(source)\n end",
"title": ""
},
{
"docid": "3d420fd51b70178c7565921e504b5db4",
"score": "0.56252694",
"text": "def file_url\n url\n end",
"title": ""
},
{
"docid": "603ec6eb3366a21f0539f388ce67a9d3",
"score": "0.5617975",
"text": "def set_UploadSourceURL(value)\n set_input(\"UploadSourceURL\", value)\n end",
"title": ""
},
{
"docid": "1f8ecd4bca7064f0c71bba9e51648707",
"score": "0.56166565",
"text": "def sources\n response = Faraday.get 'https://newsapi.org/v2/sources?' do |req|\n req.params['apiKey'] = ENV['API_KEY']\n req.params['country'] = 'us'\n end\n @sources = JSON.parse(response.body)\n render json: @sources, status: 200\n end",
"title": ""
},
{
"docid": "684dd415dc4145ccbc2d6bb6b5662e91",
"score": "0.5608475",
"text": "def xfinity_sources\n [\n source_obj(\"free_web_sources\", \"xfinity\"),\n source_obj(\"tv_everywhere_web_sources\", \"xfinity_tveverywhere\"),\n source_obj(\"purchase_web_sources\", \"xfinity_purchase\")\n ]\n end",
"title": ""
},
{
"docid": "8439f9c8c0035e79b2a6f631805f1923",
"score": "0.56038016",
"text": "def generate_url\n Dropio::Resource.client.generate_asset_url(self)\n end",
"title": ""
},
{
"docid": "e162e2f190dfbfd8be17826a11ac2cde",
"score": "0.56023365",
"text": "def source_url\n raise NoAccessKey if access_key.nil? || access_key.empty?\n url_componenets = {\n host: service_host,\n path: TW_SERVICE_PATH,\n query: \"source=#{source}\"\n }\n URI::HTTPS.build(url_componenets)\n end",
"title": ""
},
{
"docid": "5f711b40109b7bfc5e6cb5b9fe734eb6",
"score": "0.5598199",
"text": "def create_url_file\n name = params[:bruse_file][:data].gsub(/(https?|s?ftp):\\/\\//, \"\").gsub(/(\\/.*)*/, \"\")\n @file = BruseFile.new(\n name: name,\n foreign_ref: params[:bruse_file][:data],\n filetype: params[:bruse_file][:type],\n identity: @identity\n )\n end",
"title": ""
},
{
"docid": "5282bf57ea2969d615519954130e22b7",
"score": "0.55767363",
"text": "def external_copy(target, options={})\n data = {\n source: cdn_url(!options.fetch(:strip_operations){ false }),\n target: target,\n pattern: options.fetch(:pattern){ nil },\n make_public: options.fetch(:make_public){ nil },\n }.reject{|_,v| v.nil?}\n\n @api.post \"/files/\", data\n end",
"title": ""
},
{
"docid": "711f67e212516da125236b01f40e9660",
"score": "0.5571478",
"text": "def sources=(value)\n @sources = value\n end",
"title": ""
},
{
"docid": "711f67e212516da125236b01f40e9660",
"score": "0.5571478",
"text": "def sources=(value)\n @sources = value\n end",
"title": ""
},
{
"docid": "cfb63e2d398899afca77bf9bab0a11ba",
"score": "0.556893",
"text": "def download_source\n self.source = \"\" if source.nil?\n \n return if source !~ /^http:\\/\\// || !file_ext.blank?\n\n ##################################################################\n # below are the custom changes to upload for different websites #\n # this should be in the local_config.rb #\n # #\n # there should be a check to see if there 'is' an extension, #\n # if there isn't, that means it's using a website page #\n ##################################################################\n\n # for pixiv pictures, fix this. #####################################\n\n pixiv_stuff = true\n if source =~ %r(http://www\\.pixiv\\.net/member_illust\\.php\\?mode=medium&illust_id=\\d+)\n self.original_source = source\n pixiv_stuff = pixiv_download\n end\n\n unless pixiv_stuff\n logger.info(\"----------- final error and hope to return\")\n errors.add :pixiv_pool, \"pool is finish\"\n return false\n end\n\n if source =~ /pixiv\\.net\\/img\\//\n if source =~/(_m|_s)\\.[^\\.]+$/\n ext_end = source[/\\.[^\\.]+$/]\n source.sub!(/(_s|_m)\\.[^\\.]+$/, ext_end)\n end\n\n # Pawsie - right here is the error \n if source[/_big_p/]\n test = Danbooru.http_ping(source)\n if test == \"404\"\n source.gsub!(/_big_p/, \"_p\")\n test = Danbooru.http_ping(source)\n if test == \"404\"\n logger.info(\"----------- final error and hope to return\")\n errors.add :pixiv_pool, \"pool is finish\"\n return false\n end\n end\n end\n end\n\n # for FurAffinity.net\n if source =~ /d\\.facdn\\.net\\/art/ and source =~ /\\.(thumbnail|half)\\./\n source.sub!(/\\.(thumbnail|half)\\./,\".\")\n end\n\n # for DeviantArt.net\n if source =~ /deviantart\\.net/ and source =~ /\\/(150|PRE)\\//\n source.sub!(/\\/(150|PRE)\\//,\"/\")\n end\n\n #######\n # end #\n #######\n\n #######################################\n # this is for the danbooru downloader #\n #######################################\n\n if source =~ %r#/post/show/\\d+#\n from_danbooru\n end\n\n #######\n # end #\n #######\n\n # to save original file name\n self.original_name = source[/[^\\/]*$/]\n\n # to check the number of ext\n num_ext = 0\n \n begin\n Danbooru.http_get_streaming(source) do |response|\n File.open(tempfile_path, \"wb\") do |out|\n response.read_body do |block|\n out.write(block)\n end\n end\n end\n \n if source.to_s =~ /\\/src\\/\\d{12,}|urnc\\.yi\\.org|yui\\.cynthia\\.bne\\.jp/\n self.source = \"Image board\"\n end\n \n return true\n rescue SocketError, URI::Error, SystemCallError => x\n delete_tempfile\n\n # try changing the ext\n if change_ext then retry end\n\n errors.add \"source\", \"couldn't be opened: #{x}\"\n return false\n=begin\n rescue PostMethods::PixivPost::PixivFinish\n delete_tempfile\n \n errors.add \"pixiv_pool\", \"couldn't be opened\"\n return false\n=end\n end\n end",
"title": ""
},
{
"docid": "305227499d8eaa20cf5406a6118e1a0f",
"score": "0.5566142",
"text": "def create_source(uri)\n TaliaCore::Source.create!(uri)\n end",
"title": ""
},
{
"docid": "8b3600cd469acf4906b361b10eaa1929",
"score": "0.55636954",
"text": "def source_uris= new_uris\n if new_uris.nil?\n @gapi.configuration.load.update! source_uris: nil\n else\n @gapi.configuration.load.update! source_uris: Array(new_uris)\n end\n end",
"title": ""
},
{
"docid": "a96d16944abfe4f5b5ae006e70db33ea",
"score": "0.5549898",
"text": "def create url\n function = ''\n \n post_data = {}\n post_data[:url] = url\n\n request(@resource, function, nil, 'post', post_data)\n end",
"title": ""
},
{
"docid": "e85744687a0337afea0a31a9f89807e9",
"score": "0.554148",
"text": "def source_url=(url)\n\t return nil if not url \n\t\treturn nil if url.blank?\n\t http_getter = Net::HTTP\n\t uri = URI.parse(url)\n\t response = http_getter.start(uri.host, uri.port) {|http|\n\t http.get(uri.path)\n\t }\n\t case response\n\t when Net::HTTPSuccess\n\t file_data = response.body\n\t return nil if file_data.nil? || file_data.size == 0\n\t self.content_type = response.content_type\n\t \tself.temp_data = file_data\n\t\n\t self.filename = uri.path.split('/')[-1]\n\telse\n\t return nil\n\t end\n\tend",
"title": ""
},
{
"docid": "caf0cafa83a78e5325ce5cf9cae6daff",
"score": "0.55384123",
"text": "def init_sources\n if defined? Rho::RhoConfig::sources\n Rhom::RhomDbAdapter::delete_all_from_table('sources')\n src_attribs = []\n attribs_empty = false\n \n # quick and dirty way to get unique array of hashes\n uniq_sources = Rho::RhoConfig::sources.values.inject([]) { |result,h| \n result << h unless result.include?(h); result\n }\n\t\t\n # generate unique source list in databse for sync\n uniq_sources.each do |source|\n src_id = source['source_id']\n url = source['url']\n Rhom::RhomDbAdapter::insert_into_table('sources',\n {\"source_id\"=>src_id,\"source_url\"=>url})\n end\n end\n end",
"title": ""
},
{
"docid": "3356fbe8fe5ec11fbfab3fcea336dc73",
"score": "0.5531832",
"text": "def handle_url\n return unless PictureTag.preset['link_source'] && !self['link']\n\n @content['link'] = PictureTag.build_source_url(\n Utils.biggest_source.shortname\n )\n end",
"title": ""
},
{
"docid": "369dea38a21276f5b87dd3b7b75dc950",
"score": "0.55316967",
"text": "def source_path(url_path)\n @url = url_path\n end",
"title": ""
},
{
"docid": "e9ad204373f7c37045937ac68a5a46ab",
"score": "0.552755",
"text": "def source(api_url, **options)\n source = Source.new(self, api_url, **options)\n @sources[source.uri.to_s] = source\n end",
"title": ""
},
{
"docid": "e6c5e305c482a56dcd25053610feb1a4",
"score": "0.5522471",
"text": "def sources\n fetch(:sources)\n end",
"title": ""
},
{
"docid": "5bd3456793514623e78940d4cf99ea80",
"score": "0.55183345",
"text": "def sourceurl=(url)\n @sourceurl = url\n @dataobj.sourceurl = url\n end",
"title": ""
},
{
"docid": "190eed3247ad28a76e15a964c4a3223a",
"score": "0.55171335",
"text": "def remote_path\n source || URL\n end",
"title": ""
},
{
"docid": "190eed3247ad28a76e15a964c4a3223a",
"score": "0.5516361",
"text": "def remote_path\n source || URL\n end",
"title": ""
},
{
"docid": "bddad3cbaa79072b6acb4d0391a4762f",
"score": "0.55065894",
"text": "def source_url\n self['source'][1]\n end",
"title": ""
},
{
"docid": "c381a92edf56c3b0472bc7ecce543d1c",
"score": "0.55014724",
"text": "def generate_url\n Dropio::Client.instance.generate_asset_url(self)\n end",
"title": ""
},
{
"docid": "4b50d12cc327cb176b037b9e8068f99d",
"score": "0.54978013",
"text": "def set_URLSource(value)\n set_input(\"URLSource\", value)\n end",
"title": ""
},
{
"docid": "4b50d12cc327cb176b037b9e8068f99d",
"score": "0.54978013",
"text": "def set_URLSource(value)\n set_input(\"URLSource\", value)\n end",
"title": ""
},
{
"docid": "4b50d12cc327cb176b037b9e8068f99d",
"score": "0.54978013",
"text": "def set_URLSource(value)\n set_input(\"URLSource\", value)\n end",
"title": ""
},
{
"docid": "1d88da1082135d97b832bf924fe41f0f",
"score": "0.54859686",
"text": "def internal_copy(options={})\n data = {\n source: cdn_url(!options.fetch(:strip_operations){ false }),\n store: options.fetch(:store){ nil }\n }.reject{|_,v| v.nil?}\n\n @api.post \"/files/\", data\n end",
"title": ""
},
{
"docid": "97b925ffb1ff649fe7fb3364617bafc8",
"score": "0.5484263",
"text": "def url\n STRATEGIES[source].url(path, format)\n end",
"title": ""
},
{
"docid": "5abfe98f7a0766cbdad5fcb05f2dbf6a",
"score": "0.5475784",
"text": "def sources\n package.sources.map do |x| \n Source.new(:label => x['name'], :resource => x['web'])\n end\n end",
"title": ""
},
{
"docid": "b8985d026f5ff310799d3808da9b2c03",
"score": "0.5475024",
"text": "def source_url\n settings.source_url\n end",
"title": ""
},
{
"docid": "8382560a4e7c7c0c80662d21a41d31b9",
"score": "0.54748976",
"text": "def source_links\n result[\"source\"][\"main_source_ids\"].map do |id|\n \"http://browser.carboncalculated.com/main_sources/#{id}\"\n end\n end",
"title": ""
},
{
"docid": "519b54aa5d8bd8d03fcce865112ce8bc",
"score": "0.5469978",
"text": "def build_sources(names)\n names.transform_values { |n| PictureTag::SourceImage.new n }\n end",
"title": ""
},
{
"docid": "ef7f3012891e32569257caaafa572be1",
"score": "0.546757",
"text": "def get_sources\n @sources\n end",
"title": ""
},
{
"docid": "dca8e800d1b013e9c3e17c3d02eea3b5",
"score": "0.54580903",
"text": "def create\n @source = current_user.sources.new(source_params)\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to @source, notice: 'Source was successfully created.' }\n format.json { render :show, status: :created, location: @source }\n else\n format.html { render :new }\n format.json { render json: @source.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "04231a2d7e54a14c158c1cc2169ae9ca",
"score": "0.5456114",
"text": "def sources\n @sources ||= SourcesService.new(@http_client)\n end",
"title": ""
},
{
"docid": "7e96e2e188d0ca737036e0901c739eb4",
"score": "0.54548484",
"text": "def sources=(sources)\n if sources.nil?\n fail ArgumentError, 'invalid value for \"sources\", sources cannot be nil.'\n end\n @sources = sources\n end",
"title": ""
},
{
"docid": "2096f8e7f54a4eaf3a2d1d3b7b4e25a7",
"score": "0.54513836",
"text": "def htmlimport_url(source, options = {})\n url_to_asset(source, {type: :htmlimport}.merge!(options))\n end",
"title": ""
},
{
"docid": "33b5a3f87e946c808653ef077a171581",
"score": "0.54441375",
"text": "def initialize(name, sources, save_path, padding, url)\n @name = name\n @sources = sources.map { |path| Source.new(path) }\n @save_path = save_path\n @padding = padding\n @url = url\n end",
"title": ""
},
{
"docid": "c30b7fe9d8e85d5f7863f5c64349204b",
"score": "0.54393494",
"text": "def list_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.list_sources ...'\n end\n # resource path\n local_var_path = '/sources'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['UserSecurity']\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<Source>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#list_sources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "8df8e6bddf637057fb5e99e5cd342635",
"score": "0.5435151",
"text": "def set_source\n set_source_from_params || set_source_from_session || set_source_from_cookie || set_source_from_origin || set_source_from_default\n end",
"title": ""
},
{
"docid": "9978be6bce0058d82b10adcbe49ed0dd",
"score": "0.5431223",
"text": "def url(src)\n h.store_url(store.handle,:src => src)\n end",
"title": ""
},
{
"docid": "5759fc03a4ffd760d33d20d9c8b4d041",
"score": "0.542141",
"text": "def format_sources(sources)\n sources.map{ |s|\n s << \"*\" if @config[\"enabled_sources\"].include?(s)\n s\n }\n end",
"title": ""
},
{
"docid": "fb922543f20c73f0d7481928c226786b",
"score": "0.54183316",
"text": "def find(sources, options)\n paths = normalise_sources(sources, options)\n if options[:development]\n assets = paths.flat_map { |path| a = environment[path, bundle: true].to_a ; a.empty? ? [path] : a }\n else\n assets = paths.map { |path| environment[path] || path }\n end\n assets.map { |asset| to_url(asset, options[:development]) }\n end",
"title": ""
},
{
"docid": "fb922543f20c73f0d7481928c226786b",
"score": "0.54183316",
"text": "def find(sources, options)\n paths = normalise_sources(sources, options)\n if options[:development]\n assets = paths.flat_map { |path| a = environment[path, bundle: true].to_a ; a.empty? ? [path] : a }\n else\n assets = paths.map { |path| environment[path] || path }\n end\n assets.map { |asset| to_url(asset, options[:development]) }\n end",
"title": ""
},
{
"docid": "e09be9856e0a983eff5323712b86858c",
"score": "0.5418235",
"text": "def asset_proxy_url(url); end",
"title": ""
},
{
"docid": "b3692fed91bf228f7cad8da7e22c6114",
"score": "0.54128844",
"text": "def sources=(new_value) # :nodoc:\n @sources = new_value\n end",
"title": ""
},
{
"docid": "065f5d4f50ebd09504e6bffe0ce19a91",
"score": "0.5410117",
"text": "def create\n logger.info(params[:source])\n\n @source = @person.sources.new(params[:source])\n\n render_sources\n end",
"title": ""
},
{
"docid": "528af902a1f198eb03f695330eac6fee",
"score": "0.54037255",
"text": "def get_download_urls\n urls = download_urls\n if xpath\n parsed = URI.parse(source_url)\n client.get(source_url).body.xpath(xpath).each do |href|\n value = href.value\n if value[' '] # ca_on_toronto has unescaped spaces\n value = URI.escape(href.value)\n end\n urls << \"#{parsed.scheme}://#{parsed.host}#{URI.parse(value).path}\"\n end\n end\n urls\n end",
"title": ""
},
{
"docid": "07734e5e6cc4ee2849de790e1b0b6e06",
"score": "0.5399024",
"text": "def sources\n @sources ||= Sources.new(raw_sources)\n end",
"title": ""
}
] |
1ccf474702afef6f76b67bf7b38af8cb | Important words from a string | [
{
"docid": "303f2488637f408e26cfedd932332f03",
"score": "0.7373642",
"text": "def important_words\n str = self\n str = str.gsub(/ +/, ' ').strip\n parts = str.split(' ')\n parts.reject { |p| p.length <= 3 }.join(' ')\n end",
"title": ""
}
] | [
{
"docid": "dc6689717172447558178555416d9d21",
"score": "0.7688285",
"text": "def words\n unless @words\n @words = @string.gsub( /[,\\\"\\\\]/, \"\" ).gsub( /\\+/, \" \" ).split.select do |word|\n case word\n # Ignore really common words.\n when \"a\", \"of\", \"the\", \"to\", \"or\", \"in\", \"is\", \"and\", \"for\", \"+\", \"on\", \"at\", \"!\", \"-\"\n false\n # Ignore things that will generally be Google directives.\n when /^-[a-z]+?:/\n false\n else\n true\n end\n end.uniq\n end\n @words\n end",
"title": ""
},
{
"docid": "7aa454facc2726008931bf1ddcf1a97d",
"score": "0.7382933",
"text": "def words\n @words ||= self.class.permutate(@string).sort.map do |word|\n [Dictionary.include?(word), word] \n end\n end",
"title": ""
},
{
"docid": "f5d74ccdc40f6cb703deb10f936e5255",
"score": "0.72606283",
"text": "def words_from_string(string)\n string.downcase.gsub(/[^a-z\\-0-9_\\s]/, '').split(' ') #ignores punctuation, line endings, and is case insensitive\nend",
"title": ""
},
{
"docid": "c22742383d14f57fcf9edab7dfa2e13c",
"score": "0.7222601",
"text": "def words\n %w(\n shit\n shitty\n fuck\n fucked\n fucking\n ass\n asshole\n cunt\n dick\n cock\n pussy\n )\n end",
"title": ""
},
{
"docid": "b39ce78f697fd43fcacf4b0eee058516",
"score": "0.71417904",
"text": "def words_from_string(string) \t\t\t# downcase returns a lowercase version of a string\n\tstring.downcase.scan(/[\\w']+/)\t\t# scan returns an array of substrings that match a pattern\n\tend",
"title": ""
},
{
"docid": "b1662b6a71b3b3c1b9e3a3195090efa5",
"score": "0.71265966",
"text": "def words\n # Actively scan for word characters instead of splitting on space characters so that punctuation is ignored.\n unnormalized_words = string.scan(/\\w+/)\n normalized_word = unnormalized_words.map(&:downcase)\n\n normalized_word\n end",
"title": ""
},
{
"docid": "380900503062b17e47ea3855bdf8d807",
"score": "0.7091515",
"text": "def words(str)\n str.to_s.downcase.scan(/[A-Za-z0-9\\_]+/)\n end",
"title": ""
},
{
"docid": "5f6da753872312359536e7f511a9b4f6",
"score": "0.70525396",
"text": "def subwords(str)\n dictionary = File.readlines(\"dictionary.txt\").map(&:chomp)\n\n real_words = substrings(str).select { |word| dictionary.include?(word) }\n\n real_words\n end",
"title": ""
},
{
"docid": "1e647d35829073298cc9e9f87bbf6ca9",
"score": "0.6993341",
"text": "def get_words(line)\n line=line.split(/[^[[:word:]]]+/)\n line\n end",
"title": ""
},
{
"docid": "65a60c3f7912789dcc6502c9aa7269e4",
"score": "0.6929438",
"text": "def words(string)\n string.split(' ')\n end",
"title": ""
},
{
"docid": "1c9abfd5a9b1377e2877bb57179932dd",
"score": "0.68981797",
"text": "def words_from_string(string)\n string.downcase.scan(/[\\w'']+/) # => [\"this\", \"is\", \"a\", \"five\", \"worder\"]\n end",
"title": ""
},
{
"docid": "1e6485296c7373330dbc12d33b804a09",
"score": "0.68794876",
"text": "def words\n [\n \"geography\", \"cat\", \"yesterday\", \"java\", \"truck\", \"opportunity\",\n \"fish\", \"token\", \"transportation\", \"bottom\", \"apple\", \"cake\",\n \"remote\", \"boots\", \"terminology\", \"arm\", \"cranberry\", \"tool\",\n \"caterpillar\", \"spoon\", \"watermelon\", \"laptop\", \"toe\", \"toad\",\n \"fundamental\", \"capitol\", \"garbage\", \"anticipate\", \"pesky\"\n ]\n end",
"title": ""
},
{
"docid": "27409f41f66d73803e6d3bab5b699e1d",
"score": "0.68425345",
"text": "def words_from_string(string)\n string.downcase.scan(/[\\w']+/)\nend",
"title": ""
},
{
"docid": "27409f41f66d73803e6d3bab5b699e1d",
"score": "0.68425345",
"text": "def words_from_string(string)\n string.downcase.scan(/[\\w']+/)\nend",
"title": ""
},
{
"docid": "27409f41f66d73803e6d3bab5b699e1d",
"score": "0.68425345",
"text": "def words_from_string(string)\n string.downcase.scan(/[\\w']+/)\nend",
"title": ""
},
{
"docid": "ef931e6e83b5b720d6612655e729f218",
"score": "0.6833797",
"text": "def words\n @phrase.\n split(/[\\n ,]/).\n map {|w| normalize_word(w) }.\n delete_if {|w| w.empty? }\n end",
"title": ""
},
{
"docid": "613b75da4f294bc38bd2657f7901c3bf",
"score": "0.68276834",
"text": "def words\n\t\tscan(/\\w[\\w\\-\\']*/)\n\tend",
"title": ""
},
{
"docid": "203a35c4c226cb4b220fa78f5e3de302",
"score": "0.6795589",
"text": "def words\n gsub(/[^A-Za-z0-9_-|\\s]/, '').downcase.split(\" \").uniq\n end",
"title": ""
},
{
"docid": "b1ed0e33c4d80d92a69224075e78dcac",
"score": "0.6790184",
"text": "def words\n scan(/\\w[\\w\\'\\-]*/)\n end",
"title": ""
},
{
"docid": "8258e20d3846dd2aa958375b1a943f10",
"score": "0.6739933",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n text.scan(/un+\\S+ing/)\nend",
"title": ""
},
{
"docid": "f70405266677129cf7a9b2e9608f35f1",
"score": "0.6717421",
"text": "def words\n @words = text.split(/[^a-zA-Z]/).delete_if { |word| word.empty? }\n end",
"title": ""
},
{
"docid": "8765b8fe023a84f4df81562e92d13215",
"score": "0.6707609",
"text": "def words\n @text.downcase.scan(/[a-z]+/)\n end",
"title": ""
},
{
"docid": "d6effa494b04478c5176dc74111ef2b3",
"score": "0.67056453",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n text.scan(/un\\w+ing/)\nend",
"title": ""
},
{
"docid": "fc9ef454c69538538a3f1b28894ebe2b",
"score": "0.67012155",
"text": "def words\n @words ||= text.split(/[[:space:]!|\\\\;:,\\.\\?\\/'\\(\\)\\[\\]]/)\n end",
"title": ""
},
{
"docid": "201d19bab61a36dde2974f3d9a1848d6",
"score": "0.66998667",
"text": "def words_from_string(string) # string = \"this is a five worder\"\n string.downcase.scan(/[\\w'']+/) # => [\"this\", \"is\", \"a\", \"five\", \"worder\"]\n end",
"title": ""
},
{
"docid": "201d19bab61a36dde2974f3d9a1848d6",
"score": "0.66998667",
"text": "def words_from_string(string) # string = \"this is a five worder\"\n string.downcase.scan(/[\\w'']+/) # => [\"this\", \"is\", \"a\", \"five\", \"worder\"]\n end",
"title": ""
},
{
"docid": "201d19bab61a36dde2974f3d9a1848d6",
"score": "0.66998667",
"text": "def words_from_string(string) # string = \"this is a five worder\"\n string.downcase.scan(/[\\w'']+/) # => [\"this\", \"is\", \"a\", \"five\", \"worder\"]\n end",
"title": ""
},
{
"docid": "201d19bab61a36dde2974f3d9a1848d6",
"score": "0.66998667",
"text": "def words_from_string(string) # string = \"this is a five worder\"\n string.downcase.scan(/[\\w'']+/) # => [\"this\", \"is\", \"a\", \"five\", \"worder\"]\n end",
"title": ""
},
{
"docid": "201d19bab61a36dde2974f3d9a1848d6",
"score": "0.66998667",
"text": "def words_from_string(string) # string = \"this is a five worder\"\n string.downcase.scan(/[\\w'']+/) # => [\"this\", \"is\", \"a\", \"five\", \"worder\"]\n end",
"title": ""
},
{
"docid": "201d19bab61a36dde2974f3d9a1848d6",
"score": "0.66998667",
"text": "def words_from_string(string) # string = \"this is a five worder\"\n string.downcase.scan(/[\\w'']+/) # => [\"this\", \"is\", \"a\", \"five\", \"worder\"]\n end",
"title": ""
},
{
"docid": "201d19bab61a36dde2974f3d9a1848d6",
"score": "0.66998667",
"text": "def words_from_string(string) # string = \"this is a five worder\"\n string.downcase.scan(/[\\w'']+/) # => [\"this\", \"is\", \"a\", \"five\", \"worder\"]\n end",
"title": ""
},
{
"docid": "55b2db708ce983114042e16be39eb1fb",
"score": "0.6697241",
"text": "def words\n @phrase.split(' ')\n end",
"title": ""
},
{
"docid": "abc7834ee42f91120bf3e0063d6ee9c0",
"score": "0.6694579",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n text.split().grep(/\\bun\\w+ing\\b/)\nend",
"title": ""
},
{
"docid": "a28181b1f485808fe65c6ff139545f2f",
"score": "0.6689688",
"text": "def words\n phrase.split\n end",
"title": ""
},
{
"docid": "4c380a473e0ec7886b3287426044e2c6",
"score": "0.66854835",
"text": "def words\n\t\tscan(/\\w[\\w\\'\\-]*/)\t\t\t\t\t# %Q - double quote, %q - single quote, \\w - word character [a-zA-Z0-9]\n\tend",
"title": ""
},
{
"docid": "3d6f0e3a3f5a00d38bc39d7a2347ab4a",
"score": "0.66831696",
"text": "def extract_words(string)\n words = []\n (1..3).each do |length| #break the string by half at position 1,2,3\n first = string[0..length]\n second = string[length+1..string.size-1]\n \n if contain?(first.downcase) && contain?(second.downcase)\n words << [first, second]\n end\n end\n\n return words\n end",
"title": ""
},
{
"docid": "5bcec2ed66155f7401ccf03296d5f4f7",
"score": "0.6680122",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n text.scan(/un\\w+ing/)\nend",
"title": ""
},
{
"docid": "6f4b4ef5055348d42a4032458d9984e0",
"score": "0.6671882",
"text": "def words\n phrase.downcase.split(/[^'[[:alnum:]]]/).reject(&:empty?)\n end",
"title": ""
},
{
"docid": "3b2cac60347fb3ce4a88ba51c110ee78",
"score": "0.66685665",
"text": "def o_words(string)\n string.split.select { |word| word.include?('o') }\nend",
"title": ""
},
{
"docid": "ccb58e4dcad7a8c28c4d0bc22db87291",
"score": "0.6656476",
"text": "def clean_words_string(words,use_stem = true)\n if use_stem\n block = lambda { |word| KeywordDensity.make_stem(word) }\n else\n block = lambda { |word| KeywordDensity.make_phrase_singular(word) }\n end\n words.split(' ').delete_if do |word|\n word.length <= 2 ||\n stop_word?(word)\n end.collect( &block )\n end",
"title": ""
},
{
"docid": "39e623b0b79353885ef9a2df99db4a25",
"score": "0.6652808",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n text.scan(/\\bun\\w+ing\\b/)\nend",
"title": ""
},
{
"docid": "6f8a4d1dfd55e8bbeefa9e489c3489d3",
"score": "0.6652068",
"text": "def clean_words_string(words,use_stem = true)\r\n if use_stem\r\n block = lambda { |word| KeywordDensity.make_stem(word) }\r\n else\r\n block = lambda { |word| KeywordDensity.make_phrase_singular(word) }\r\n end\r\n words.split(' ').delete_if do |word|\r\n word.length <= 2 ||\r\n stop_word?(word)\r\n end.collect( &block )\r\n end",
"title": ""
},
{
"docid": "95d608ccaead20e5d9dda86d034145bb",
"score": "0.66514796",
"text": "def add_words my_string, dictionary\n new_words = my_string.split(\" \")\n new_words.each do |word|\n # remove any returns or spaces\n word.strip!\n # remove possesive case\n if word[-2..-1] == \"'s\"\n word.slice!(-2, 2)\n end\n # remove any preceeding non-alphabetical characters\n while (word.length > 0) && (word[0].match(/[a-zA-Z]/) == nil)\n # note: can not call match() on nil strings. must check length first\n word.slice!(0)\n end\n # remove any trailing non-alphabetical characters\n while (word.length > 0) && (word[-1].match(/[a-zA-Z]/) == nil)\n # note: can not call match() on nil strings. must check length first\n word.slice!(-1)\n end\n # don't add empty strings\n if (word.length > 0) && (!dictionary.include?(word))\n dictionary.push(word.downcase)\n end\n end\nend",
"title": ""
},
{
"docid": "c615346b64ed5119a504f6f0cd73fd31",
"score": "0.6646763",
"text": "def brak_words(stuff\n words = stuff.split(\" \")\n word\nend",
"title": ""
},
{
"docid": "7a2101f6966fd74b8094ddc90b302649",
"score": "0.6646127",
"text": "def words (text)\n return text.scan(/[a-z]+/)\n end",
"title": ""
},
{
"docid": "97fd4a7f4b77c95e007162d525e60af8",
"score": "0.6640754",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n text.scan(/un\\w+ing\\b/)\nend",
"title": ""
},
{
"docid": "50f5d1e529cd0f8f87e3043e28436762",
"score": "0.6639006",
"text": "def words(text)\n text.downcase.scan(/[a-z]+/)\n end",
"title": ""
},
{
"docid": "2567880d237ecae244d2eceab674aa8e",
"score": "0.6635911",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n\nend",
"title": ""
},
{
"docid": "f9a0062e821758e4738093713386b91c",
"score": "0.6624708",
"text": "def sub_bad_words\n\n end",
"title": ""
},
{
"docid": "4c7445741ada3947f2be29536da5afcc",
"score": "0.66103274",
"text": "def translate string\n words = string.split(' ')\n words.map! {|word| examine word}\n words.join(' ')\nend",
"title": ""
},
{
"docid": "2556bba1bcfee2ce8677c1566db6a060",
"score": "0.6608604",
"text": "def get_words(mensagem_texto)\n mensagem_texto.scan(/[\\w-]+/)\nend",
"title": ""
},
{
"docid": "2556bba1bcfee2ce8677c1566db6a060",
"score": "0.6608604",
"text": "def get_words(mensagem_texto)\n mensagem_texto.scan(/[\\w-]+/)\nend",
"title": ""
},
{
"docid": "3286a5748ed1370ab2dbb272dc9c04c3",
"score": "0.6604223",
"text": "def o_words(str)\n arr = str.split(\" \")\n return arr.select { |element| element.include?(\"o\") }\nend",
"title": ""
},
{
"docid": "e6b574a2f8404c33c920891c6a18f18a",
"score": "0.6590969",
"text": "def words\n\t\tscan(/\\w+/u)\n\tend",
"title": ""
},
{
"docid": "aa2558697c2bbddca3d65d4c079ebbc4",
"score": "0.658563",
"text": "def phraseable_words\n words - COMMON_WORDS\n end",
"title": ""
},
{
"docid": "5205c9ccf985e11ac66ae64be5bc8102",
"score": "0.6570227",
"text": "def o_words(sentence)\n # Write your code here\n sentence.split(\" \").select{|words|words unless !words.downcase.include? \"o\"}\n #map return also nil while select return only detected words\nend",
"title": ""
},
{
"docid": "f3aa73bafcfafae4e1cffe31cbc15b97",
"score": "0.6570068",
"text": "def o_words(sentence)\n return sentence.split(\" \").select { |ele| ele.include?(\"o\") }\nend",
"title": ""
},
{
"docid": "ab4240fb5611f9b216008d3fd43e7527",
"score": "0.6552",
"text": "def words\n reject { |arg| arg.index('-') == 0 }\n end",
"title": ""
},
{
"docid": "139724247fa5ce31b30d3db12b3fe7e6",
"score": "0.65404874",
"text": "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end",
"title": ""
},
{
"docid": "139724247fa5ce31b30d3db12b3fe7e6",
"score": "0.65404874",
"text": "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end",
"title": ""
},
{
"docid": "139724247fa5ce31b30d3db12b3fe7e6",
"score": "0.65404874",
"text": "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end",
"title": ""
},
{
"docid": "139724247fa5ce31b30d3db12b3fe7e6",
"score": "0.65404874",
"text": "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end",
"title": ""
},
{
"docid": "139724247fa5ce31b30d3db12b3fe7e6",
"score": "0.65404874",
"text": "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end",
"title": ""
},
{
"docid": "139724247fa5ce31b30d3db12b3fe7e6",
"score": "0.65404874",
"text": "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end",
"title": ""
},
{
"docid": "139724247fa5ce31b30d3db12b3fe7e6",
"score": "0.65404874",
"text": "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end",
"title": ""
},
{
"docid": "139724247fa5ce31b30d3db12b3fe7e6",
"score": "0.65404874",
"text": "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end",
"title": ""
},
{
"docid": "139724247fa5ce31b30d3db12b3fe7e6",
"score": "0.65404874",
"text": "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end",
"title": ""
},
{
"docid": "139724247fa5ce31b30d3db12b3fe7e6",
"score": "0.65404874",
"text": "def words (text)\n return text.downcase.scan(/[a-z]+/) #find all matches of this simple regular expression\n end",
"title": ""
},
{
"docid": "d966c5c341625f24d921f7608601ff1c",
"score": "0.6533186",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n#returns an array with the words starting with 'un' and ending with 'ing'\n text.scan(/un\\w+ing/)\n #text.scan(/un\\w+ing\\b/)\nend",
"title": ""
},
{
"docid": "9252dce2d9e75d8236043926d3b8cab5",
"score": "0.6524012",
"text": "def words\n scan(/\\S+/)\n end",
"title": ""
},
{
"docid": "0ecc99576fc7e412d8f827b5b340b28f",
"score": "0.650335",
"text": "def o_words(sentence)\n #sentence = sentence.split(\" \")\n return sentence.split.select { |ele| ele.include?(\"o\") }\nend",
"title": ""
},
{
"docid": "bfe838c0f8716a24410b2df825fbfd25",
"score": "0.64932513",
"text": "def words_with(*letters)\n @lines.select{ |term| \n letters.any?{ |letter|\n term.match(/#{letter}/) \n }\n }\n end",
"title": ""
},
{
"docid": "59ece8beec13bcaa50053384ce085218",
"score": "0.64928615",
"text": "def oneAndTwoWordStrings(str)\n min_word_length = 3\n \tkeywords = str.split(' ').reject{ |word| word.length < min_word_length }\n \n \tn = keywords.length \n \tnewwords = (0..(n-2)).collect { |i| keywords[i] + \" \" + keywords[i+1] }\n \treturn (keywords + newwords)\n end",
"title": ""
},
{
"docid": "dddba5e5bb52ac296f53b53be47bb5f7",
"score": "0.64908",
"text": "def words\n text.words.map {|word| word.to_s}.uniq\n end",
"title": ""
},
{
"docid": "5d9c30020471a3f5454b25e01d45aa87",
"score": "0.6480891",
"text": "def bad_words\n [\n \"biatch\",\n \"bitch\",\n \"chinaman\",\n \"chinamen\",\n \"chink\",\n \"crip\",\n \"cunt\",\n \"dago\",\n \"daygo\",\n \"dego\",\n \"dick\",\n \"douchebag\",\n \"dyke\",\n \"fag\",\n \"fatass\",\n \"fatso\",\n \"gash\",\n \"gimp\",\n \"golliwog\",\n \"gook\",\n \"gyp\",\n \"homo\",\n \"hooker\",\n \"jap\",\n \"kike\",\n \"kraut\",\n \"lardass\",\n \"lesbo\",\n \"negro\",\n \"nigger\",\n \"paki\",\n \"pussy\",\n \"raghead\",\n \"retard\",\n \"shemale\",\n \"skank\",\n \"slut\",\n \"spic\",\n \"tard\",\n \"tits\",\n \"titt\",\n \"trannies\",\n \"tranny\",\n \"twat\",\n \"wetback\",\n \"whore\",\n \"wop\"\n ]\n end",
"title": ""
},
{
"docid": "109b400a4ce7efec640dfb25609f6f90",
"score": "0.6479808",
"text": "def words_in(text)\n emojies_in(text) + sanitize(text).split\n end",
"title": ""
},
{
"docid": "4f119edf387a884580418a6c8175caee",
"score": "0.6473709",
"text": "def words\n @content.scan(/[[[:alpha:]]']+/)\n end",
"title": ""
},
{
"docid": "fe44ae14fb3c702e24d61ebe1cfa7056",
"score": "0.64734477",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n txt_arr = text.split(\" \")\n ret = txt_arr.grep(/un[a-zA-Z]*ing/)\n ret\nend",
"title": ""
},
{
"docid": "e442c19266871abd1d2a35ddbafdc3d4",
"score": "0.6470936",
"text": "def o_words(sentence)\n sentence.split(\" \").select {|w| w.include?(\"o\")}\nend",
"title": ""
},
{
"docid": "35ad8a6360d45c5023ced6ef4470d449",
"score": "0.64557505",
"text": "def words(text)\n text.downcase.scan(/[a-z]+/)\nend",
"title": ""
},
{
"docid": "a7754fdc89e22cd860851feaee47a809",
"score": "0.64479464",
"text": "def subwords(str)\n words = File.readlines('dictionary.txt').map(&:chomp)\n substrings(str).select { |word| words.include?(word) }\nend",
"title": ""
},
{
"docid": "321aa47ba0a4acfb0c35ca0b41e39d9c",
"score": "0.64354324",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n array = []\n array2 = []\n array = text.split(\" \")\n array2 = array.grep(/\\bun\\w+ing\\b/)\n array2\nend",
"title": ""
},
{
"docid": "345554729364d9406e128ae4a26b2393",
"score": "0.6424678",
"text": "def o_words(sentence)\n sentence = sentence.split(\" \")\n return sentence.select { |ele| ele.include?(\"o\") }\nend",
"title": ""
},
{
"docid": "20030c8a498c1c9e1aea55c65bba0fd2",
"score": "0.6421149",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n # return an array (scan method)\n # find \"un\" string: un\n # match the word that has \"un\" string: \\w+\n # find \"ing\" string at the end of the word (\\b is a word boundary): ing\\b\n text.scan(/un\\w+ing\\b/)\nend",
"title": ""
},
{
"docid": "7a977b87da288b14828ad4ffc5d18073",
"score": "0.6405398",
"text": "def get_perfect_words\n filtered_text.split(WORDS_DELIMITER).reject { |w| !(3..9).include?(w.length) }\n end",
"title": ""
},
{
"docid": "3f740eedc04c2f98f8c1120bc1fd9839",
"score": "0.6405162",
"text": "def get_subwords(word)\n word.underscore.\n gsub(\"_\", \" \").\n gsub(\"-\", \" \").\n split(\" \")\nend",
"title": ""
},
{
"docid": "f99160b2324ae5dae35525d802347836",
"score": "0.6397641",
"text": "def words_after(word)\n shakespeare = File.read(File.dirname(__FILE__) + '/Shakespeare.txt')\n shakespeare.scan(Regexp.new(word + ' (\\w+)')).uniq.flatten\nend",
"title": ""
},
{
"docid": "8d3a757a3eaf6a2c3e6b2a898d8aef9c",
"score": "0.63789135",
"text": "def subwords(string)\n dictionary = []\n # or can use dictionry = File.foreach('dictionary.txt').map(&:chomp)\n File.foreach('dictionary.txt') do |f|\n dictionary << f.chomp\n end\n substrings(string).select { |word| dictionary.include? word }\n\nend",
"title": ""
},
{
"docid": "2624fe3b623c4be4050ca91fe64d22f7",
"score": "0.63740546",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n array = []\n text_array = text.split\n array = text_array.grep(/\\Aun\\w+ing\\Z/)\n array\nend",
"title": ""
},
{
"docid": "19ca7e3294085f20d38349238b89ba95",
"score": "0.6370452",
"text": "def words\n self.split(/\\W+/)\n end",
"title": ""
},
{
"docid": "01fec65702deee713fe6601895a433fa",
"score": "0.6369048",
"text": "def words_with_part(part)\n words.select { |w| w.include?(part) }\n end",
"title": ""
},
{
"docid": "43bb9c6ef03f3d12667223fb0264920f",
"score": "0.6363825",
"text": "def words\n self.split(/[\\s\\W]+/)\n end",
"title": ""
},
{
"docid": "babe4dba21b2601ad417a364817ee23f",
"score": "0.63589954",
"text": "def get_words\n page = Nokogiri::HTML(open(\"http://wiki.dothraki.org/Idioms_and_Phrases\"))\n dictionary = page.css(\"li b\").text\n words = dictionary.split(/\\b/)\n words.delete_if {|element| element == \" \" || element == \"'\" || element == \"!\" || element == \"?\" || element == \".\"}\n words.pop\n words.delete(\"vikeesichomakvichomerakyershafkaShekhikhiGweholatMe\")\n words\nend",
"title": ""
},
{
"docid": "472d6a3705351f5d70b6021fbe336d45",
"score": "0.6353076",
"text": "def o_words(sentence)\n sentence.split.select { |i| i if i.include?('o') }\nend",
"title": ""
},
{
"docid": "d8f449ec58da50557f5e9d3606aab8b1",
"score": "0.63503253",
"text": "def o_words(sentence)\n \n formatArr = sentence.split(\" \")\n returnArr = formatArr.select { |ele| ele.include?(\"o\")}\n\n return returnArr\n\n\n\nend",
"title": ""
},
{
"docid": "67841c55a16fd3e4e470955cca03890f",
"score": "0.63455963",
"text": "def sanitized_words\n @words = @tweet.split(\" \")\n\n remove_short_words\n remove_non_alpha_words\n\n @words\n end",
"title": ""
},
{
"docid": "67841c55a16fd3e4e470955cca03890f",
"score": "0.63455963",
"text": "def sanitized_words\n @words = @tweet.split(\" \")\n\n remove_short_words\n remove_non_alpha_words\n\n @words\n end",
"title": ""
},
{
"docid": "d77f7d8e4155e7de3a17e97066c18c90",
"score": "0.63442296",
"text": "def subwords(string)\n words = []\n File.foreach('dictionary.txt') { |line| words << line.chomp }\n all_substrings = substrings(string)\n all_substrings.select { |word| words.include?(word) }\nend",
"title": ""
},
{
"docid": "9dc6e92f2e4860305371e21d4996d4ed",
"score": "0.6342704",
"text": "def whisper_words(words)\n return words.map {|w| w.downcase+\"...\"}\nend",
"title": ""
},
{
"docid": "4d84a6a84791f0dc792b9adb4aeef96a",
"score": "0.6334796",
"text": "def words\n self.clean_words.split(' ')\n end",
"title": ""
}
] |
96f6a3d193e8feace6982734c5ff01fe | method for saving posted image locally | [
{
"docid": "94c8395a3697bc468e0c74b5ea9640e8",
"score": "0.5761403",
"text": "def upload_image\n uploaded_image = params[:image_id]\n image_size = uploaded_image.size\n filename = uploaded_image.original_filename\n @user = User.find(params[:id])\n\n # gets the type of image and saves relevant user variable\n if params[:type] == 'avatar'\n @user.image_id = filename\n else\n @user.verification = filename\n end\n \n # saves the file locally if image size is <= 2MB and filename is not nil\n if @user.save and image_size <= 2.megabytes\n File.open(Rails.root.join('app', 'assets', 'images', filename), 'wb') do |file|\n file.write(uploaded_image.read)\n end\n flash[:success] = 'Image uploaded!'\n redirect_to edit_user_path(@user)\n else\n flash[:danger] = 'Could not upload image, verify that size less than 2MB'\n redirect_to edit_user_path(@user)\n end\n end",
"title": ""
}
] | [
{
"docid": "9d740ced620df8f881711dfd9a04507f",
"score": "0.69373304",
"text": "def picture_save \n \tuploader = ImageUploader.new\n \tuploader.store!(image)\n \timage = uploader.store_dir\n \tsave\n end",
"title": ""
},
{
"docid": "d8c552776fefeff760ba232285a15c38",
"score": "0.69338715",
"text": "def save\n persist! do\n question.user = user\n question.image_url = question.upload(image: image, filename: filename)\n question.save!\n end\n end",
"title": ""
},
{
"docid": "6c314d0cfe3a185384cd0fceb1a6b088",
"score": "0.6886218",
"text": "def save_image(url)\n file_name = get_filename(url)\n dir_name = '/vagrant/bookinfo/public/'\n file_path = dir_name + file_name\n\n mechanize = Mechanize.new\n page = mechanize.get(url)\n page.save_as(file_path)\n\n return file_path\n end",
"title": ""
},
{
"docid": "b9760debcbd970870cc282fd2bf406b3",
"score": "0.67645454",
"text": "def save_to_file image\n File.open('uml.png', 'wb') do |file|\n file << image.body\n end if image\n end",
"title": ""
},
{
"docid": "d9b33cf13f1d38985cd5954489acf311",
"score": "0.6737191",
"text": "def save_picture(data)\n File.open('public/images/'+ self.picture,'w') do |f|\n f.write data\n end\n end",
"title": ""
},
{
"docid": "351b237ad3271397f94dd8abafa6519b",
"score": "0.6728903",
"text": "def save_file(upload)\n\t\t\tfilename = upload[0].original_filename\n\t\t\tfilepath = Rails.root.join('public', 'img', filename)\n\n\t\t\tFile.open(filepath, 'wb') do |file|\n\t\t\t\tfile.write(upload[0].read)\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "b57c34f7d254c038b2be58de96e8ed60",
"score": "0.6715395",
"text": "def save_to_file\n f = File.open(\"#{IMAGE_DATA_DIR}/#{self.id}\",\"w\")\n f.write(self.data)\n f.close\n end",
"title": ""
},
{
"docid": "7158686e1c77716c39c42381f6dfc492",
"score": "0.67078763",
"text": "def store_image\n if @file_data\n FileUtils.mkdir_p Img_Store\n File.open(image_filename, 'wb') do |f|\n f.write (@file_data.read)\n end\n @file_data = nil\n end\n end",
"title": ""
},
{
"docid": "020662ce5d33eccbe11cf73e59abdc37",
"score": "0.66636276",
"text": "def create\n @post = Post.new(post_params)\n @post.user_id = @current_user.id\n @post.save\n image = post_params[:image]\n @post.image_name = \"#{@post.id}.jpg\"\n\n respond_to do |format|\n if @post.save\n\n File.binwrite(Rails.root.join(\"public\", \"text_images\", @post.image_name), image.read)\n format.html { redirect_to @post, notice: '投稿しました' }\n format.json { render :show, status: :created, location: @post }\n else\n @post.destroy\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "410504bb2033f7c1b4a3d8cfc794793c",
"score": "0.6657013",
"text": "def image_save_path\n @image_save_path\n end",
"title": ""
},
{
"docid": "96a761f99ee386ce4431f04bda22c2e8",
"score": "0.66537917",
"text": "def write_image(filename, decoded_image)\r\n\r\n f = File.new \"./public/images/blog/#{filename}\", \"wb\"\r\n f.write(decoded_image)\r\n f.close if f\r\n\r\n end",
"title": ""
},
{
"docid": "9dd1eaca4cc9a373b1e5b559171be521",
"score": "0.6645605",
"text": "def saveProfileImage\n profileImageData = params[:picture]\n filepath =\"\"\n unless profileImageData.original_filename.blank?\n filename = Digest::SHA1.hexdigest(Time.now.to_i().to_s())\n filename= \"profile\"+filename+\".png\"\n logger.info(filename);\n filedir = \"public/profile/\"\n filepath = File.join(filedir,filename)\n \n f = File.open(filepath, \"wb\")\n f.write(profileImageData.read)\n f.close\n filepath =\"profile/\"+filename \n end\n respond_to do |format|\n if filepath!=\"\"\n format.html { render action: 'new'}\n format.json { render :text => \"#{filepath}\"}\n else\n format.html { render action: 'new' }\n format.json { render :text => \"-1\" }\n end\n end\n \n end",
"title": ""
},
{
"docid": "71f82e4670e4400ba5d5d98627a49dee",
"score": "0.65798444",
"text": "def create\n @et_report = EtReport.new(et_report_params)\n if params[:et_report][:i_image].present?\n @et_report.i_image = params[:et_report][:i_image].original_filename\n \n File.open(\"public/images/#{@et_report.i_image}\",'w+b') { |f|\n f.write(params[:et_report][:i_image].read)}\n end\n \n respond_to do |format|\n if @et_report.save\n format.html { redirect_to @et_report, notice: 'Et report was successfully created.' }\n format.json { render :show, status: :created, location: @et_report }\n else\n format.html { render :new }\n format.json { render json: @et_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4350034f12e6112df453d3ab5cb10419",
"score": "0.6481992",
"text": "def save_path\n @save_path ||= self.class.image_save_path.dup\n end",
"title": ""
},
{
"docid": "9090a5d696675bb1d7cfc783d1f81aec",
"score": "0.6477714",
"text": "def save_img(filename)\n @img.save(filename, :fast_rgb)\n end",
"title": ""
},
{
"docid": "83ce3871614033cfbd8967937a98ea98",
"score": "0.64712685",
"text": "def save_picture(data)\n File.open('public/images/areas/'+ self.profile_picture,'w') do |f|\n f.write data\n end\n end",
"title": ""
},
{
"docid": "dc4db5d330ec160e3c6088976875ada6",
"score": "0.64554125",
"text": "def save\r\n # Draw a frame.\r\n frame = Draw.new\r\n frame.stroke(\"black\")\r\n frame.stroke_width(2)\r\n frame.fill_opacity(0)\r\n frame.rectangle(0, 0, @image.columns-1, @image.rows-1)\r\n frame.draw(@image)\r\n \r\n @image.write(name + '.png')\r\n end",
"title": ""
},
{
"docid": "cc4c6030040feed52780afe076c1072d",
"score": "0.6432419",
"text": "def save_image!(rmagick_image, model_image_attr, tmp_filename='custom')\n t_custom = Tempfile.new([tmp_filename, '.jpg'])\n rmagick_image.write(t_custom.path)\n model_image_attr.store!(File.open(t_custom.path))\n send(\"write_#{model_image_attr.mounted_as}_identifier\")\n save # pretty sure we need to save the model\n t_custom\n end",
"title": ""
},
{
"docid": "f6af2b3d45087112d77bfc099099997c",
"score": "0.64019233",
"text": "def store_image\n uri = URI.parse(profile_image_url)\n Net::HTTP.start(uri.host, uri.port) do |http|\n resp = http.get(uri.path)\n open(image_path, \"wb\") do |file|\n file.write(resp.body)\n end\n end\n end",
"title": ""
},
{
"docid": "3bc5522a7f9eeaf902e2426be122d6da",
"score": "0.6399872",
"text": "def upload\n if File.exists?(file_path = \"/home/redroid/motion_detection_images/#{params[:img]}.jpg\")\n send_403_forbidden\n else\n File.open(file_path, 'wb') { |file| file.write(request.raw_post)}\n send_200_ok\n end\nend",
"title": ""
},
{
"docid": "40329b94b95f405a0cb3a10324f07aac",
"score": "0.6368507",
"text": "def save_image_to_file( image_url, filename )\n image_uri = URI.parse( image_url )\n data = Net::HTTP.get_response( image_uri.host, image_uri.path ).body\n open( filename, 'w' ) do |f|\n f.write( data )\n end\n end",
"title": ""
},
{
"docid": "203b6d1ec865e2e94f1acf3975c14844",
"score": "0.63184303",
"text": "def create\n @image = Image.new(image_params)\n @image.generate_filename # a function you write to generate a random filename and put it in the images \"filename\" variable\n @image.user = current_user\n @uploaded_io = params[:image][:uploaded_file]\n File.open(Rails.root.join('public', 'images', @image.filename), 'wb') do |file|\n file.write(@uploaded_io.read)\n end\n\n if @image.save\n redirect_to @image, notice: 'Image was successfully created.'\n else\n render :new\n end\n\n #if @image.save\n #redirect_to @image, notice: 'Image was successfully created.'\n #else\n #render :new\n #end\n end",
"title": ""
},
{
"docid": "d1d30406f8838c4f88fce4c4829d828e",
"score": "0.63152015",
"text": "def save(path='result.jpg')\n @canvas.write(path)\n end",
"title": ""
},
{
"docid": "ef18fba57607b33f631d8b300a8aba82",
"score": "0.62680286",
"text": "def save\n\n properties = {}\n # exif = {}\n # KCGImagePropertyExifDictionary\n # exif[KCGImagePropertyExifUserComment] = 'Image downloaded from www.sheetmusicplus.com'\n # exif[KCGImagePropertyExifAuxOwnerName] = 'www.sheetmusicplus.com'\n if @filetype == :pdf\n CGPDFContextEndPage(@ctx)\n CGContextFlush(@ctx)\n return\n elsif @filetype == :png\n format = NSPNGFileType\n elsif @filetype == :tif\n format = NSTIFFFileType\n properties[NSImageCompressionMethod] = NSTIFFCompressionLZW\n #properties[NSImageCompressionMethod] = NSTIFFCompressionNone\n elsif @filetype == :gif\n format = NSGIFFileType\n #properties[NSImageDitherTransparency] = 0 # 1 = dithered, 0 = not dithered\n #properties[NSImageRGBColorTable] = nil # For GIF input and output. It consists of a 768 byte NSData object that contains a packed RGB table with each component being 8 bits.\n elsif @filetype == :jpg\n format = NSJPEGFileType\n properties[NSImageCompressionFactor] = @quality # (jpeg compression, 0.0 = max, 1.0 = none)\n #properties[NSImageEXIFData] = exif\n end\n cgimageref = CGBitmapContextCreateImage(@ctx) # => CGImageRef\n bitmaprep = NSBitmapImageRep.alloc.initWithCGImage(cgimageref) # => NSBitmapImageRep\n blob = bitmaprep.representationUsingType(format, properties:properties) # => NSConcreteData\n blob.writeToFile(@output, atomically:true)\n true\n end",
"title": ""
},
{
"docid": "79f064264018f1a0b04ca28cb0ff5ef0",
"score": "0.6262763",
"text": "def save_photo\n if @photo_data\n directory_name = File.join PHOTO_STORE, self.catalogue.id.to_s\n Dir.mkdir(directory_name) unless File.exists?(directory_name)\n self.image_url = self.id.to_s + @image_extension\n # Write the data out to a file\n name = File.join directory_name, image_url\n File.open(name, 'wb') do |f|\n f.write(@photo_data.read)\n end\n @photo_data = nil\n self.save\n end\n end",
"title": ""
},
{
"docid": "710ac33a4a639bc332f056eed97ed778",
"score": "0.62516075",
"text": "def img_upload(file)\n\t \t# puts \"++++ #{file.inspect} ++++\"\n\t \tpath=File.dirname(__FILE__) + '/public/uploads/' + file[:filename]\n\t \t# puts \"///////\"\n\t \t# puts path\n\t \tFile.open(path, \"w\") do |upload|\n\t \t\tupload.write(file[:tempfile].read)\n\t end\n\t return file[:filename]\n\t end",
"title": ""
},
{
"docid": "9528c78eb445081e03ed00f9cc964597",
"score": "0.6242904",
"text": "def image_file\n outfile = Tempfile.new(['gore_captcha', '.jpg'])\n outfile.binmode\n\n Services.write_image_for_text(text, outfile)\n File.expand_path(outfile.path)\n end",
"title": ""
},
{
"docid": "829f99b781f1c91cd75b938ff8c8dfd9",
"score": "0.6239555",
"text": "def save\n if !persisted?\n gps=EXIFR::JPEG.new(@contents).gps\n @location=Point.new(:lng=>gps.longitude,:lat=>gps.latitude)\n @contents.rewind\n\n description = {}\n description[:content_type]='image/jpeg' \n description[:metadata]={:location=>@location.to_hash} \n\n grid_file = Mongo::Grid::File.new(@contents.read,description)\n @id=Photo.mongo_client.database.fs.insert_one(grid_file).to_s\n end \n\tend",
"title": ""
},
{
"docid": "b66c34996558c2b8a3e6ce62e6d81a60",
"score": "0.62285185",
"text": "def save(name)\n Highgui.save_image name, @iplimage_struct\n end",
"title": ""
},
{
"docid": "c90c7351c01e3109bc1e49223c679d41",
"score": "0.6215512",
"text": "def uploadImage\n post = DataFile.save(params[:upload], \"\")\n \n f = Family.where(turn: -1).first\n if f.nil?\n f = Family.new\n f.turn = -1\n f.save\n end\n \n f.name = post.to_s\n f.save\n \n # render :text => \"File has been uploaded successfully\"\n redirect_to :back\n end",
"title": ""
},
{
"docid": "1127f35599798b3c265f7fd97b078393",
"score": "0.62119025",
"text": "def save\n begin\n requires :bytes\n\n request = BB::Facebook::Request.new(graph: BB::Facebook.graph)\n\n attributes = self.instance_values\n\n req_image_details = request.create_image(BB::Facebook::Account.id, attributes)\n\n unless req_image_details['error'].nil?\n raise BB::Errors::NotFound, \"#{req_image_details['error']['message']}: #{req_image_details['error']['error_user_msg']}\"\n end\n\n begin\n attributes = {\n hash: req_image_details['images']['bytes']['hash'],\n url: req_image_details['images']['bytes']['url']\n }\n rescue Exception => e\n raise BB::Errors::NotFound, \"Convert Image Error\"\n end\n\n image = BB::Facebook::Image.new(attributes)\n\n image.instance_values.each do |key, value|\n send(\"#{key.to_s}=\", value) rescue false\n end\n\n true\n\n rescue BB::Errors::NotFound => e\n self.errors = e\n false\n rescue Exception => e\n self.errors = e\n false \n end\n end",
"title": ""
},
{
"docid": "e38c02e1d4e5cbab9cbf732b32c2f4a3",
"score": "0.6200668",
"text": "def save(params = {})\n params[:name] ||= @pictureName\n params[:save] ||= @picturePath\n @picture.save(File.join(params[:save], params[:name]))\n end",
"title": ""
},
{
"docid": "a5ff723ac70d8e4d1c4c52cd7fe9e621",
"score": "0.61709887",
"text": "def post_image(url, filename)\n post(url) do |req|\n req.body = open(filename).read\n end\n end",
"title": ""
},
{
"docid": "86aaeec66f330204383912a857d5d137",
"score": "0.6160343",
"text": "def safe_save(name, data, loggger)\r\n begin\r\n File.open(ImagesRootBase + name, \"wb\") { |f| f.write(data.read) }\r\n return name\r\n rescue\r\n logger.error(\"Failed to save uploaded file because: \" + $!)\r\n return nil\r\n end\r\n end",
"title": ""
},
{
"docid": "0a79ce808facf28a5ee3e4bc60643fbf",
"score": "0.6157503",
"text": "def image\n @sys_image = resource_find(params[:id])\n uploaded_io = params[:file]\n _size = File.size(uploaded_io)\n write_resource(@sys_image, uploaded_io.read, \"ndz\")\n redirect_to(@sys_image) \n end",
"title": ""
},
{
"docid": "a1291a21b46891ad22f6326a35ccf7fc",
"score": "0.61496437",
"text": "def save_local_path(url)\n return nil if url.nil? || ! url.match(%{^http})\n tmp_file = \"/tmp/#{Digest::SHA1.hexdigest(url)}\"\n agent = Mechanize.new { |_agent| _agent.user_agent = WebStat::Configure.get[\"user_agent\"] }\n image = agent.get(url)\n File.open(tmp_file, \"w+b\") do |_file|\n if image.class == Mechanize::File\n _file.puts(image.body)\n elsif image.respond_to?(:body_io)\n _file.puts(image.body_io.read)\n end\n end\n tmp_file\n rescue\n false\n end",
"title": ""
},
{
"docid": "074e01d90247121421fd63484e2ffb2d",
"score": "0.6146104",
"text": "def create\n if params[:post][:picture_base64].present?\n /data:image\\/(.*);base64,/ =~ params[:post][:picture_base64]\n ext = $1\n data = params[:post][:picture_base64].gsub(/data:image\\/.*;base64,/, '')\n file = Tempfile.new([\"post_picture\", \".#{ext}\"])\n file.binmode\n file.write(Base64.decode64 data)\n params[:post][:picture] = file\n end\n\n @post = Post.new(params[:post])\n\n if @post.save\n redirect_to @post, :notice => 'Post was successfully created.'\n else\n render :action => \"new\"\n end\n\n file.close if params[:post][:picture_base64].present?\n end",
"title": ""
},
{
"docid": "20172833671c2efbd2798e11af0b151e",
"score": "0.61435336",
"text": "def save_attached_files; end",
"title": ""
},
{
"docid": "20172833671c2efbd2798e11af0b151e",
"score": "0.61435336",
"text": "def save_attached_files; end",
"title": ""
},
{
"docid": "9c8e02fad18109ef299c870cc1d6ee84",
"score": "0.6143353",
"text": "def save_file\n if self.file then\n self.file.save\n end\n end",
"title": ""
},
{
"docid": "c930eb4fc841a68fde037731fb9a6351",
"score": "0.61358696",
"text": "def create\n # This path within filesystem to which uploaded\n # file will be copied. Server can not write to\n # assets directory\n directory = \"public/staging\"\n # grab the ActionDispath::Http:UploadedFile object\n file = params[:photo][:file]\n #\n orig_name = file.original_filename\n # This is \"path\" for image per image_tag and asset\n # naming policy\n @image=\"/staging/#{orig_name}\"\n\n if request.post?\n path = File.join(directory, orig_name)\n # copy tmp file into public\n FileUtils.copy(file.tempfile.path, path)\n end\n\n end",
"title": ""
},
{
"docid": "8adbf582854c465504b32a74de99f33f",
"score": "0.6095626",
"text": "def write_out\n File.delete(@path) if File.exist?(@path)\n File.open(@path, mode: 'w', encoding: @img_data.encoding) { |f| f.write(@img_data) }\n end",
"title": ""
},
{
"docid": "57e33b55129b1e4b50c4bf6441b9f9af",
"score": "0.6071129",
"text": "def song_save_image\r\n\r\n\t\t@song = Song.find(params[:song_id])\r\n\t\t@artist = Artist.find_by_url_slug(params[:url_slug])\r\n\r\n\t\t@song.image = \"https://\"+IMAGE_BUCKET+\".s3.amazonaws.com/Three_Repeater-\"+@artist.url_slug+\"-\"+@song.id.to_s+\"-\"+params[:file_name]\r\n\r\n\t\t@song.update_column(:image,@song.image)\r\n\r\n\t\tlogger.info(\"song image= \"+@song.image.to_s)\r\n\r\n\t\trespond_to do |f|\r\n\r\n\t\t\tf.json {\r\n\t\t\t\trender :json => {\r\n\t\t\t\t\t\t:success => true}\r\n\t\t\t}\r\n\r\n\t\tend\r\n\r\n\tend",
"title": ""
},
{
"docid": "4c9f9bf369b6a0a376507a3020b32a3b",
"score": "0.6055671",
"text": "def write( path )\n base_image.write( path )\n end",
"title": ""
},
{
"docid": "a1188d29743bcdeba9ce6a28409c5f44",
"score": "0.6054636",
"text": "def upload_image\n \t@person = Person.find(params[:id])\n \t@person.image = params[:person][:image]\n \t@person.save!\n \tredirect_to @person\n end",
"title": ""
},
{
"docid": "b8847afe2f0e06b741ca16657c1567f5",
"score": "0.6048319",
"text": "def save #always post\n #TODO: don't let people overwrite others' posts by changing the URL\n @post ||= generate_post(@user, {\n :paint_time=>0, \n :in_progress=>true})\n #overwrite work in progress\n if params[:started_at] && @post.paint_time.present?\n @post.paint_time += Time.now.to_i - params[:started_at].to_i\n else\n @post.paint_time = nil\n end\n @post.image = params[:picture]\n @post.anim = params[:chibifile]\n @post.palette = params[:swatches]\n @post.rotation = params[:rotation]\n @post.save!\n \n #save and continue drawing option\n render :text=>\"CHIBIOK\\n\" and return\n end",
"title": ""
},
{
"docid": "cabd4d021428ab7dbaf39f4d6aedc93f",
"score": "0.60304874",
"text": "def session_image\n raise \"no image in session\" if !params[:file_name] || !(file = all_uploaded_files_on_session.detect{|f| f[:filename].rindex(params[:file_name])})\n send_file file[:filename], :filename => file[:filename], \n :stream => false, :disposition => 'inline', :type => file[:mime_type]\n end",
"title": ""
},
{
"docid": "e87c67f52fc0152c030bc27406c4bfae",
"score": "0.6005938",
"text": "def save_to(path); end",
"title": ""
},
{
"docid": "6d9caf49a00aa03b27fa3f59528b2b0b",
"score": "0.5993229",
"text": "def save_impl(format, file)\n ImageIO.write(@src, format, file)\n end",
"title": ""
},
{
"docid": "0e762e7de46353b583efa6a7c4c62bfd",
"score": "0.5975827",
"text": "def save_uploaded_file\n return unless @uploaded_data\n @download = self.download || self.build_download\n @download.update_attributes(:uploaded_data => @uploaded_data, :title => self)\n end",
"title": ""
},
{
"docid": "ae5d5a3c885183821f3663b12332b3d7",
"score": "0.5970092",
"text": "def create\r\n @family = Family.new(family_params)\r\n @image = @family.images.new\r\n @image.generate_filename\r\n @uploaded_io = params[:family][:uploaded_file]\r\n\r\n File.open(Rails.root.join('public', 'images', @image.filename), 'wb') do |file|\r\n file.write(@uploaded_io.read)\r\n end\r\n\r\n respond_to do |format|\r\n if @family.save\r\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\r\n format.json { render :show, status: :created, location: @family }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @family.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "6ddb27280ab41fca2205801db67cb312",
"score": "0.5967248",
"text": "def encode_picture(file,output)\n enc = Base64.encode64(File.open(file,'rb'){|io| io.read})\n File.open(Rails.public_path.to_s + '/images/'+ output,'w') do |f|\n enc.gsub!(\"\\n\",'')\n f.write enc\n end\nend",
"title": ""
},
{
"docid": "f8a2dafc855a397c2e065782e150fab0",
"score": "0.5962435",
"text": "def save_image(image_attrs, options = {})\n temporary = options.delete(:temporary) || false\n content = image_attrs['content']\n name = Digest::MD5.hexdigest(content).encode(\"UTF-8\")\n self.transaction do\n record = find_or_initialize_by_name name\n unless record.persisted?\n image_attrs.map{ |k,v| record[k] = v if %w[size width height].include? k }\n record.image_type = ::ActsAsImageStore::TYPE_TO_EXT[image_attrs['type'].to_sym.upcase]\n if temporary\n record.refcount = 0\n record.keep_till = Time.now + (ActsAsImageStore.options[:upload_cache] || 3600)\n else\n record.refcount = 1\n end\n storage.store record, content\n record.save!\n record.to_key\n else\n if temporary\n record.keep_till = Time.now + (ActsAsImageStore.options[:upload_cache] || 3600)\n else\n record.refcount += 1\n end\n record.save\n record.to_key\n end\n end\n end",
"title": ""
},
{
"docid": "4b0af28cf16f057e10ccbee11a5b4bbc",
"score": "0.5959053",
"text": "def save_image(filename)\n\t\t@image.save(filename, :interlace => true)\t\t\n\tend",
"title": ""
},
{
"docid": "9b95397a4aaf7108ffe0a3b545a18d38",
"score": "0.59427255",
"text": "def update_imagem(foto_64)\n foto_64 = \"data:image/jpeg;base64,#{foto_64}\"\n if foto_64 != \"\" && foto_64 != nil\n base_64_encoded_data = foto_64\n string_img = Base64.decode64(base_64_encoded_data['data:image/png;base64,'.length .. -1])\n File.open(\"#{Rails.root}/tmp/motorista2.jpg\", \"wb\") do |file| \n file.write(string_img)\n file.size\n self.imagem = file\n end\n end\n end",
"title": ""
},
{
"docid": "ca50ecaed55420d54d29e7ef2f0c66a0",
"score": "0.5940329",
"text": "def save\n if !persisted?\n gps = EXIFR::JPEG.new(@contents).gps\n\n description = {}\n description[:content_type] = 'image/jpeg'\n description[:metadata] = {}\n \n @location = Point.new(:lng => gps.longitude, :lat => gps.latitude)\n description[:metadata][:location] = @location.to_hash\n description[:metadata][:place] = @place\n\n if @contents\n @contents.rewind\n grid_file = Mongo::Grid::File.new(@contents.read, description)\n id = self.class.mongo_client.database.fs.insert_one(grid_file)\n @id = id.to_s\n end\n else\n self.class.mongo_client.database.fs.find(:_id => BSON::ObjectId(@id))\n .update_one(:$set => {\n :metadata => {\n :location => @location.to_hash,\n :place => @place\n }\n })\n end\n end",
"title": ""
},
{
"docid": "2b93c1efd6da69de799d341351d05e3f",
"score": "0.59389204",
"text": "def changestaffimage\n @staff = Staff.find_by(id: params[:id])\n @staff.update_attribute(:image , params[:staff][:image].original_filename)\n \n \n \n tmp = params[:staff][:image].tempfile\n #require 'ftools'\n file = File.join(\"app/assets/images\", params[:staff][:image].original_filename) # use public if you want\n FileUtils.cp tmp.path, file\n \n \n redirect_to \"/admin\"\nend",
"title": ""
},
{
"docid": "0a503424d305860262e26e1f0f3c53be",
"score": "0.592951",
"text": "def create\n @board = Board.new(board_params)\n file = params[:board][:image]\n @board.set_image(file)\n @board.save\n redirect_to @board\n end",
"title": ""
},
{
"docid": "88d92ca53816ac7c2f7c450131ab6083",
"score": "0.59236884",
"text": "def save_to_temp_file\n result = true\n unless upload_temp_file\n\n # Image is supplied in a input stream. This can happen in a variety of\n # cases, including during testing, and also when the image comes in as\n # the body of a request.\n if upload_handle.is_a?(IO) || upload_handle.is_a?(StringIO) ||\n defined?(Unicorn) && upload_handle.is_a?(Unicorn::TeeInput)\n begin\n # Using an instance variable so the temp file lasts as long as\n # the reference to the path.\n @file = Tempfile.new(\"image_upload\")\n File.open(@file, \"wb\") do |write_handle|\n loop do\n str = upload_handle.read(16_384)\n break if str.to_s.empty?\n\n write_handle.write(str)\n end\n end\n # This seems to have problems with character encoding(?)\n # FileUtils.copy_stream(upload_handle, @file)\n self.upload_temp_file = @file.path\n self.upload_length = @file.size\n result = true\n rescue StandardError => e\n errors.add(:image,\n \"Unexpected error while copying attached file \" \\\n \"to temp file. Error class #{e.class}: #{e}\")\n result = false\n end\n\n # It should never reach here.\n else\n errors.add(:image, \"Unexpected error: did not receive a valid upload \" \\\n \"stream from the webserver (we got an instance of \" \\\n \"#{upload_handle.class.name}). Please try again.\")\n result = false\n end\n end\n result\n end",
"title": ""
},
{
"docid": "a2fa6f073a78ceab39aa847d1ba14830",
"score": "0.59127736",
"text": "def to_jpg\n load_image\n end",
"title": ""
},
{
"docid": "9aae2e40bd35825dd96ad2720f7f0081",
"score": "0.5912",
"text": "def upload_url\n return unless @data['image']\n # Isn't actually displayed in-app without this set\n return unless image['property'] == 'image'\n file(@data['image'])\n end",
"title": ""
},
{
"docid": "d55485f57276a4c6275d812192ea1e2b",
"score": "0.5894429",
"text": "def save_file\n File.open(full_file_path, 'wb') { |file| file.write @file.read } unless @file.nil?\n rescue\n uploading_error\n end",
"title": ""
},
{
"docid": "7a161927e02389ae3467a6db290fe21b",
"score": "0.5887452",
"text": "def save_to_storage\n if save_attachment?\n start_ssh do |ssh|\n ssh.exec!(\"mkdir -p #{e File.dirname(full_filename)}\")\n ssh.scp.upload!(temp_path, full_filename)\n ssh.exec!( \"chmod #{attachment_options.fetch(:chmod, '0644')}\" +\n \" #{e full_filename}\" )\n end\n end\n @old_filename = nil\n true\n end",
"title": ""
},
{
"docid": "52f732fb9ea43725b28e8ff61a0acb0f",
"score": "0.58845586",
"text": "def upload_file \n @doctor = Doctor.find_by_user_id(params[:id])\n \n if !params[:doctor][:image].blank?\n File.open(\"#{RAILS_ROOT}/public/pictures/#{session[:user]}.jpg\", \"wb\") do |f|\n f.write(params[:doctor][:image].read)\n end\n end\n redirect_to :action => 'show', :id => params[:id]\n end",
"title": ""
},
{
"docid": "f885ca2ca4615e62f39158d897869313",
"score": "0.58808565",
"text": "def save_image(file)\n client = Appwrite::Client.new()\n\n client\n .set_endpoint(ENV['APPWRITE_ENDPOINT']) # Your API Endpoint\n .set_project(ENV['APPWRITE_FUNCTION_PROJECT_ID']) # Your project ID available by default\n .set_key(ENV['APPWRITE_API_KEY']) # Your secret API key\n\n storage = Appwrite::Storage.new(client)\n\n response = storage.create_file(file: Appwrite::File.new(file));\n\n puts response\nend",
"title": ""
},
{
"docid": "e573061f7ec0a2ab2577fe5d0c00a969",
"score": "0.58795136",
"text": "def image=(image)\n self.image.assign image.tempfile\n end",
"title": ""
},
{
"docid": "8a455eec5544c43ef22ab24e4fcc732e",
"score": "0.58729595",
"text": "def image_upload\n measurement = Measurement.find_by_id(params[:measurement_id])\n\n if measurement\n measurement.image = params[:image]\n measurement.save!\n end\n end",
"title": ""
},
{
"docid": "c48310feaf5eda0c1278e376c548818c",
"score": "0.5872914",
"text": "def create\n @photo = Photo.new(params[:photo])\n \n respond_to do |format|\n # ユーザIDを保存\n @photo.user_id = current_user.id\n \n #@photo.album_id = $album.id\n \n File.open(\"public/ziptmp/img_#{current_user.id}.jpg\",'w+b'){|file|\n file.binmode\n file.write @photo.file\n }\n\t\t\n\t\t\n\t\t\n\t\timg_tmp = Pikl::Image.open(\"public/ziptmp/img_#{current_user.id}.jpg\")\n\n\t img_tmp.fit(150, 150).save(\"public/ziptmp/img_#{current_user.id}.jpg\")\n\t\t \n\t\timg_tmp = File.open(\"public/ziptmp/img_#{current_user.id}.jpg\", 'r+b')\n\t\t@photo.short_file = img_tmp.read\n\t\timg_tmp.close\n\t\tFileUtils.rm_r(\"public/ziptmp/img_#{current_user.id}.jpg\")\n \n if (@photo.content_type == \"image/jpeg\") || (@photo.content_type == \"image/png\")\n @photo.save\n\t end\n\t format.html { redirect_to(photos_url) }\n\t format.xml { head :ok }\n\t end\n end",
"title": ""
},
{
"docid": "c119054600b59ea967ad8dff899fa099",
"score": "0.5863727",
"text": "def save_impl(format, file)\n write_new_image format, FileImageOutputStream.new(file)\n end",
"title": ""
},
{
"docid": "878b1fec98a00f562872e6788753bdf6",
"score": "0.5862634",
"text": "def create\n image_data = Base64.decode64(params[:image_data])\n image_data = image_data.gsub('data:image/jpeg;base64,', '')\n file_name = Digest::MD5.hexdigest(image_data)\n file_path = \"/tmp/#{file_name}.jpeg\"\n f=open(file_path, \"wb\") \n f.puts(image_data) \n f.close\n\n f = open(file_path, \"rb\")\n uploader = ImageUploader.new\n uploader.store!(f)\n \n\n @camera = Camera.new\n @camera.image_url = uploader.filename\n\n user = current_user\n @camera.user_id = user.id\n @camera.camera_place_id = params[:camera_place_id]\n\n respond_to do |format|\n if @camera.save\n format.html { redirect_to @camera, notice: 'Camera was successfully created.' }\n format.json { render json: @camera, status: :created, location: @camera }\n else\n format.html { render action: \"new\" }\n format.json { render json: @camera.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5e7597f6c915aa90bd282674612de3d0",
"score": "0.58515775",
"text": "def store_artist_image\n ArtistsController.store_image(self, @artist)\n end",
"title": ""
},
{
"docid": "0ee665bc3255c2ba37549fc3b44aa6f2",
"score": "0.58403045",
"text": "def export(filename)\n @image.save(filename, interlace: true)\n end",
"title": ""
},
{
"docid": "20e6b45ffcf604e7b1931351ef9d8ebd",
"score": "0.5834915",
"text": "def img\n source = Tinify.from_file(params[:file].tempfile.path)\n if source.store(\n service: 's3',\n aws_access_key_id: ENV['AWS_Access_Key_ID'],\n aws_secret_access_key: ENV['AWS_Secret_Access_Key'],\n region: 'us-west-1',\n path: 'gkbimages//client/'+params[:file].original_filename\n )\n render :json => {status: 0, data: 'https://s3-us-west-1.amazonaws.com/gkbimages//client/'+params[:file].original_filename}\n else \n render :json => {status: 404, data: \"Something went wrong with image upload\"}\n end\n end",
"title": ""
},
{
"docid": "65dc86c0e1182b6af38274d760a00e7a",
"score": "0.58338165",
"text": "def create\n @post = Post.new(post_params)\n @post.score = 0\n\n\n\n if(post_params[:image] == nil)\n path = \"#{Rails.root}/public/uploads/post/image/#{@post.id}/image.jpg\"\n File.open(path, \"wb\") do |f|\n f.write(Base64.decode64(@post.imagedata))\n end\n @post.image = File.open(path)\n else\n @post.imagedata = Base64.encode64(File.open(@post.image.path).read)\n end\n\n respond_to do |format|\n if @post.save\n format.html {\n redirect_to @post, notice: 'Post was successfully created.' \n }\n format.json {\n render json: @post \n }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3847462416ac3175f2ecf23d023f3ab3",
"score": "0.5829646",
"text": "def save_attachment\n return unless save_attachment?\n save_file\n @save_attachment = false\n true\n end",
"title": ""
},
{
"docid": "f9be2c9601448cd28ef2ed585f75f01e",
"score": "0.5823361",
"text": "def create\n @image = Image.new(params[:image])\n\t\t\n\t\tif (params[:image][:filename])\n \t#function in manage_images.rb\n \tprocess_image(tmp = params[:image][:filename].tempfile)\n\t\tend\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render json: @image, status: :created, location: @image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8b8dd38cc23ea7adfa5afb624149af2c",
"score": "0.58211637",
"text": "def upload_session_image\n max_width = params[:width] || 120\n max_height = params[:height] || 120\n begin\n file = params[\"uploaded_file_#{params[:name]}\".to_sym]\n logger.debug \"file = #{file.inspect}\"\n original_tmpfile = tmp_file_path(file.original_filename)\n File.open(original_tmpfile,\"wb\") do |f|\n f.write(file.read)\n end\n # Validate the original file\n @image_errors = []\n validate_image_type(original_tmpfile, params[:name])\n \n image_attached_class = eval(self.class.image_attached_class_name)\n validate_method_name = \"validate_image_as_#{params[:name].singularize}\".to_sym\n if image_attached_class.respond_to?(validate_method_name)\n errors = image_attached_class.send(validate_method_name, original_tmpfile)\n @image_errors.concat(errors) if errors.kind_of?(Array)\n end\n # TODO: deprecated.\n validate_image(original_tmpfile) if self.respond_to?(:validate_image)\n unless @image_errors.empty?\n File.delete(original_tmpfile)\n responds_to_parent do\n render :update do |page|\n page << \"#{main_object_name(params[:name])}.refresh();\"\n page.alert(@image_errors.join('\\n'))\n end\n end\n return\n end\n\n modified_tmpfile = tmp_file_path(file.original_filename)\n if !resize_and_write_image(original_tmpfile, modified_tmpfile)\n modified_tmpfile = original_tmpfile\n end\n original_tmpname = cut_path(original_tmpfile) # file name\n modified_tmpname = cut_path(modified_tmpfile) # file name\n display_size, original_width, original_height, mime_type = ImageResize.use_image_size(modified_tmpfile) do |i|\n [ImageResize.get_reduction_size(i, max_width, max_height), i.get_width, i.get_height, i.mime_type]\n end\n uploaded_files_on_session(params[:name]) << {\n :filename => modified_tmpfile,\n :original_filename => file.original_filename,\n :session => true,\n :width => display_size[:width],\n :height => display_size[:height],\n :original_width => original_width,\n :original_height => original_height,\n :original_tmp_filename => original_tmpfile,\n :modified_angle => 0,\n :mime_type => mime_type\n }\n responds_to_parent do\n render :update do |page|\n image = {\n :original_filename => file.original_filename,\n :image_uri => url_for(:action => 'session_image', :file_name => modified_tmpname),\n :name => modified_tmpname,\n :session => true,\n :width => display_size[:width],\n :height => display_size[:height],\n :original_width => original_width,\n :original_height => original_height,\n :mime_type => mime_type\n }\n page << \"#{main_object_name(params[:name])}.onUploaded(#{image.to_json});\"\n end\n end\n rescue => e\n logger.error e\n logger.error e.backtrace.join(\"\\n\")\n responds_to_parent do \n render :text => e.to_s\n end\n end\n end",
"title": ""
},
{
"docid": "d99d6868da61059aaa121ddb9ef0f646",
"score": "0.5820913",
"text": "def save_img_from_url(img_url, dst_path)\n\t\topen(dst_path, 'wb') do |output|\n\t open(img_url) do |data|\n\t output.write(data.read)\n\t end\n\t end\n\t\tnil\n\tend",
"title": ""
},
{
"docid": "6e2a04d22306d98e1ef6b3659baa7dca",
"score": "0.5814628",
"text": "def copy_offer_image_to_photo!\n self.copy_offer_image_to_photo\n self.save\n end",
"title": ""
},
{
"docid": "f6999960ff8a94e482be2163f65a6a0d",
"score": "0.581033",
"text": "def save!; File.write @path, @data end",
"title": ""
},
{
"docid": "bbf9c793e37ff512dd58a9d5fc86f3e3",
"score": "0.58054006",
"text": "def create\n\n\n @img_info = ImgInfo.new \n @img_info.img_url=upload_file(params[:img_info]['imgdata']);\n \n respond_to do |format|\n if @img_info.save\n flash[:notice] = 'ImgInfo was successfully created.'\n format.html { redirect_to(@img_info) }\n format.xml { render :xml => @img_info, :status => :created, :location => @img_info }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @img_info.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b8f648f9beb170e7a0f206a43ecee4f8",
"score": "0.5804916",
"text": "def save\n if self.persisted?\n # Just update the metadata\n ph = self.class.mongo_client.database.fs.find({:_id=>BSON::ObjectId.from_string(@id)})\n ph.update_one(\n {:metadata=>\n {:location=>@location.to_hash, :place=>@place}\n }) if ph.count == 1\n return\n end\n\n # Get the GPS info from the photo metadata\n gps = EXIFR::JPEG.new(@contents).gps\n @contents.rewind # Reset the read cursor\n\n # Store the latitude/longitude information in a Point object\n @location = Point.new(:lng=>gps.longitude, :lat=>gps.latitude)\n\n # Store meta data about the file\n description = {}\n description[:content_type] = \"image/jpeg\"\n description[:metadata] = {}\n description[:metadata][:location] = @location.to_hash\n description[:metadata][:place] = @place\n\n # Save the file\n grid_file = Mongo::Grid::File.new(@contents.read, description)\n id = self.class.mongo_client.database.fs.insert_one(grid_file)\n @id = id.to_s\n @id\n end",
"title": ""
},
{
"docid": "6936799c8df437e101f0a717add23455",
"score": "0.5804763",
"text": "def save(item)\n url = item['images']['standard_resolution']['url']\n created_at = Time.at(item['created_time'].to_i)\n folder_name = \"#{ USERNAME }/#{ created_at.strftime(\"%Y/%m\") }\"\n file_path = \"#{ folder_name }/#{ item['id'] }.jpg\"\n\n # Organize photos into year and month folders\n `mkdir -p #{ folder_name }`\n\n # Check if 1080 resolution is available (not exposed in their api)\n url_1080 = url.gsub('s640x640', 's1080xs1080')\n url = url_1080 if `curl -s -I #{ url_1080 }` =~ /200 OK/\n\n # Download photo\n `curl -s -o #{ file_path } #{ url }`\n\n # Set exif time\n `./jhead-3.00 -mkexif -ts#{ created_at.strftime('%Y:%m:%d-%T') } #{ file_path }`\n\n # Set exif comment to include location and caption\n location = item['location']['name'] if item['location'] && item['location']['name']\n caption = item['caption']['text'] if item['caption'] && item['caption']['text']\n comment = [location, caption].compact.join(' | ')\n .gsub(/\\n/, ' ')\n .gsub(/\\s+/, ' ')\n .gsub(/\"/, \"'\")\n `./jhead-3.00 -cl \"#{ comment }\" #{ file_path }`\n\n puts \"saved #{ item['id'] }\"\nend",
"title": ""
},
{
"docid": "7ec70bfbf2c45348c20be35e80d21231",
"score": "0.5798853",
"text": "def create\n @item = Item.new(item_params)\n @item.owner_id = current_user.id\n @item.purchased = 0\n @uploaded_io = params[:item][:uploaded_file]\n File.open(Rails.root.join('public', 'images', @item.filename), 'wb') do |file|\n file.write(@uploaded_io.read)\n end\n if @item.save\n redirect_to @item, notice: 'Item was successfully created.'\n else\n render :new\n end\n end",
"title": ""
},
{
"docid": "cc758a98f20db20c36bfd35274ea395f",
"score": "0.5794921",
"text": "def save_file\n if Rails.configuration.file_storage_method == \"fs\"\n FileSaver.save_to_fs annotation.uuid, path, content\n elsif Rails.configuration.file_storage_method == \"s3\"\n FileSaver.save_to_s3 annotation.uuid, path, content\n else\n raise \"Illegal file storage method #{Rails.configuration.file_storage_method}\"\n end\n end",
"title": ""
},
{
"docid": "a21af411df72bbae88d35dffffd18cea",
"score": "0.57869565",
"text": "def save_raw_image(dest)\n execute!(\"cp #{@tempfile} #{dest}\")\n orig_user = `whoami`.strip\n execute!(\"chown #{orig_user} #{dest}\")\n end",
"title": ""
},
{
"docid": "916d3b8c7fae241e74462e7e05c1027a",
"score": "0.5774822",
"text": "def save\n \n sdc = FXDCWindow.new(@exportImage) #Select the export Image\n sdc.foreground = FXRGB(255, 255, 255)\n sdc.fillRectangle(0, 0, @canvasWidth, @canvasHeight) #Flush the export Image.\n \n index = @layerArray.length() #Pointer that starts at the end of the layer array.\n while index >= 0\n if @dirtyArray[index] == true\n sdc.drawImage(@imageArray[index], 0, 0) #If the layer has image data, merge that image data with the export image.\n end\n index = index - 1\n end\n sdc.end\n \n saveDialog = FXFileDialog.new(@parent, \"Save as PNG\") #Create a save dialog\n if saveDialog.execute != 0 #Check Save dialog Intregrity\n FXFileStream.open(saveDialog.filename, FXStreamSave) do |outfile|\n @exportImage.restore #Ensure image data has been allocated\n @exportImage.savePixels(outfile) #Save the pixels in export Image to the specified loction in the file dialog.\n @saved = true #Since a long save has occured, quick save should now overwrite long save data\n temp = saveDialog.filename\n @savePath = File.basename(temp) #Store the file name for the quicksave method.\n puts(@savePath)\n\n end\n end\n return 1\n end",
"title": ""
},
{
"docid": "0d6d9d42c4167d5d803f8a54ae072cbf",
"score": "0.5765483",
"text": "def save\n if has_upload?\n @asset = Ingest::AssetFileAttacher.call(@asset, @upload)\n end\n\n @asset.save\n end",
"title": ""
},
{
"docid": "3ae81fec8d306072a2466a5227505602",
"score": "0.5764918",
"text": "def write_swap_file(filename, decoded_image)\n\n f = File.new \"./public/swap/#{filename}\", \"wb\"\n # f = File.new \"../public/swap/#{filename}\", \"wb\" # inline testing path\n f.write(decoded_image)\n f.close if f\n\nend",
"title": ""
},
{
"docid": "3ae81fec8d306072a2466a5227505602",
"score": "0.5764918",
"text": "def write_swap_file(filename, decoded_image)\n\n f = File.new \"./public/swap/#{filename}\", \"wb\"\n # f = File.new \"../public/swap/#{filename}\", \"wb\" # inline testing path\n f.write(decoded_image)\n f.close if f\n\nend",
"title": ""
},
{
"docid": "4bec694d14643ed33150ee2173fc88a7",
"score": "0.57611066",
"text": "def upload\r\n \r\n end",
"title": ""
},
{
"docid": "6079220bd2dd09663efacf833230305a",
"score": "0.57507217",
"text": "def uploaded_pic_file=(pic_file)\n if !pic_file.blank?\n img = Magick::Image.from_blob(pic_file.read).first\n img.change_geometry!('100x100'){ |cols, rows, im|\n im.resize!(cols, rows)\n }\n new_file = \"public/images/profile_images/#{self.username}.jpg\"\n img.write(new_file)\n end\n end",
"title": ""
},
{
"docid": "792d73bfdf0bf6798f26a9bb7867e048",
"score": "0.5749711",
"text": "def save_to_disk url, target_name\n from_url = URI.parse url\n Net::HTTP.start(from_url.host) do |http|\n resp = http.get(from_url.path)\n open(target_name, \"wb\") do |file|\n begin\n file.write(resp.body)\n rescue => err # FIXME don't fail on failed write (OTOH it's better it have no image than crash the whole app)\n return nil\n end\n return target_name\n end\n end\n end",
"title": ""
},
{
"docid": "f0ba96a4d5015b012fa6d6f37bab1eef",
"score": "0.57476807",
"text": "def copy_offer_image_to_photo\n unless self.offer_image.nil?\n original_file = self.offer_image.url(:original)\n unless original_file.nil? \n original_file_path = \"#{RAILS_ROOT}/public#{original_file}\"\n if File.exists?(original_file_path)\n file = File.new(original_file_path)\n self.photo = file\n end\n end\n end\n end",
"title": ""
},
{
"docid": "5da731f9eab7b1f67f93a2d42bdab90e",
"score": "0.57476306",
"text": "def upload_photo(proof_image, filename)\n uploader = PhotoUploader.new\n uploader.setname(filename)\n uploader.setstore(\"img/issue\")\n uploader.store!(proof_image)\n end",
"title": ""
},
{
"docid": "436ae644a71870dd0a4d4593a642dfa7",
"score": "0.5739372",
"text": "def create\n @image = Image.new(image_params)\n @image.ip = ip2long request.remote_ip\n @image.delete_code = (0...50).map { ('a'..'z').to_a[rand(26)] }.join\n @image.homepage = false\n @image.save\n end",
"title": ""
},
{
"docid": "535c8a9c4d5bc8ad1bada5f2c0e31e87",
"score": "0.57388294",
"text": "def create\n filename = request.headers['Content-Disposition'].split('filename=').last\n filename = filename.scan(/(?<=\")[^\"]+/).first if filename.include?('\"')\n filename = filename.split('/').last.split('.')\n extension = filename.pop\n name = filename.join('.')\n tmp_file = \"#{Rails.root}/tmp/#{name}.#{extension}\"\n id = 0\n while File.exists?(tmp_file)\n id += 1\n tmp_file = \"#{Rails.root}/tmp/#{name}-#{id}.#{extension}\"\n end\n File.open(tmp_file, 'wb') do |f|\n f.write request.body.read\n end\n\n @profile_pic = ProfilePic.new\n @profile_pic.profile = @profile\n File.open(tmp_file) do |f|\n @profile_pic.image = f\n end\n\n respond_to do |format|\n if @profile_pic.save\n format.json { render action: 'show', status: :created, location: profile_pic_url(@profile, @profile_pic) }\n else\n format.json { render json: @profile_pic.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "08133ed53e9d7dd228f2f7e3677c99a5",
"score": "0.5735262",
"text": "def create\n @question = Question.new(question_params)\n @question.question = params[:question][:question]\n @question.grade_id = params[:question][:grade_id]\n @question.subject_id = params[:question][:subject_id]\n @question.picture = params[:question][:picture]\n @question.nameless = params[:question][:nameless]\n @question.solve = params[:question][:solve]\n @question.user_id = current_user.id\n\n if params[:question][:picture].present?\n @question.picture = params[:question][:picture].original_filename\n logger.debug @question.picture\n File.open(\"app/assets/images/q&a/questions/#{@question.picture}\", 'w+b') { |f|\n f.write(params[:question][:picture].read)\n }\n end\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"title": ""
},
{
"docid": "cac32d8ce5b118d4650c47511e30cf24",
"score": "0.57345414",
"text": "def image\n begin\n #send_file File.join(APP_CONFIG['part_image_path'],@part.id.to_s,@part.image_name.url.split(\"/\").last),:disposition => 'inline'\n if File.exists?(File.join(params[:image]))\n data = open(params[:image])\n send_data data.read, disposition: 'inline', stream: 'true', stream: 'true'\n #send_file File.join(params[:image]),:disposition => 'inline'\n else\n data = open(\"#{Rails.root}/public/image_not_available.jpg\")\n send_data data.read, disposition: 'inline', stream: 'true', stream: 'true'\n end\n\n rescue\n \"No Image Found\"\n end\n end",
"title": ""
},
{
"docid": "9af8b53dfbb52948a3a2fa2a139fc44d",
"score": "0.57345337",
"text": "def save(args, image_bounds, config)\n logger = config[:logger]\n attempt = 0\n begin\n dest_path = destination_path(args[:destination_path], args[:destination_path_type], config)\n existing_files = Dir.glob(File.join(dest_path, \"#{self.id.to_s}*.*\"))\n if existing_files.empty?\n # get the symbol (:Original, :Large, :Medium, :Small) for the largest available size\n size_symbol = get_max_size(image_bounds, config)\n unless size_symbol.nil?\n # now get the uri to the source image\n source_uri = URI.parse sizes[size_symbol].source\n # and create a fully qualified filespec for the destination\n destination = photo_destination(args[:destination_naming], source_uri, dest_path, config)\n # now get the photo from the source_uri and save it as the destination\n download(source_uri, destination, image_bounds, config) if acceptable_image_type?(destination, config)\n end\n else\n logger.info {\"Skipping #{self.id} => [#{existing_files.join(', ')}]\"}\n end\n rescue Exception => errorMsg\n logger.warn {\"Unable to save file #{destination} - #{errorMsg.to_s} (attempt: #{attempt})\"}\n logger.debug {errorMsg.backtrace.join(\"\\n\")}\n attempt += 1\n unless attempt > config[:max_save_attempts]\n retry\n end\n exit\n end\n end",
"title": ""
}
] |
f0ca37e303c60140d93783cf2aaca8d4 | Returns true if this is a set. | [
{
"docid": "cd2480cb50a4e8872fed00cef175d869",
"score": "0.6614646",
"text": "def set?\n complete_value.is_a?(Hash)\n end",
"title": ""
}
] | [
{
"docid": "aeaa5ab7c671402d775cbfea3f18c335",
"score": "0.8309839",
"text": "def is_set?\n object.kind == 'set'\n end",
"title": ""
},
{
"docid": "77d9bfa23e9a41756ce67201e36d40d4",
"score": "0.79170316",
"text": "def set?\n start_set_kind? :set\n end",
"title": ""
},
{
"docid": "96d5c697f820b97603737caca06cbdca",
"score": "0.7566995",
"text": "def set?\n self.type == :set\n end",
"title": ""
},
{
"docid": "35d83c608ebc8836c0cf74eed7a4b2a9",
"score": "0.73049784",
"text": "def set?\n @is_set\n end",
"title": ""
},
{
"docid": "148e3da9d930dd26c0a2c321d0ea4b65",
"score": "0.7256483",
"text": "def superset?(set)\n set.is_a?(self.class) or raise ArgumentError, \"value must be a set\"\n return false if cardinality < set.cardinality\n set.all? { |o| set.multiplicity(o) <= multiplicity(o) }\n end",
"title": ""
},
{
"docid": "82e275e5a7a40c778f39071e96187cf3",
"score": "0.71589756",
"text": "def proper_superset?(set)\n set.is_a?(self.class) or raise ArgumentError, \"value must be a set\"\n return false if cardinality <= set.cardinality\n set.all? { |o| set.multiplicity(o) <= multiplicity(o) }\n end",
"title": ""
},
{
"docid": "3090c98bc72fdd183014e49991c117ed",
"score": "0.70598686",
"text": "def looks_a_set?(arg)\n Array===arg or ElementSet===arg\n end",
"title": ""
},
{
"docid": "1b302d484971829aa88398c04afb3e94",
"score": "0.7023188",
"text": "def set?\n @set\n end",
"title": ""
},
{
"docid": "07f5b78f521d85c1ea28ec0daa2b2145",
"score": "0.69597983",
"text": "def superset?(set)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if size < set.size\n set.all? { |o| include?(o) }\n end",
"title": ""
},
{
"docid": "07f5b78f521d85c1ea28ec0daa2b2145",
"score": "0.69597983",
"text": "def superset?(set)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if size < set.size\n set.all? { |o| include?(o) }\n end",
"title": ""
},
{
"docid": "8647e40532598dfc9df17222e65528eb",
"score": "0.6904118",
"text": "def proper_superset?(set)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if size <= set.size\n set.all? { |o| include?(o) }\n end",
"title": ""
},
{
"docid": "8647e40532598dfc9df17222e65528eb",
"score": "0.6904118",
"text": "def proper_superset?(set)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if size <= set.size\n set.all? { |o| include?(o) }\n end",
"title": ""
},
{
"docid": "5265b061de9ffd813b44d93b7728f6fe",
"score": "0.68403935",
"text": "def superset?(set)\n return @keyword_set.superset?(set)\n end",
"title": ""
},
{
"docid": "fba36355bf7c8ec4e6f7f429bd570662",
"score": "0.68325156",
"text": "def eql?(set)\n return true if equal?(set)\n set = self.class.new(set) unless set.is_a?(self.class)\n return false unless cardinality == set.cardinality\n superset?(set) && subset?(set)\n end",
"title": ""
},
{
"docid": "babb0ba9abea7d8ec92600c456207cc7",
"score": "0.6824861",
"text": "def superset?(set)\n case\n when set.instance_of?(self.class) && @hash.respond_to?(:>=)\n @hash >= set.instance_variable_get(:@hash)\n when set.is_a?(Set)\n size >= set.size && set.all? { |o| include?(o) }\n else\n raise ArgumentError, \"value must be a set\"\n end\n end",
"title": ""
},
{
"docid": "f0cef4f3481adf7c7cc9ee3b48fdbf3c",
"score": "0.6804506",
"text": "def set?(key)\n redis.type(_key(key)) == \"set\"\n end",
"title": ""
},
{
"docid": "16a4087ec7730d38bd15d515349b440d",
"score": "0.67336327",
"text": "def valid?(set)\n set.is_a?(Hash) && set[\"values\"].is_a?(Hash)\n end",
"title": ""
},
{
"docid": "d150410a7871c16e517c5af78d8eeb65",
"score": "0.672124",
"text": "def subset?(set)\n set.is_a?(self.class) or raise ArgumentError, \"value must be a set\"\n return false if set.cardinality < cardinality\n all? { |o| multiplicity(o) <= set.multiplicity(o) }\n end",
"title": ""
},
{
"docid": "1d1b4b334cbc202c854dbd5c2b121e1b",
"score": "0.6689662",
"text": "def proper_superset?(set)\n case\n when set.instance_of?(self.class) && @hash.respond_to?(:>)\n @hash > set.instance_variable_get(:@hash)\n when set.is_a?(Set)\n size > set.size && set.all? { |o| include?(o) }\n else\n raise ArgumentError, \"value must be a set\"\n end\n end",
"title": ""
},
{
"docid": "64b27bb3162498064a86d1b08804728a",
"score": "0.667678",
"text": "def proper_subset?(set)\n set.is_a?(self.class) or raise ArgumentError, \"value must be a set\"\n return false if set.cardinality <= cardinality\n all? { |o| multiplicity(o) <= set.multiplicity(o) }\n end",
"title": ""
},
{
"docid": "8b77bd2badda555bd7f9a74e589066b8",
"score": "0.6552486",
"text": "def allSet?\n false\n end",
"title": ""
},
{
"docid": "42cf2587c4c4d445ea443e636bee333f",
"score": "0.65479076",
"text": "def bare_data_set?\n data.is_a?(Array) and ![Array, Hash].include?(data.first.class)\n end",
"title": ""
},
{
"docid": "3ce4eab3f8bed2087b63931e5459d5af",
"score": "0.6516431",
"text": "def set_is_a_string\n value_is_a_string(target: :set, value: set)\n end",
"title": ""
},
{
"docid": "21f69dc5e28ed50dd7eeb16fdd21db59",
"score": "0.64684045",
"text": "def complete_set?\n completed_kind? :set unless match.min_sets_to_play == 1\n end",
"title": ""
},
{
"docid": "791f0399b16fea1b99274457eb167dc5",
"score": "0.6429333",
"text": "def inside_at_least_one_of?\n !@set.nil?\n end",
"title": ""
},
{
"docid": "b3b0efbd4d826ea437adfba2ddeef700",
"score": "0.642176",
"text": "def is_set_member?(record, set_spec)\n static_set_eval_subqueries\n if @options[:sets]\n @options[:sets].each do |k, v|\n if v[:set_spec] && v[:set_spec] == set_spec\n if v.key? :set_definition\n # for each of this set's definitions\n v[:set_definition].each_index do |i|\n # assume this record is a set member initially\n is_set_member = true\n # for each solr field in this set definition\n v[:set_definition][i].each do |solr_field, solr_values| \n if record.key? solr_field\n # if none of the values in the set def for this key are in solr document array for this key\n if record.fetch(solr_field).is_a?(::Array) && (solr_values & record.fetch(solr_field)).empty?\n # this solr document does not match the set definition\n is_set_member = false\n # if the solr document returned a string for this value rather than an array, check to see if that value is in the definition's array\n elsif record.fetch(solr_field).is_a?(::String) && !solr_values.include?(record.fetch(solr_field)) then\n is_set_member = false\n end\n # if this set def key isn't even in the solr document, then this record is not a set member\n else\n is_set_member = false\n end\n end\n # if all of this definition's criteria have been met, it's a set member (even if it doesn't match criteria of other definitions)\n if is_set_member\n return true\n end\n end\n end\n end\n end\n end\n return false\n end",
"title": ""
},
{
"docid": "247582f7a4575d0de9663331f8b8077b",
"score": "0.6412805",
"text": "def superset?(other)\n Rangops::Set.superset?(self, other)\n end",
"title": ""
},
{
"docid": "3f894cb293cccf0e04182c345a145059",
"score": "0.6398157",
"text": "def changes_state?\n @sets\n end",
"title": ""
},
{
"docid": "9afa4cf8648206017023c59305fd97ea",
"score": "0.6383407",
"text": "def equals?(state_set)\n @native.equals state_set.__send__(:native)\n end",
"title": ""
},
{
"docid": "0abe3759bd0d6aee492e0b59c71876fb",
"score": "0.6353247",
"text": "def proper_subset?(set)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if set.size <= size\n all? { |o| set.include?(o) }\n end",
"title": ""
},
{
"docid": "0abe3759bd0d6aee492e0b59c71876fb",
"score": "0.6353247",
"text": "def proper_subset?(set)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if set.size <= size\n all? { |o| set.include?(o) }\n end",
"title": ""
},
{
"docid": "bc30ebd6a51934b0c7988b35f6e1af5c",
"score": "0.6338122",
"text": "def start_set?\n start.set?\n end",
"title": ""
},
{
"docid": "e6f92e91c55cdee0d5a389d511b2d2fc",
"score": "0.63189036",
"text": "def is_set?(uri) \n if instance.explorator::set == nil\n return false\n end \n instance.all_explorator::set.collect {|x| x.to_s }.include?(uri) \n end",
"title": ""
},
{
"docid": "a1ee2cde9fb973fdc580b80b6b7a9eec",
"score": "0.62944543",
"text": "def subset?(set)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if set.size < size\n all? { |o| set.include?(o) }\n end",
"title": ""
},
{
"docid": "a1ee2cde9fb973fdc580b80b6b7a9eec",
"score": "0.62944543",
"text": "def subset?(set)\n set.is_a?(Set) or raise ArgumentError, \"value must be a set\"\n return false if set.size < size\n all? { |o| set.include?(o) }\n end",
"title": ""
},
{
"docid": "aa3e2ec7f8da329c855914e19245be61",
"score": "0.62738234",
"text": "def contains?(set_id)\n @sets.has_key? set_id\n end",
"title": ""
},
{
"docid": "dbf8919d6ba4b7c52694a2975d758935",
"score": "0.62625784",
"text": "def is_set(i)\n\t\t\tmask = PokerEvalAPI.wrap_StdDeck_MASK(i)\n\t\t\treturn any_set(mask)\n\t\tend",
"title": ""
},
{
"docid": "9d5f676ad4324be8d67007e9556eb20a",
"score": "0.6258983",
"text": "def proper_subset?(set)\n case\n when set.instance_of?(self.class) && @hash.respond_to?(:<)\n @hash < set.instance_variable_get(:@hash)\n when set.is_a?(Set)\n size < set.size && all? { |o| set.include?(o) }\n else\n raise ArgumentError, \"value must be a set\"\n end\n end",
"title": ""
},
{
"docid": "49f732a3e96fab918eb6fbfff3edef00",
"score": "0.6235958",
"text": "def isEmpty? #just check if the set has any elements\r\n\t\tif self.set.length == 0\r\n\t\t\treturn true\r\n\t\telse\r\n\t\t\treturn false\r\n\t\tend \r\n\tend",
"title": ""
},
{
"docid": "20a3cb27d5eb5c9ae3c081cd829c4b21",
"score": "0.62315565",
"text": "def subset?(set)\n case\n when set.instance_of?(self.class) && @hash.respond_to?(:<=)\n @hash <= set.instance_variable_get(:@hash)\n when set.is_a?(Set)\n size <= set.size && all? { |o| set.include?(o) }\n else\n raise ArgumentError, \"value must be a set\"\n end\n end",
"title": ""
},
{
"docid": "a16df2a1700867a46e99048717dcca52",
"score": "0.62285745",
"text": "def set_is_a_string_and_not_null\n value_is_a_string(target: :set, value: set, nullable: false)\n end",
"title": ""
},
{
"docid": "3111437d25e543f1ee5467b698808ebb",
"score": "0.6215341",
"text": "def simple?\n key_set = keys.to_set\n key_set == [:_id].to_set || key_set == [:_id, :_type].to_set\n end",
"title": ""
},
{
"docid": "641774767781d2e6865a427cd1b0e4b7",
"score": "0.62076515",
"text": "def proper_superset?(other)\n Rangops::Set.proper_superset?(self, other)\n end",
"title": ""
},
{
"docid": "db392026b399561853e9ac9385e89676",
"score": "0.61874664",
"text": "def empty?\n @set.empty?\n end",
"title": ""
},
{
"docid": "67e1074620db5f335d52fb376204e2b6",
"score": "0.61416394",
"text": "def validation_set_defined?(set)\n [:save, :create, :update].any? do |on|\n respond_to?(validation_set_method(on, set))\n end\n end",
"title": ""
},
{
"docid": "e5bb070767d3b9c182c1089539bf9952",
"score": "0.61291236",
"text": "def required_set?\n self.options.required_set?\n end",
"title": ""
},
{
"docid": "53ab34dfd22597073ec5d87eee3edbee",
"score": "0.61059207",
"text": "def isSet?\n assert_exists\n return @o.checked\n end",
"title": ""
},
{
"docid": "53ab34dfd22597073ec5d87eee3edbee",
"score": "0.61059207",
"text": "def isSet?\n assert_exists\n return @o.checked\n end",
"title": ""
},
{
"docid": "410bbe1eb8e10f2555dc55d3c00f534f",
"score": "0.6078444",
"text": "def empty?\n @set.empty?\n end",
"title": ""
},
{
"docid": "79a9166370f0e63b4866f5c6f58f291c",
"score": "0.6075157",
"text": "def is_empty\n p @set.empty?\n end",
"title": ""
},
{
"docid": "0bc72e519162ff480ec506e5a34bab84",
"score": "0.6049026",
"text": "def content_type_set?\n !@_content_type.nil?\n end",
"title": ""
},
{
"docid": "b92a6ba1b75452486a5d2d1e81bb316c",
"score": "0.6042721",
"text": "def value_set? key\n @values.key? resolve_key! key\n end",
"title": ""
},
{
"docid": "016874740c1fbdf7abbb4d7f746178ec",
"score": "0.60291916",
"text": "def admin_set?\n !!@admin_set\n end",
"title": ""
},
{
"docid": "77e342acba76e024ddd4db34e2b9fe75",
"score": "0.60290414",
"text": "def sameset?(other)\n c = set_compare(other)\n c and (c==0)\n end",
"title": ""
},
{
"docid": "7d50fe4c9a0e5c4454f111ce52acba70",
"score": "0.6027313",
"text": "def validation_set_defined?(set)\n @_validation_sets.include?(set)\n end",
"title": ""
},
{
"docid": "a9049cfac2f414e6ca27d25ef1434a09",
"score": "0.602169",
"text": "def specified?\n self[:type] == :specified\n end",
"title": ""
},
{
"docid": "025eb659af30c9521244fdf104074b12",
"score": "0.601689",
"text": "def isSet?\n raise UnknownObjectException if @o==nil\n return true if @o.checked\n return false\n end",
"title": ""
},
{
"docid": "952441b304d93f64806ce90b69672b7b",
"score": "0.6012372",
"text": "def key?(name)\n @sets.key?(name.to_s)\n end",
"title": ""
},
{
"docid": "00f6a9d6145dda2586630350e93cf790",
"score": "0.60046667",
"text": "def empty?\n set.empty?\n end",
"title": ""
},
{
"docid": "3649a84b3b6684aeaaf078e7c4d1de28",
"score": "0.6003169",
"text": "def required_set?\n @child_options.required_set? && @child_namespaces.required_set?\n end",
"title": ""
},
{
"docid": "384b8a249b3c585063236d77a49e08ef",
"score": "0.5991261",
"text": "def hash?\n collection.is_a? Hash\n end",
"title": ""
},
{
"docid": "c890e88e67c110faba229952f64ebd0c",
"score": "0.5973828",
"text": "def ==(set)\n equal?(set) and return true\n\n set.is_a?(Set) && size == set.size or return false\n\n set.all? { |o| include?(o) }\n end",
"title": ""
},
{
"docid": "620287785425a880be074209c157bf6a",
"score": "0.59734476",
"text": "def ==(other)\n if self.equal?(other)\n true\n elsif other.instance_of?(self.class)\n @hash == other.instance_variable_get(:@hash)\n elsif other.is_a?(Set) && self.size == other.size\n other.all? { |o| @hash.include?(o) }\n else\n false\n end\n end",
"title": ""
},
{
"docid": "620287785425a880be074209c157bf6a",
"score": "0.59734476",
"text": "def ==(other)\n if self.equal?(other)\n true\n elsif other.instance_of?(self.class)\n @hash == other.instance_variable_get(:@hash)\n elsif other.is_a?(Set) && self.size == other.size\n other.all? { |o| @hash.include?(o) }\n else\n false\n end\n end",
"title": ""
},
{
"docid": "864e941789f174d2806f67bbafb03384",
"score": "0.59563476",
"text": "def set?\n valid\n end",
"title": ""
},
{
"docid": "dc0f5e98c6e0ab850914fe15a32effff",
"score": "0.5942332",
"text": "def is_valid_set(nfabuilder, t)\n valid = true\n begin\n # System.out.println(\"parse BLOCK as set tree: \"+t.toStringTree());\n nfabuilder.test_block_as_set(t)\n rescue RecognitionException => re\n # The rule did not parse as a set, return null; ignore exception\n valid = false\n end\n # System.out.println(\"valid? \"+valid);\n return valid\n end",
"title": ""
},
{
"docid": "44cd1a521dbe3ca4811813d6422f30da",
"score": "0.5916852",
"text": "def set?\n @data == 1 ? true : false\n end",
"title": ""
},
{
"docid": "c89e0d6177c00128aef46f3e625eb9ff",
"score": "0.59162015",
"text": "def valid_set?(set,val)\n set.count {|element| element == val} == 1\n end",
"title": ""
},
{
"docid": "e70cd80c9560d6acf91e7b8b6a8dd4c2",
"score": "0.5909103",
"text": "def proper_superset?(other)\n !eql_set?(other) && superset?(other)\n end",
"title": ""
},
{
"docid": "5c5925238236f47d2b6ba7419beb1fdd",
"score": "0.5890774",
"text": "def meta_type?(meta)\n return (self.type & meta == meta)\n end",
"title": ""
},
{
"docid": "a395add6e9331aafa3d5a5e6a2e4226a",
"score": "0.58760613",
"text": "def allSet?\n # Check all but last byte quickly\n (@data.length-1).times do |i|\n return false if @data[i] != 0xff\n end\n # Check last byte slowly\n toCheck = @length % 8\n toCheck = 8 if toCheck == 0\n ((@length-toCheck)..(@length-1)).each do |i|\n return false if ! set?(i)\n end\n true\n end",
"title": ""
},
{
"docid": "fc3dd9ed9458f206764e512fd0057564",
"score": "0.58623266",
"text": "def has_complete_set?\n return @has_enc_pkey && @has_enc_skey && @has_sig_pkey && @has_sig_skey\n end",
"title": ""
},
{
"docid": "673fd549db417f2f1e9508560276e85d",
"score": "0.5849301",
"text": "def empty?\n @a_set.empty? and @h_set.empty?\n end",
"title": ""
},
{
"docid": "4da0d30786defa0944ca059bbdbceec9",
"score": "0.58440214",
"text": "def attr_set?(attr)\n self.class.has_field?(attr) && self.instance_variable_defined?(\"@#{attr}\")\n end",
"title": ""
},
{
"docid": "e2c483e26ddf4e3d4d23b109ec0fec3c",
"score": "0.5840904",
"text": "def ==(object)\n\t\tret = true\n\t\tunless(object.is_a?(MyHashSet))\n\t\t\treturn false\n\t\telse\n\t\t\tret = (self.to_a == object.to_a) ? true : false\n\t\tend\n\t\tret\n\tend",
"title": ""
},
{
"docid": "ea5fbf7e7ae38dcc969c39edd80b395a",
"score": "0.5816474",
"text": "def collection?\n return array? || hash?\n end",
"title": ""
},
{
"docid": "1796a5a6df6e5b9cfa97f0dead7ed4c7",
"score": "0.5815317",
"text": "def are_que_types_and_optionsets_valid?\n \n # TODO: Return false if a invalid entry found.\n \n return true\n end",
"title": ""
},
{
"docid": "1c8226d29396372c39f3c77b8bc7c9ac",
"score": "0.58041096",
"text": "def set?\n !value_before_cast.nil?\n end",
"title": ""
},
{
"docid": "d3a3be8b1a980a3e0340726237d115b4",
"score": "0.5788032",
"text": "def includes?(val)\n set[val] == true\n end",
"title": ""
},
{
"docid": "4539b0739a08a4a16a190c03be1b6138",
"score": "0.5787447",
"text": "def is_first_set?\n get_set_param == 1\n end",
"title": ""
},
{
"docid": "1dd286173585a66f9d2d9eaa99d8e0c3",
"score": "0.5779724",
"text": "def subsets?\n not subsets.empty?\n end",
"title": ""
},
{
"docid": "49c3d54e54b4c1f7d58f4d28f9a95658",
"score": "0.5779577",
"text": "def any_preconds?() product_set.to_bool end",
"title": ""
},
{
"docid": "cad15a7e3039d563a0f4711893a42433",
"score": "0.5771854",
"text": "def fieldset?\n self.respond_to?(:content)\n end",
"title": ""
},
{
"docid": "10c91ef93b0d449b102a6dce0bd669e7",
"score": "0.57684857",
"text": "def value_set? key\n local_value_set = @values.key? @schema.resolve_key! key\n parent_value_set = @parent_config.value_set? key\n local_value_set || parent_value_set\n end",
"title": ""
},
{
"docid": "e3838b276c11fe793de9f4eb7818f76b",
"score": "0.57676387",
"text": "def eql_set?(other)\n case other\n when Range\n eql_range?(other)\n when IntervalSet\n eql?(other)\n else\n IntervalSet.unexpected_object(other)\n end\n end",
"title": ""
},
{
"docid": "0dce825b2923040929e4ee833f9fe859",
"score": "0.57669204",
"text": "def field_set?( field )\n return @field_set.include?( field )\n end",
"title": ""
},
{
"docid": "0dce825b2923040929e4ee833f9fe859",
"score": "0.57669204",
"text": "def field_set?( field )\n return @field_set.include?( field )\n end",
"title": ""
},
{
"docid": "0dce825b2923040929e4ee833f9fe859",
"score": "0.57669204",
"text": "def field_set?( field )\n return @field_set.include?( field )\n end",
"title": ""
},
{
"docid": "82dc1d30a6fb1868b42527bdeaa4efba",
"score": "0.5765064",
"text": "def eql?( set )\n super and @resources == set.resources\n end",
"title": ""
},
{
"docid": "6b7832e1787cc486b1a37143e8602339",
"score": "0.5764896",
"text": "def isEmpty(set)\n #checks to see if the set is empty\n if set.length > 0\n return false\n else\n return true\n end\n end",
"title": ""
},
{
"docid": "d52ee119562342686acf3fccb3ffc4ce",
"score": "0.5747804",
"text": "def settable?(tag)\n settable.include? tag.to_sym\n end",
"title": ""
},
{
"docid": "d52ee119562342686acf3fccb3ffc4ce",
"score": "0.5747804",
"text": "def settable?(tag)\n settable.include? tag.to_sym\n end",
"title": ""
},
{
"docid": "c0864b156de30d6e6aad14843281183a",
"score": "0.57414466",
"text": "def meta?\n return false unless @data.is_a? Hash\n @data.keys.any? { |k| k.is_a? Symbol }\n end",
"title": ""
},
{
"docid": "a5d0a5111e78b58d24a5abfc0584485d",
"score": "0.57129323",
"text": "def ==(other)\n return false if not other.is_a? ParseNodeSet\n return false if not other.size == self.size\n \n @set.each { |id| \n return false if not other.include? id\n }\n return true\n end",
"title": ""
},
{
"docid": "cbaf49d7dc08c4a316fb6e0cb16fe656",
"score": "0.5702772",
"text": "def subset?(set)\n return false unless set\n set.each { |e| return false unless contains?(e) }\n return true\n end",
"title": ""
},
{
"docid": "cbaf49d7dc08c4a316fb6e0cb16fe656",
"score": "0.5702772",
"text": "def subset?(set)\n return false unless set\n set.each { |e| return false unless contains?(e) }\n return true\n end",
"title": ""
},
{
"docid": "0a40211cc4419d26c4875b4dc3fbf208",
"score": "0.56991607",
"text": "def superset?(other)\n intersection(other) == other\n end",
"title": ""
},
{
"docid": "0db71fc546e2d9392efd68d869ac520d",
"score": "0.56969607",
"text": "def proper_subset?(other)\n return false if other.size <= size\n # See comments above\n if other.size >= 150 && @trie.size >= 190 && !(other.is_a?(Immutable::Set) || other.is_a?(::Set))\n other = ::Set.new(other)\n end\n all? { |item| other.include?(item) }\n end",
"title": ""
},
{
"docid": "30dd2b463bf177b7c8e0219b59604a01",
"score": "0.5696834",
"text": "def set_includes?(set_id, member)\n \t@sets[set_id].include? member\n end",
"title": ""
}
] |
e8a497166f79ebc7e7577a457d136055 | Returns compiled mappings hash for current type | [
{
"docid": "946c4655f679a7bf4d5fcd75f773531b",
"score": "0.6374174",
"text": "def mappings_hash\n root.mappings_hash\n end",
"title": ""
}
] | [
{
"docid": "e3298c7541d63056c2e8996ae81ab680",
"score": "0.73702693",
"text": "def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend",
"title": ""
},
{
"docid": "65a12432c9aef57143a1c44b65561904",
"score": "0.71571946",
"text": "def hash\n @type.hash\n end",
"title": ""
},
{
"docid": "787d70a5547286eee0fab9c0d01bf096",
"score": "0.69985515",
"text": "def hash\n\t\t(language + type + klass + thing).hash\n\tend",
"title": ""
},
{
"docid": "8affe05ef30c2b4eb5e95ef3dea2b9d8",
"score": "0.69865936",
"text": "def hash\n [@bit, @type].hash\n end",
"title": ""
},
{
"docid": "48081c7ec008e749812e1497a2130418",
"score": "0.69385976",
"text": "def hash\n code = 17\n code = 37 * code\n self.instance_variables.each do |v|\n code += self.instance_variable_get(v).hash\n end\n code\n end",
"title": ""
},
{
"docid": "35a2051273ac43bc0ce8f8db584c532f",
"score": "0.6891981",
"text": "def hash\n [_name, _type, _klass].hash\n end",
"title": ""
},
{
"docid": "828a076fda864406ce785b6b6bb60ad4",
"score": "0.68869793",
"text": "def hash\n type.hash ^ (id.hash >> 1)\n end",
"title": ""
},
{
"docid": "5113606ae9ed74650e7000bfb6d27ef0",
"score": "0.6694379",
"text": "def hash\n self.class.name.hash\n end",
"title": ""
},
{
"docid": "be796688b38b9989d0a8fefa543f3f19",
"score": "0.6666734",
"text": "def hash\n [bitmask, self.class].hash\n end",
"title": ""
},
{
"docid": "5890a14d49e83231148eeba2dfd02065",
"score": "0.6610799",
"text": "def hash\n [bitmask, self.class].hash\n end",
"title": ""
},
{
"docid": "05f465bb6a994caab702ea28df69e032",
"score": "0.6602099",
"text": "def hash\n { hash: @hash, hashType: @hash_type }\n end",
"title": ""
},
{
"docid": "9b164bda867a96d4c7eb797196217c27",
"score": "0.65040505",
"text": "def hash\n code.hash\n end",
"title": ""
},
{
"docid": "0dfbda316290f2d58c5b081618165296",
"score": "0.646356",
"text": "def hash\n [ data, type ].hash\n end",
"title": ""
},
{
"docid": "6036fa01ff28481d6ed36679c93d56ad",
"score": "0.64418405",
"text": "def hash\n @hash[:perm_type].hash ^\n @hash[:perms].hash ^\n @hash[:inheritance].hash ^\n @hash[:target].hash\n end",
"title": ""
},
{
"docid": "2fe66cff14fdabeab11d6f696606a539",
"score": "0.64259297",
"text": "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end",
"title": ""
},
{
"docid": "25aaa5db4613080c00be30b0e859d322",
"score": "0.6396812",
"text": "def hash_code; end",
"title": ""
},
{
"docid": "76d4ecd3d4f75d7b7c3aa802e2144ae4",
"score": "0.63855374",
"text": "def hash\n code.hash\n end",
"title": ""
},
{
"docid": "69a9eb2e2353c88799859edcad3ee8a0",
"score": "0.63842684",
"text": "def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"title": ""
},
{
"docid": "69a9eb2e2353c88799859edcad3ee8a0",
"score": "0.63842684",
"text": "def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end",
"title": ""
},
{
"docid": "39da28cb1a00a41769a34f4c22388d7b",
"score": "0.6361609",
"text": "def hash\n self.atoms.hash\n end",
"title": ""
},
{
"docid": "7afb19d95b8feff763212a1d1bb91ce2",
"score": "0.6358711",
"text": "def hash\n [self.class, id].hash\n end",
"title": ""
},
{
"docid": "8a846341e56ecf2df190b0f2c2c64931",
"score": "0.6354702",
"text": "def instance_hash(type)\n @instances[type.intern]\n end",
"title": ""
},
{
"docid": "d59d5cca0679f5d6577a66c530b12904",
"score": "0.6353606",
"text": "def hash\n [self.class, to_h].hash\n end",
"title": ""
},
{
"docid": "d59d5cca0679f5d6577a66c530b12904",
"score": "0.6353606",
"text": "def hash\n [self.class, to_h].hash\n end",
"title": ""
},
{
"docid": "d59d5cca0679f5d6577a66c530b12904",
"score": "0.6353606",
"text": "def hash\n [self.class, to_h].hash\n end",
"title": ""
},
{
"docid": "1e5bf06291d3cbb29f5de8c2d61da5ee",
"score": "0.6298668",
"text": "def hash\n [self.class, to_s].hash\n end",
"title": ""
},
{
"docid": "d1a151d2114e7874bfcca36cf244be2d",
"score": "0.62846935",
"text": "def hash\n self.class.name.hash ^ @key.hash\n end",
"title": ""
},
{
"docid": "fdf1de551825467eb73bf963ecad0cd3",
"score": "0.6272176",
"text": "def type_map\n @type_map\n end",
"title": ""
},
{
"docid": "86c4ef278b5561ce28b4893381294d61",
"score": "0.62241834",
"text": "def hash\n [code, scope].hash\n end",
"title": ""
},
{
"docid": "4826fc4b4388974dc97515aa732820a2",
"score": "0.6218948",
"text": "def hash\n [hint,name,ordinal,module_name].hash\n end",
"title": ""
},
{
"docid": "727b40f9aeaf16679278f4e7e7c6a588",
"score": "0.6208935",
"text": "def hash()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "7732ba0a8556331b04787ccf3101094f",
"score": "0.6177718",
"text": "def hash\n [self.class, to_s].hash\n end",
"title": ""
},
{
"docid": "ac727b2d42f42e491e856c32ba1dd8a6",
"score": "0.61752725",
"text": "def to_hash\n @__table\n end",
"title": ""
},
{
"docid": "bd56331c5e151f10079d400ee3327f8d",
"score": "0.6172081",
"text": "def hash\n to_h.hash ^ self.class.hash\n end",
"title": ""
},
{
"docid": "b5e546803550e2d3b406e4425a2e1db8",
"score": "0.6147839",
"text": "def hash\n self.class.hash ^ @ns.hash\n end",
"title": ""
},
{
"docid": "534f167afd5327f6915c9b2cb99261d6",
"score": "0.61435324",
"text": "def get_hash(type)\n allowed_tables = A_HASHES\n allowed_tran = %w(month day)\n allowed_spec = %w(time)\n\n if allowed_tables.include? type\n rows = get_list(type)\n if rows == 'ERROR' # Dirty fix for 'multiple responses' error\n return 'ERROR'\n end\n\n r = {}\n\n rows.each {|v|\n r[v.id] = v.name\n }\n\n r\n elsif allowed_tran.include? type\n a = ::I18n.t(\"g_#{type}s\").clone # Because Translation is given by reference. REFERENCE.\n\n i = 0\n a.map! {|v| [i += 1, v]}\n\n a.to_h\n\n elsif allowed_spec.include? type\n get_special_list type\n\n else\n # TODO: Log error\n end\n end",
"title": ""
},
{
"docid": "37b0274531a5378d59cd04bb9ce92732",
"score": "0.6113001",
"text": "def hash\n\t\treturn [ self.class, self.dn ].hash\n\tend",
"title": ""
},
{
"docid": "2c935fd63f79ea6d75bb4cbdbb9f0343",
"score": "0.6099449",
"text": "def hash\n [domain, message, stack, type].hash\n end",
"title": ""
},
{
"docid": "2995f14406c97b37355769ea977a3cb5",
"score": "0.608442",
"text": "def hash\n [_hash, name, owner].hash\n end",
"title": ""
},
{
"docid": "bf7342566e8f178376b07a61d5289c46",
"score": "0.6083043",
"text": "def hash\n [oct, pc].hash\n end",
"title": ""
},
{
"docid": "6ee03262e297920b8a0ee8f7503623db",
"score": "0.6070293",
"text": "def to_hash_keys\n ([:_type] + _struct.keys.map(&:to_sym)).uniq\n end",
"title": ""
},
{
"docid": "d63333ed15c27e3f7526f0c6f8099546",
"score": "0.6060675",
"text": "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"title": ""
},
{
"docid": "2247596c1af1ea3859d9b23958ad5b06",
"score": "0.60605615",
"text": "def hash\n self[:pc].hash\n end",
"title": ""
},
{
"docid": "56c74da3c92d5d754e13e7842e7637c8",
"score": "0.6055467",
"text": "def hash\n [discriminator, name].hash\n end",
"title": ""
},
{
"docid": "03406ad22e65b1f70bb8dafd1b0ee641",
"score": "0.6042825",
"text": "def hash\n [schema, name].hash\n end",
"title": ""
},
{
"docid": "3f47bf4d00665ec530f769b22f2afbbc",
"score": "0.6039138",
"text": "def to_hash\n memoize(:to_hash) do\n _process_hashed(structures.inject({}) { |acc, elem| Utils.merge(acc, elem) })\n end\n end",
"title": ""
},
{
"docid": "23cdf6a080837fbe407633be0799ea0e",
"score": "0.60357744",
"text": "def hash() end",
"title": ""
},
{
"docid": "23cdf6a080837fbe407633be0799ea0e",
"score": "0.60357744",
"text": "def hash() end",
"title": ""
},
{
"docid": "23cdf6a080837fbe407633be0799ea0e",
"score": "0.60357744",
"text": "def hash() end",
"title": ""
},
{
"docid": "23cdf6a080837fbe407633be0799ea0e",
"score": "0.60357744",
"text": "def hash() end",
"title": ""
},
{
"docid": "23cdf6a080837fbe407633be0799ea0e",
"score": "0.60357744",
"text": "def hash() end",
"title": ""
},
{
"docid": "23cdf6a080837fbe407633be0799ea0e",
"score": "0.60357744",
"text": "def hash() end",
"title": ""
},
{
"docid": "23cdf6a080837fbe407633be0799ea0e",
"score": "0.60357744",
"text": "def hash() end",
"title": ""
},
{
"docid": "87a186c0b24355b56e128d388fbbf48b",
"score": "0.602852",
"text": "def to_hash(*)\n mapper.new(self).to_hash\n end",
"title": ""
},
{
"docid": "f4e6f621e3b9e0129df1ddda0aa13e6c",
"score": "0.60060805",
"text": "def hash # :nodoc:\n name.hash ^ type.hash ^ requirement.hash\n end",
"title": ""
},
{
"docid": "e769e59ac54238523686f70c1f2a6c1c",
"score": "0.59953415",
"text": "def hash\n [class_id, object_type, description, name, type, system].hash\n end",
"title": ""
},
{
"docid": "ef200ff818c310e9a179653879c9f2f1",
"score": "0.59909165",
"text": "def hash; end",
"title": ""
},
{
"docid": "ef200ff818c310e9a179653879c9f2f1",
"score": "0.59909165",
"text": "def hash; end",
"title": ""
},
{
"docid": "ef200ff818c310e9a179653879c9f2f1",
"score": "0.59909165",
"text": "def hash; end",
"title": ""
},
{
"docid": "ef200ff818c310e9a179653879c9f2f1",
"score": "0.59909165",
"text": "def hash; end",
"title": ""
},
{
"docid": "ef200ff818c310e9a179653879c9f2f1",
"score": "0.59909165",
"text": "def hash; end",
"title": ""
},
{
"docid": "ef200ff818c310e9a179653879c9f2f1",
"score": "0.59909165",
"text": "def hash; end",
"title": ""
},
{
"docid": "ef200ff818c310e9a179653879c9f2f1",
"score": "0.59909165",
"text": "def hash; end",
"title": ""
},
{
"docid": "ef200ff818c310e9a179653879c9f2f1",
"score": "0.59909165",
"text": "def hash; end",
"title": ""
},
{
"docid": "ef200ff818c310e9a179653879c9f2f1",
"score": "0.59909165",
"text": "def hash; end",
"title": ""
},
{
"docid": "ef200ff818c310e9a179653879c9f2f1",
"score": "0.59909165",
"text": "def hash; end",
"title": ""
},
{
"docid": "5dda49b13de6e432061cc36723bef20e",
"score": "0.59734464",
"text": "def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end",
"title": ""
},
{
"docid": "ed81e99b1fb9dd0bdfbee8bf918e513d",
"score": "0.5964443",
"text": "def to_hash() end",
"title": ""
},
{
"docid": "fe85257322c89459e7e4472f6234a766",
"score": "0.59626937",
"text": "def hash\n [self.class, dimension, system, name].hash\n end",
"title": ""
},
{
"docid": "a6b4ae8a5945916a5ee8730ea48e511d",
"score": "0.5957955",
"text": "def hash\n\t\treturn self.name.to_s.hash\n\tend",
"title": ""
},
{
"docid": "56ce2345415a12ddc2fe4fdd19eb6b51",
"score": "0.595745",
"text": "def to_hash\n {\n type: self.class.name,\n secret: secret,\n salt: salt,\n iterations: iterations,\n hash_function: hash_function.class.name\n }\n end",
"title": ""
},
{
"docid": "f0b44237e10f8dae8cf7934053856e18",
"score": "0.59459096",
"text": "def hash\n size.hash ^ rank.hash\n end",
"title": ""
},
{
"docid": "0d90325dff70fd84bfc6bb3fc721bdfb",
"score": "0.59345263",
"text": "def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\n end",
"title": ""
},
{
"docid": "fe60a9eeaac3d0f9e9bf98328f939ff3",
"score": "0.59167206",
"text": "def hash\n [self.class, self.val, self.attribute].hash\n end",
"title": ""
},
{
"docid": "f2af5a04b5cfd922b831232c23bb425c",
"score": "0.5910424",
"text": "def hash\n\n self.h.fei.hash\n end",
"title": ""
},
{
"docid": "3f6d4de84df62c5b99d5f324e7bea556",
"score": "0.5907236",
"text": "def classes_hash\n @classes\n end",
"title": ""
},
{
"docid": "3f6d4de84df62c5b99d5f324e7bea556",
"score": "0.5907236",
"text": "def classes_hash\n @classes\n end",
"title": ""
},
{
"docid": "7b80a5cd34b3ff10c045a4c7d8274bff",
"score": "0.5895226",
"text": "def output_hash; end",
"title": ""
},
{
"docid": "17686bdd385a74e16ffe86aad36b36f0",
"score": "0.5884002",
"text": "def hash\n @hash ||= self.to_a.hash\n end",
"title": ""
},
{
"docid": "aef20a616bc584f4e9e1e5e306e7be7c",
"score": "0.58750594",
"text": "def hash\n [type, direction, shape, stops, linear_angle, is_scaled, tile_flip].hash\n end",
"title": ""
},
{
"docid": "545c6161cbb0f58788aed7ac68d225b3",
"score": "0.584882",
"text": "def hash\n @table.hash\n end",
"title": ""
},
{
"docid": "aa2be8e4d7810b0b12442043c8e349a7",
"score": "0.5846412",
"text": "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end",
"title": ""
},
{
"docid": "26fab0c477fbf1eaa413cec435e785b2",
"score": "0.5842074",
"text": "def hash\n 0\n end",
"title": ""
},
{
"docid": "9ed2b99091fc9cc7dde23c40aad66950",
"score": "0.5838653",
"text": "def hash # Hack for Ruby 1.8.6\n @node.id.hash ^ self.class.hash\n end",
"title": ""
},
{
"docid": "aa2b491dc5a8ad96d4b565f848102d55",
"score": "0.58267087",
"text": "def deep_hash\n UniMap.deep_hash( self )\n end",
"title": ""
},
{
"docid": "19191643ff1f1fc1d8a5105eabda3d7d",
"score": "0.5808177",
"text": "def hash\n return @hash_code if defined? @hash_code\n @hash_code = usual_equal_object.hash\n end",
"title": ""
},
{
"docid": "8638a1d41de4b443a0a7950732636252",
"score": "0.58037513",
"text": "def hash\n [class_id, object_type, action, cache_state, cached_time, last_access_time, md5sum, original_sha512sum, path, registered_workflows, used_count, file, network_element].hash\n end",
"title": ""
},
{
"docid": "b78a8c3fbbda0dc6b3ed59f810316f24",
"score": "0.580187",
"text": "def hash(*) end",
"title": ""
},
{
"docid": "d9e2ab74b1f30db5ad7b282990544869",
"score": "0.579625",
"text": "def hash\n @hash.hash\n end",
"title": ""
},
{
"docid": "5316fd0c87cd4e01147ffc2cd630018b",
"score": "0.5790145",
"text": "def mapping\n {\n type.to_sym => {\n properties: self.type_mapping\n }\n }\n end",
"title": ""
},
{
"docid": "76c82ba2d29e1890ce89c3f856787242",
"score": "0.578746",
"text": "def hash\n return to_s.hash\n end",
"title": ""
},
{
"docid": "4ec8cc87a203ea3ac478d4327ee2f9a9",
"score": "0.5784086",
"text": "def source_map\n o = Object.new\n def o.generated_code; \"\"; end\n def o.to_h; {version: 3, sections: nil, sources: [], mappings: []}; end\n o\n end",
"title": ""
},
{
"docid": "fe7c2c64c29c946504401d90c78c61b4",
"score": "0.5782224",
"text": "def hash\n name.hash\n end",
"title": ""
},
{
"docid": "fe7c2c64c29c946504401d90c78c61b4",
"score": "0.5781919",
"text": "def hash\n name.hash\n end",
"title": ""
},
{
"docid": "c112d36f6d1e601059e1f655db33afab",
"score": "0.5779287",
"text": "def hash\n self.class.hash ^ key_attributes.hash\n end",
"title": ""
},
{
"docid": "68483d2a8a6e059b71202a1b2e4dfc9e",
"score": "0.5774248",
"text": "def hash\n instance_variables.map do |var|\n instance_variable_get(var).hash\n end.reduce(:^)\n end",
"title": ""
},
{
"docid": "007a7471553652c67a33a8d828b85fdb",
"score": "0.57683015",
"text": "def hash\n @vbits.hash\n end",
"title": ""
},
{
"docid": "3be090c3f17c8013e2dee4d50a9daa36",
"score": "0.5762782",
"text": "def hash\r\n return to_s.hash\r\n end",
"title": ""
},
{
"docid": "d5a298e1bcfbb3e80fbf94f77fdc92ab",
"score": "0.5747454",
"text": "def hash\n @symbols.hash + 37*positive?.hash\n end",
"title": ""
},
{
"docid": "5ffd655bf48444f9af1816804362fe6b",
"score": "0.5746074",
"text": "def hash\n model.hash + key.hash\n end",
"title": ""
}
] |
e5488f68f69f310e4ddd15eebbb370e2 | Returns the `mtime` of the most recent nondot file found in the requested directory hierarchy. | [
{
"docid": "590b90d516cc756181a276a6f64100d4",
"score": "0.7249839",
"text": "def get_max_mtime(dir)\n max_mtime = Dir.glob(\"#{dir}/**/*\").max_by do |f|\n File.symlink?(f) ? Time.new(1900) : File.mtime(f)\n end\n if max_mtime.to_s.empty?\n Time.now\n else\n File.mtime(max_mtime)\n end\nend",
"title": ""
}
] | [
{
"docid": "ccfe4031b67aa4be7e88e63c5700162f",
"score": "0.73904675",
"text": "def latest_modification_time_in(directory)\n %x{find #{directory} -print0 | xargs -0 stat -f %m | sort -r | head -n1}.to_i\n end",
"title": ""
},
{
"docid": "77fa1e36a70ef6221e11d66fd9f7a2b8",
"score": "0.73674685",
"text": "def latest_mtime(path, dirs); end",
"title": ""
},
{
"docid": "77fa1e36a70ef6221e11d66fd9f7a2b8",
"score": "0.73674685",
"text": "def latest_mtime(path, dirs); end",
"title": ""
},
{
"docid": "c61f1b8415953b5743136c1b00b8612d",
"score": "0.70033634",
"text": "def get_last_mtime_of path\n ppdestore(pstore, \"#{path}-mtime\") || 0\n end",
"title": ""
},
{
"docid": "af614cd98feeae6bd8ac04e71b269593",
"score": "0.6995679",
"text": "def timestamp\n stat = File::stat(name.to_s)\n stat.directory? ? Time.at(0) : stat.mtime\n end",
"title": ""
},
{
"docid": "a2d6d62fca2aa8d0640f6637246cdc5a",
"score": "0.68090266",
"text": "def newest_file_in dir\n Find.find(dir).map { |x| [x, File.new(x).mtime] }.sort { |x,y| y[1] <=> x[1] }.first\nend",
"title": ""
},
{
"docid": "46c81135da82f948920e68eb89382a9d",
"score": "0.68077666",
"text": "def real_newest_modification_time(root_path)\n\t\t\t@exceptions = []\n\n\t\t\tnewest_mtime = nil\n\t\t\t@newest_path = nil\n\t\t\tDir[\"#{root_path}/**/*\"].each do |f|\n\t\t\t\tbegin\n\t\t\t\t\tnext if File.directory? f\n\t\t\t\t\tmtime = File.mtime f\n\t\t\t\t\tif newest_mtime.nil? or mtime > newest_mtime\n\t\t\t\t\t\tnewest_mtime = mtime\n\t\t\t\t\t\t@newest_path = f\n\t\t\t\t\tend\n\t\t\t\trescue => e\n\t\t\t\t\t@exceptions << e\n\t\t\t\t\traise if @raise_exceptions\n\t\t\t\tend\n\t\t\tend\n\t\t\tnewest_mtime\n\t\tend",
"title": ""
},
{
"docid": "782562e280bf92739073ed4b87b4ff35",
"score": "0.6770219",
"text": "def latest_mtime(path, dirs)\n max = -1\n [\"\", *dirs].each do |dir|\n curr = begin\n File.mtime(\"#{path}/#{dir}\").to_i\n rescue Errno::ENOENT, Errno::ENOTDIR, Errno::EINVAL\n -1\n end\n max = curr if curr > max\n end\n max\n end",
"title": ""
},
{
"docid": "f79d80b75070d4e567adf3c89c72a77a",
"score": "0.6650244",
"text": "def max_mtime(paths); end",
"title": ""
},
{
"docid": "c229f10d675bdcf398c760fe2b320f33",
"score": "0.65704685",
"text": "def get_mtime\n File.mtime(mtime_path) rescue Time.at(0)\n end",
"title": ""
},
{
"docid": "02dcb81d561bc441bf27c2078647b8e0",
"score": "0.65511787",
"text": "def mtime\n File.stat(path).mtime.to_i\n end",
"title": ""
},
{
"docid": "420f1dff90face2b35702b795b67922c",
"score": "0.65439886",
"text": "def last_mtime\n options[:files].map do |file|\n ::File.stat(file).mtime rescue nil\n end.compact.max\n end",
"title": ""
},
{
"docid": "178dc394af203805438738fc148b778b",
"score": "0.6527173",
"text": "def last_updated_at\n if git?\n Dir.chdir(@path) do\n Time.parse(`git log --date=iso8601 --pretty=\"%cd\" -1`)\n end\n else\n File.mtime(@path)\n end\n end",
"title": ""
},
{
"docid": "162b9469392bdb358e5619ca0b3ef9c8",
"score": "0.6517159",
"text": "def mtime\n#--{{{\n File::stat(@path).mtime\n#--}}}\n end",
"title": ""
},
{
"docid": "155c7f09efc121bccdbd3a4cd2d13373",
"score": "0.6495617",
"text": "def max_mtime(paths)\n time_now = Time.now\n max_mtime = nil\n\n # Time comparisons are performed with #compare_without_coercion because\n # AS redefines these operators in a way that is much slower and does not\n # bring any benefit in this particular code.\n #\n # Read t1.compare_without_coercion(t2) < 0 as t1 < t2.\n paths.each do |path|\n mtime = File.mtime(path)\n\n next if time_now.compare_without_coercion(mtime) < 0\n\n if max_mtime.nil? || max_mtime.compare_without_coercion(mtime) < 0\n max_mtime = mtime\n end\n end\n\n max_mtime\n end",
"title": ""
},
{
"docid": "1edb4441b9ab93d6e222c470f080deac",
"score": "0.64256054",
"text": "def newest(dirname=nil)\n dirname = '.' if dirname.nil?\n e = Dir.entries(dirname)\n e.delete('.')\n e.delete('..')\n e.sort {|x,y| File.ctime(y) <=> File.ctime(x)}[0]\nend",
"title": ""
},
{
"docid": "9156bcaf7d48112a51ccd6f1f4375037",
"score": "0.64240724",
"text": "def mtime_int\n File.mtime( fullpath ).to_i\n end",
"title": ""
},
{
"docid": "6c3691d14ac930298680ffe9cac1d17a",
"score": "0.639504",
"text": "def max_mtime(paths)\n time_now = Time.now\n paths.map {|path| File.mtime(path)}.reject {|mtime| time_now < mtime}.max\n end",
"title": ""
},
{
"docid": "2080cde3961286ec7617813e19944d4f",
"score": "0.63910824",
"text": "def mtime_for(files)\n time = files.map { |f| File.mtime(f).to_i if f.is_a?(String) && File.file?(f) }.compact.max\n Time.at(time) if time\n end",
"title": ""
},
{
"docid": "fe0eb3740bf1ff209b74ddc6ec78f20e",
"score": "0.6377486",
"text": "def max_mtime_for(subpath)\n @fragments.map { |f| f.mtime if f.target_subpaths.include?(subpath) }.compact.max\n end",
"title": ""
},
{
"docid": "34596cb1e6422b55003828ec705c83f0",
"score": "0.6363991",
"text": "def mtime\n File.mtime(complete_path)\n end",
"title": ""
},
{
"docid": "eac6f90dc95d7bcdef8de27012095ce8",
"score": "0.63596445",
"text": "def mtime\n @mtime ||= BusterHelpers.mtime_for(files)\n end",
"title": ""
},
{
"docid": "470d053bb8176dad2252447b2cb02be1",
"score": "0.63376606",
"text": "def mtime\n @path.mtime\n end",
"title": ""
},
{
"docid": "6945dbb19c31df7dceda59b077fd1ed4",
"score": "0.6330536",
"text": "def mtime_for(file)\n File.mtime(file)\n end",
"title": ""
},
{
"docid": "b88331ea5eca63f3daa3f00814ef9d42",
"score": "0.63181",
"text": "def newest_in dir\n File.exists?(dir) ? newest_file_in(dir) : [\"not existent\", Time.new(\"1/1/1970\")]\nend",
"title": ""
},
{
"docid": "07198e1c1d28b706cee0f2911621ada0",
"score": "0.6286758",
"text": "def mtime\n File.mtime(@path)\n end",
"title": ""
},
{
"docid": "f06b430c53f4091b5c8d74c530e8f307",
"score": "0.6274532",
"text": "def last_modified file\n return File.stat(file).mtime.to_i\nrescue\n return 0\nend",
"title": ""
},
{
"docid": "f06b430c53f4091b5c8d74c530e8f307",
"score": "0.6274532",
"text": "def last_modified file\n return File.stat(file).mtime.to_i\nrescue\n return 0\nend",
"title": ""
},
{
"docid": "f333b24588bfb200f87dcff37b6e4d39",
"score": "0.62173104",
"text": "def mtime\n @mtime ||= dependency_paths.map { |h| h['mtime'] }.max\n end",
"title": ""
},
{
"docid": "79ecbe2512ba9dd306119e2bc191bd6f",
"score": "0.62169385",
"text": "def mtime_of(file)\n File.lstat(file).mtime.send(HIGH_PRECISION_SUPPORTED ? :to_f : :to_i)\n end",
"title": ""
},
{
"docid": "7b410a93b94a92b4d048a224c2effa8c",
"score": "0.61973834",
"text": "def filesystem_mtime\n File.mtime(path)\n end",
"title": ""
},
{
"docid": "4a45ddaea0e6249b7ea9f403882c190a",
"score": "0.6190535",
"text": "def last_modified(file)\n mod_time = File.open(file).mtime\n (Time.now - mod_time) / 86400\nend",
"title": ""
},
{
"docid": "7b6ceb8db758a128f68efeac183b0d97",
"score": "0.6161397",
"text": "def mtime(file)\n return 0 unless File.file?(file)\n File.mtime(file).to_i\n end",
"title": ""
},
{
"docid": "7b6ceb8db758a128f68efeac183b0d97",
"score": "0.6161397",
"text": "def mtime(file)\n return 0 unless File.file?(file)\n File.mtime(file).to_i\n end",
"title": ""
},
{
"docid": "81bc486b4c446e854240456d369ffc29",
"score": "0.6155666",
"text": "def last_modified(file)\n seconds_diff = Time.now.to_i - File.new(file).mtime.to_i\n days_diff = seconds_diff / (60 * 60 * 24.0)\n \"#{file} was last modified #{days_diff} days ago\"\nend",
"title": ""
},
{
"docid": "7d06bdfa243176050fac9302c050eb8b",
"score": "0.61534196",
"text": "def latest(path)\n Dir.glob(path).max_by {|f| File.mtime(f) }\n end",
"title": ""
},
{
"docid": "87012f20c4e21b408511b135f4981aa6",
"score": "0.6148223",
"text": "def find_files_to_test(files=find_files)\n updated = files.select { |filename, mtime| self.last_mtime < mtime }\n\n p updated if $v unless updated.empty? || self.last_mtime.to_i == 0\n\n hook :updated, updated unless updated.empty? || self.last_mtime.to_i == 0\n\n if updated.empty? then\n nil\n else\n files.values.max\n end\n end",
"title": ""
},
{
"docid": "dd27806f4a76c1654ee7812ce0272f09",
"score": "0.6141015",
"text": "def last_modified\n ::File.mtime(@path)\n end",
"title": ""
},
{
"docid": "3e74e568de8597d1e0aa794ebdf84512",
"score": "0.6137897",
"text": "def last_modified\n stat.mtime\n end",
"title": ""
},
{
"docid": "3e74e568de8597d1e0aa794ebdf84512",
"score": "0.6137897",
"text": "def last_modified\n stat.mtime\n end",
"title": ""
},
{
"docid": "3e74e568de8597d1e0aa794ebdf84512",
"score": "0.6137897",
"text": "def last_modified\n stat.mtime\n end",
"title": ""
},
{
"docid": "9d1c600626646a88bca8eb6186e0dd63",
"score": "0.6123635",
"text": "def file_timestamp(path)\n File.mtime(path).to_i\n end",
"title": ""
},
{
"docid": "a0ed0c698d47151ae0adea24ebe26914",
"score": "0.61198795",
"text": "def last_modified(file)\n seconds_in_a_day = 86400\n (Time.now - File.mtime(file)) / seconds_in_a_day\nend",
"title": ""
},
{
"docid": "7360212fa416069d3abc2d1f965ef0a4",
"score": "0.60984993",
"text": "def get_mru( dirname )\n\t\t\tmru = nil\n\t\t\tdir_path = File.join( @repo, dirname )\n\t\t\tputs \"Calculating access time for #{dirname} using the files therein:\" if verbose?\n\t\t\tDir.foreach( dir_path ) do |child|\n\t\t\t\tchild_path = File.join( dir_path, child )\n\t\t\t\tif File.file? child_path then\n\t\t\t\t\tatime = File.atime( child_path )\n\t\t\t\t\tputs( \"\\tAccess time for file #{child}: #{atime}\") if verbose?\n\t\t\t\t\tmru = atime if mru == nil || atime > mru\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs \"Access time for folder #{dirname} calculated as: #{mru}\" if verbose?\n\t\t\treturn mru.to_date\n\t\tend",
"title": ""
},
{
"docid": "c5ead7f575edfbd5843e56c8f1c46763",
"score": "0.6068875",
"text": "def modification_time\r\n File.mtime(path)\r\n end",
"title": ""
},
{
"docid": "e2985f428ab8539a10aeb8d15f72e3e0",
"score": "0.606805",
"text": "def last_update_time(file)\n time = `git log -1 --format=%cd #{file} 2>/dev/null`\n if time == ''\n return ''\n end\n return Time.parse time\n end",
"title": ""
},
{
"docid": "521c73d793104c82affe1269f1102146",
"score": "0.6063626",
"text": "def get_mtime(file)\n time = File.mtime(file).to_formatted_s(:db)\n end",
"title": ""
},
{
"docid": "0c67fb37795a6928969dea2843cb54f8",
"score": "0.60623866",
"text": "def mtime(filename)\n file_try { File.mtime(filename) }\n end",
"title": ""
},
{
"docid": "be90bb78578355a47f2a5900025fad7e",
"score": "0.6037446",
"text": "def mtime\n @mtime ||= File.mtime(filename)\n end",
"title": ""
},
{
"docid": "dfe95a8a0b123fb7b659d4e9df513ed8",
"score": "0.6029488",
"text": "def key_mtime(key)\n raise ArgumentError, \"expected a valid key\" unless valid_key(key)\n File::mtime(File.join(@path, '.index', key))\n rescue Errno::ENOENT\n return nil\n end",
"title": ""
},
{
"docid": "3f3fb77117a7a8cd77e20d4b2e5f07a8",
"score": "0.6020618",
"text": "def mtime() -1 end",
"title": ""
},
{
"docid": "40b3d0db212fea528311a7dc4159d012",
"score": "0.5942418",
"text": "def lastmod(file)\n if @options[:lastmod]==:mtime\n return \" lastmod=\"+DateTime.parse(file.mtime.rfc2822).to_s\n else\n return \"\"\n end\n end",
"title": ""
},
{
"docid": "038bb4cfa3e3d8adc9a5888f9263c070",
"score": "0.5928965",
"text": "def template_last_modified\n if deps = @dependencies\n deps.map{|f| File.mtime(f)}.max\n else\n File.mtime(@path)\n end\n end",
"title": ""
},
{
"docid": "d362cbf2858bdc1f8394e035a38f3170",
"score": "0.592189",
"text": "def _uri_mtime(file)\n # For now, only accepts abcolute filenames accepted by File\n # TODO: allow http\n begin\n File.mtime(file)\n rescue\n # Return a Unix time of 0 if no file found\n Time.gm(1970,\"jan\",1,0,0,0)\n end\n end",
"title": ""
},
{
"docid": "97b44f3110528b008c83d071e1a0511a",
"score": "0.5919403",
"text": "def latest_mtime() raise \"Implement me\" end",
"title": ""
},
{
"docid": "0477c3c34a593c399097330b463b4e47",
"score": "0.5908947",
"text": "def mtime_file(filename)\n File.stat(filename).send(:mtime)\n end",
"title": ""
},
{
"docid": "1599027b0c0ab07185dc2a2438e9959e",
"score": "0.5906983",
"text": "def __get_node_last_modified_date(path, revision_number)\n return @repos.fs.root(revision_number).stat(path).time2\n end",
"title": ""
},
{
"docid": "562f90693160b0198e90fda8727f7b80",
"score": "0.59038174",
"text": "def mtime\n paths = @source_files | @provided.values\n mtimes = paths.map do |f| \n File.exists?(f) ? File.mtime(f) : Time.now\n end\n\n mtimes.max\n end",
"title": ""
},
{
"docid": "539fd761a53856a3b55c3792613a4ee8",
"score": "0.59036815",
"text": "def modification_time\n\n\t\t\treturn nil if @file_stat.nil?\n\n\t\t\t@file_stat.mtime\n\t\tend",
"title": ""
},
{
"docid": "ec2f8a1a8bf6cc39f6cbfe9f23cbe576",
"score": "0.58976376",
"text": "def last_modified\n\t\tstat[:mtime]\n\tend",
"title": ""
},
{
"docid": "c5c2b11f32278cfe1e8a2570a4d394df",
"score": "0.5894502",
"text": "def file_mtime(file)\n File.mtime(file)\n end",
"title": ""
},
{
"docid": "6e5cad5fd735e9e91321a95d5df202ea",
"score": "0.5893031",
"text": "def timestamp\n File::stat(name.to_s).mtime\n end",
"title": ""
},
{
"docid": "8a2548f86d62c6e3e7f91e5719e27042",
"score": "0.58920145",
"text": "def modified_at\n File.mtime(path)\n end",
"title": ""
},
{
"docid": "011d5158baf3a4aa613a186f31e5c604",
"score": "0.58732015",
"text": "def updated_at\n File.mtime(path).utc\n end",
"title": ""
},
{
"docid": "6cc518e8c3bfbfe9c75b89325d776089",
"score": "0.58699197",
"text": "def max_mtime_for(subpath)\n @aggregators.map { |a| a.max_mtime_for(subpath) }.compact.max\n end",
"title": ""
},
{
"docid": "e0159f66625c26c53e7c5ded9608e3b5",
"score": "0.5865417",
"text": "def source_path_mtime\n return @source_path_mtime unless @source_path_mtime.nil?\n \n if composite?\n mtimes = (composite || []).map { |x| x.source_path_mtime }\n ret = mtimes.compact.sort.last\n else\n ret = (File.exists?(source_path)) ? File.mtime(source_path) : nil\n end\n return @source_path_mtime = ret \n end",
"title": ""
},
{
"docid": "e553942dc1af4643742b7cfad361f4a9",
"score": "0.58628756",
"text": "def last_activity\n\t\tfile = self.listdir + 'archnum'\n\t\treturn unless file.exist?\n\t\treturn file.stat.mtime\n\tend",
"title": ""
},
{
"docid": "0e1f4fb5fbbaa1517dbfdfefcc481ff2",
"score": "0.5840917",
"text": "def max_modified_time\n mtime_sources = @file_map.keys.collect do |file|\n full_path = File.join(@root_dir, file)\n File.exist?(full_path) ? File.mtime(full_path) : Time.now\n end\n\n mtime_json = @json_maps.collect do |file|\n File.exist?(file) ? File.mtime(file) : Time.now\n end\n\n [mtime_sources.max, mtime_json.max].compact.max\n end",
"title": ""
},
{
"docid": "0c0269adea6334d0551fc222717f07bf",
"score": "0.5838335",
"text": "def last_modified(parts)\n files = parts.select{ |f| File.file?(f) }\n times = files.collect do |part|\n file = File.join(part)\n File.mtime(file)\n end\n times.max\n end",
"title": ""
},
{
"docid": "f2ace352237040d3297e2aa40f1879a0",
"score": "0.5833634",
"text": "def mtime(p)\n File.mtime(p)\n end",
"title": ""
},
{
"docid": "bfbf0bf328f504fa62a5d42e60a27518",
"score": "0.5824798",
"text": "def mtime\n @mtime || Time.now\n end",
"title": ""
},
{
"docid": "bfbf0bf328f504fa62a5d42e60a27518",
"score": "0.5824798",
"text": "def mtime\n @mtime || Time.now\n end",
"title": ""
},
{
"docid": "4a9879396c8a44ad53e16e200af09fc6",
"score": "0.58181196",
"text": "def last_modified\n File.new(__FILE__).mtime\n end",
"title": ""
},
{
"docid": "4a9879396c8a44ad53e16e200af09fc6",
"score": "0.58181196",
"text": "def last_modified\n File.new(__FILE__).mtime\n end",
"title": ""
},
{
"docid": "1c8bb3439346e1a4c4c56ce2c870e303",
"score": "0.5808629",
"text": "def last_modified(file) \r\n time = Time.now - File.new(file).atime\r\n days = time / 86400.0\r\n \"#{file} was last modified #{days} days ago.\" \r\nend",
"title": ""
},
{
"docid": "92d4dea713116bc159f8f7fd1b458de0",
"score": "0.5804671",
"text": "def source_path_mtime\n return @source_path_mtime unless @source_path_mtime.nil?\n\n if composite?\n mtimes = (composite || []).map { |x| x.source_path_mtime }\n ret = mtimes.compact.sort.last\n else\n ret = (File.exists?(source_path)) ? File.mtime(source_path) : nil\n end\n return @source_path_mtime = ret\n end",
"title": ""
},
{
"docid": "fd7f88ac0f96fb66c8b27adbc29cb253",
"score": "0.5794727",
"text": "def last_modified\r\n return nil if @attrs[:lastModified].nil?\r\n return nil if @attrs[:lastModified]==0\r\n Time.at(@attrs[:lastModified]/1000)\r\n end",
"title": ""
},
{
"docid": "1b31ad60177d8a157547866f9c3db3a7",
"score": "0.579201",
"text": "def mtime\n Time.at(@native.lastModified().to_f / 1000)\n end",
"title": ""
},
{
"docid": "14d1bb0017f5b3eee4f4e42070d17a09",
"score": "0.5791588",
"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": "d7e77dfd83370d7dba60f691d5c27279",
"score": "0.57801956",
"text": "def get_last_ran_at\n return nil if self.log_file.nil?\n File.mtime(self.log_file)\n end",
"title": ""
},
{
"docid": "e4343a13cfe78ef65b86a81103d7a36d",
"score": "0.5771163",
"text": "def last_modified_file\n files.first\n end",
"title": ""
},
{
"docid": "e1d6b786b92ac273078b8871d94b0a8b",
"score": "0.57678455",
"text": "def last_added(path)\n path += \"*\" unless path.index(\"*\")\n Dir[path].select {|f| test ?f, f}.sort_by {|f| File.mtime f}.pop\n end",
"title": ""
},
{
"docid": "7b8775bc4503b24be6cebc3b48cab941",
"score": "0.5763273",
"text": "def modified_time(file)\n File.mtime(file)\nend",
"title": ""
},
{
"docid": "8f16f3c64cf461ab203abe17fdcd2d3c",
"score": "0.5746019",
"text": "def last_added_dir(path)\n path += \"*\" unless path.index(\"*\")\n Dir.glob(path + \"/*/\", File::FNM_CASEFOLD).sort_by {|f| File.mtime f}.pop\n end",
"title": ""
},
{
"docid": "8f16f3c64cf461ab203abe17fdcd2d3c",
"score": "0.5746019",
"text": "def last_added_dir(path)\n path += \"*\" unless path.index(\"*\")\n Dir.glob(path + \"/*/\", File::FNM_CASEFOLD).sort_by {|f| File.mtime f}.pop\n end",
"title": ""
},
{
"docid": "8f16f3c64cf461ab203abe17fdcd2d3c",
"score": "0.5746019",
"text": "def last_added_dir(path)\n path += \"*\" unless path.index(\"*\")\n Dir.glob(path + \"/*/\", File::FNM_CASEFOLD).sort_by {|f| File.mtime f}.pop\n end",
"title": ""
},
{
"docid": "cb935cd460aa48c99a0d8d1166f11035",
"score": "0.57383084",
"text": "def filetime(f)\n File.mtime(f).to_s\nend",
"title": ""
},
{
"docid": "b7b696a3d39412ad5686b7cfab6bb9de",
"score": "0.5738083",
"text": "def last_modified options = {}\n changed_at = [Time.zone.at(::File.new(\"#{Rails.root}\").mtime), created_at, updated_at, modified_at]\n \n if(options[:include_pages])\n changed_at << Humpyard::Page.select('updated_at').order('updated_at DESC').first.updated_at\n end\n \n (changed_at - [nil]).max.utc \n end",
"title": ""
},
{
"docid": "17b838fb83ffc5eeec64a032f3397ed6",
"score": "0.57361543",
"text": "def mtime(filename, local = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "7223c43e80768841543cf7afe290135d",
"score": "0.5734927",
"text": "def mtime\n Time.at(@mtime)\n end",
"title": ""
},
{
"docid": "7223c43e80768841543cf7afe290135d",
"score": "0.5734927",
"text": "def mtime\n Time.at(@mtime)\n end",
"title": ""
},
{
"docid": "0022205a8a2d09759fdb9d1fd0dac4d6",
"score": "0.57319677",
"text": "def mtime\n Time.at @mtime\n end",
"title": ""
},
{
"docid": "941aaecdbebf0475f4e7effbd2e6cde4",
"score": "0.5727596",
"text": "def mtime(relative_path)\n full_path = path(relative_path)\n File.exists?(full_path) ? File.mtime(full_path) : nil\n end",
"title": ""
},
{
"docid": "3e5563835c5dff3e69ba6be94bb68d08",
"score": "0.57270575",
"text": "def last_updated\n self.subtree.map { |child| child.updated_at }.max\n end",
"title": ""
},
{
"docid": "70ada65d09f98b03de07567916f70a0b",
"score": "0.57247025",
"text": "def modification_time\n (run_baby_run 'GetFileInfo', ['-P', '-m', self]).chomp!\n end",
"title": ""
},
{
"docid": "004131da3420aab7ca6423c4a78fe4e8",
"score": "0.5712182",
"text": "def files\n Dir.glob(\"#{File.expand_path(path)}/*\").map do |filename|\n begin\n [File.mtime(filename), filename]\n rescue Errno::ENOENT\n nil\n end\n end.compact.sort.reverse.map { |mtime, filename| filename }\n end",
"title": ""
},
{
"docid": "c757020f6406893cd8cd0a01c54bcc34",
"score": "0.5711727",
"text": "def subdir_times(dir)\n h = {}\n Find.find(dir) do |f|\n h[f] = modified_at(f) if File.directory?(f)\n end\n h\n end",
"title": ""
},
{
"docid": "3a2c152d1573a5a2732bf8e3e02075a4",
"score": "0.5705378",
"text": "def lastmod\n File.mtime(location.path) if location.reserved_name?\n rescue\n nil\n end",
"title": ""
},
{
"docid": "43cfa6fd2d4729adee30c7fb80509f7e",
"score": "0.56713915",
"text": "def fileTimestamp\n timestamp = Time.at($ZEROTIME)\n localfile = cacheFile(@url)\n if localfile and File.exist?(localfile)\n begin\n timestamp = File.mtime(localfile)\n rescue => e\n # there's no cache file\n debug \"mtime failed: #{e}\"\n end\n end\n return timestamp\n end",
"title": ""
},
{
"docid": "8b4dd659f326688c90f5253c882a8d8d",
"score": "0.56679267",
"text": "def file_mtime filename\n\t\t\treturn CACHE_STORE[filename].mtime if cached?(filename)\n\t\t\tFile.mtime(filename)\n\t\tend",
"title": ""
}
] |
0ad7f48c598c80ab73127ee9b2368aaa | a user has left | [
{
"docid": "d8753845986a9152752aad37d8e2b28e",
"score": "0.0",
"text": "def terminate_session\n puts \"starting termination....\"\n \tuser = User.find_by(email: session[:user][:email])\n lobby = Lobby.find_by id: user.lid\n chan = user.lid.to_s\n\n user.update(race_status: \"not in lobby\", lid: nil)\n #check if lobby is empty\n if User.where(\"lid = ?\", lobby.id).count==0\n #lobby has 0 players now, so we delete it\n lobby.delete()\n #check if host has left (other players are still in game)\n elsif session[:user][:email]==lobby.host\n #select new host for lobby\n new_host = User.where(\"lid = ? AND email != ?\", lobby.id, user.email).first.email\n lobby.update(host: new_host)\n WebsocketRails[chan].trigger(:new_host, {new_host_name: new_host})\n end\n \n race = Race.where(\"lid = ? AND end_time is ?\", lobby.id, nil).first()\n #if user was in race, store progress\n if race!=nil\n lastUpdate = CurrentRaceUpdate.where(\"uid = ? AND rid = ?\", user.id, race.id).order(\"created_at\").last()\n dist = lastUpdate.distance\n raceSum = RaceSummary.where(\"uid = ? AND rid = ?\", user.id, race.id)\n time = Time.now-race.created_at\n cb = ((82*dist*0.000621371192)*(time/3600)).round\n if raceSum.count==0\n RaceSummary.create(uid: user.id, rid: race.id, place: 0, time: time, distance: dist*0.000621371192, calories: cb, map: lobby.map)\n else\n if raceSum.first().place==0\n raceSum.first().update(time: Time.now-race.created_at, distance: dist*0.000621371192, calories: cb)\n end\n end\n \n #if they were last racer, end race and restart lobby\n if User.where(\"lid = ? AND race_status = ?\", lobby.id, 'racing').count==0\n race.update(end_time: Time.now)\n CurrentRaceUpdate.delete_all(\"rid=#{race.id}\")\n User.where(\"lid = ?\", lobby.id).each do |player|\n player.update(race_status: \"lobby\")\n end\n WebsocketRails[chan].trigger(:restart, {finishes: RaceSummary.where(\"rid = ?\", race.id).limit(16).order(\"place\").select('users.email, race_summaries.*').joins('INNER JOIN users ON users.id = race_summaries.uid')})\n end\n end\n\n #remove user from lobby\n WebsocketRails[message[:chan]].trigger(:dc_user, {email: session[:user][:email], host_name: lobby.host})\n puts \"....terminate session channel:#{message[:chan]} user:#{session[:user][:email]}\"\n end",
"title": ""
}
] | [
{
"docid": "d22c40385cf39c4ae7bec266f21d98f3",
"score": "0.7194447",
"text": "def user_left channel, user\n cache[:names].delete user.nick\n end",
"title": ""
},
{
"docid": "317191e23c922f6356eee7b9a51a2415",
"score": "0.6989783",
"text": "def leave!(reason = 'Logout')\n self.active = false\n self.save\n \n UserLeftEvent.new(self, 'Logout').enqueue_for_all_active_users(:except => self.id)\n \n # TODO: End active games that the user was participating in...\n \n \n self\n end",
"title": ""
},
{
"docid": "b686cfd7dce2a6e341851aefd8270c87",
"score": "0.6700544",
"text": "def leave( user )\n user.active = false\n if user.save\n return \"Take a break! :desert_island: Type `opt`, `yes` or `join` anytime to hop back in.\"\n else\n return \"Sorry, something went wrong. :robot_face: Please try again.\"\n end\n end",
"title": ""
},
{
"docid": "8badd501609d8ae4c90407c04de6cdcd",
"score": "0.6699127",
"text": "def can_leave?(user)\n !membership(user).nil?\n end",
"title": ""
},
{
"docid": "143eec2b61d4a276f5f03813c5347e85",
"score": "0.66874254",
"text": "def user_leave(aUser)\n aUser.in_game = false\n aUser.save\n end",
"title": ""
},
{
"docid": "ce09281ba0d203d60fbe611589cc8f8b",
"score": "0.66419244",
"text": "def leave(user)\n if self.status == ROOM_STATUS[:open]\n if self.join?(user)\n # Delete existing grids\n Room.transaction do\n self.grids.where(user_id: user.id).each do |grid|\n grid.delete\n end\n self.users.delete(user)\n end\n self.edit_occupancy\n self.save\n end\n elsif self.status == ROOM_STATUS[:locked]\n # during the game play; mark the status in the connection table\n self.set_user_status(user, USER_STATUS[:leave])\n else self.status == ROOM_STATUS[:finished]\n # Do nothing\n false\n end\n end",
"title": ""
},
{
"docid": "0cda53d1dac215058b30aea0bbbb7924",
"score": "0.6554119",
"text": "def leave\n if @room.users.include?(current_user)\n @room.users.delete(current_user)\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"title": ""
},
{
"docid": "b8648a4a4e191aec195caa178f3f5c89",
"score": "0.6479428",
"text": "def leave user\n demote user\n self.users.destroy user\n if self.users.size == 0\n self.destroy\n end\n end",
"title": ""
},
{
"docid": "9c2734ff8e01ae8284ff0baa9eaf9a59",
"score": "0.6471278",
"text": "def leave?\n !@session.nil? && !session.meetup.archived && !@user.nil? &&\\\n @session.holdings.where(user_id: @user.id).exists? &&\\\n @user != @session.holdings.first.user\n end",
"title": ""
},
{
"docid": "a3a7447ccfb39c2ec277b6c9ed08da63",
"score": "0.643562",
"text": "def onUserLeave(server, channel, user, reason)\n end",
"title": ""
},
{
"docid": "c8c6ec3136d85a8698f5eb186f424edc",
"score": "0.6427872",
"text": "def user_count_changed(status = :join)\n # set up giver\n if @users.size > 0\n @card = @cards.first\n \n if @card.nil?\n game_over\n return\n end\n \n giver = find_giver\n giver.trigger_event Event.new(:become_giver)\n giver.trigger_event Event.new(:new_card, {word: @card.word, taboo_words: @card.taboo_words})\n end\n \n # check if more than one user is playing\n if @users.size == 1\n # only one guy left\n @paused = true\n trigger_global_event Event.new(:pause)\n elsif @users.size == 2 && status == :join\n # second user joined, game can continue\n @paused = false\n trigger_global_event Event.new(:unpause)\n end\n \n trigger_users\n trigger_time_sync\n end",
"title": ""
},
{
"docid": "f23924ecf27422eb220756278b8ffebf",
"score": "0.64234877",
"text": "def users_joined?\n true\n end",
"title": ""
},
{
"docid": "e68f6e6f4fc718d944176184ed136a75",
"score": "0.6397555",
"text": "def remaining_spaces?\n\t\tself.users.count\n\t\t#self.number_of_volunteers - self.users.count\n\tend",
"title": ""
},
{
"docid": "9a80d52149775d9636ca903e955fb9a5",
"score": "0.63686687",
"text": "def client_left( user )\n @clients.delete( user )\n msg = \"#{user} left the Server.\"\n logger( msg )\n process_msg( \"ChatServer\", msg )\n end",
"title": ""
},
{
"docid": "f3e2b33431592d44fd301b0ae8038a96",
"score": "0.6134893",
"text": "def leave!\n @client.chat_del_user(self, @client.profile.to_tg)\n end",
"title": ""
},
{
"docid": "134c783985b30619d3814b5fbd060c4f",
"score": "0.61066693",
"text": "def got_part network, command\n name = command[0]\n \n if channel = network.channel_by_name(name)\n if user = channel.user_by_nick(command.sender.nickname)\n channel.users.delete user\n \n emit :user_left, channel, user\n end\n end\n end",
"title": ""
},
{
"docid": "6f336f3e4ffb976ce7466d73ad1d0df5",
"score": "0.6105012",
"text": "def ensure_an_admin_remains\n \t\t\tif User.count.zero?\n \t\t\t\traise \"Can't delete last user\"\n \t\t\tend\n \t\tend",
"title": ""
},
{
"docid": "0f5d0a7b332c97d59275d37135a9ee48",
"score": "0.6092863",
"text": "def leave(*args)\r\n args.each do |user|\r\n conversation_members.where(:user_id => user.id).update_all :parted => false\r\n\r\n destroy_empty\r\n broadcast_destroy user\r\n end\r\n end",
"title": ""
},
{
"docid": "1fe3bff86ab23cfee41cdfd15c381c53",
"score": "0.60924995",
"text": "def remove_from_backend\n json_body = { key: join_key, match_key: match_key }\n send_json \"#{backend_http_url}/user_left\", json_body\n\n # NOTE: no error handling here; if the backend is down, it already removed\n # the user from the queue\n end",
"title": ""
},
{
"docid": "8a0675c16c74c8bf971377ffbd851eaa",
"score": "0.60733587",
"text": "def ensure_an_admin_remains\n \t\tif User.count.zero?\n \t\t\traise \"Can't delete last User\"\n \t\tend \t\t\n \tend",
"title": ""
},
{
"docid": "375af2a23654d3ee8ca9168e7a3b2085",
"score": "0.605384",
"text": "def ensure_an_admin_remains\n\t\tif User.count.zero?\n\t\traise \"Can't delete last user\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "b9bac4f83e924941044c3bda6a6c6ed9",
"score": "0.60532534",
"text": "def leave(user_id)\n if is_a_member?(user_id)\n begin\n NotesUser.find_by_sql(\"DELETE FROM notes_users WHERE note_id = #{self.id} and user_id = #{user_id}\")\n rescue\n return false\n end\n end\n return true\n end",
"title": ""
},
{
"docid": "b9fcec6df576714b4946412fffbdb16f",
"score": "0.6052226",
"text": "def client_left( user )\n @clients.delete( user )\n msg = \"\\\"#{user}\\\" no longer connected.\"\n self.logger( msg )\n self.process_msg( \"ChatServer\", msg )\n end",
"title": ""
},
{
"docid": "b23c619b02b5b53c10496886db008a26",
"score": "0.6029284",
"text": "def has_left?\n self.activity.each {|activity|\n if activity.code.to_i >= 100\n return true\n end\n }\n return false\n end",
"title": ""
},
{
"docid": "74ebd0ea928a1418fea456969cecd44c",
"score": "0.6011374",
"text": "def ensure_an_admin_remains\n\t\tif User.count.zero?\n\t\t\traise \"Can't delete last user\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "b23d979de7c949c508d60d2e92d93804",
"score": "0.59991956",
"text": "def users_managed_by_leave_admin\r\n users_leave_ids = self.users.can_create_leave_request.not_contractor.pluck(:id)\r\n lmr = self.leave_management_rules.where(action: LeaveManagementRule.actions[\"is_managed_by\"])\r\n lmr_users = lmr.map(&:to_users)\r\n user_list = lmr_users.map{|t| t[:user_senders] + t[:user_receivers]}.flatten.uniq\r\n manages_user_list = lmr_users.map{|t| t[:user_senders]}.flatten.uniq\r\n return (user_list - manages_user_list).select{|u| u.id.in?(users_leave_ids)}\r\n end",
"title": ""
},
{
"docid": "893ef1dce4ed475f4ccd02a89f8ead28",
"score": "0.5984413",
"text": "def lose_life(user)\n if user.lives > 1\n user.lives -= 1\n switch_user\n puts \"P1: #{@players[0].lives}/3 vs P2: #{@players[1].lives}/3\"\n puts \"\\n\" + @@new_turn_alert\n play_game\n elsif user.lives == 1\n switch_user\n puts \"#{@current_user.name} wins with a score of #{@current_user.lives}/3\"\n puts \"\\n\" + @@game_over_alert\n play_again?\n end\n end",
"title": ""
},
{
"docid": "514d653b78816bd0e8e5fd752fbf22ad",
"score": "0.5975959",
"text": "def leave\n @users_group = group.users_groups.where(user_id: current_user.id).first\n\n if group.last_owner?(current_user)\n redirect_to(profile_groups_path, alert: \"You can't leave group. You must add at least one more owner to it.\")\n else\n @users_group.destroy\n redirect_to(profile_groups_path, info: \"You left #{group.name} group.\")\n end\n end",
"title": ""
},
{
"docid": "1fa5359b3de1f3018af8b51ef0ce3e3d",
"score": "0.59385514",
"text": "def player_leave(user_name)\r\n # when aplayer leave the game, his label becomes empty\r\n lbl_displ_pl = get_player_lbl_symbol(user_name)\r\n lbl_gfx = @labels_to_disp[lbl_displ_pl]\r\n if lbl_gfx\r\n lbl_gfx.text = \"(Posto vuoto)\"\r\n update_dsp\r\n else\r\n @log.warn(\"player_leave(GFX) don't have recognized player: #{user_name}\")\r\n end\r\n end",
"title": ""
},
{
"docid": "1fa5359b3de1f3018af8b51ef0ce3e3d",
"score": "0.59385514",
"text": "def player_leave(user_name)\r\n # when aplayer leave the game, his label becomes empty\r\n lbl_displ_pl = get_player_lbl_symbol(user_name)\r\n lbl_gfx = @labels_to_disp[lbl_displ_pl]\r\n if lbl_gfx\r\n lbl_gfx.text = \"(Posto vuoto)\"\r\n update_dsp\r\n else\r\n @log.warn(\"player_leave(GFX) don't have recognized player: #{user_name}\")\r\n end\r\n end",
"title": ""
},
{
"docid": "ca356895642385ee1620415179bd6b62",
"score": "0.59334844",
"text": "def ensure_an_admin_remains\n if User.count.zero?\n raise \"Cant delete last user\"\n end\n end",
"title": ""
},
{
"docid": "f2464c203500a7372cdc5fc6b594c6ca",
"score": "0.59227586",
"text": "def has_left?\n has_arrived? ||\n activity.any? { |activity| HAS_LEFT_CODES.include?(activity.code) }\n end",
"title": ""
},
{
"docid": "655b65c8fdb220d656a6882a98d8af38",
"score": "0.59222454",
"text": "def ensure_an_admin_remains\n if User.count.zero?\n raise \"Can't delete last user\"\n end\n end",
"title": ""
},
{
"docid": "655b65c8fdb220d656a6882a98d8af38",
"score": "0.59222454",
"text": "def ensure_an_admin_remains\n if User.count.zero?\n raise \"Can't delete last user\"\n end\n end",
"title": ""
},
{
"docid": "c8c079712bc89254aa039972c42ed149",
"score": "0.59185296",
"text": "def leave\n RedisSingleton.instance.srem('participants', current_user.to_json)\n send_members_to_chat\n end",
"title": ""
},
{
"docid": "b4476a7650f1c752e7e4551d4cec5260",
"score": "0.5895835",
"text": "def player_leave(user_name)\r\n # when player leave the game, his label becomes empty\r\n @labels_graph.change_text_label(user_name, \"(Posto vuoto)\")\r\n update_dsp\r\n end",
"title": ""
},
{
"docid": "2a09d0357b251d8369a4230a21079336",
"score": "0.5888988",
"text": "def guesses_left\n @current_guess_count < @guesses_allowed\n end",
"title": ""
},
{
"docid": "ec49f2aac221918aea960d8e3e2abd43",
"score": "0.58757013",
"text": "def got_part network, message\n channel_name = message.parameters[0]\n\n return unless (channel = network.channels[channel_name])\n return unless (user = network.users[message.prefix.nick])\n\n _user_part_channel user, channel\n\n emit :user_left, channel, user\n end",
"title": ""
},
{
"docid": "e2289ae6ca6d6789b1e939b7a128d1a0",
"score": "0.58571076",
"text": "def lobby_a_new_user user_id\n user = User.find_by(id: user_id)\n user_current_game = user.try(:current_game)\n if user.blank? || # player doesn't exist or\n user.current_games_user_name || # player already created a game name for a game lobbying with game\n user_current_game.try(:midgame?) # c) player is currently in the middle of a game\n\n return false\n\n elsif user_current_game.try(:pregame?)\n # remove other game user that the user wishes to not be associated with any more\n user.current_games_user.try(:destroy)\n end\n\n self.users << user\n true\n end",
"title": ""
},
{
"docid": "c22257460147e1a351d978fe684308a5",
"score": "0.5852881",
"text": "def leave\n @current_user.cluster = nil\n end",
"title": ""
},
{
"docid": "cb91b2cdde5b85aa3f1c80fc6b904222",
"score": "0.58487636",
"text": "def leave\n # Attempt to grab their membership\n membership = @club.memberships.find_by(user_id: current_user.id)\n if membership\n # Remove their membership\n membership.delete\n\n # User is already a member\n redirect_to @club, notice: 'You have left this club.'\n else\n # User isn't a member to begin with\n redirect_to @club, notice: 'You were never a member to begin with.'\n end\n end",
"title": ""
},
{
"docid": "9a22eedd43148510cd86b303a529aa0c",
"score": "0.58479077",
"text": "def canbeJoined\n \tisNotExpired && (status == 1) \n end",
"title": ""
},
{
"docid": "5537f5b0b2630838767bea38585c18ef",
"score": "0.5843667",
"text": "def jobs_left()\n return @guru.duties_left()\n end",
"title": ""
},
{
"docid": "49462b418f12f6deb3d77bebe4af6665",
"score": "0.58094907",
"text": "def in_game_leave\n board = Board.find(params[:board_id])\n user = User.find(params[:user_id])\n losing_team = user.current_team\n\n board.teams.each do |team|\n team.game_result = team == losing_team ? :loss : :win\n team.save\n end\n push_public_board_info(params[:channel_name], params[:public_update_event_name], board.id, {game_abort: true})\n board.users.each do |each_user|\n each_user.current_team = nil\n each_user.state = :lobby\n each_user.save\n end\n board.update_number_of_players\n board.save\n reset_board(board)\n render :json => {'success' => true}\n end",
"title": ""
},
{
"docid": "4acf71c86f54abc6141357f15296b5f9",
"score": "0.58017355",
"text": "def away(username, status=nil)\n user = StatusUser.new(username, status: status)\n\n @client.setex (STATUS_KEY + username),\n EXPIRE_TIME_IN_SECONDS,\n user.for_redis\n\n @history.left(username, user.time)\n\n user\n end",
"title": ""
},
{
"docid": "df1028e13fc33be7ae4c659d0e2b9fb3",
"score": "0.57988405",
"text": "def leave\n if current_user.leave @club\n redirect_to :back, notice: \"Left #{ @club.title }\"\n else\n redirect_to :back, alert: 'Something went wrong'\n end\n end",
"title": ""
},
{
"docid": "7a046ff7ad686941ed088ce2f29d7913",
"score": "0.57956845",
"text": "def leaves\n if current_user.max_leaves == (current_user.leaves.where(:status => \"accepted\").count + current_user.leaves.where(:status => \"pending\").count)\n flash[:notice] = \"Sorry , Your Leaves Have been Completed\"\n redirect_to \"/leaves\"\n end\nend",
"title": ""
},
{
"docid": "ba73d3afa0952d50bd1468edd7e787b0",
"score": "0.5794255",
"text": "def guesses_left_statement\n\t\tguesses_left = (@guesses_allowed - @current_guess_count)\n\t\t\n\t\tif guesses_left > 1\n\t\t\t\"You have \" + guesses_left.to_s + \" guesses left.\"\n\t\telse\n\t\t\t\"Be careful! You only have \" + guesses_left.to_s + \" guess left.\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "bdc3c8d0e530e0ff655d71739ed33d57",
"score": "0.57889766",
"text": "def ensure_an_admin_remains\n if User.count.zero?\n raise Error, \"Can't delete the last user!\"\n end\n end",
"title": ""
},
{
"docid": "54fe8159fefd8bd6124b0f85d9351e0e",
"score": "0.57845074",
"text": "def leave \n members = @forum_poll.members.where(:user_id=> current_user.id)\n members.delete_all\n flash[:notice] = 'Forum poll is successfully Leaved.'\n redirect_to '/dashboard'\n end",
"title": ""
},
{
"docid": "483747c9e51a892f2658933fa6c0bab4",
"score": "0.57778996",
"text": "def any_unassigned_users_left?(vidwall_user_tag_rankings)\n vidwall_user_tag_rankings.any?{|wall, users| !users.empty?}\n end",
"title": ""
},
{
"docid": "1f2f443a77ce8e02d3c7fb7ebe823396",
"score": "0.57694817",
"text": "def yozm_joined?\n\t\t\tget(\"/yozm/v1_0/user/joined.json\")\n\t\tend",
"title": ""
},
{
"docid": "90850df711f7d158eff89945dff687bc",
"score": "0.5767096",
"text": "def ensure_an_admin_remains\n if User.count.zero?\n raise Error.new \"Can't delete last user\"\n end\n end",
"title": ""
},
{
"docid": "f2f5efd95ac313b47238b7c82442ff23",
"score": "0.5763838",
"text": "def trying_to_takeover\n @user.email == 'ozelen@djerelo.info' && current_user.email != 'ozelen@djerelo.info'\n end",
"title": ""
},
{
"docid": "6b854ea47d331552cbfd7a7325312ae4",
"score": "0.5758989",
"text": "def has_left?\n activity.any? {|activity| activity.code.to_i >= 100 }\n end",
"title": ""
},
{
"docid": "69988dbe3434770c14f7ace00f58ede3",
"score": "0.5758036",
"text": "def ensure_an_admin_remains\n if User.count.zero?\n raise Error.new \"Can't delete the last user\"\n end\n end",
"title": ""
},
{
"docid": "a6601b87a738388be564db004fbdf76a",
"score": "0.574316",
"text": "def time_left\n @timeleft\n end",
"title": ""
},
{
"docid": "ed9c2db36341004b843c38e8cd065a99",
"score": "0.5742429",
"text": "def user_join\n current_user.in_game = true\n current_user.save\n end",
"title": ""
},
{
"docid": "cd0a7119b5683003e578b03e0abaaa64",
"score": "0.5730726",
"text": "def guesses_left\n @guesses_allowed - @current_guess_count\n \n end",
"title": ""
},
{
"docid": "08af44e69e3ac617c88e8eff2003f0c6",
"score": "0.5725259",
"text": "def loser?(user)\n !self.winner.nil? && (self.winner.id != user.id)\n end",
"title": ""
},
{
"docid": "888d110d1670d5dda148e274b574ee89",
"score": "0.57062674",
"text": "def tries_left?\n return tries <= 0 ? false : true\n end",
"title": ""
},
{
"docid": "5ae93be857c02f48ef8b6113d9f46062",
"score": "0.57032084",
"text": "def end_of_game(user)\n\tputs \"La partie est finie\"\n\tif user.life_points > 0 \n\t\tputs \"BRAVO ! TU AS GAGNE !\"\n\telse\n\t\tputs \"Loser ! Tu as perdu !\"\n\tend\nend",
"title": ""
},
{
"docid": "4606333218d840c2c0d8816b45d8bc83",
"score": "0.5701148",
"text": "def on_part(context, channel, user)\n return unless context.nick.strip.downcase == user.nick.strip.downcase\n context.part_succeeded(channel) \n @log.debug(\"#{network_name(context)} Successfully left channel #{channel}.\") \n end",
"title": ""
},
{
"docid": "550065a02556631cc7ab3f07758d7282",
"score": "0.56879884",
"text": "def leave\n id = params[:id]\n @group = Group.find(id)\n if @group.group_users.find_by_user_id(@current_user.id).destroy #find user in GroupUser and delete\n flash[:notice] = \"You have left this group.\"\n redirect_to root_path\n else\n flash.now[:alert] = \"You cannot leave. Sorry.\"\n render root_path\n end\n end",
"title": ""
},
{
"docid": "26db7dc4cd77b0d2c98a7c24523d707b",
"score": "0.5684643",
"text": "def ensure_an_admin_remains\n raise Error, 'Can\\'t delete last user!' if User.count.zero?\n end",
"title": ""
},
{
"docid": "0078d5362e4902cd66ad1750b28f1b4d",
"score": "0.56818104",
"text": "def time_left\n time_difference(Time.now,out_time)\n end",
"title": ""
},
{
"docid": "01d78d8a31134c2e629f5281e809b992",
"score": "0.56740594",
"text": "def cancel_joining(other_user)\n guests.delete(other_user)\n end",
"title": ""
},
{
"docid": "707e258a1cb14327987bdfc7d1aef7a5",
"score": "0.5671214",
"text": "def user_unsynched?(user)\n $redis.get(redis_key(\"user_unsynched:#{user.id}\")) == '1'\n end",
"title": ""
},
{
"docid": "707e258a1cb14327987bdfc7d1aef7a5",
"score": "0.5671214",
"text": "def user_unsynched?(user)\n $redis.get(redis_key(\"user_unsynched:#{user.id}\")) == '1'\n end",
"title": ""
},
{
"docid": "90a8c3224d6096d02dc1ce846a4a8b4c",
"score": "0.5663886",
"text": "def ensure_one_admin_remains\n raise \"Can't delete last user\" if User.count.zero?\n end",
"title": ""
},
{
"docid": "34569ff4691b016e1418210cde9f0091",
"score": "0.56611836",
"text": "def guesses_left\n @guesses_allowed - @current_guess_count\n end",
"title": ""
},
{
"docid": "7bca32d242b392010d552e81ad1cc687",
"score": "0.5656665",
"text": "def leave_team\n if current_user.team_id != -1\n @team = Team.find(current_user.team_id)\n @team.players_id.delete(current_user.id)\n current_user.update_attribute(:team_id, -1)\n @team.save\n current_user.save\n flash[:warning] = \"You have left this team.\"\n end\n redirect_to action: \"show\"\n end",
"title": ""
},
{
"docid": "8409e243031194a2ba0023c258f48a88",
"score": "0.5651939",
"text": "def remaining\r\n\t\t@guesses=@guesses-1\r\n\t\t@guesses\r\n\tend",
"title": ""
},
{
"docid": "cae403bc92cf29522fa600e57bcc770f",
"score": "0.5630469",
"text": "def sleeptime_left(wakeup_time)\n # TODO\n end",
"title": ""
},
{
"docid": "bc826541f4b6c939fd509a7d22b0d0e6",
"score": "0.5627258",
"text": "def in_full_game\r\n # Return if the user is ingame and there is a second user\r\n return in_game && @current_game.user2 != nil\r\n end",
"title": ""
},
{
"docid": "50e2ae2076e08ff5331e8c65a44e952f",
"score": "0.56269914",
"text": "def has_invitations_left?; end",
"title": ""
},
{
"docid": "853d68157a2e99ea392727ff36c7c5c5",
"score": "0.56252885",
"text": "def leave\n request(:leave)\n end",
"title": ""
},
{
"docid": "70f9eb0855fd0323bdae8d15f9988fe0",
"score": "0.56250614",
"text": "def leave \n members = @community.members.where(:user_id=> current_user.id)\n members.delete_all\n flash[:notice] = 'Group is successfully Leaved.'\n redirect_to '/dashboard'\n end",
"title": ""
},
{
"docid": "ef5c5ad6dbe4896e8d3d10c3cd9e1686",
"score": "0.5621126",
"text": "def has_left\n super || time_left_at&.past?\n end",
"title": ""
},
{
"docid": "e3af5b710940daab1a4af033131c6f7f",
"score": "0.5610538",
"text": "def client_left( nick )\n @clients.delete( nick )\n msg = \"#{nick} left the Server.\"\n logger( msg )\n process_msg( \"ChatServer\", msg )\n end",
"title": ""
},
{
"docid": "defc64d93685cb0cfdc2ff1508c3c647",
"score": "0.5610428",
"text": "def erg_leader?\r\n group_leaders.count > 0\r\n end",
"title": ""
},
{
"docid": "852125ffbad30f38799ca9a69850a198",
"score": "0.5607887",
"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": "06c68b8659f1f06f99818cc9e4a7c64d",
"score": "0.56067985",
"text": "def held_roles(user)\n if user\n held_roles = AuthorizationRole.held_by(user)\n if held_roles.empty?\n return \"Current user #{user} holds no roles.\"\n else\n return \"Current user #{user} holds roles:\\n\n #{held_roles.join(\"\\n\")}\"\n end\n else\n return 'Not logged in: no roles held.'\n end\n end",
"title": ""
},
{
"docid": "bb1f3c25ac0650bdd23c07f40184264c",
"score": "0.5601917",
"text": "def how_do_the_player_leave\n return 0 if @what_was_buyed.empty?\n return 1 if @what_was_buyed.size == 1\n if @what_was_buyed.size >= 2\n return 2\n else \n return 1\n end\n end",
"title": ""
},
{
"docid": "961bd00f2b09b882e4aec8ed894806c4",
"score": "0.56010836",
"text": "def username_taken?\n @user && user.errors.added?(:username, :taken)\n end",
"title": ""
},
{
"docid": "d82137833e896983e05b56314050688f",
"score": "0.5599768",
"text": "def left\n if @table.robot_present?\n @robot.left\n @messages.robot_action_confirm\n else\n return @messages.robot_not_placed\n end\n end",
"title": ""
},
{
"docid": "0d6ca5fce6466dfb9b8be6d2425ffddb",
"score": "0.55986774",
"text": "def leave \n members = @group.members.where(:user_id=> current_user.id)\n members.delete_all\n flash[:notice] = 'Group is successfully Leaved.'\n redirect_to '/dashboard'\n end",
"title": ""
},
{
"docid": "43e2d28ca83fdc8f6794e8dcbb06691a",
"score": "0.55904883",
"text": "def check_user_count\n unless @institute.plan.unlimited_users? \n if @institute.plan.user_count <= @institute.admins.count\n @unauthorized = \"true\"\n @new_user = \"true\"\n @page_access = \"false\"\n @location = \"#{@institute.plan.user_count} Workplace Users/Members\"\n @contact = \"Please contact #{@institute.subscription.admin.name} in order to upgrade the subscription and lift or remove this restriction.\"\n end \n end\n end",
"title": ""
},
{
"docid": "2fe33e79294ce4cb53a1a5a7bbb4c617",
"score": "0.55891204",
"text": "def drop_user(uid, disconnected)\n u = @roster.get_user(uid)\n @cells.each do |col|\n col.each do |cell|\n if cell.uid == uid\n cell.uid = nil\n @letters_version += 1\n end\n end\n end\n @messages.add(\n \"#{u.get_html} #{disconnected ? \"left the game\" : \"timed out\"}.\")\n @roster.drop_user(uid)\n give_up(nil) # check if this means that enough players have given up\n end",
"title": ""
},
{
"docid": "11a1a5f64dc5ea33d738896991d9d7b2",
"score": "0.558561",
"text": "def guesses_left\n @guesses_allowed - @guess_count\n end",
"title": ""
},
{
"docid": "c99f2ac7326d2bf62db7f30a2f6685ff",
"score": "0.55816466",
"text": "def join( user )\n user.active = true\n if user.save\n return \"Thanks for joining! :tada:\"\n else\n return \"Sorry, something went wrong. :robot_face: Please try again.\"\n end\n end",
"title": ""
},
{
"docid": "0fa3f613036819bb0b96fa9dfa40c14a",
"score": "0.5580691",
"text": "def not_taken\n yetto = self.user_quizzes.select {|user_quiz| user_quiz.status == \"Completed\" || \"In Progress\"}\n #yetto_ids = yetto.map { |x| x.user_id}\n #yetto_users = yetto_ids.map { |x| User.find(x)} \n \n #User.find_by_organization_id(@current_org.id).all - yetto_users\n\n end",
"title": ""
},
{
"docid": "9677ee562a229787f2c32748f3989f6b",
"score": "0.5578352",
"text": "def can_resign_leadership?\n return self.group.leaders.count > 1 && self.is_leader?\n end",
"title": ""
},
{
"docid": "31e38e51669f1482683745d45c9b1966",
"score": "0.55748844",
"text": "def available?\n user_id.zero?\n end",
"title": ""
},
{
"docid": "da2e5593fb41d70e4ff86a3f0eb9a41b",
"score": "0.55637217",
"text": "def has_invitations_left?\n # Admin users have no invitations limit\n return true if current_inviter.admin\n\n # If no invitation limit has been set, there are always invitations left\n return true if current_inviter.invitation_limit.nil?\n\n if current_inviter.invitations_count >= current_inviter.invitation_limit\n Rails.logger.warn \"User #{current_inviter.id} - #{current_inviter.email} tried to send an invitation, but has no invitations left\"\n head 400\n return\n end\n end",
"title": ""
},
{
"docid": "bf16c02822a21d33341e533e40d085ad",
"score": "0.55627877",
"text": "def leave\n end",
"title": ""
},
{
"docid": "d861d91142881bc7ee68d65b17519175",
"score": "0.5560664",
"text": "def new_user?\n trade_count == 0 && [item_count, Item.owned_by(self).count ].max < MINIMUM_ITEM_COUNT_BEYOND_NEW &&\n ::Schools::SchoolGroup.get_schoolmates(self.id).size <= 1\n end",
"title": ""
},
{
"docid": "ff3d7705e72bab869e48eab830124dab",
"score": "0.55586135",
"text": "def user_blocked?\n user.blocked?\n end",
"title": ""
},
{
"docid": "e243f395aeebfd8a45ffafb38f02263b",
"score": "0.55568975",
"text": "def verificationUserNotRepit(user)\n userp = searchUserByUsername(user)\n if !userp.nil?\n user.errors.add(:username,\"The user is repeated, please introdeced other\")\n end\n end",
"title": ""
},
{
"docid": "94b32a9115c4b936fe91e8c49f570b51",
"score": "0.5555882",
"text": "def how_do_the_player_leave\n return 0 if @what_was_buyed.empty?\n return 1 if @what_was_buyed.size == 1\n if @what_was_buyed.size >= 2 && @what_was_buyed[0] != @what_was_buyed[1]\n return 2\n else \n return 1\n end\n end",
"title": ""
},
{
"docid": "22d86343b15346f45407939c9577af2b",
"score": "0.5554398",
"text": "def join_leave\n @event = Event.find(params[:id])\n if !@event.has_participant(session[:user_id])\n \n @event.add_participant(session[:user_id]) \n else\n @event.delete_participant(session[:user_id])\n end\n \n redirect_to :action => :show, :id => @event.id\n end",
"title": ""
}
] |
69e7edc033f5cc2a00f9972e971605a6 | Returns a specific document by ID and version id ID of document version Version of the document | [
{
"docid": "8abbd66de5d5544bdea9e3285ac4868a",
"score": "0.8091933",
"text": "def get_document_by_id( id, version = nil )\n if version\n get( '/records/' + @record_id + '/documents/' + id + '/versions/' + version ).xpath('//api:document').first\n else\n get( '/records/' + @record_id + '/documents/' + id ).xpath('//api:document').first\n end\n end",
"title": ""
}
] | [
{
"docid": "06ed1f7198150419bbb4cec25d1f9f66",
"score": "0.75874966",
"text": "def get_document_versions( id )\n get( '/records/' + @record_id + '/documents/' + id + '/versions' ).xpath('//api:document')\n end",
"title": ""
},
{
"docid": "30a65cde481f0fd3669b4df13bfdddc6",
"score": "0.7530924",
"text": "def get_version(version_id)\n self.versions.select { |v| v.versionID == version_id}.first\n end",
"title": ""
},
{
"docid": "a425ae9da0f1c8f5f22dd4e399a3174c",
"score": "0.73973787",
"text": "def set_document_and_version\n @document = Document.find(params[:document_id])\n @version = @document.versions.find(params[:id])\n end",
"title": ""
},
{
"docid": "d2dd59aafaf9cfc197931799d8215214",
"score": "0.70891255",
"text": "def version_object( id )\n uri = URI::HTTP.build( {:host => @host, :port => @port,\n :path => build_resource(id), :query => \"versions\" } )\n\n headers = {}\n\n request = build_request( EsuRestApi::POST, uri, headers, nil )\n\n response = @session.request( request )\n\n handle_error( response )\n\n # Parse returned ID\n return ID_EXTRACTOR.match( response[\"location\"] )[1].to_s\n end",
"title": ""
},
{
"docid": "f2c704515ade4cb8caf492824b9c12f5",
"score": "0.7037713",
"text": "def set_document_version\n @document_version = DocumentVersion.find(params[:id])\n end",
"title": ""
},
{
"docid": "b5130166a619020c1f0cad807608c907",
"score": "0.70104927",
"text": "def fetch_version_for_id(id)\n version_id = DB[DatabaseUtils.to_table_name(self)].where(id: id).get(:_version_id)\n raise Repository::NotFound.new(id, self) if version_id.nil?\n\n version = DB[:_versions].where(id: version_id).first\n raise Repository::NotFound.new(version_id, Version) if version.nil?\n\n Version.new(version)\n end",
"title": ""
},
{
"docid": "1fd151fdff7edbba8ad27451577f2ea0",
"score": "0.68982476",
"text": "def document_by_v_id id\n if String === id\n settings.mongo_db['mostRecent'].\n find_one(:id => id)\n end#end if\n end",
"title": ""
},
{
"docid": "81a069e17d555a0914df29d5f6bd5c7a",
"score": "0.6879311",
"text": "def show_version\n @document = Document.find(params[:id])\n @version = @document.revert_to(params[:version_id])\n @documentversion = @document.versions.find(:all)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @document }\n end\n end",
"title": ""
},
{
"docid": "5d07c312c559a903264779bcff7f3e81",
"score": "0.6760133",
"text": "def get(entry_id, version=-1)\n\t\t\tkparams = {}\n\t\t\t# Document entry id\n\t\t\tclient.add_param(kparams, 'entryId', entry_id);\n\t\t\t# Desired version of the data\n\t\t\tclient.add_param(kparams, 'version', version);\n\t\t\tclient.queue_service_action_call('document_documents', 'get', 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": "c6034c712c1d6106c2f45d8fc6446bf1",
"score": "0.66873974",
"text": "def set_document\n @document = Document.find(params[:id])\n if params.has_key? :version and @document.available_versions.include?(params[:version].to_i)\n @document.version = params[:version].to_i\n end\n end",
"title": ""
},
{
"docid": "a96a1b4fc5b10f0542ec220a7e5cf4ba",
"score": "0.66516024",
"text": "def current_version\n\t\t\t\t\tif @current_version.nil?\n\t\t\t\t\t\t@current_version = document_versions.order(id: :desc).first\n\t\t\t\t\tend\n\t\t\t\t\treturn @current_version\n\t\t\t\tend",
"title": ""
},
{
"docid": "671c643de187f9a9b74065de66245b33",
"score": "0.66210216",
"text": "def show\n @document = Document.find(params[:id])\n @documentversion = @document.versions.find(:all)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @document }\n end\n end",
"title": ""
},
{
"docid": "01e5ec3c12104e918a989637ec2a3a79",
"score": "0.6524179",
"text": "def snap_version_by_query(doc, opts = {})\n json = collection.find_one doc, opts\n snap_version json unless json.nil?\n end",
"title": ""
},
{
"docid": "4bc4a79d39bd35b87d55f43fd2d5ad58",
"score": "0.65208876",
"text": "def version(identifier)\n self.versions.find_by(version: identifier)\n end",
"title": ""
},
{
"docid": "ce444b6740eb4ee3c4193e9156832baa",
"score": "0.6452769",
"text": "def [](version)\n @cache[version] ||= @document.store.find(document.uuid,version)\n end",
"title": ""
},
{
"docid": "2ac6f60c1090081553a9bedfa847112b",
"score": "0.633669",
"text": "def find_versions(id, options = {})\n versioned_class.find :all, {\n conditions: [\"#{versioned_foreign_key} = ?\", id],\n order: 'version'\n }.merge(options)\n end",
"title": ""
},
{
"docid": "74e0619ace45629b940446775724b80a",
"score": "0.63218933",
"text": "def get docid, params={}\n doc = get_doc(docid, params)\n if !doc\n raise BoothError.new(404, \"not_found\", \"missing doc '#{docid}'\");\n elsif doc.deleted\n raise BoothError.new(404, \"not_found\", \"deleted doc '#{docid}'\");\n else\n doc\n end\n end",
"title": ""
},
{
"docid": "c577983341195a888776aa8979ee6fc4",
"score": "0.62993795",
"text": "def version_id\n return @version_id\n end",
"title": ""
},
{
"docid": "ce0bf29a6a036d1f5a95553116b1d0ab",
"score": "0.6273223",
"text": "def version_id\n data.version_id\n end",
"title": ""
},
{
"docid": "200a601925c5d72b0fcd8bf61e559948",
"score": "0.6248928",
"text": "def versioned!\n @versioned = true\n key :version, BSON::ObjectId, :default => lambda { BSON::ObjectId.new }\n end",
"title": ""
},
{
"docid": "6c175e22ca0889d2f13d31d643b2997d",
"score": "0.62474453",
"text": "def show\n @document_version = DocumentVersion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document_version }\n end\n end",
"title": ""
},
{
"docid": "6c175e22ca0889d2f13d31d643b2997d",
"score": "0.62474453",
"text": "def show\n @document_version = DocumentVersion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document_version }\n end\n end",
"title": ""
},
{
"docid": "9c923025a11d58787e19635b0f59ff50",
"score": "0.62434846",
"text": "def get_doc docid, params={}\n @by_docid[docid]\n end",
"title": ""
},
{
"docid": "978e01c1a4c8bdb49b90f1113efd24f4",
"score": "0.6242324",
"text": "def get_document(id, api, ref)\n documents = api.form(\"everything\")\n .query(\"[[:d = at(document.id, \\\"#{id}\\\")]]\")\n .submit(ref)\n\n documents.length == 0 ? nil : documents.first\n end",
"title": ""
},
{
"docid": "4813624ea3ec404a773fcef6ce004de6",
"score": "0.6226019",
"text": "def version_id\n data[:version_id]\n end",
"title": ""
},
{
"docid": "9bef609b87a8654e8894c3e0712b406c",
"score": "0.62099975",
"text": "def find_by_version( id , version )\n begin\n ( Regulate.repo.commit(version).tree / File.join( id , 'attributes.json' ) ).data\n rescue\n nil\n end\n end",
"title": ""
},
{
"docid": "5d6fce30e6f6ebb8a3f7dfa1d88dd3d3",
"score": "0.61982673",
"text": "def get_version(name, project_id)\n get :get_version, :name => name, :project_id => project_id\n end",
"title": ""
},
{
"docid": "ce2516edc40eb5f2419a0773d73cf516",
"score": "0.6197015",
"text": "def find(id)\n @document\n end",
"title": ""
},
{
"docid": "3f858e0832f3db64395abd7e01766b82",
"score": "0.61954206",
"text": "def get_survey_version\n @survey = @current_user.surveys.find(params[:survey_id])\n @survey_version = @survey.survey_versions.find(params[:survey_version_id])\n end",
"title": ""
},
{
"docid": "3f858e0832f3db64395abd7e01766b82",
"score": "0.61954206",
"text": "def get_survey_version\n @survey = @current_user.surveys.find(params[:survey_id])\n @survey_version = @survey.survey_versions.find(params[:survey_version_id])\n end",
"title": ""
},
{
"docid": "2f55c7333813d15377cbeb31d22e2dd3",
"score": "0.6187491",
"text": "def get_solr_doc(doc_id)\n _, document = search_service.fetch doc_id\n document\n end",
"title": ""
},
{
"docid": "9ad623392f9ef43462fa52dd6a8a48b4",
"score": "0.618192",
"text": "def version_id\n self.get_column(\"VersionId\")\n end",
"title": ""
},
{
"docid": "ee36c63265dd3181a146e769840a5386",
"score": "0.6170221",
"text": "def id value\n self.find { |i| i['id'] == value }['doc']\n end",
"title": ""
},
{
"docid": "a9b161d9d1b35743efdaab789fb88679",
"score": "0.6169102",
"text": "def version_id\n self.get_column(\"Entry_ID/Version\")\n end",
"title": ""
},
{
"docid": "6fbf72950fc2be7b5d17e88ca8ee9f55",
"score": "0.6163137",
"text": "def get_document_by_id(id)\n response = @client.get index: @index, type: @type, id: id\n LogWrapper.log('DEBUG', {'message' => \"Got ES document successfully. Id: #{id}\", \n 'method' => 'get_document_by_id'})\n response\n end",
"title": ""
},
{
"docid": "e12b1220d6636820e2c757b4dc9f983b",
"score": "0.615905",
"text": "def v number\n if self.version == number\n self\n else\n self.versions.find_by_version(number)\n end\n end",
"title": ""
},
{
"docid": "a3856adbd76c50573098f59df1382d19",
"score": "0.6137139",
"text": "def find_doc\n # get the specific document by id\n @doc = Doc.find(params[:id]) \n end",
"title": ""
},
{
"docid": "93fc449b2356de48c6389132701f4701",
"score": "0.6123306",
"text": "def load_version(assoc, id, transaction_id, version_at)\n assoc.klass.paper_trail.version_class.\n where(\"item_type = ?\", assoc.klass.base_class.name).\n where(\"item_id = ?\", id).\n where(\"created_at >= ? OR transaction_id = ?\", version_at, transaction_id).\n order(\"id\").\n limit(1).\n first\n end",
"title": ""
},
{
"docid": "fe33a0384adc5a60555a2e1016f8b145",
"score": "0.606575",
"text": "def show\n @version = Version.find(params[:id])\n end",
"title": ""
},
{
"docid": "709cb1376423082aecfba10ee4e0e3b0",
"score": "0.60579836",
"text": "def variant_version_id(variant_id:)\n if status[:variants]\n status[:variants].collect do |item|\n item[:version_id] if item[:variant_id] == variant_id\n end.compact.first\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "7c17f175565b4f25ab67fa39cadf7e25",
"score": "0.6045646",
"text": "def find_document_by(id)\n link = @@repo.find_link_by(Dctmclient::Resources::Link::RELATIONS[:self])\n link.href += \"/documents/#{id}\"\n @@repo.link_to(link, :Document)\n end",
"title": ""
},
{
"docid": "0a922d304f1193d7dc24a6d757b066b7",
"score": "0.604174",
"text": "def version(*args)\n ::Mongoid.unit_of_work(disable: :current) do\n self.class.find(_id).tap do |copy|\n copy.apply_version!(*args)\n end\n end\n end",
"title": ""
},
{
"docid": "582fbd7b671801002ec888c22d5c943a",
"score": "0.6009737",
"text": "def get!(id, db = database)\n raise CouchRest::Model::DocumentNotFound if id.blank?\n\n doc = db.get id\n build_from_database(doc)\n rescue CouchRest::NotFound\n raise CouchRest::Model::DocumentNotFound\n end",
"title": ""
},
{
"docid": "0893497a11ef50b85cdbfee34455bd36",
"score": "0.6001219",
"text": "def document_id(id)\n id\n end",
"title": ""
},
{
"docid": "65fe7176ee0c876b1092954ae84ecb45",
"score": "0.597783",
"text": "def on_get_version(doc)\n end",
"title": ""
},
{
"docid": "d83e55640aa9da45b6472b8355880557",
"score": "0.5973844",
"text": "def current_version_id\n current_version.id\n end",
"title": ""
},
{
"docid": "6363383048a2501a0636f02d40ac6af1",
"score": "0.5969401",
"text": "def find_doc\n\t\t\t# Find by the parameters Id\n\t\t\t@doc = Doc.find(params[:id])\n\t\tend",
"title": ""
},
{
"docid": "bef23fe39a33dc860433ad8273fb7439",
"score": "0.5962505",
"text": "def find(id)\n documents[id.to_s]\n end",
"title": ""
},
{
"docid": "c7a31cd4e560b4415bbfb850f06f2bb9",
"score": "0.59607065",
"text": "def find_last_version\n self.class.\n where(:_id => id).\n any_of({ :version => version }, { :version => nil }).first\n end",
"title": ""
},
{
"docid": "3d03acd056bc6892b07af70887da60cf",
"score": "0.5957895",
"text": "def show\n @document_version = DocumentVersion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @document_version }\n end\n end",
"title": ""
},
{
"docid": "bb98ce5e6ed7e75555b6563f2d2af5d5",
"score": "0.59578246",
"text": "def set_version\n @version = Version.find(params[:id])\n end",
"title": ""
},
{
"docid": "bb98ce5e6ed7e75555b6563f2d2af5d5",
"score": "0.59578246",
"text": "def set_version\n @version = Version.find(params[:id])\n end",
"title": ""
},
{
"docid": "bb98ce5e6ed7e75555b6563f2d2af5d5",
"score": "0.59578246",
"text": "def set_version\n @version = Version.find(params[:id])\n end",
"title": ""
},
{
"docid": "bb98ce5e6ed7e75555b6563f2d2af5d5",
"score": "0.59578246",
"text": "def set_version\n @version = Version.find(params[:id])\n end",
"title": ""
},
{
"docid": "d9599a9a73ea7b664f7c7d4266893ddf",
"score": "0.59571177",
"text": "def get_version(number)\n version = versions.where(:version_number => number).first\n raise NoSuchVersionError if version.nil?\n version\n end",
"title": ""
},
{
"docid": "fc832dd0d618d33e8dfe2415c4cf6b04",
"score": "0.5951692",
"text": "def get_document_by_id(document_id)\n # look through both schema and report files for the document\n doc = self.get_schema_document_by_id(document_id)\n if doc.nil?\n doc = self.get_report_document_by_id(document_id)\n end\n\n return doc\n end",
"title": ""
},
{
"docid": "c2a76ef47dc537fa0a1df8242769d187",
"score": "0.5950596",
"text": "def ver_id\n @ver_id\n end",
"title": ""
},
{
"docid": "9c2e228d353ee28121187b807167bbb0",
"score": "0.59459996",
"text": "def product_version_id(product_id:)\n if status[:products]\n status[:products].collect do |item|\n item[:version_id] if item[:product_id] == product_id\n end.compact.first\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "20494d07bb7db0cff01820c3b3cd35d1",
"score": "0.5943915",
"text": "def search_by_id\n begin\n result = Openws::GeneralDocument.with(collection: namespaced_collection).find(params[:id])\n render json: result, status: 200\n rescue\n render json: { msg: 'Document not found' }, status: 404\n end\n end",
"title": ""
},
{
"docid": "f3f05e32ce509896a16da84e9b3448f9",
"score": "0.5942148",
"text": "def show\n @target_document_version = TargetDocumentVersion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @target_document_version }\n end\n end",
"title": ""
},
{
"docid": "dda70c26cfe5a1bbc04845b1cd608d0e",
"score": "0.5903235",
"text": "def find\n self.class.find(version_key)\n end",
"title": ""
},
{
"docid": "61029ebc9a9d9057e123e2e304c7119d",
"score": "0.5902246",
"text": "def set_version\n @version = Version.find(params[:id])\n end",
"title": ""
},
{
"docid": "61029ebc9a9d9057e123e2e304c7119d",
"score": "0.5902246",
"text": "def set_version\n @version = Version.find(params[:id])\n end",
"title": ""
},
{
"docid": "5d4a0b3fbc896c1b39221e219fc71ff6",
"score": "0.5881452",
"text": "def edit\n return unless has_permission :can_post_news\n @page_title = 'Edit News Article'\n @document = NewsArticle.find(params[:id])\n if params[:version]!=nil\n @document = @document.get_version params[:version]\n end\n if request.method == :post\n @document.last_updated_by = current_user \n if @document.update_attributes(params[:document])\n flash[:notice] = 'Document was successfully updated.'\n end\n end\n @versions = @document.versions\n end",
"title": ""
},
{
"docid": "6bd2973dfa0d5ab960a8c7005856af62",
"score": "0.58801204",
"text": "def set_document_revision\n @document_revision = DocumentRevision.find(params[:id])\n end",
"title": ""
},
{
"docid": "a99d986cd0e931d93fbd3aee08526f8f",
"score": "0.58764",
"text": "def index\n\n @versions = @library.documents.find_by_id(params[:document_id]).versions.all(:order=>'major_version_number DESC, minor_version_number DESC')\n\n for i in (0..@versions.length-1)\n @version=@versions[i]\n @version.sort_id=i\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @versions.to_json(:methods=>[:sort_id]) }\n end\n end",
"title": ""
},
{
"docid": "a90955f89549f2ec37f19a8250b84fe0",
"score": "0.5870417",
"text": "def update\n @document_version = DocumentVersion.find(params[:id])\n\n respond_to do |format|\n if @document_version.update_attributes(params[:document_version])\n format.html { redirect_to document_path(@document_version.document_id), notice: 'Document version was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @document_version.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "025d8ed7d8971cd327fc44490810f240",
"score": "0.5869967",
"text": "def set_version\n @version = Audited::Audit.find(params[:id])\n end",
"title": ""
},
{
"docid": "392ec3c6fd81b855a8bbef24f5ae0448",
"score": "0.58672136",
"text": "def set_version\n @version = PaperTrail::Version.find(params[:id])\n end",
"title": ""
},
{
"docid": "f2ef0204702f7bc878d9c791d495df4c",
"score": "0.5866126",
"text": "def revision\n if id == nil\n return nil\n end\n revisions.first\n end",
"title": ""
},
{
"docid": "7af5ad256af68105406244aa05f275fe",
"score": "0.58656925",
"text": "def get_library_version(query, version: :latest)\n results = if query.key?(:name)\n Model.find(**query).sort\n else\n Model.find(**query)\n end\n return nil if results.size == 0\n return results.first if results.size == 1\n\n if version == :latest\n results.last\n elsif version == :oldest\n results.last\n elsif version =~ /^[0-9.]*$/\n results.find { |r| r.version == version }\n else\n raise ArgumentError, \"Invalid version specified in arguments — #{version}.\" +\n \"Expecting either :latest, :oldest, or a specific version number.\"\n end\n end",
"title": ""
},
{
"docid": "ef46a0c3c97e456fd065a62f254a1b95",
"score": "0.5861328",
"text": "def show\n @version = @page.versions.find_by_version(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @version }\n end\n end",
"title": ""
},
{
"docid": "7009e983c7b6f003034d2c30e35cc992",
"score": "0.5853808",
"text": "def doc_id\n @document.fetch('id')\n end",
"title": ""
},
{
"docid": "cca65a92546f81a3c13d802260dacd6e",
"score": "0.5853377",
"text": "def get!(id, db = database)\n doc = db.get id\n create_from_database(doc)\n end",
"title": ""
},
{
"docid": "5c69297420d33a628960ad52b6b88a47",
"score": "0.58519423",
"text": "def show_version\n note = Note.where(:id => params[:id], :user_id => current_or_guest_user.id).first\n version = note.versions.find(params[:version_id]).next\n if version.nil?\n redirect_to \"/notes/#{params[:id]}\" and return\n end\n @version_id = params[:version_id]\n @note = note.versions.find(params[:version_id]).next.reify\n\n @versions = note.versions\n\n respond_to do |format|\n format.html { render \"show\" }\n format.json { render json: @note }\n end\n end",
"title": ""
},
{
"docid": "aacde2894dc8e44d359159d0644ff611",
"score": "0.5846954",
"text": "def versionable_deduce_id\n respond_to?(:id) ? id : self['_id']\n end",
"title": ""
},
{
"docid": "d55a543e4905ad8a4d44dd64350166f4",
"score": "0.5841006",
"text": "def set_version\n @version = Version.find(params[:id])\n end",
"title": ""
},
{
"docid": "d55a543e4905ad8a4d44dd64350166f4",
"score": "0.5841006",
"text": "def set_version\n @version = Version.find(params[:id])\n end",
"title": ""
},
{
"docid": "d55a543e4905ad8a4d44dd64350166f4",
"score": "0.5841006",
"text": "def set_version\n @version = Version.find(params[:id])\n end",
"title": ""
},
{
"docid": "d55a543e4905ad8a4d44dd64350166f4",
"score": "0.5841006",
"text": "def set_version\n @version = Version.find(params[:id])\n end",
"title": ""
},
{
"docid": "d55a543e4905ad8a4d44dd64350166f4",
"score": "0.5841006",
"text": "def set_version\n @version = Version.find(params[:id])\n end",
"title": ""
},
{
"docid": "d55a543e4905ad8a4d44dd64350166f4",
"score": "0.5841006",
"text": "def set_version\n @version = Version.find(params[:id])\n end",
"title": ""
},
{
"docid": "d55a543e4905ad8a4d44dd64350166f4",
"score": "0.5841006",
"text": "def set_version\n @version = Version.find(params[:id])\n end",
"title": ""
},
{
"docid": "d55a543e4905ad8a4d44dd64350166f4",
"score": "0.5841006",
"text": "def set_version\n @version = Version.find(params[:id])\n end",
"title": ""
},
{
"docid": "940c836e3ab78e58e86a3be00dd73527",
"score": "0.5833308",
"text": "def set_api_v1_document\n @api_v1_document = Api::V1::Document.find(params[:id])\n end",
"title": ""
},
{
"docid": "6272c60080b84a3caf2a7ac852f41cb0",
"score": "0.5832877",
"text": "def load_version(assoc_klass, id, transaction_id, version_at)\n assoc_klass.paper_trail.version_class.\n where(\"item_type = ?\", assoc_klass.base_class.name).\n where(\"item_id = ?\", id).\n where(\"created_at >= ? OR transaction_id = ?\", version_at, transaction_id).\n order(\"id\").limit(1).first\n end",
"title": ""
},
{
"docid": "7609a10b7b4633f3610a8e4db8e0a62b",
"score": "0.5824801",
"text": "def find_document(options)\n id = options[:id]\n name = options[:name]\n \n self.documents.find do |document|\n if id.not_nil?\n document.id == id\n elsif name.not_nil?\n document.name == name\n end\n end\n end",
"title": ""
},
{
"docid": "b1d2e00c7c617327a9cb67736a2f85fd",
"score": "0.58245605",
"text": "def version_obj\n version_cache.version_obj ||= begin\n if version_cache.wanted_version_number\n obj = versions.\n where(:number => version_cache.wanted_version_number).first\n unless obj || version_cache.self_version || version_cache.existing_version_wanted\n # versions.to_a # TODO: prefetch versions before building a new one?\n obj = versions.build({\n :number => version_cache.wanted_version_number,\n :versioned_attributes => versioned_attributes,\n :created_at => updated_at_was\n })\n end\n obj\n else\n editing_time = self.class.versioning_options[:editing_time]\n if !editing_time || version_updated_at <= (Time.now-editing_time.to_i) || updated_at > Time.now # allow future versions\n versions.build(:created_at => updated_at_was)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "3763a0d1f2bb37427bb942e241b71f12",
"score": "0.5812454",
"text": "def show\n @note = Note.where(:id => params[:id], :user_id => current_or_guest_user.id).first\n\n unless @note\n redirect_to '/notes'\n end\n\n @version_id = (@note.versions.empty? || @note.versions.nil?) ? 0 : @note.versions.last.id\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @note }\n end\n end",
"title": ""
},
{
"docid": "2786ef2a2427f69b780cd44fe1cdbb77",
"score": "0.5810004",
"text": "def get(id, params = {})\n slug = escape_docid(id)\n url = CouchRest.paramify_url(\"#{@root}/#{slug}\", params)\n result = CouchRest.get(url)\n return result unless result.is_a?(Hash)\n doc = if /^_design/ =~ result[\"_id\"]\n Design.new(result)\n else\n Document.new(result)\n end\n doc.database = self\n doc\n end",
"title": ""
},
{
"docid": "308e4d7bfe4fe1b221c1adc7cb399024",
"score": "0.5800839",
"text": "def write1(doc, id=nil, rev=nil)\n doc['_id'] = id if id\n doc['_rev'] = rev if rev\n writem([doc]).first['rev']\nend",
"title": ""
},
{
"docid": "41caef7bb9fe6b34a31a509b455dcc72",
"score": "0.57957035",
"text": "def find_doc\n @doc = Doc.find(params[:id])\n end",
"title": ""
},
{
"docid": "9ede38db3232c84e2ec9d109f567099a",
"score": "0.5791944",
"text": "def new\n @document_version = DocumentVersion.new\n if params[:document_id] then\n @document_version.document=Document.find_by_id(params[:document_id])\n @doc_defined=true\n else\n @doc_defined=false\n end\n \n #@user = User.find(params[:id]) \n \n\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document_version }\n end\n end",
"title": ""
},
{
"docid": "7c09a10b8fe513b2d727f9849e1eee4a",
"score": "0.5790071",
"text": "def version_id\n end",
"title": ""
},
{
"docid": "cda6cab9f4fe55c65b46b6289cfd05c2",
"score": "0.57881",
"text": "def index\n @versions = Version.where(document_id: session[:current_document_id]).order(:version_number).reverse_order\n end",
"title": ""
},
{
"docid": "e1237ce1d37f311cd9bc0d5b2da166be",
"score": "0.5783894",
"text": "def get_document(index, id)\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{CGI::escape(id)}\")\n req = Net::HTTP::Get.new(uri)\n resp = run(uri, req)\n if resp.is_a? Net::HTTPNotFound\n @logger.debug(\"ELASTICSEARCH\") { \"Document #{id} not found in index #{index}\" }\n nil\n elsif resp.is_a? Net::HTTPSuccess\n JSON.parse resp.body\n else\n @logger.error(\"ELASTICSEARCH\") { \"Failed to get document #{id} from index #{index}.\\nGET #{uri}\\nResponse: #{resp.code} #{resp.msg}\\n#{resp.body}\" }\n raise \"Failed to get document #{id} from index #{index}\"\n end\n end",
"title": ""
},
{
"docid": "adab52b0c927147cd15c3b41af834a9b",
"score": "0.5782187",
"text": "def get_survey\n @survey = @current_user.surveys.find(params[:survey_id])\n @survey_version = @survey.survey_versions.find(params[:id]) if params[:id]\n end",
"title": ""
},
{
"docid": "d1b3e4187bc4cf5012374ab7e69be3ae",
"score": "0.57807994",
"text": "def document; parent.get_document_by_unid(universal_id); end",
"title": ""
},
{
"docid": "d1b3e4187bc4cf5012374ab7e69be3ae",
"score": "0.57807994",
"text": "def document; parent.get_document_by_unid(universal_id); end",
"title": ""
},
{
"docid": "59e56342c3d588dad4e7373f30185a5a",
"score": "0.5775081",
"text": "def find_standard_version(version)\n return version if version.is_a?(self.class.versioned_class)\n return nil if version.is_a?(ActiveRecord::Base)\n find_standard_versions(conditions: ['version = ?', version], limit: 1).first\n end",
"title": ""
}
] |
7777b258cfe39cfecf6b04aefcc48ff5 | Add a new space with a given address and size. | [
{
"docid": "43bd9507619e2a6f476a3d2a515452bd",
"score": "0.87063086",
"text": "def add_space(address, size)\n if size <= 0\n PEROBS.log.fatal \"Size (#{size}) must be larger than 0.\"\n end\n # The following check is fairly costly and should never trigger unless\n # there is a bug in the PEROBS code. Only use this for debugging.\n #if has_space?(address, size)\n # PEROBS.log.fatal \"The space with address #{address} and size \" +\n # \"#{size} can't be added twice.\"\n #end\n root.add_space(address, size)\n end",
"title": ""
}
] | [
{
"docid": "139c4784ad308a7b108fc3bb9b3924f2",
"score": "0.66609997",
"text": "def add_size (size)\n @size << size\n end",
"title": ""
},
{
"docid": "77ccf11660b0970cfe004b52f0a4496e",
"score": "0.65572554",
"text": "def add_size( size )\n\n @size << size\n\n end",
"title": ""
},
{
"docid": "77ccf11660b0970cfe004b52f0a4496e",
"score": "0.65572554",
"text": "def add_size( size )\n\n @size << size\n\n end",
"title": ""
},
{
"docid": "8bf421d95e8aeb037598d53cd975153e",
"score": "0.64686924",
"text": "def add_space(space)\n raise \"Object was not an Innodb::Space\" unless space.is_a?(Innodb::Space)\n\n spaces[space.space_id.to_i] = space\n end",
"title": ""
},
{
"docid": "3997a260850beca47db7093c7f83cf16",
"score": "0.62111187",
"text": "def slot (number, address)\r\n @slots[number] = {:address => address, :size => @slot_size}\r\n end",
"title": ""
},
{
"docid": "4533e2e4abdb015abc340aede0d42710",
"score": "0.61394674",
"text": "def has_space?(address, size)\n root.has_space?(address, size)\n end",
"title": ""
},
{
"docid": "1ecb0f9cb0366b714d40862eed2a0444",
"score": "0.58024204",
"text": "def add(value)\n raise \"Bad things happen\" if @size == 10\n @storage[@size] = value\n @size += 1\n end",
"title": ""
},
{
"docid": "5f3bd2bffa219d5b355844e826e6e59f",
"score": "0.5742662",
"text": "def reserve_space space\n return if self.last and self.last.id >= space\n\n o = self.new\n o.id= space\n o.save_without_alter_ego\n o.delete\n return\n end",
"title": ""
},
{
"docid": "5e4df600724991d6a816f2ad1cdc8fe8",
"score": "0.5695792",
"text": "def add_address(address)\n @addresses << address\n end",
"title": ""
},
{
"docid": "9e53ba42b9155b61b0d520ad037dadb7",
"score": "0.55825233",
"text": "def add_address_symbol(symbol, address)\n\n\t\t@mem_hash[symbol] = address\n\n\tend",
"title": ""
},
{
"docid": "e770f7a627b13991fe93b4223f620dc7",
"score": "0.54892874",
"text": "def create(size)\n disk_id = uuid\n sh \"zfs create -o reservation=1024 -o quota=1024 #{base}/#{disk_id}\"\n disk_id\n end",
"title": ""
},
{
"docid": "cedbdcdab9299c4f8f331bd295ea2992",
"score": "0.54773",
"text": "def add(value)\n rause \"Bad Things\" if @size == @storage.length\n @storage[@size] = value\n @size += 1\n end",
"title": ""
},
{
"docid": "5722f2f9b792ec2eb07867137501a879",
"score": "0.5422147",
"text": "def add_address(kind, street_1, street_2, city, state, postal_code)\n #instanciamos\n address = Address.new\n #y le damos los atributos\n address.kind = kind\n address.street_1 = street_1\n address.street_2 = street_2\n address.city = city\n address.state = state\n address.postal_code = postal_code\n #se lo enchumamos al array, no hay que poner add\n addresses.push(address)\n end",
"title": ""
},
{
"docid": "fbf99c1610337bc024f58bdab0e86fad",
"score": "0.5328361",
"text": "def add_space_attribute_definition(name, description, allows_multiple, headers=default_headers)\n body = {\n \"allowsMultiple\" => allows_multiple,\n \"description\" => description,\n \"name\" => name\n }\n info(\"Adding Space attribute definition \\\"#{name}\\\" to the \\\"#{space_slug}\\\" space.\")\n # Create the attribute definition\n post(\"#{@api_url}/spaceAttributeDefinitions\", body, headers)\n end",
"title": ""
},
{
"docid": "f6b92377b4102f680fcd72af105a982b",
"score": "0.52979577",
"text": "def add_address(type, street_1, street_2, city, state, zipcode)\n #Initialize a new instance of the Address class (why)\n address = Address.new\n #then set all of the ATTRIBUTES to the ARGUEMENTS of this METHOD\n address.type = type\n address.street_1 = street_1\n address.street_2 = street_2\n address.city = city\n address.state = state\n address.zipcode =zipcode\n #then append this to the internal array of addresses-since addresses is a attr_reader we do not have to use the @ sign\n addresses.push(address)\n end",
"title": ""
},
{
"docid": "6291824c55bc5f7e8bbff7714cf99575",
"score": "0.52868724",
"text": "def add_order origin, destination, size\n # check for duplicates\n\n order = {\n origin: Integer(origin),\n destination: destination,\n size: size\n }\n\n @orders.push order \n\n puts(\"Added Order #{origin}, #{destination}, #{size}\")\n true\n end",
"title": ""
},
{
"docid": "5c489fd2fd4d444ff6b11a4c30edbfd2",
"score": "0.52780205",
"text": "def add_kase(position, kase) \r\n @spaces[position] = kase\r\n end",
"title": ""
},
{
"docid": "55080ce01c6971c26896632a0b0fd98c",
"score": "0.5268704",
"text": "def put(entry)\n grow if should_grow?\n @slots[find_slot(entry)] = entry\n @count += 1\n end",
"title": ""
},
{
"docid": "c98a45a9884dec1258e39bb9979b64e9",
"score": "0.52508175",
"text": "def add_space_file(space_filenames)\n space = Innodb::Space.new(space_filenames)\n space.innodb_system = self\n add_space(space)\n end",
"title": ""
},
{
"docid": "14f086cb08f18360d763b1e2f9edbb28",
"score": "0.52337736",
"text": "def add_space_attribute_definition(name, description, allows_multiple, headers=default_headers)\n body = {\n \"allowsMultiple\" => allows_multiple,\n \"description\" => description,\n \"name\" => name\n }\n @logger.info(\"Adding Space attribute definition \\\"#{name}\\\" to the \\\"#{space_slug}\\\" space.\")\n # Create the attribute definition\n post(\"#{@api_url}/spaceAttributeDefinitions\", body, headers)\n end",
"title": ""
},
{
"docid": "c1c82f1ff58f57d156d229c204b25035",
"score": "0.5219341",
"text": "def +(offset)\n to_alloc + offset\n end",
"title": ""
},
{
"docid": "664a040fb016f3bd8791d1f63e6b5880",
"score": "0.52177286",
"text": "def add_space_field(name,type)\n class_type = Parfait.object_space.get_type_by_class_name(:Space)\n class_type.send(:private_add_instance_variable, name , type)\n end",
"title": ""
},
{
"docid": "7f83b4d3667677ef3b15a93ff97579d2",
"score": "0.52056617",
"text": "def new_item(x = 0, y = 0, w = 1, h = 1)\n l = Layout.new\n l.sizes.set x, y, w, h\n add_item l\n end",
"title": ""
},
{
"docid": "ffb94fb89e33b56a808a00006ad1cd62",
"score": "0.52047175",
"text": "def add(address)\n unless addresses.include?(address)\n server = Server.new(address, options)\n addresses.push(address)\n @servers.push(server)\n server\n end\n end",
"title": ""
},
{
"docid": "8593b4990a61d7df23ddc5080b80fcf2",
"score": "0.5183528",
"text": "def add_card(card)\n raise \"invalid placement!\" unless valid_placement?(card)\n @store << card\n end",
"title": ""
},
{
"docid": "6b56c3f064cf37e9e7f34ae956341579",
"score": "0.51738",
"text": "def add_address(addresses, address)\n address[:postcode] = postcode\n addresses.push(AddressSummary.new_from_search(address))\n end",
"title": ""
},
{
"docid": "fcd8895d4b2ccdc62beac8766e8bc738",
"score": "0.5140222",
"text": "def slot_size (size)\r\n @slot_size = size\r\n end",
"title": ""
},
{
"docid": "79beedc00cdc2c176f656eee9fa3b4f9",
"score": "0.51362956",
"text": "def allocate_address\n request(\n 'Action' => 'AllocateAddress',\n :parser => Fog::Parsers::BT::Compute::AllocateAddress.new\n )\n end",
"title": ""
},
{
"docid": "71399b4f03d7cf170e7528b99021f2f3",
"score": "0.51254684",
"text": "def get_space(size)\n if size <= 0\n PEROBS.log.fatal \"Size (#{size}) must be larger than 0.\"\n end\n\n if (address_size = root.find_matching_space(size))\n # First we try to find an exact match.\n return address_size\n elsif (address_size = root.find_equal_or_larger_space(size))\n return address_size\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "4bb7f3503288dbd9f80a5e6486123e3c",
"score": "0.50929904",
"text": "def create\n @spaces_mine = Space.mine(current_user.id)\n raise Space::NotAllowed, '공간 생성 한도를 초과했습니다.' if over_space_limit\n @space = Space.new(space_params.merge(user_id: current_user.id))\n @space.save\n flash.now[:error] = @space.errors.messages[:url] if @space.errors.any?\n broadcast_create_space(@space)\n end",
"title": ""
},
{
"docid": "4c875af3af62530f3ca9754a76e5f9b8",
"score": "0.5089641",
"text": "def add_indentation(p_size, p_type)\n delimiter_result = p_size.send(p_type)\n self.insert(0, delimiter_result)\n end",
"title": ""
},
{
"docid": "2befc62060edec82e74e9e2f48c6c6fc",
"score": "0.50760454",
"text": "def add_disk(server, size)\n host = server.to_s\n\n # Increment disk id\n if !DISKS.key?(host) then\n DISKS[host] = 0\n else\n DISKS[host] += 1\n end\n disk_id = DISKS[host]\n disk_filename = \".vagrant/disks/\" + host + \"_\" + disk_id.to_s + \".vdi\"\n\n server.vm.provider \"virtualbox\" do |v|\n # Create disk if it not exist\n unless File.exist?(disk)\n v.customize [\"createhd\", \"--filename\", disk_filename, \"--size\", size * 1024 * 1024]\n end\n v.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', disk_id, '--device', 0, '--type', 'hdd', '--medium', disk]\n end\nend",
"title": ""
},
{
"docid": "d6dc55a4b2265261c4b37ff3576e6613",
"score": "0.5071442",
"text": "def +(other)\n if Size === other\n Size.new(value + other.value, @parts + other.parts)\n else\n Size.new(value + other, @parts + [[:halfpts, other]])\n end\n end",
"title": ""
},
{
"docid": "9ab63c9604c1744fafba075cd21dbdb4",
"score": "0.5061913",
"text": "def add num = 1\n @ec.add reg, size * num\n end",
"title": ""
},
{
"docid": "7b37eaad78f25959235132ca78089d67",
"score": "0.5055665",
"text": "def store(ptr, val)\n if !@store.has_key?(ptr)\n raise \"Address #{ptr} was never allocated!\"\n end\n\n @store[ptr] = val\n end",
"title": ""
},
{
"docid": "7eb87956643cd43f3185651bcda50e48",
"score": "0.5052859",
"text": "def create_space(create_space_request, opts = {})\n data, _status_code, _headers = create_space_with_http_info(create_space_request, opts)\n data\n end",
"title": ""
},
{
"docid": "49889aa5003bee641c79c82577c22245",
"score": "0.5040609",
"text": "def add_address\n \n params[:place]\n address = ReceiverAddress.new(:label => params[:place], \n :city_id => params[:city_id], \n :address => params[:address])\n @receive.document = \"234\"\n @receiver.receiver_addresses << address\n respond_to do |format|\n format.html { render @receiver, action ='new'}\n end\n end",
"title": ""
},
{
"docid": "11b5f0846c6f3eeca67cb21208437844",
"score": "0.503456",
"text": "def add_address(request, address)\r\n return if address.nil?\r\n request.Set(RocketGate::GatewayRequest::BILLING_ADDRESS, address[:address1])\r\n request.Set(RocketGate::GatewayRequest::BILLING_CITY, address[:city])\r\n request.Set(RocketGate::GatewayRequest::BILLING_ZIPCODE, address[:zip])\r\n request.Set(RocketGate::GatewayRequest::BILLING_COUNTRY, address[:country])\r\n\r\n#\r\n#\tOnly add the state if the country is the US or Canada.\r\n#\t \r\n if address[:state] =~ /[A-Za-z]{2}/ && address[:country] =~ /^(us|ca)$/i\r\n request.Set(RocketGate::GatewayRequest::BILLING_STATE, address[:state].upcase)\r\n end\r\n end",
"title": ""
},
{
"docid": "9e9a9bb5b8bd4e4cf61eb8d2842794b1",
"score": "0.502901",
"text": "def add_a_ship_to_fleet(a_size, a_origin, a_direction)\n\tnew_ship = Ship.new(a_size, a_origin, a_direction)\n\tnew_ship.check_is_out_of_board(width, long)\n\tnew_ship.check_for_collisions(ships)\n\tadd_ship(new_ship)\n end",
"title": ""
},
{
"docid": "52d4f3f6fb93ea9728e94ea42e6b62d2",
"score": "0.5023578",
"text": "def new_address\n @client.new_address(name)\n end",
"title": ""
},
{
"docid": "c9d04a6ba7f5ecd7a26aa176ba3c352c",
"score": "0.5018551",
"text": "def create_address\n create_resource :address, {}\n end",
"title": ""
},
{
"docid": "c1a9d8b3a4a966e6ce27840ba26b4cfe",
"score": "0.50165486",
"text": "def pad!(min_size, value = nil)\n spaces = min_size - self.length\n spaces.times do \n self.push(value)\n end\n self\nend",
"title": ""
},
{
"docid": "da08a2b9a2aa9fe29ce8e38de483786a",
"score": "0.501567",
"text": "def create_address(addr, **opts)\n Address.create(@id, addr.to_s, node: node, address: subnet.subnet_addr(addr), **opts)\n end",
"title": ""
},
{
"docid": "2e1b306bfbc49086861260dc076eb286",
"score": "0.50140387",
"text": "def add(opt)\n ipaddr_modify(RTM_NEWADDR, NLM_F_CREATE|NLM_F_EXCL, opt)\n end",
"title": ""
},
{
"docid": "e3d4f9d29567ead8da2ce26327306f54",
"score": "0.5009369",
"text": "def address_size\n @address_size ||= 2 # Expressed in bytes\n end",
"title": ""
},
{
"docid": "dc22c345d8cc3a65be1220b7cbdbea2e",
"score": "0.5000718",
"text": "def add_section(s_ident, off=0, sz=nil, name=nil, \n flgs=Section::DEFAULT_FLAGS, arch_info=nil)\n sz ||= size - off\n s = Bgo::Section.new(s_ident, name, image, image_offset + off, off, sz, \n flgs)\n s.arch_info = arch_info if arch_info\n add_section_object s\n end",
"title": ""
},
{
"docid": "a769185d3686d965056bcc29c6543af7",
"score": "0.49755853",
"text": "def add_air_space(thickness, resistance )\n layer = Layer.new()\n layer.set_air_space(thickness, resistance)\n @layers.push(layer)\n end",
"title": ""
},
{
"docid": "f86d33065ef0d136df2288597f7aadca",
"score": "0.49622294",
"text": "def padding_add!(size=4096)\n @metadata_blocks.each do |type|\n if type[0] == \"padding\"\n raise FlacInfoError, \"PADDING block exists. Use 'padding_resize!'\"\n end\n end\n build_padding_block(size) ? true : false\n end",
"title": ""
},
{
"docid": "322bc6f28fcd7c819cee8937addcf493",
"score": "0.49527565",
"text": "def space_params\n params.require(:space).permit(:name, :spaceType, :multiplier, :area)\n end",
"title": ""
},
{
"docid": "9d7ddb5d527394b3ca7a42d7e64300bd",
"score": "0.4939889",
"text": "def pad!(size, value = nil)\n (size - self.length).times { self << value }\n self\n end",
"title": ""
},
{
"docid": "9d7ddb5d527394b3ca7a42d7e64300bd",
"score": "0.4939889",
"text": "def pad!(size, value = nil)\n (size - self.length).times { self << value }\n self\n end",
"title": ""
},
{
"docid": "695dec5abcb8af4651d343e5d34f9d1e",
"score": "0.49343467",
"text": "def add(mountString)\n @mtab << mountString\n end",
"title": ""
},
{
"docid": "5803b72c8d3ef65d4d288662cb233a73",
"score": "0.49266437",
"text": "def create_space(organization, user)\n space_name = Figaro.env.respond_to?(:cf_space) ? Figaro.env.cf_space : DEFAULT_SPACE_NAME\n space = Space.new.get(space_name, organization)\n space = Space.new.create(space_name, organization) unless space\n\n Space.new.assign_roles(space, user, space_roles) if space_roles.any?\n\n space\n end",
"title": ""
},
{
"docid": "b912aaabac4532aefbae1a2a2e8a7067",
"score": "0.48930606",
"text": "def add(obj, width)\n @objs << obj\n @width += width\n end",
"title": ""
},
{
"docid": "ae5701c995ec183dfe7e39a7e3f50c8e",
"score": "0.48887223",
"text": "def move_to_space(space_number)\n TSApi.tsapi_moveToSpaceOnDisplay(space_number, 0)\n end",
"title": ""
},
{
"docid": "88e2db890418e3cf8bf20eaabf604a6a",
"score": "0.48854426",
"text": "def wrap(address, alignment = self::ALIGNMENT)\n __wrap__(address, self::SIZE, alignment)\n end",
"title": ""
},
{
"docid": "edb999ec91f61116c04c83e3bcbe5729",
"score": "0.48842442",
"text": "def add_address(params)\n ad = AnubisNetwork::Model::AddAddress.new\n ad_arr = Array.new\n ad.domain_id = params[:domain_id]\n params[:address].each do |address|\n add = AnubisNetwork::Model::Address.new\n add.address = address\n ad_arr.push(add)\n end\n\n ad.address = ad_arr\n ad.import_type = params[:import_type]\n payload = ad.to_xmldoc_r\n result = @connection.rest_request(\n method: :post,\n path: \"/mps_setup/add_address/\",\n body: payload,\n session: params[:session]\n )\n xml = result.body.sub(/(?<=\\<n:add_addressResponse).*?(?=\\>)/,\"\")\n xml = xml.gsub(/(?=n:add_addressResponse).*?(?=\\>)/,\"add_addressResponse\")\n return Hash.from_xml(xml).to_json\n\n end",
"title": ""
},
{
"docid": "328489bc3cee2b0738ecceb3f52118a3",
"score": "0.48823977",
"text": "def space(space_id)\n return spaces[space_id] if spaces[space_id]\n\n unless (table_record = data_dictionary.table_by_space_id(space_id))\n raise \"Table with space ID #{space_id} not found\"\n end\n\n add_table(table_record[\"NAME\"])\n\n spaces[space_id]\n end",
"title": ""
},
{
"docid": "d9a0c01b4390c1df0056e162ceeab980",
"score": "0.48801896",
"text": "def add_indentation!(p_size, p_type)\n self.replace(add_indentation(p_size, p_type))\n end",
"title": ""
},
{
"docid": "8a46b19a443bf85b8537722f9b5ffb12",
"score": "0.48727286",
"text": "def alloc(sz, syscall=false) \r\n if syscall or sz > 4090\r\n ret = syscall_alloc(sz)\r\n else\r\n ptr(@a.alloc(sz))\r\n end\r\n end",
"title": ""
},
{
"docid": "1db6865dde52eb1c77e8aad470b7c698",
"score": "0.4864135",
"text": "def add(key, value = key)\n new_node = HeapNode.new(key, value)\n @store << new_node\n heap_up(@store.size-1)\n end",
"title": ""
},
{
"docid": "46a6f9747694cccb38d2e11154882143",
"score": "0.48626503",
"text": "def size(size)\n @value[:size] = size\n self\n end",
"title": ""
},
{
"docid": "41a8a6b82bae74d0bb388a9bcf7f5116",
"score": "0.48580313",
"text": "def add(entity)\n\t\t# TODO: set entity ID when adding to Space\n\t\t# (without a proper unique ID, serialization will not work. without serialization, we can't roll back history.)\n\t\t@entities << entity\n\t\t\n\t\t\n\t\t@cp_space.add_shape(entity.shape)\n\t\t@cp_space.add_body(entity.body)\n\tend",
"title": ""
},
{
"docid": "e66f79a5a3747bb213c69f0bfbe9ceaf",
"score": "0.48480368",
"text": "def lv_create_size_in_kb(logical_volume_name, volume_group, size_in_kb)\n External.cmd(@server, \"#{@command} lvcreate -l #{size_in_kb} -n #{logical_volume_name} #{volume_group.name}\") if volume_group_check_space_in_kb(volume_group,size_in_kb)\n end",
"title": ""
},
{
"docid": "29efa740ffc9686685569effd6b1894b",
"score": "0.48456624",
"text": "def fragment_grow(fragment, to_size)\n\t\t\t\tnewfrag = allocate(size)\n\t\t\t\tmove(fragment.start, newfrag.start, fragment.size)\n\t\t\t\tfragment_release(fragment)\n\t\t\t\tnewfrag\n\t\t\tend",
"title": ""
},
{
"docid": "ad7780ecf47c6c1ea68bbb7105a6392e",
"score": "0.48395845",
"text": "def set_space\n space_class = Thinkspace::Common::Space\n space_id = ENV['SPACE_ID']\n if space_id.present?\n @space = space_class.find_by(id: space_id)\n raise_error \"Space id #{space_id} not found.\" if space.blank?\n else\n create_space(space_class)\n end\n end",
"title": ""
},
{
"docid": "725bb7f658883f336eae97ee182f235d",
"score": "0.4836344",
"text": "def align(addr, width)\n\treturn addr + pad_length(addr, width)\nend",
"title": ""
},
{
"docid": "7e870721ebadcce09d6afac964781433",
"score": "0.48326144",
"text": "def set_space\n @space = @location.spaces.find_by_permalink(params[:space_id])\n raise ActiveRecord::RecordNotFound unless @space\n end",
"title": ""
},
{
"docid": "7f31f4c348c3dbe515ebc6d2dae17ad4",
"score": "0.48279876",
"text": "def add(key, value = key)\n @store << HeapNode.new(key, value)\n\n heap_up(@store.length - 1)\n end",
"title": ""
},
{
"docid": "7f31f4c348c3dbe515ebc6d2dae17ad4",
"score": "0.48279876",
"text": "def add(key, value = key)\n @store << HeapNode.new(key, value)\n\n heap_up(@store.length - 1)\n end",
"title": ""
},
{
"docid": "2bbbd57788ed253f0e414dcb2914e266",
"score": "0.48269823",
"text": "def add(key, value = key)\n new_node = HeapNode.new(key, value)\n @store << new_node\n heap_up(@store.length-1)\n end",
"title": ""
},
{
"docid": "4fad21a877c9dc2a3a00393adc8173e3",
"score": "0.4824026",
"text": "def add(key, value = key)\n new_node = HeapNode.new(key, value)\n @store << new_node\n\n heap_up(@store.length - 1)\n end",
"title": ""
},
{
"docid": "28a56701e19e9296f26fc64a1c3af053",
"score": "0.48209515",
"text": "def add_tuple_space(tuple_space)\n uuid = tuple_space.uuid\n\n # update tuple space table with the id\n @tuple_space_lock.synchronize {@tuple_space[uuid] = tuple_space}\n end",
"title": ""
},
{
"docid": "99d744896c9fcdb6d8d937360ca95992",
"score": "0.48160744",
"text": "def vm_allocate(task, address, size, anywhere)\n addr = int_to_intptr(address)\n anywhere = anywhere ? 1 : 0\n r = CALLS[\"libc!vm_allocate:IPII=I\"].call(task,addr,size,anywhere).first\n raise KernelCallError.new(r) if r != 0\n addr.ptr\n end",
"title": ""
},
{
"docid": "289928f69e29a79312d0091563d044e6",
"score": "0.48003632",
"text": "def add(entry)\n _check_open!\n ::Dnet.route_add(@handle, entry)\n end",
"title": ""
},
{
"docid": "46d3962b3f60f6c59fd71bd5fb339c14",
"score": "0.47895342",
"text": "def add(key, value = key)\n node = HeapNode.new(key, value)\n @store << node\n heap_up(@store.length - 1)\n end",
"title": ""
},
{
"docid": "5172fc5b0b14655447ffcc0c5818b01e",
"score": "0.47887224",
"text": "def casespace_seed_config_add_spaces(config)\r\n spaces = [config[:spaces]].flatten.compact\r\n return if spaces.blank?\r\n seed_config_message('++Adding seed config spaces.', config)\r\n spaces.each do |hash|\r\n title = hash[:institution]\r\n if title.blank?\r\n hash[:institution] = nil\r\n else\r\n institution = find_institution(title: title)\r\n seed_config_error \"Space institution title #{title.inspect} not found.\", config if institution.blank?\r\n hash[:institution] = institution\r\n end\r\n hash[:title] ||= get_default_record_title(:common, :space)\r\n hash[:state] ||= :active\r\n sandbox_space_id = casespace_seed_config_get_sandbox_space_id(hash)\r\n space = create_space hash.merge(space_type: get_casespace_space_type, sandbox_space_id: sandbox_space_id)\r\n seed_config_models.add(config, space)\r\n if hash[:is_sandbox] == true\r\n seed_config_error \"Space cannot have both a 'sandbox' and 'is_sandbox' value.\", config if space.sandbox_space_id.present?\r\n space.sandbox_space_id = space.id\r\n @seed.create_error(space) unless space.save\r\n end\r\n end\r\nend",
"title": ""
},
{
"docid": "09522c6cf3bb87f7f7a131e99d1fdb1a",
"score": "0.47886342",
"text": "def create_spree_address\n @spree_address = Spree::Address.new(address_attributes)\n @spree_address.save(validate: false)\n end",
"title": ""
},
{
"docid": "744ff06ad5eb8cf607ceac3acb09ec52",
"score": "0.4785108",
"text": "def addlease(name, ip_addr)\n call_rpc_for_target(VN_METHODS[:addlease], name, ip_addr)\n end",
"title": ""
},
{
"docid": "4a7cdbb09813b0f502aeaa5c25995a87",
"score": "0.47814637",
"text": "def alloc(var_entry)\n if @deallocated.any?\n addr = @deallocated.first\n @deallocated.shift\n else\n addr = @local_counter\n @local_counter += 1\n end\n var_entry.set_addr addr\n @memory[var_entry.name] = var_entry\n var_entry\n end",
"title": ""
},
{
"docid": "60c3fb684773c79251a719e8c33f480e",
"score": "0.47760168",
"text": "def add_allocated_memory(count)\n self.allocated_memory += count\n if (allocated_memory - last_allocated_memory) > allocated_memory_threshold\n GC.start\n @last_allocated_memory = allocated_memory\n end\n end",
"title": ""
},
{
"docid": "90d3d2855ff92a4f86ab10ed90106eeb",
"score": "0.4768651",
"text": "def add_memory_to_vbox_vm(client_name)\n message = \"Adding:\\t\\tMemory to VM \"+client_name\n command = \"VBoxManage modifyvm \\\"#{client_name}\\\" --memory \\\"#{$default_vm_mem}\\\"\"\n execute_command(message,command)\n return\nend",
"title": ""
},
{
"docid": "dbc90ec064561fae62e2c1ea3ac6c190",
"score": "0.47658017",
"text": "def set_space(space_id = params[:id])\n @space = Space.find(space_id)\n end",
"title": ""
},
{
"docid": "39f35ad17a997aae7a0d8614cc4dcecc",
"score": "0.47655463",
"text": "def insert(value)\n store.push value\n swim(length)\n self\n end",
"title": ""
},
{
"docid": "57179b8029385698f458cbfbeeb4bc9a",
"score": "0.47582632",
"text": "def store(address)\n check_address(address)\n value = Integer(yield(address))\n @storage[address]=value\n end",
"title": ""
},
{
"docid": "0adc024854d4dd1973f3b5d7c878f78c",
"score": "0.47537705",
"text": "def add_or_replace_address(address, existing_addresses)\n # Update the registration's nested addresses, replacing any existing address of the same type\n updated_addresses = existing_addresses\n matched_address = updated_addresses.find(existing_address.id) if existing_address\n\n if matched_address\n updated_addresses.delete(matched_address)\n matched_address.delete\n end\n\n updated_addresses << address if address\n\n updated_addresses\n end",
"title": ""
},
{
"docid": "6860d63f8a9f6c196db2823597a04703",
"score": "0.47468022",
"text": "def insert(data)\n raise VolumeCapacityExceeded if (new_tail = @tail + 4 + data.size) > size\n @file.seek(@tail)\n @file.write([data.size].pack('N') + data)\n t = @tail\n @tail = new_tail\n write_tail(@file, @tail)\n t\n end",
"title": ""
},
{
"docid": "08b418058f79a8f48594f8efdab50833",
"score": "0.4735",
"text": "def add_map_reloc(image, load_address, offset=0, sz=nil, flags=nil,\n arch_info=nil) \n sz ||= image.size\n begin\n check_map_overlap(load_address, sz)\n rescue MapOverlapError\n load_address = find_next_free_space(load_address, sz)\n end\n m = add_map image, load_address, offset, sz, flags, arch_info\n if m.vma != load_address\n m.tag(:needs_relocation)\n m.properties[:orig_vma] = load_address\n end\n m\n end",
"title": ""
},
{
"docid": "251d8938a2a6e681e9c1ff71d76b9612",
"score": "0.4734477",
"text": "def add(key, value = key)\n new_node = HeapNode.new(key, value)\n @store << new_node\n\n heap_up(@store.length - 1) unless self.empty?\n end",
"title": ""
},
{
"docid": "bbf5f91034919e3f00d6f2dc3d9abe2d",
"score": "0.47311196",
"text": "def add_shard( *args )\n shard_def = ( args.first.is_a?(ShardDefinition) ? args.first : ShardDefinition.new( *args ) )\n\n duplicate_exists = shard_name_exists?( shard_def.name )\n\n raise NameNotUniqueError,\n \"Shard named '#{shard_def.name.to_s}' exists for schema '#{shard_def.schema.to_s}'\" if duplicate_exists\n\n definitions << shard_def\n definitions_by_schema( shard_def.schema ) << shard_def\n definitions_by_name[ shard_def.name.to_sym ] = shard_def\n\n shard_def\n end",
"title": ""
},
{
"docid": "a12a91aa3e8ba606b01bfbc0ac8ce87e",
"score": "0.47284672",
"text": "def add_address(parameters, creditcard, options)\n end",
"title": ""
},
{
"docid": "de6edac64f04a51927ce24fc11975cb8",
"score": "0.47247896",
"text": "def duplicate_space(space, source_space_id)\n return if source_space_id.nil?\n\n source_space = Space.find(source_space_id)\n\n space_copier = CopyService::SpaceCopier.new(api: api, user: user)\n space_copier.copy(space, source_space)\n end",
"title": ""
},
{
"docid": "13e2cb0200ddba5e47140bf2d14fdd3a",
"score": "0.47190583",
"text": "def add storage\n Storage.new (storage.data+@data), @length\n end",
"title": ""
},
{
"docid": "028c3c25f71244524e23a7c03a3ab1a7",
"score": "0.4717717",
"text": "def allocate_address\n action = 'AllocateAddress'\n params = {\n 'Action' => action\n }\n\n response = send_query_request(params)\n parser = Awsum::Ec2::AddressParser.new(self)\n parser.parse(response.body)[0]\n end",
"title": ""
},
{
"docid": "268727dfd8a054a341e897ec63529fb1",
"score": "0.47176772",
"text": "def add_address(ipaddress, rule)\n return false unless rule.is_a?(Rule)\n @addresses ||= {}\n (@addresses[ipaddress] ||= []) << rule\n rule\n end",
"title": ""
},
{
"docid": "7aeb4492a88d298ba81f721c44051de6",
"score": "0.47118434",
"text": "def create_new_addr_bounds(addr_codes)\n\t\t\taddr_codes.each do |ac|\n\t\t\t\t@address.addr_bounds.create(addr_code: ac)\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "2777844b2625a0fef1d39b2f54dd5ba2",
"score": "0.47113657",
"text": "def add_slot(name, value)\n slot = Slot.new(name, value)\n @slots[:name] = slot\n slot\n end",
"title": ""
},
{
"docid": "de1cb1c4089673d387d1f2b98b7bf0f6",
"score": "0.4709895",
"text": "def create_address(address, profile_id)\n @type = Type::CIM_CREATE_ADDRESS\n @fields.merge!(address.to_hash)\n handle_profile_id(profile_id)\n make_request\n end",
"title": ""
},
{
"docid": "1f3c9b4d0e2b76d59e45276c93e2f18e",
"score": "0.47089517",
"text": "def set_space_unit(key, value)\n\t@space_units_values[key] = value\nend",
"title": ""
},
{
"docid": "0f390feb60f548f7c8098ac21ed11794",
"score": "0.47085166",
"text": "def add(field_name, field_type, offset: current_size, skip: 0)\n field = type.add(field_name.to_s, field_type, offset: offset, skip: skip)\n @current_size = [current_size, field.offset + field.size].max\n field\n end",
"title": ""
}
] |
69beaa3e957d1fc356539d0314d703e1 | Custom attribute writer method checking allowed values (enum). | [
{
"docid": "641b474c48fd793e6fdc43ee7af71ccb",
"score": "0.0",
"text": "def license_type=(license_type)\n validator = EnumAttributeValidator.new('String', [\"Base\", \"Essential\", \"Standard\", \"Advantage\", \"Premier\", \"IWO-Essential\", \"IWO-Advantage\", \"IWO-Premier\"])\n unless validator.valid?(license_type)\n fail ArgumentError, \"invalid value for \\\"license_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @license_type = license_type\n end",
"title": ""
}
] | [
{
"docid": "af6d0e33773bc681443214ce777b13e1",
"score": "0.7088127",
"text": "def write_attribute_with_enum(attr, value)\n write_attribute_without_enum attr, converted_enum(attr, value)\n end",
"title": ""
},
{
"docid": "85eec95603dc239e3d18923b2c672b31",
"score": "0.64820594",
"text": "def attr_enum(name, enum, options={}, &block)\n raise ArgumentError, 'enum' unless enum && enum.respond_to?(:values)\n\n options = {\n :enum => enum,\n :validate => true\n }.merge(options)\n\n required = options[:required] == true\n converter = block_given? ? block : Converters.converter_for(:enum, options)\n\n attr_reader_with_converter name, converter, options\n\n validates name,\n :allow_blank => !required,\n :allow_nil => !required,\n :inclusion => { :in => enum.values } if options[:validate]\n\n attr_writer name\n\n add_attr(name, :enum, converter, options)\n end",
"title": ""
},
{
"docid": "1813a772b2cbcd958e1dc18a502929ae",
"score": "0.6429773",
"text": "def _attribute_enum?(attr)\n return false unless self.class.respond_to?(:defined_enums)\n self.class.defined_enums.with_indifferent_access.include?(attr)\n end",
"title": ""
},
{
"docid": "acb82197ce967648e755848e4bedefaa",
"score": "0.6227689",
"text": "def nature_of_business=(nature_of_business)\n validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n unless validator.valid?(nature_of_business) || nature_of_business.empty?\n fail ArgumentError, \"invalid value for \\\"nature_of_business\\\", must be one of #{validator.allowable_values}.\"\n end\n @nature_of_business = nature_of_business\n end",
"title": ""
},
{
"docid": "7bfae678a265eff1e17561c08eeaa7ee",
"score": "0.61418885",
"text": "def valid?\n type_validator = EnumAttributeValidator.new('String', ['Appear', 'CurveUpDown', 'Ascend', 'Blast', 'Blinds', 'Blink', 'BoldFlash', 'BoldReveal', 'Boomerang', 'Bounce', 'Box', 'BrushOnColor', 'BrushOnUnderline', 'CenterRevolve', 'ChangeFillColor', 'ChangeFont', 'ChangeFontColor', 'ChangeFontSize', 'ChangeFontStyle', 'ChangeLineColor', 'Checkerboard', 'Circle', 'ColorBlend', 'ColorTypewriter', 'ColorWave', 'ComplementaryColor', 'ComplementaryColor2', 'Compress', 'ContrastingColor', 'Crawl', 'Credits', 'Custom', 'Darken', 'Desaturate', 'Descend', 'Diamond', 'Dissolve', 'EaseInOut', 'Expand', 'Fade', 'FadedSwivel', 'FadedZoom', 'FlashBulb', 'FlashOnce', 'Flicker', 'Flip', 'Float', 'Fly', 'Fold', 'Glide', 'GrowAndTurn', 'GrowShrink', 'GrowWithColor', 'Lighten', 'LightSpeed', 'MediaPause', 'MediaPlay', 'MediaStop', 'Path4PointStar', 'Path5PointStar', 'Path6PointStar', 'Path8PointStar', 'PathArcDown', 'PathArcLeft', 'PathArcRight', 'PathArcUp', 'PathBean', 'PathBounceLeft', 'PathBounceRight', 'PathBuzzsaw', 'PathCircle', 'PathCrescentMoon', 'PathCurvedSquare', 'PathCurvedX', 'PathCurvyLeft', 'PathCurvyRight', 'PathCurvyStar', 'PathDecayingWave', 'PathDiagonalDownRight', 'PathDiagonalUpRight', 'PathDiamond', 'PathDown', 'PathEqualTriangle', 'PathFigure8Four', 'PathFootball', 'PathFunnel', 'PathHeart', 'PathHeartbeat', 'PathHexagon', 'PathHorizontalFigure8', 'PathInvertedSquare', 'PathInvertedTriangle', 'PathLeft', 'PathLoopdeLoop', 'PathNeutron', 'PathOctagon', 'PathParallelogram', 'PathPeanut', 'PathPentagon', 'PathPlus', 'PathPointyStar', 'PathRight', 'PathRightTriangle', 'PathSCurve1', 'PathSCurve2', 'PathSineWave', 'PathSpiralLeft', 'PathSpiralRight', 'PathSpring', 'PathSquare', 'PathStairsDown', 'PathSwoosh', 'PathTeardrop', 'PathTrapezoid', 'PathTurnDown', 'PathTurnRight', 'PathTurnUp', 'PathTurnUpRight', 'PathUp', 'PathUser', 'PathVerticalFigure8', 'PathWave', 'PathZigzag', 'Peek', 'Pinwheel', 'Plus', 'RandomBars', 'RandomEffects', 'RiseUp', 'Shimmer', 'Sling', 'Spin', 'Spinner', 'Spiral', 'Split', 'Stretch', 'Strips', 'StyleEmphasis', 'Swish', 'Swivel', 'Teeter', 'Thread', 'Transparency', 'Unfold', 'VerticalGrow', 'Wave', 'Wedge', 'Wheel', 'Whip', 'Wipe', 'Magnify', 'Zoom', 'OLEObjectShow', 'OLEObjectEdit', 'OLEObjectOpen'])\n return false unless type_validator.valid?(@type)\n subtype_validator = EnumAttributeValidator.new('String', ['None', 'Across', 'Bottom', 'BottomLeft', 'BottomRight', 'Center', 'Clockwise', 'CounterClockwise', 'GradualAndCycleClockwise', 'GradualAndCycleCounterClockwise', 'Down', 'DownLeft', 'DownRight', 'FontAllCaps', 'FontBold', 'FontItalic', 'FontShadow', 'FontStrikethrough', 'FontUnderline', 'Gradual', 'Horizontal', 'HorizontalIn', 'HorizontalOut', 'In', 'InBottom', 'InCenter', 'InSlightly', 'Instant', 'Left', 'OrdinalMask', 'Out', 'OutBottom', 'OutCenter', 'OutSlightly', 'Right', 'Slightly', 'Top', 'TopLeft', 'TopRight', 'Up', 'UpLeft', 'UpRight', 'Vertical', 'VerticalIn', 'VerticalOut', 'Wheel1', 'Wheel2', 'Wheel3', 'Wheel4', 'Wheel8'])\n return false unless subtype_validator.valid?(@subtype)\n preset_class_type_validator = EnumAttributeValidator.new('String', ['Entrance', 'Exit', 'Emphasis', 'Path', 'MediaCall', 'OLEActionVerbs'])\n return false unless preset_class_type_validator.valid?(@preset_class_type)\n return false if @shape_index.nil?\n trigger_type_validator = EnumAttributeValidator.new('String', ['AfterPrevious', 'OnClick', 'WithPrevious'])\n return false unless trigger_type_validator.valid?(@trigger_type)\n restart_validator = EnumAttributeValidator.new('String', ['Always', 'WhenNotActive', 'Never', 'NotDefined'])\n return false unless restart_validator.valid?(@restart)\n after_animation_type_validator = EnumAttributeValidator.new('String', ['DoNotDim', 'Color', 'HideAfterAnimation', 'HideOnNextMouseClick'])\n return false unless after_animation_type_validator.valid?(@after_animation_type)\n true\n end",
"title": ""
},
{
"docid": "9a4ca131cd09e0a484d4f7e59c03f493",
"score": "0.5809922",
"text": "def enum_attr?(name)\n return false unless @enum_attrs\n @enum_attrs.key?(name)\n end",
"title": ""
},
{
"docid": "2ec49776d78d21ab22c5f6abf9205423",
"score": "0.57507086",
"text": "def classy_enum_attr(attribute, options={})\n enum = (options[:class_name] || options[:enum] || attribute).to_s.camelize.constantize\n allow_blank = options[:allow_blank] || false\n allow_nil = options[:allow_nil] || false\n default = ClassyEnum._normalize_default(options[:default], enum)\n\n # Add ActiveRecord validation to ensure it won't be saved unless it's an option\n validates_inclusion_of attribute,\n in: enum,\n allow_blank: allow_blank,\n allow_nil: allow_nil\n\n # Use a module so that the reader methods can be overridden in classes and\n # use super to get the enum value.\n mod = Module.new do\n\n # Define getter method that returns a ClassyEnum instance\n define_method attribute do\n enum.build(read_attribute(attribute), owner: self)\n end\n\n # Define setter method that accepts string, symbol, instance or class for member\n define_method \"#{attribute}=\" do |value|\n value = ClassyEnum._normalize_value(value, default, (allow_nil || allow_blank))\n super(value)\n end\n\n define_method :save_changed_attribute do |attr_name, arg|\n if attribute.to_s == attr_name.to_s && !attribute_changed?(attr_name)\n arg = enum.build(arg)\n current_value = clone_attribute_value(:read_attribute, attr_name)\n\n if arg != current_value\n if respond_to?(:set_attribute_was, true)\n set_attribute_was(attr_name, enum.build(arg, owner: self))\n else\n changed_attributes[attr_name] = enum.build(current_value, owner: self)\n end\n end\n else\n super(attr_name, arg)\n end\n end\n end\n\n include mod\n\n # Initialize the object with the default value if it is present\n # because this will let you store the default value in the\n # database and make it searchable.\n if default.present?\n after_initialize do\n value = read_attribute(attribute)\n\n if (value.blank? && !(allow_blank || allow_nil)) || (value.nil? && !allow_nil)\n send(\"#{attribute}=\", default)\n end\n end\n end\n\n end",
"title": ""
},
{
"docid": "5e395e619219a91208346fffe6d60ab5",
"score": "0.5743216",
"text": "def is_enum_param(name)\n [\"bookmarkType\", \"order\", \"role\"].include?(name)\n end",
"title": ""
},
{
"docid": "5d8eb84436220f806eb50c8a0bc66867",
"score": "0.5736045",
"text": "def valid?\n ENUM.include? @type.downcase.to_sym\n end",
"title": ""
},
{
"docid": "01ae05766f20de61607b667fad9a6158",
"score": "0.5708027",
"text": "def type=(type)\n validator = EnumAttributeValidator.new('String', ['Appear', 'CurveUpDown', 'Ascend', 'Blast', 'Blinds', 'Blink', 'BoldFlash', 'BoldReveal', 'Boomerang', 'Bounce', 'Box', 'BrushOnColor', 'BrushOnUnderline', 'CenterRevolve', 'ChangeFillColor', 'ChangeFont', 'ChangeFontColor', 'ChangeFontSize', 'ChangeFontStyle', 'ChangeLineColor', 'Checkerboard', 'Circle', 'ColorBlend', 'ColorTypewriter', 'ColorWave', 'ComplementaryColor', 'ComplementaryColor2', 'Compress', 'ContrastingColor', 'Crawl', 'Credits', 'Custom', 'Darken', 'Desaturate', 'Descend', 'Diamond', 'Dissolve', 'EaseInOut', 'Expand', 'Fade', 'FadedSwivel', 'FadedZoom', 'FlashBulb', 'FlashOnce', 'Flicker', 'Flip', 'Float', 'Fly', 'Fold', 'Glide', 'GrowAndTurn', 'GrowShrink', 'GrowWithColor', 'Lighten', 'LightSpeed', 'MediaPause', 'MediaPlay', 'MediaStop', 'Path4PointStar', 'Path5PointStar', 'Path6PointStar', 'Path8PointStar', 'PathArcDown', 'PathArcLeft', 'PathArcRight', 'PathArcUp', 'PathBean', 'PathBounceLeft', 'PathBounceRight', 'PathBuzzsaw', 'PathCircle', 'PathCrescentMoon', 'PathCurvedSquare', 'PathCurvedX', 'PathCurvyLeft', 'PathCurvyRight', 'PathCurvyStar', 'PathDecayingWave', 'PathDiagonalDownRight', 'PathDiagonalUpRight', 'PathDiamond', 'PathDown', 'PathEqualTriangle', 'PathFigure8Four', 'PathFootball', 'PathFunnel', 'PathHeart', 'PathHeartbeat', 'PathHexagon', 'PathHorizontalFigure8', 'PathInvertedSquare', 'PathInvertedTriangle', 'PathLeft', 'PathLoopdeLoop', 'PathNeutron', 'PathOctagon', 'PathParallelogram', 'PathPeanut', 'PathPentagon', 'PathPlus', 'PathPointyStar', 'PathRight', 'PathRightTriangle', 'PathSCurve1', 'PathSCurve2', 'PathSineWave', 'PathSpiralLeft', 'PathSpiralRight', 'PathSpring', 'PathSquare', 'PathStairsDown', 'PathSwoosh', 'PathTeardrop', 'PathTrapezoid', 'PathTurnDown', 'PathTurnRight', 'PathTurnUp', 'PathTurnUpRight', 'PathUp', 'PathUser', 'PathVerticalFigure8', 'PathWave', 'PathZigzag', 'Peek', 'Pinwheel', 'Plus', 'RandomBars', 'RandomEffects', 'RiseUp', 'Shimmer', 'Sling', 'Spin', 'Spinner', 'Spiral', 'Split', 'Stretch', 'Strips', 'StyleEmphasis', 'Swish', 'Swivel', 'Teeter', 'Thread', 'Transparency', 'Unfold', 'VerticalGrow', 'Wave', 'Wedge', 'Wheel', 'Whip', 'Wipe', 'Magnify', 'Zoom', 'OLEObjectShow', 'OLEObjectEdit', 'OLEObjectOpen'])\n unless validator.valid?(type)\n fail ArgumentError, 'invalid value for \"type\", must be one of #{validator.allowable_values}.'\n end\n @type = type\n end",
"title": ""
},
{
"docid": "32aca728dc2aa7b5684e66efae126019",
"score": "0.57014966",
"text": "def set_enum_attrs(subset)\n raise ArgumentError, \"attrs is not a proper subset of available values\" unless subset.all? { |attr| attrs.include? attr }\n @enum_attrs = subset\n end",
"title": ""
},
{
"docid": "ef543a39cb61fc92dc80acd0cd8c67da",
"score": "0.56777334",
"text": "def country=(country)\n validator = EnumAttributeValidator.new('String', [\"ZZ\", \"AD\", \"AE\", \"AF\", \"AG\", \"AI\", \"AL\", \"AM\", \"AO\", \"AQ\", \"AR\", \"AS\", \"AT\", \"AU\", \"AW\", \"AX\", \"AZ\", \"BA\", \"BB\", \"BD\", \"BE\", \"BF\", \"BG\", \"BH\", \"BI\", \"BJ\", \"BL\", \"BM\", \"BN\", \"BO\", \"BQ\", \"BR\", \"BS\", \"BT\", \"BV\", \"BW\", \"BY\", \"BZ\", \"CA\", \"CC\", \"CD\", \"CF\", \"CG\", \"CH\", \"CI\", \"CK\", \"CL\", \"CM\", \"CN\", \"CO\", \"CR\", \"CU\", \"CV\", \"CW\", \"CX\", \"CY\", \"CZ\", \"DE\", \"DJ\", \"DK\", \"DM\", \"DO\", \"DZ\", \"EC\", \"EE\", \"EG\", \"EH\", \"ER\", \"ES\", \"ET\", \"FI\", \"FJ\", \"FK\", \"FM\", \"FO\", \"FR\", \"GA\", \"GB\", \"GD\", \"GE\", \"GF\", \"GG\", \"GH\", \"GI\", \"GL\", \"GM\", \"GN\", \"GP\", \"GQ\", \"GR\", \"GS\", \"GT\", \"GU\", \"GW\", \"GY\", \"HK\", \"HM\", \"HN\", \"HR\", \"HT\", \"HU\", \"ID\", \"IE\", \"IL\", \"IM\", \"IN\", \"IO\", \"IQ\", \"IR\", \"IS\", \"IT\", \"JE\", \"JM\", \"JO\", \"JP\", \"KE\", \"KG\", \"KH\", \"KI\", \"KM\", \"KN\", \"KP\", \"KR\", \"KW\", \"KY\", \"KZ\", \"LA\", \"LB\", \"LC\", \"LI\", \"LK\", \"LR\", \"LS\", \"LT\", \"LU\", \"LV\", \"LY\", \"MA\", \"MC\", \"MD\", \"ME\", \"MF\", \"MG\", \"MH\", \"MK\", \"ML\", \"MM\", \"MN\", \"MO\", \"MP\", \"MQ\", \"MR\", \"MS\", \"MT\", \"MU\", \"MV\", \"MW\", \"MX\", \"MY\", \"MZ\", \"NA\", \"NC\", \"NE\", \"NF\", \"NG\", \"NI\", \"NL\", \"NO\", \"NP\", \"NR\", \"NU\", \"NZ\", \"OM\", \"PA\", \"PE\", \"PF\", \"PG\", \"PH\", \"PK\", \"PL\", \"PM\", \"PN\", \"PR\", \"PS\", \"PT\", \"PW\", \"PY\", \"QA\", \"RE\", \"RO\", \"RS\", \"RU\", \"RW\", \"SA\", \"SB\", \"SC\", \"SD\", \"SE\", \"SG\", \"SH\", \"SI\", \"SJ\", \"SK\", \"SL\", \"SM\", \"SN\", \"SO\", \"SR\", \"SS\", \"ST\", \"SV\", \"SX\", \"SY\", \"SZ\", \"TC\", \"TD\", \"TF\", \"TG\", \"TH\", \"TJ\", \"TK\", \"TL\", \"TM\", \"TN\", \"TO\", \"TR\", \"TT\", \"TV\", \"TW\", \"TZ\", \"UA\", \"UG\", \"UM\", \"US\", \"UY\", \"UZ\", \"VA\", \"VC\", \"VE\", \"VG\", \"VI\", \"VN\", \"VU\", \"WF\", \"WS\", \"YE\", \"YT\", \"ZA\", \"ZM\", \"ZW\"])\n unless validator.valid?(country)\n fail ArgumentError, \"invalid value for 'country', must be one of #{validator.allowable_values}.\"\n end\n @country = country\n end",
"title": ""
},
{
"docid": "d5da2fed1c88e6216b3b7c424e2c0435",
"score": "0.5601988",
"text": "def check_option!(name, definition)\n case name\n when :values\n raise AttributorException, \"Allowed set of values requires an array. Got (#{definition})\" unless definition.is_a? ::Array\n when :default\n raise AttributorException, \"Default value doesn't have the correct attribute type. Got (#{definition.inspect})\" unless type.valid_type?(definition) || definition.is_a?(Proc)\n options[:default] = load(definition) unless definition.is_a?(Proc)\n when :description\n raise AttributorException, \"Description value must be a string. Got (#{definition})\" unless definition.is_a? ::String\n when :required\n raise AttributorException, 'Required must be a boolean' unless definition == true || definition == false\n raise AttributorException, 'Required cannot be enabled in combination with :default' if definition == true && options.key?(:default)\n when :required_if\n raise AttributorException, 'Required_if must be a String, a Hash definition or a Proc' unless definition.is_a?(::String) || definition.is_a?(::Hash) || definition.is_a?(::Proc)\n raise AttributorException, 'Required_if cannot be specified together with :required' if options[:required]\n when :example\n unless definition.is_a?(::Regexp) || definition.is_a?(::String) || definition.is_a?(::Array) || definition.is_a?(::Proc) || definition.nil? || type.valid_type?(definition)\n raise AttributorException, \"Invalid example type (got: #{definition.class.name}). It must always match the type of the attribute (except if passing Regex that is allowed for some types)\"\n end\n when :custom_data\n raise AttributorException, \"custom_data must be a Hash. Got (#{definition})\" unless definition.is_a?(::Hash)\n else\n return :unknown # unknown option\n end\n\n :ok # passes\n end",
"title": ""
},
{
"docid": "2ff40e55efb8cb9a847f91dde056f8a1",
"score": "0.55947953",
"text": "def define_active_enum_write_method(attribute)\n class_eval <<-DEF\n def #{attribute}=(arg)\n if arg.is_a?(Symbol)\n super(self.class.active_enum_for(:#{attribute})[arg])\n else\n super\n end\n end\n DEF\n end",
"title": ""
},
{
"docid": "2dd2524cbabda42bd3e3516243852b91",
"score": "0.55464065",
"text": "def check_enum(validation:, key:, schema:)\n return false if !validation[:required] && schema.nil? # Optional and not here, dont check\n return false unless validation[:values]\n return false if validation[:values].include?(schema)\n\n schema = 'nothing' if schema.nil?\n error! key, \"must be one of #{validation[:values].join(', ')}, but was #{schema}\"\n true\n end",
"title": ""
},
{
"docid": "36b1f9f5ca30c5b954d7b2a8e70fd531",
"score": "0.55371004",
"text": "def should_allow_values_for(attribute, *good_values)\n get_options!(good_values)\n good_values.each do |value|\n matcher = allow_value(value).for(attribute)\n should matcher.description do\n assert_accepts matcher, subject\n end\n end\n end",
"title": ""
},
{
"docid": "783341e607312dfeedf41ec376f6cc01",
"score": "0.55344343",
"text": "def validate_exclusion_of(attr); end",
"title": ""
},
{
"docid": "e8eb54d3ebfe60d7acf8f1c923d63747",
"score": "0.5528221",
"text": "def valid_attribute_types\n\t\treturn self.must_attribute_types |\n\t\t self.may_attribute_types |\n\t\t self.operational_attribute_types\n\tend",
"title": ""
},
{
"docid": "ba396369e0961def5f7c21ef8eaf53d2",
"score": "0.5434983",
"text": "def valid?\n status_validator = EnumAttributeValidator.new('String', [\"ACTIVE\", \"INACTIVE\"])\n return false unless status_validator.valid?(@status)\n country_validator = EnumAttributeValidator.new('String', [\"ZZ\", \"AD\", \"AE\", \"AF\", \"AG\", \"AI\", \"AL\", \"AM\", \"AO\", \"AQ\", \"AR\", \"AS\", \"AT\", \"AU\", \"AW\", \"AX\", \"AZ\", \"BA\", \"BB\", \"BD\", \"BE\", \"BF\", \"BG\", \"BH\", \"BI\", \"BJ\", \"BL\", \"BM\", \"BN\", \"BO\", \"BQ\", \"BR\", \"BS\", \"BT\", \"BV\", \"BW\", \"BY\", \"BZ\", \"CA\", \"CC\", \"CD\", \"CF\", \"CG\", \"CH\", \"CI\", \"CK\", \"CL\", \"CM\", \"CN\", \"CO\", \"CR\", \"CU\", \"CV\", \"CW\", \"CX\", \"CY\", \"CZ\", \"DE\", \"DJ\", \"DK\", \"DM\", \"DO\", \"DZ\", \"EC\", \"EE\", \"EG\", \"EH\", \"ER\", \"ES\", \"ET\", \"FI\", \"FJ\", \"FK\", \"FM\", \"FO\", \"FR\", \"GA\", \"GB\", \"GD\", \"GE\", \"GF\", \"GG\", \"GH\", \"GI\", \"GL\", \"GM\", \"GN\", \"GP\", \"GQ\", \"GR\", \"GS\", \"GT\", \"GU\", \"GW\", \"GY\", \"HK\", \"HM\", \"HN\", \"HR\", \"HT\", \"HU\", \"ID\", \"IE\", \"IL\", \"IM\", \"IN\", \"IO\", \"IQ\", \"IR\", \"IS\", \"IT\", \"JE\", \"JM\", \"JO\", \"JP\", \"KE\", \"KG\", \"KH\", \"KI\", \"KM\", \"KN\", \"KP\", \"KR\", \"KW\", \"KY\", \"KZ\", \"LA\", \"LB\", \"LC\", \"LI\", \"LK\", \"LR\", \"LS\", \"LT\", \"LU\", \"LV\", \"LY\", \"MA\", \"MC\", \"MD\", \"ME\", \"MF\", \"MG\", \"MH\", \"MK\", \"ML\", \"MM\", \"MN\", \"MO\", \"MP\", \"MQ\", \"MR\", \"MS\", \"MT\", \"MU\", \"MV\", \"MW\", \"MX\", \"MY\", \"MZ\", \"NA\", \"NC\", \"NE\", \"NF\", \"NG\", \"NI\", \"NL\", \"NO\", \"NP\", \"NR\", \"NU\", \"NZ\", \"OM\", \"PA\", \"PE\", \"PF\", \"PG\", \"PH\", \"PK\", \"PL\", \"PM\", \"PN\", \"PR\", \"PS\", \"PT\", \"PW\", \"PY\", \"QA\", \"RE\", \"RO\", \"RS\", \"RU\", \"RW\", \"SA\", \"SB\", \"SC\", \"SD\", \"SE\", \"SG\", \"SH\", \"SI\", \"SJ\", \"SK\", \"SL\", \"SM\", \"SN\", \"SO\", \"SR\", \"SS\", \"ST\", \"SV\", \"SX\", \"SY\", \"SZ\", \"TC\", \"TD\", \"TF\", \"TG\", \"TH\", \"TJ\", \"TK\", \"TL\", \"TM\", \"TN\", \"TO\", \"TR\", \"TT\", \"TV\", \"TW\", \"TZ\", \"UA\", \"UG\", \"UM\", \"US\", \"UY\", \"UZ\", \"VA\", \"VC\", \"VE\", \"VG\", \"VI\", \"VN\", \"VU\", \"WF\", \"WS\", \"YE\", \"YT\", \"ZA\", \"ZM\", \"ZW\"])\n return false unless country_validator.valid?(@country)\n currency_validator = EnumAttributeValidator.new('String', [\"UNKNOWN_CURRENCY\", \"AED\", \"AFN\", \"ALL\", \"AMD\", \"ANG\", \"AOA\", \"ARS\", \"AUD\", \"AWG\", \"AZN\", \"BAM\", \"BBD\", \"BDT\", \"BGN\", \"BHD\", \"BIF\", \"BMD\", \"BND\", \"BOB\", \"BOV\", \"BRL\", \"BSD\", \"BTN\", \"BWP\", \"BYR\", \"BZD\", \"CAD\", \"CDF\", \"CHE\", \"CHF\", \"CHW\", \"CLF\", \"CLP\", \"CNY\", \"COP\", \"COU\", \"CRC\", \"CUC\", \"CUP\", \"CVE\", \"CZK\", \"DJF\", \"DKK\", \"DOP\", \"DZD\", \"EGP\", \"ERN\", \"ETB\", \"EUR\", \"FJD\", \"FKP\", \"GBP\", \"GEL\", \"GHS\", \"GIP\", \"GMD\", \"GNF\", \"GTQ\", \"GYD\", \"HKD\", \"HNL\", \"HRK\", \"HTG\", \"HUF\", \"IDR\", \"ILS\", \"INR\", \"IQD\", \"IRR\", \"ISK\", \"JMD\", \"JOD\", \"JPY\", \"KES\", \"KGS\", \"KHR\", \"KMF\", \"KPW\", \"KRW\", \"KWD\", \"KYD\", \"KZT\", \"LAK\", \"LBP\", \"LKR\", \"LRD\", \"LSL\", \"LTL\", \"LVL\", \"LYD\", \"MAD\", \"MDL\", \"MGA\", \"MKD\", \"MMK\", \"MNT\", \"MOP\", \"MRO\", \"MUR\", \"MVR\", \"MWK\", \"MXN\", \"MXV\", \"MYR\", \"MZN\", \"NAD\", \"NGN\", \"NIO\", \"NOK\", \"NPR\", \"NZD\", \"OMR\", \"PAB\", \"PEN\", \"PGK\", \"PHP\", \"PKR\", \"PLN\", \"PYG\", \"QAR\", \"RON\", \"RSD\", \"RUB\", \"RWF\", \"SAR\", \"SBD\", \"SCR\", \"SDG\", \"SEK\", \"SGD\", \"SHP\", \"SLL\", \"SOS\", \"SRD\", \"SSP\", \"STD\", \"SVC\", \"SYP\", \"SZL\", \"THB\", \"TJS\", \"TMT\", \"TND\", \"TOP\", \"TRY\", \"TTD\", \"TWD\", \"TZS\", \"UAH\", \"UGX\", \"USD\", \"USN\", \"USS\", \"UYI\", \"UYU\", \"UZS\", \"VEF\", \"VND\", \"VUV\", \"WST\", \"XAF\", \"XAG\", \"XAU\", \"XBA\", \"XBB\", \"XBC\", \"XBD\", \"XCD\", \"XDR\", \"XOF\", \"XPD\", \"XPF\", \"XPT\", \"XTS\", \"XXX\", \"YER\", \"ZAR\", \"ZMK\", \"ZMW\", \"BTC\"])\n return false unless currency_validator.valid?(@currency)\n type_validator = EnumAttributeValidator.new('String', [\"PHYSICAL\", \"MOBILE\"])\n return false unless type_validator.valid?(@type)\n return true\n end",
"title": ""
},
{
"docid": "5aa41aab2e0a4e7df65e6424415564b8",
"score": "0.54312384",
"text": "def update_allowed_values\n self.url_allowed = true if url_required\n self.description_allowed = true if description_required\n self.title_allowed = true if title_required\n\n TagSet::TAG_TYPES.each do |tag_type|\n required = eval(\"#{tag_type}_num_required\") || eval(\"self.#{tag_type}_num_required\") || 0\n allowed = eval(\"#{tag_type}_num_allowed\") || eval(\"self.#{tag_type}_num_allowed\") || 0\n if required > allowed\n eval(\"self.#{tag_type}_num_allowed = required\")\n end\n end\n end",
"title": ""
},
{
"docid": "7ff664ed667045d39b3260cd6a0d3a40",
"score": "0.5418137",
"text": "def test_valid?\n assert_raise( RuntimeError ) { Tui::Model::Enum.new( 'lab1', { }, 1 ) }\n base = Tui::Model::Enum.new( 'lab1', { 'val1' => '1', 'val99' => '99' }, 'val99' )\n assert_false base.valid?( 1 )\n assert_true base.valid?( \"val1\" )\n ex = assert_raise( RuntimeError ) { base.value = 1; }\n assert_equal( 'Invalid value for model type Tui::Model::Enum!', ex.message )\n end",
"title": ""
},
{
"docid": "56e896af4b3de46539f2a445a1f2ae82",
"score": "0.5379602",
"text": "def validate_may_attributes\n\t\thash = (self.entry || {} ).merge( @values )\n\t\tattributes = hash.keys.map( &:to_sym ).uniq\n\t\tvalid_attributes = self.valid_attribute_oids +\n\t\t\tself.operational_attribute_oids +\n\t\t\tIGNORED_OPERATIONAL_ATTRS\n\n\t\tself.log.debug \"Validating MAY attributes: %p against the list of valid OIDs: %p\" %\n\t\t\t[ attributes, valid_attributes ]\n\t\tunknown_attributes = attributes - valid_attributes\n\t\tunknown_attributes.each do |oid|\n\t\t\tself.errors.add( oid, \"is not allowed by entry's objectClasses\" )\n\t\tend\n\tend",
"title": ""
},
{
"docid": "ac55752dd9cc4f485a916c46d7b41237",
"score": "0.53794384",
"text": "def allowed_attributes=(_arg0); end",
"title": ""
},
{
"docid": "ac55752dd9cc4f485a916c46d7b41237",
"score": "0.53794384",
"text": "def allowed_attributes=(_arg0); end",
"title": ""
},
{
"docid": "91c8cba712c18d00879c543b2686cf75",
"score": "0.53653747",
"text": "def validate_range(key, value, enum_values)\n values = value.instance_of?(Array) ? value : [value]\n values.each do |v|\n add_templated_error(key, \"'#{v}' is not a valid setting for '#{template.name_for(key)}'\") unless enum_values.include?(v)\n end\n end",
"title": ""
},
{
"docid": "bdf28e68ba6dab72ee9b580bb965b3f3",
"score": "0.53513694",
"text": "def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n return false unless object_type_validator.valid?(@object_type)\n true\n end",
"title": ""
},
{
"docid": "eed235e3960d45d5aae2733376c26c7f",
"score": "0.53364015",
"text": "def allowed_values(value, pdef)\n if(pdef['AllowedValues'].include?(value))\n true\n else\n \"Not an allowed value: #{pdef['AllowedValues'].join(', ')}\"\n end\n end",
"title": ""
},
{
"docid": "ccfe8738bfd90d4dd7cb62eaf02a0937",
"score": "0.5330548",
"text": "def allowed_to_write(name)\n # no point allowing attribute writes if we can't save them?\n if allowed_to_save\n name = name.to_s\n validation_methods = self.class.write_validations(name) \n if validation_methods.nil?\n # We haven't registered any filters on this attribute, so allow the write.\n true\n elsif validation_methods.check :accessor => accessor, :model => self\n # One of the authentication methods worked, so allow the write.\n true\n else\n # We had filters but none of them passed. Disallow write.\n false\n end\n else\n false\n end\n end",
"title": ""
},
{
"docid": "aa9af6f302eab691811de43fd5119e4a",
"score": "0.5324624",
"text": "def status_enum=(status)\n write_attribute(:status, status)\n end",
"title": ""
},
{
"docid": "aec1171a0bb0b9aa69a0d222b5e42061",
"score": "0.53222466",
"text": "def setting_attribute_is_allowed?(name, user)\n return false unless user.can_write?(self, name)\n (self.whitelisted_attributes && self.whitelisted_attributes.has_key?( name.to_sym)) ||\n (\n self.attribute_names.include?( name.to_s ) &&\n ( self.blacklisted_attributes.nil? ||\n ! self.blacklisted_attributes.has_key?( name.to_sym ) )\n )\n end",
"title": ""
},
{
"docid": "8a0c85ab2f4e0dc8c9d541d1a9d672d9",
"score": "0.5307476",
"text": "def valid?\n return false if !super\n status_validator = EnumAttributeValidator.new('String', ['NotDefined', 'Active', 'Resolved', 'Closed'])\n return false unless status_validator.valid?(@status)\n true\n end",
"title": ""
},
{
"docid": "cdad6e3a8b5642a185bca042edae26fd",
"score": "0.53004855",
"text": "def valid?\n MANDATORY_ATTRIBUTES[type].each{|a| return false unless self[a]}\n true\n end",
"title": ""
},
{
"docid": "5ea5581623455c92a5407359d9e0d1b1",
"score": "0.52841866",
"text": "def valid?\n return false if !super\n return false if @style.nil?\n style_validator = EnumAttributeValidator.new('String', ['Unknown', 'Percent05', 'Percent10', 'Percent20', 'Percent25', 'Percent30', 'Percent40', 'Percent50', 'Percent60', 'Percent70', 'Percent75', 'Percent80', 'Percent90', 'DarkHorizontal', 'DarkVertical', 'DarkDownwardDiagonal', 'DarkUpwardDiagonal', 'SmallCheckerBoard', 'Trellis', 'LightHorizontal', 'LightVertical', 'LightDownwardDiagonal', 'LightUpwardDiagonal', 'SmallGrid', 'DottedDiamond', 'WideDownwardDiagonal', 'WideUpwardDiagonal', 'DashedUpwardDiagonal', 'DashedDownwardDiagonal', 'NarrowVertical', 'NarrowHorizontal', 'DashedVertical', 'DashedHorizontal', 'LargeConfetti', 'LargeGrid', 'HorizontalBrick', 'LargeCheckerBoard', 'SmallConfetti', 'Zigzag', 'SolidDiamond', 'DiagonalBrick', 'OutlinedDiamond', 'Plaid', 'Sphere', 'Weave', 'DottedGrid', 'Divot', 'Shingle', 'Wave', 'Horizontal', 'Vertical', 'Cross', 'DownwardDiagonal', 'UpwardDiagonal', 'DiagonalCross', 'NotDefined'])\n return false unless style_validator.valid?(@style)\n true\n end",
"title": ""
},
{
"docid": "19056d6a35509fdd23a84fa3afae6658",
"score": "0.52784383",
"text": "def enum?(field)\n !!self.enums[field.to_sym]\n end",
"title": ""
},
{
"docid": "90f91e2cc45b45578cf3bb665fb4c15e",
"score": "0.52683413",
"text": "def currency=(currency)\n validator = EnumAttributeValidator.new('String', [\"UNKNOWN_CURRENCY\", \"AED\", \"AFN\", \"ALL\", \"AMD\", \"ANG\", \"AOA\", \"ARS\", \"AUD\", \"AWG\", \"AZN\", \"BAM\", \"BBD\", \"BDT\", \"BGN\", \"BHD\", \"BIF\", \"BMD\", \"BND\", \"BOB\", \"BOV\", \"BRL\", \"BSD\", \"BTN\", \"BWP\", \"BYR\", \"BZD\", \"CAD\", \"CDF\", \"CHE\", \"CHF\", \"CHW\", \"CLF\", \"CLP\", \"CNY\", \"COP\", \"COU\", \"CRC\", \"CUC\", \"CUP\", \"CVE\", \"CZK\", \"DJF\", \"DKK\", \"DOP\", \"DZD\", \"EGP\", \"ERN\", \"ETB\", \"EUR\", \"FJD\", \"FKP\", \"GBP\", \"GEL\", \"GHS\", \"GIP\", \"GMD\", \"GNF\", \"GTQ\", \"GYD\", \"HKD\", \"HNL\", \"HRK\", \"HTG\", \"HUF\", \"IDR\", \"ILS\", \"INR\", \"IQD\", \"IRR\", \"ISK\", \"JMD\", \"JOD\", \"JPY\", \"KES\", \"KGS\", \"KHR\", \"KMF\", \"KPW\", \"KRW\", \"KWD\", \"KYD\", \"KZT\", \"LAK\", \"LBP\", \"LKR\", \"LRD\", \"LSL\", \"LTL\", \"LVL\", \"LYD\", \"MAD\", \"MDL\", \"MGA\", \"MKD\", \"MMK\", \"MNT\", \"MOP\", \"MRO\", \"MUR\", \"MVR\", \"MWK\", \"MXN\", \"MXV\", \"MYR\", \"MZN\", \"NAD\", \"NGN\", \"NIO\", \"NOK\", \"NPR\", \"NZD\", \"OMR\", \"PAB\", \"PEN\", \"PGK\", \"PHP\", \"PKR\", \"PLN\", \"PYG\", \"QAR\", \"RON\", \"RSD\", \"RUB\", \"RWF\", \"SAR\", \"SBD\", \"SCR\", \"SDG\", \"SEK\", \"SGD\", \"SHP\", \"SLL\", \"SOS\", \"SRD\", \"SSP\", \"STD\", \"SVC\", \"SYP\", \"SZL\", \"THB\", \"TJS\", \"TMT\", \"TND\", \"TOP\", \"TRY\", \"TTD\", \"TWD\", \"TZS\", \"UAH\", \"UGX\", \"USD\", \"USN\", \"USS\", \"UYI\", \"UYU\", \"UZS\", \"VEF\", \"VND\", \"VUV\", \"WST\", \"XAF\", \"XAG\", \"XAU\", \"XBA\", \"XBB\", \"XBC\", \"XBD\", \"XCD\", \"XDR\", \"XOF\", \"XPD\", \"XPF\", \"XPT\", \"XTS\", \"XXX\", \"YER\", \"ZAR\", \"ZMK\", \"ZMW\", \"BTC\"])\n unless validator.valid?(currency)\n fail ArgumentError, \"invalid value for 'currency', must be one of #{validator.allowable_values}.\"\n end\n @currency = currency\n end",
"title": ""
},
{
"docid": "14f5df7520af62af6b8b571a30ba190a",
"score": "0.5265264",
"text": "def enum_defined_for?(attribute)\n context = self.eh_params[:enum_contexts][attribute.to_s]\n !!(eh_params[:db_codes][context] && eh_params[:db_codes][context][attribute.to_s])\n # Returns true if the indicated attribute has an enum defined\n end",
"title": ""
},
{
"docid": "2adac3b4896db42a0fd697678d494edc",
"score": "0.525289",
"text": "def object_type=(object_type)\n validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n unless validator.valid?(object_type)\n fail ArgumentError, \"invalid value for \\\"object_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @object_type = object_type\n end",
"title": ""
},
{
"docid": "b32831f81f13e75188ef82c53b4cff4f",
"score": "0.52094126",
"text": "def type=(type)\n validator = EnumAttributeValidator.new('String', [\"\", \"APIC\", \"DCNM\", \"UCSFI\", \"UCSFIISM\", \"IMC\", \"IMCM4\", \"IMCM5\", \"IMCRack\", \"UCSIOM\", \"HX\", \"HyperFlexAP\", \"IWE\", \"UCSD\", \"IntersightAppliance\", \"IntersightAssist\", \"PureStorageFlashArray\", \"UCSC890\", \"NetAppOntap\", \"NetAppActiveIqUnifiedManager\", \"EmcScaleIo\", \"EmcVmax\", \"EmcVplex\", \"EmcXtremIo\", \"VmwareVcenter\", \"MicrosoftHyperV\", \"AppDynamics\", \"Dynatrace\", \"NewRelic\", \"ServiceNow\", \"ReadHatOpenStack\", \"CloudFoundry\", \"MicrosoftAzureApplicationInsights\", \"OpenStack\", \"MicrosoftSqlServer\", \"Kubernetes\", \"AmazonWebService\", \"AmazonWebServiceBilling\", \"MicrosoftAzureServicePrincipal\", \"MicrosoftAzureEnterpriseAgreement\", \"DellCompellent\", \"HPE3Par\", \"RedHatEnterpriseVirtualization\", \"NutanixAcropolis\", \"HPEOneView\", \"ServiceEngine\", \"HitachiVirtualStoragePlatform\", \"IMCBlade\", \"TerraformCloud\", \"TerraformAgent\", \"CustomTarget\", \"AnsibleEndpoint\", \"HTTPEndpoint\", \"SSHEndpoint\", \"CiscoCatalyst\"])\n unless validator.valid?(type)\n fail ArgumentError, \"invalid value for \\\"type\\\", must be one of #{validator.allowable_values}.\"\n end\n @type = type\n end",
"title": ""
},
{
"docid": "ee363055a838373695652b0b491da617",
"score": "0.5189669",
"text": "def compliance=(compliance)\n validator = EnumAttributeValidator.new('String', ['Pdf15', 'PdfA1b'])\n unless validator.valid?(compliance)\n fail ArgumentError, 'invalid value for \"compliance\", must be one of #{validator.allowable_values}.'\n end\n @compliance = compliance\n end",
"title": ""
},
{
"docid": "357d6a8e13f5a706b484303ab9ee7cdb",
"score": "0.5185224",
"text": "def supports_polymorphic_enum_handling(attribute_name)\n self.eh_params[:polymorphic_attribute] = \"#{attribute_name}_type\".to_sym\n end",
"title": ""
},
{
"docid": "78e5d949278093d255b3732d7aff694a",
"score": "0.51700306",
"text": "def should_deny_values(options)\n klass = self.name.gsub(/Test$/, '').constantize\n\n context \"#{klass}\" do\n options.each_pair do |attribute, values|\n [*values].each do |value|\n display_value = value.class == NilClass ? \"nil\" : \"\\\"#{value}\\\"\"\n \n should \"not allow #{attribute} to be #{display_value}\" do\n instance = get_instance_of(klass)\n instance.send(\"#{attribute}=\", value)\n assert !instance.valid?, \n \"Expected #{klass} to be invalid when #{attribute} is set to #{display_value}\"\n assert instance.errors.on(attribute.to_sym), \n \"Expected errors on #{attribute} when set to #{display_value}\"\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "e2e9afb173da2d957ea5f6da5e4dc86a",
"score": "0.5146029",
"text": "def enum?\n true\n end",
"title": ""
},
{
"docid": "cab57c195d4c38b65eff62f6280e2382",
"score": "0.51444733",
"text": "def kind=(kind)\n validator = EnumAttributeValidator.new('String', [\"UNKNOWN\", \"USER_CREATED\", \"INTERNAL\"])\n unless validator.valid?(kind)\n fail ArgumentError, \"invalid value for \\\"kind\\\", must be one of #{validator.allowable_values}.\"\n end\n @kind = kind\n end",
"title": ""
},
{
"docid": "a9a890b66030eba0877102e7863ecb9e",
"score": "0.51369494",
"text": "def validate_attribute_syntax\n\t\t@values.each do |attribute, values|\n\t\t\t[ values ].flatten.each do |value|\n\t\t\t\tbegin\n\t\t\t\t\tself.get_converted_attribute( attribute.to_sym, value )\n\t\t\t\trescue => err\n\t\t\t\t\tself.log.error \"validation for %p failed: %s: %s\" %\n\t\t\t\t\t\t[ attribute, err.class.name, err.message ]\n\t\t\t\t\tattrtype = self.find_attribute_type( attribute )\n\t\t\t\t\tself.errors.add( attribute, \"isn't a valid %s value\" %\n\t\t\t\t\t\t[ attrtype.syntax ? attrtype.syntax.desc : attrtype.syntax_oid ] )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "bd91828da82acda673c62a1067987a25",
"score": "0.5134045",
"text": "def valid?\n return false if @name.nil?\n return false if @name.to_s.length > 25\n return false if @based_on.nil?\n based_on_validator = EnumAttributeValidator.new('String', [\"MyCalendar\", \"Customer\", \"AllHours\", \"Custom\"])\n return false unless based_on_validator.valid?(@based_on)\n return false if !@application_order.nil? && @application_order > 32767\n return false if !@application_order.nil? && @application_order < 1\n return false if !@respond_hours.nil? && @respond_hours > 999\n return false if !@respond_hours.nil? && @respond_hours < 0\n return false if !@respond_percent.nil? && @respond_percent > 99999\n return false if !@respond_percent.nil? && @respond_percent < 0\n return false if !@plan_within.nil? && @plan_within > 999\n return false if !@plan_within.nil? && @plan_within < 0\n return false if !@plan_within_percent.nil? && @plan_within_percent > 99999\n return false if !@plan_within_percent.nil? && @plan_within_percent < 0\n return false if !@resolution_hours.nil? && @resolution_hours > 999\n return false if !@resolution_hours.nil? && @resolution_hours < 0\n return false if !@resolution_percent.nil? && @resolution_percent > 99999\n return false if !@resolution_percent.nil? && @resolution_percent < 0\n return true\n end",
"title": ""
},
{
"docid": "6f8fee872b3443305e1369595c783840",
"score": "0.5133414",
"text": "def valid?\n policy_validator = EnumAttributeValidator.new('Object', ['RMF', 'DIACAP', 'Reporting'])\n return false unless policy_validator.valid?(@policy)\n registration_type_validator = EnumAttributeValidator.new('Object', ['Assess and Authorize', 'Assess Only', 'Guest', 'Regular', 'Functional', 'Cloud Service Provider'])\n return false unless registration_type_validator.valid?(@registration_type)\n organization_name_validator = EnumAttributeValidator.new('Object', ['Army', 'Navy', 'Air Force', 'Marines', 'DoD', 'Defense Information Systems Agency'])\n return false unless organization_name_validator.valid?(@organization_name)\n system_type_validator = EnumAttributeValidator.new('Object', ['IS Major Application', 'IS Enclave', 'Platform IT', 'Platform IT System', 'Interconnection', 'AIS Application'])\n return false unless system_type_validator.valid?(@system_type)\n authorization_status_validator = EnumAttributeValidator.new('Object', ['Authority to Operate (ATO)', 'Interim Authority to Operate (IATO)', 'Interim Authority to Test (IATT)', 'Authority to Operate with Conditions (ATO) w/Conditions)', 'Denied Authority to Operate (DATO)', 'Not Yet Authorized', 'Unaccredited', 'Decommissioned'])\n return false unless authorization_status_validator.valid?(@authorization_status)\n confidentiality_validator = EnumAttributeValidator.new('Object', ['High', 'Moderate', 'Low'])\n return false unless confidentiality_validator.valid?(@confidentiality)\n integrity_validator = EnumAttributeValidator.new('Object', ['High', 'Moderate', 'Low'])\n return false unless integrity_validator.valid?(@integrity)\n availability_validator = EnumAttributeValidator.new('Object', ['High', 'Moderate', 'Low'])\n return false unless availability_validator.valid?(@availability)\n mac_validator = EnumAttributeValidator.new('Object', ['I', 'II', 'III'])\n return false unless mac_validator.valid?(@mac)\n dod_confidentiality_validator = EnumAttributeValidator.new('Object', ['Public', 'Sensitive', 'Classified'])\n return false unless dod_confidentiality_validator.valid?(@dod_confidentiality)\n true\n end",
"title": ""
},
{
"docid": "43deed946b4deaa7a6dd5a6e2b77a417",
"score": "0.5130944",
"text": "def enum?\n false\n end",
"title": ""
},
{
"docid": "8f63719c80c3ed5cc2b4d9d3eaf29db9",
"score": "0.51203525",
"text": "def unassignable_value_for(attr)\n case attr.type\n when :integer\n attr.assignable_values.max + 1\n when :string\n assignable_value_for(attr) + '-unassignable'\n else\n raise \"Assignable values for :#{attr.type} attributes not supported\"\n end\n end",
"title": ""
},
{
"docid": "c47d0ef8ae645c81ce97b33bf3c93f37",
"score": "0.5117331",
"text": "def define_value_methods!\n self.accepted_values.each do |(name, bit)|\n self.meta_class.class_eval <<-FLAG_METHODS\n\n def #{name}\n ((@value || 0) & #{bit}) != 0\n end\n alias :#{name}? :#{name}\n\n def #{name}=(new_value)\n boolean = self.to_boolean(new_value)\n current = self.#{name}\n if boolean ^ current\n self.value = ((@value || 0) ^ #{bit})\n end\n self.#{name}\n end\n\n FLAG_METHODS\n end\n end",
"title": ""
},
{
"docid": "33054e077cd8262c72df41ae9bf69d31",
"score": "0.5108703",
"text": "def replace_enumerations_in_hash(attrs, allow_multiple = true) #:nodoc:\n attrs.each do |attr, value|\n if options = enumerator_options_for(attr, value, allow_multiple)\n attrs.delete(attr)\n attrs.merge!(options)\n end\n end\n end",
"title": ""
},
{
"docid": "014d5d1896a36c56888e9112fe53938a",
"score": "0.5108653",
"text": "def update_enum_attribute(database_id:, collection_id:, key:, elements:, required:, default:)\n path = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'\n .gsub('{databaseId}', database_id)\n .gsub('{collectionId}', collection_id)\n .gsub('{key}', key)\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n if collection_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"collectionId\"')\n end\n\n if key.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"key\"')\n end\n\n if elements.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"elements\"')\n end\n\n if required.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"required\"')\n end\n\n if default.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"default\"')\n end\n\n params = {\n elements: elements,\n required: required,\n default: default,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::AttributeEnum\n )\n end",
"title": ""
},
{
"docid": "dcc177b2012612550b8eeea52e57d111",
"score": "0.5106191",
"text": "def as_enum\n # Should look like:\n # enum attribute_name: [\"one\", \"two\"]\n\n if is_enum?\n if (enum_options = properties[:enum_options]).present?\n enum_options_as_hash = Frontier::HashSingleLineDecorator.new array_as_hash(enum_options)\n \"enum #{name}: {#{enum_options_as_hash}}\"\n else\n raise(ArgumentError, \"No enum_options provided for attribute: #{name}\")\n end\n else\n raise(ArgumentError, \"Attempting to display field #{name} as enum, but is #{type}\")\n end\n end",
"title": ""
},
{
"docid": "7a09e0c90e0709a14b9b262e30c704ec",
"score": "0.50937504",
"text": "def validate_marital_status(val)\n unless @valid_marital_statuses.include?(val)\n raise \"Invalid value: #{val}\"\n end\n end",
"title": ""
},
{
"docid": "7a09e0c90e0709a14b9b262e30c704ec",
"score": "0.50937504",
"text": "def validate_marital_status(val)\n unless @valid_marital_statuses.include?(val)\n raise \"Invalid value: #{val}\"\n end\n end",
"title": ""
},
{
"docid": "9aec55858498c37905bd05d874f4013a",
"score": "0.50840217",
"text": "def enumeration?\n @is_enumeration ||= @xml.xpath('./xs:restriction/xs:enumeration', {'xs' => 'http://www.w3.org/2001/XMLSchema'}).length > 0\n end",
"title": ""
},
{
"docid": "e9ef4781273662f843a0de3cf5619270",
"score": "0.5082524",
"text": "def pa_esigibilita=(pa_esigibilita)\n validator = EnumAttributeValidator.new('String', ['I', 'D', 'S', 'N'])\n unless validator.valid?(pa_esigibilita)\n fail ArgumentError, 'invalid value for \"pa_esigibilita\", must be one of #{validator.allowable_values}.'\n end\n @pa_esigibilita = pa_esigibilita\n end",
"title": ""
},
{
"docid": "1d802e367bf697117a3a55c60eeb6489",
"score": "0.5074987",
"text": "def timeliness_validation_for(attr_names, type)\n super\n attr_names.each { |attr_name| define_timeliness_write_method(attr_name) }\n end",
"title": ""
},
{
"docid": "5656f6d73a1098f99089c6c24ec8d9c0",
"score": "0.50655115",
"text": "def type=(type)\n validator = EnumAttributeValidator.new('String', ['Once', 'Hourly', 'Daily', 'Weekly', 'Monthly', 'Yearly'])\n unless validator.valid?(type)\n fail ArgumentError, 'invalid value for \"type\", must be one of #{validator.allowable_values}.'\n end\n @type = type\n end",
"title": ""
},
{
"docid": "bb0813227909c9a93a20ea4f58c7d324",
"score": "0.5064211",
"text": "def validate_allowed(record)\n unknown = provided(record) - allowed\n\n return if unknown.empty?\n\n record.errors.add(\n options[:attribute],\n \"contains unknown options: #{unknown.join(', ')}\"\n )\n end",
"title": ""
},
{
"docid": "90108605ef4ed6d8dd357504a3d86f54",
"score": "0.505987",
"text": "def valid?\n source_validator = EnumAttributeValidator.new('Integer', [\"1\", \"2\"])\n return false unless source_validator.valid?(@source)\n return true\n end",
"title": ""
},
{
"docid": "57afa6b65a77e5651a5dd7df65e1a85b",
"score": "0.50555235",
"text": "def valid?(value)\n return false if self == Enum\n return true if value.equal?(LAZY_VALUE)\n self.values.include?(value.to_s)\n end",
"title": ""
},
{
"docid": "1010cbb86278818e332e15d7d4bc4c76",
"score": "0.50513357",
"text": "def smee=(smee)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(smee)\n fail ArgumentError, \"invalid value for \\\"smee\\\", must be one of #{validator.allowable_values}.\"\n end\n @smee = smee\n end",
"title": ""
},
{
"docid": "722e6e7f5ce2cd67fab1d88be88866d5",
"score": "0.5044483",
"text": "def allowed_status\n errors.add(:string, 'must be pending, accepted or declined.') unless %w[pending accepted declined].any?(status)\n end",
"title": ""
},
{
"docid": "a2db5fa50322ba3291dd926657f9b0aa",
"score": "0.5041556",
"text": "def define_active_enum_write_method_multiple(attribute, column)\n class_eval <<-DEF\n def #{attribute}=(args)\n self.#{column} = args.map do |arg|\n self.class.active_enum_get_id_for_#{attribute}(arg)\n end\n end\n DEF\n end",
"title": ""
},
{
"docid": "effe91b664b00a6a858ca04d5b14f871",
"score": "0.5036054",
"text": "def valid?\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', [\"alert\", \"notification\"])\n return false unless type_validator.valid?(@type)\n priority_validator = EnumAttributeValidator.new('String', [\"P1\", \"P2\", \"P3\", \"P4\", \"P5\"])\n return false unless priority_validator.valid?(@priority)\n return true\n end",
"title": ""
},
{
"docid": "2ccb0fcc20c4ef57cec863b86b897901",
"score": "0.5031193",
"text": "def has_enums?\n !!eh_params[:has_enums]\n end",
"title": ""
},
{
"docid": "71747f04f529172711346720e6407040",
"score": "0.5023556",
"text": "def type=(type)\n validator = EnumAttributeValidator.new('String', ['active', 'notActive', 'unknown'])\n unless validator.valid?(type)\n fail ArgumentError, %Q'invalid value for \"type\", must be one of #{validator.allowable_values}.'\n end\n @type = type\n end",
"title": ""
},
{
"docid": "64abebe2a7f2c7c8df10faf6872ab0ea",
"score": "0.5019361",
"text": "def level=(level)\n validator = EnumAttributeValidator.new('String', [\"Unknown\", \"Inline\", \"Block\", \"Row\", \"Cell\"])\n if level.to_i == 0\n unless validator.valid?(level)\n raise ArgumentError, \"invalid value for 'level', must be one of #{validator.allowable_values}.\"\n end\n @level = level\n else\n @level = validator.allowable_values[level.to_i]\n end\n end",
"title": ""
},
{
"docid": "08ecd7399d75cb525d1f0248ff26f611",
"score": "0.49934402",
"text": "def mode=(mode)\n validator = EnumAttributeValidator.new('String', [\"default\", \"custom\"])\n unless validator.valid?(mode)\n fail ArgumentError, \"invalid value for 'mode', must be one of #{validator.allowable_values}.\"\n end\n @mode = mode\n end",
"title": ""
},
{
"docid": "d90cfe7e7db391b50ff95a10e3f29df6",
"score": "0.4989093",
"text": "def valid?\n type_validator = EnumAttributeValidator.new('String', ['active', 'notActive', 'unknown'])\n return false unless type_validator.valid?(@type)\n true\n end",
"title": ""
},
{
"docid": "a105bf81c47e159a3ffe3ec67c805125",
"score": "0.49836317",
"text": "def allowed_access_levels\n validator = lambda do |field|\n level = public_send(field) || ENABLED # rubocop:disable GitlabSecurity/PublicSend\n not_allowed = level > ENABLED\n self.errors.add(field, \"cannot have public visibility level\") if not_allowed\n end\n\n (FEATURES - %i(pages)).each {|f| validator.call(\"#{f}_access_level\")}\n end",
"title": ""
},
{
"docid": "bdc594896da6fcb92215fb8b4674b848",
"score": "0.49754748",
"text": "def type=(type)\n validator = EnumAttributeValidator.new('String', [\"Paragraph\", \"Character\", \"Table\", \"List\"])\n if type.to_i == 0\n unless validator.valid?(type)\n raise ArgumentError, \"invalid value for 'type', must be one of #{validator.allowable_values}.\"\n end\n @type = type\n else\n @type = validator.allowable_values[type.to_i]\n end\n end",
"title": ""
},
{
"docid": "db7ec93090129556f97c7773041a5f9e",
"score": "0.49738207",
"text": "def legal_entity_type=(legal_entity_type)\n validator = EnumAttributeValidator.new('String', [\"sole_proprietorship\", \"partnership\", \"privately_owned_company\", \"publicly_owned_company\", \"government_owned_entity\", \"trust\", \"ngo\", \"club_and_society\", \"go\", \"other\", \"financial_institution\", \"mto\"])\n unless validator.valid?(legal_entity_type) || legal_entity_type.empty?\n fail ArgumentError, \"invalid value for \\\"legal_entity_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @legal_entity_type = legal_entity_type\n end",
"title": ""
},
{
"docid": "697794f778b4c83e62037bbf18b45a6d",
"score": "0.49702868",
"text": "def all_attributes_exists_with_enumerations?(attribute_names)\n exists = all_attributes_exists_without_enumerations?(attribute_names)\n exists ||= attribute_names.all? do |name|\n column_methods_hash.include?(name.to_sym) || reflect_on_enumeration(name)\n end\n end",
"title": ""
},
{
"docid": "5550cfd7e462ceb2ad5ac6a8409014e1",
"score": "0.49647367",
"text": "def valid_setters\n methods = ScheduledActivity.instance_methods\n @valid_setters ||= methods.select do |m|\n methods.include?(:\"#{m}=\")\n end\n end",
"title": ""
},
{
"docid": "7bc12c4f0fdd8e72556c0ea19b7d9d88",
"score": "0.49602023",
"text": "def type=(type)\n validator = EnumAttributeValidator.new('String', [\"Weekly\", \"BiWeekly\", \"SemiMonthly\", \"Monthly\"])\n unless validator.valid?(type)\n fail ArgumentError, \"invalid value for 'type', must be one of #{validator.allowable_values}.\"\n end\n @type = type\n end",
"title": ""
},
{
"docid": "7c5cd1575d655ce2d39655732d247985",
"score": "0.4959052",
"text": "def valid?\n return false if @type.nil?\n type_validator = EnumAttributeValidator.new('String', [\"ITEM\", \"CATEGORY\", \"ITEM_VARIATION\", \"TAX\", \"DISCOUNT\", \"MODIFIER_LIST\", \"MODIFIER\"])\n return false unless type_validator.valid?(@type)\n return false if @id.nil?\n return false if @id.to_s.length < 1\n return true\n end",
"title": ""
},
{
"docid": "872faf9c46b19bab793b2856a9998ce7",
"score": "0.49577102",
"text": "def valid?\n return false if @value.nil?\n change_mode_validator = EnumAttributeValidator.new('String', [\"immediate\", \"delayed\"])\n return false unless change_mode_validator.valid?(@change_mode)\n invoicing_type_validator = EnumAttributeValidator.new('String', [\"Immediate\", \"Aggregated\"])\n return false unless invoicing_type_validator.valid?(@invoicing_type)\n return true\n end",
"title": ""
},
{
"docid": "07aba547e1f80fa59ec608437c716765",
"score": "0.49549797",
"text": "def valid?\n type_validator = EnumAttributeValidator.new('String', [\"person\", \"business\"])\n return false unless type_validator.valid?(@type)\n return false if @country.nil?\n return false if @street.nil?\n return false if @postal_code.nil?\n return false if @city.nil?\n return false if @email.nil?\n return false if @ip.nil?\n identification_type_validator = EnumAttributeValidator.new('String', [\"DL\", \"PP\", \"ID\", \"OT\"])\n return false unless identification_type_validator.valid?(@identification_type)\n legal_entity_type_validator = EnumAttributeValidator.new('String', [\"sole_proprietorship\", \"partnership\", \"privately_owned_company\", \"publicly_owned_company\", \"government_owned_entity\", \"trust\", \"ngo\", \"club_and_society\", \"go\", \"other\", \"financial_institution\", \"mto\"])\n return false unless legal_entity_type_validator.valid?(@legal_entity_type)\n nature_of_business_validator = EnumAttributeValidator.new('String', [\"personal\", \"agriculture_and_hunting\", \"forestry\", \"fishing\", \"agricultural_by_products\", \"coal_mining\", \"oil_mining\", \"iron_ore_mining\", \"other_metal_and_diamond_mining\", \"other_mineral_mining\", \"manufacturing_of_food_drink_tobacco\", \"manufacturing_of_textiles_leather_fur_furniture\", \"manufacture_of_wooden_products_furniture\", \"manufacture_of_paper_pulp_allied_products\", \"manufacture_of_chemicals_medical_petroleum_rubber_plastic_products\", \"manufacture_of_pottery_china_glass_stone\", \"manufacture_of_iron_steel_non_ferrous_metals_basic_industries\", \"manufacture_of_metal_products_electrical_and_scientific_engineering\", \"manufacture_of_jewelry_musical_instruments_toys\", \"electricity_gas_and_water\", \"construction\", \"wholesale_trade\", \"retail_trade\", \"catering_incl_hotels\", \"transport_storage\", \"communications\", \"finance_and_holding_companies\", \"insurance\", \"business_services\", \"real_estate_development_investment\", \"central_state_governments\", \"community_services_defence_police_prisons_etc\", \"social_services_education_health_care\", \"personal_services_leisure_services\", \"personal_services_domestic_laundry_repairs\", \"personal_services_embassies_international_organisations\"])\n return false unless nature_of_business_validator.valid?(@nature_of_business)\n return false if @documents.nil?\n gender_validator = EnumAttributeValidator.new('String', [\"M\", \"F\", \"O\"])\n return false unless gender_validator.valid?(@gender)\n true\n end",
"title": ""
},
{
"docid": "ffb7bab889e65bc5ead31cd91f4661e8",
"score": "0.49535498",
"text": "def class_id=(class_id)\n validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n unless validator.valid?(class_id)\n fail ArgumentError, \"invalid value for \\\"class_id\\\", must be one of #{validator.allowable_values}.\"\n end\n @class_id = class_id\n end",
"title": ""
},
{
"docid": "ea85dd52b9b8366fadbfcb7e5d20dc81",
"score": "0.49489576",
"text": "def assert_white_list_setter(clazz, attr, value, whitelist_clazz)\n instance = clazz.new(attr => value)\n assert_kind_of whitelist_clazz, instance.send(attr)\n assert_equal value, instance.send(attr).value\n end",
"title": ""
},
{
"docid": "2f29ce80bdde4039c3e6e09e7065b758",
"score": "0.49489233",
"text": "def allow_value_matcher; end",
"title": ""
},
{
"docid": "54a6e53067c5137493d22cfc311acff1",
"score": "0.4943718",
"text": "def raise_invalid(value)\n if value.is_a?(Numeric)\n raise EnumError, \"#{value.inspect} is out of bounds of #{self.class.name}\"\n else\n raise EnumError, \"#{value.inspect} is not valid for #{self.class.name}\"\n end\n end",
"title": ""
},
{
"docid": "3f83c6bb12252459c8cab8f157ff4b40",
"score": "0.494183",
"text": "def valid_parameter_for_conditional_formatting\n [\n :type,\n :format,\n :criteria,\n :value,\n :minimum,\n :maximum,\n :min_type,\n :mid_type,\n :max_type,\n :min_value,\n :mid_value,\n :max_value,\n :min_color,\n :mid_color,\n :max_color,\n :bar_color\n ]\n end",
"title": ""
},
{
"docid": "537db0e6878268286aa25feacbc118b1",
"score": "0.494042",
"text": "def valid_parameter_for_conditional_formatting\n %i[\n type\n format\n criteria\n value\n minimum\n maximum\n stop_if_true\n min_type\n mid_type\n max_type\n min_value\n mid_value\n max_value\n min_color\n mid_color\n max_color\n bar_color\n bar_negative_color\n bar_negative_color_same\n bar_solid\n bar_border_color\n bar_negative_border_color\n bar_negative_border_color_same\n bar_no_border\n bar_direction\n bar_axis_position\n bar_axis_color\n bar_only\n icon_style\n reverse_icons\n icons_only\n icons\n data_bar_2010\n ]\n end",
"title": ""
},
{
"docid": "feba2e0ba2012033bbc14d7e55bbe5b2",
"score": "0.4935984",
"text": "def oil_types=(vals = [])\n if vals.is_a?(Array)\n OilTypes.collect {|t| t[1]}.each do |type|\n if vals.member?(type)\n send(type+\"=\",true)\n else\n send(type+\"=\",false)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "349cdb080e936568e6d7b58ab17c53fc",
"score": "0.49353147",
"text": "def validate_enum_name(name)\n name.gsub(/[-\\s]/, \"_\").sub(/^\\d/, '_\\0')\n end",
"title": ""
},
{
"docid": "a44f0cac9e04b7efdbfa6a1a6f8e6f5e",
"score": "0.4934332",
"text": "def sr_iov=(sr_iov)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(sr_iov)\n fail ArgumentError, \"invalid value for \\\"sr_iov\\\", must be one of #{validator.allowable_values}.\"\n end\n @sr_iov = sr_iov\n end",
"title": ""
},
{
"docid": "d348bda62f7d1c5da3aef3ebdc5d1d21",
"score": "0.49269903",
"text": "def appearance=(appearance)\n validator = EnumAttributeValidator.new('String', [\"Default\", \"BoundingBox\", \"Tags\", \"Hidden\"])\n if appearance.to_i == 0\n unless validator.valid?(appearance)\n raise ArgumentError, \"invalid value for 'appearance', must be one of #{validator.allowable_values}.\"\n end\n @appearance = appearance\n else\n @appearance = validator.allowable_values[appearance.to_i]\n end\n end",
"title": ""
},
{
"docid": "80f642d84aedd2cb6e23aad692aa12b6",
"score": "0.49202663",
"text": "def validate_entities!(enum)\n unless enum.respond_to?(:each)\n raise Errors::InternalError, 'Validation cannot be performed on non-enumerable objects'\n end\n enum.each(&:valid!)\n enum\n rescue ::Occi::Core::Errors::MandatoryArgumentError, ::Occi::Core::Errors::ValidationError => ex\n logger.error \"Validation failed: #{ex.class} #{ex.message}\"\n raise Errors::ValidationError, ex.message\n end",
"title": ""
},
{
"docid": "9d97b70affd13483396e64e3169601de",
"score": "0.49195725",
"text": "def attr_bool_writer *symbols\n attr_writer *symbols\n end",
"title": ""
},
{
"docid": "83bb196aae84618223a833a2f4414f54",
"score": "0.49171844",
"text": "def valid?\n frequency_validator = EnumAttributeValidator.new('String', [\"daily\", \"weekly\", \"monthly\", \"quarterly\", \"yearly\"])\n return false unless frequency_validator.valid?(@frequency)\n return true\n end",
"title": ""
},
{
"docid": "289cec42e6e5444bf080c96454e04e2c",
"score": "0.49135497",
"text": "def valid_attributes\n {\n name: \"Unlimited\",\n award_title_name: \"10k Unlimited\",\n scoring_class: \"Freestyle\"\n }\n end",
"title": ""
},
{
"docid": "9bac31f737fd3a5c6f8fd0d665119684",
"score": "0.49132174",
"text": "def should_allow_values(options)\n klass = self.name.gsub(/Test$/, '').constantize\n\n context \"#{klass}\" do\n options.each_pair do |attribute, values|\n [*values].each do |value|\n display_value = value.class == NilClass ? \"nil\" : \"\\\"#{value}\\\"\"\n \n should \"allow #{attribute} to be #{display_value}\" do\n instance = get_instance_of(klass)\n instance.send(\"#{attribute}=\", value)\n assert_nil instance.errors.on(attribute), \n \"Expected no errors when #{attribute} is set to #{display_value}, \n instead found error \\\"#{instance.errors.on(attribute)}\\\".\"\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "73b095cb85d0ab2e93546a1b1f0f70cd",
"score": "0.4910008",
"text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"offsetInDays\", @offset_in_days)\n writer.write_enum_value(\"timeBasedAttribute\", @time_based_attribute)\n end",
"title": ""
},
{
"docid": "ed60861731f7b9c328b984f99b6deb78",
"score": "0.49098906",
"text": "def gr_append_check? obj\n return false if obj.class!=self.class\n return false if !respond_to(\"each\")\n myEnum=to_enum\n objEnum=obj.to_enum\n while true\n begin\n myEle=myEnum.next\n rescue\n return true\n end\n begin\n objEle=objEnum.next\n rescue\n return false\n end\n return false if myEle!=objEle\n end\n return true\n end",
"title": ""
},
{
"docid": "7b1d15949960dcdeaf4849ddcf1a0813",
"score": "0.49096495",
"text": "def validate( value )\n raise ReadOnlyException.new(self) unless settable?\n @definition.type.validate(value)\n end",
"title": ""
},
{
"docid": "1b075bdb9fe5094da68383aeaef930e8",
"score": "0.49090025",
"text": "def valid?\n only_display_validator = EnumAttributeValidator.new('String', [\"DoNotDisplay\", \"Closed30Days\", \"Closed60Days\", \"Closed90Days\", \"Closed120Days\", \"AllClosed\"])\n return false unless only_display_validator.valid?(@only_display)\n return true\n end",
"title": ""
},
{
"docid": "5deb2669b8e93acd0cc40a766dd6d010",
"score": "0.49080157",
"text": "def patrol_scrub=(patrol_scrub)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"disabled\", \"Enable at End of POST\", \"enabled\"])\n unless validator.valid?(patrol_scrub)\n fail ArgumentError, \"invalid value for \\\"patrol_scrub\\\", must be one of #{validator.allowable_values}.\"\n end\n @patrol_scrub = patrol_scrub\n end",
"title": ""
},
{
"docid": "8353bceba43a8998eaa26e35462c05d7",
"score": "0.49024847",
"text": "def _class=(_class)\n validator = EnumAttributeValidator.new('String', [\"Other\", \"Absolute\", \"Possessory\", \"Qualified\", \"Good\"])\n unless validator.valid?(_class)\n fail ArgumentError, \"invalid value for '_class', must be one of #{validator.allowable_values}.\"\n end\n @_class = _class\n end",
"title": ""
},
{
"docid": "55fd3d1aaa61add7608c52634c60c28a",
"score": "0.49014568",
"text": "def valid?\n return false if !super\n quartile_method_validator = EnumAttributeValidator.new('String', ['Exclusive', 'Inclusive'])\n return false unless quartile_method_validator.valid?(@quartile_method)\n true\n end",
"title": ""
}
] |
4dac0b00fc2d07dd5587eb323f2360db | GET /collections/new GET /collections/new.xml | [
{
"docid": "4bd6d0e6423dd8369debcb485d3c1871",
"score": "0.6786406",
"text": "def new\n if !current_user.is_editor\n redirect_to ('/')\n return\n end\n\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.77337784",
"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.77337784",
"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.77337784",
"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": "8092bea80b96b6967eb72ff2c9bc6b46",
"score": "0.76988626",
"text": "def new\n @collection_name = CollectionName.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection_name }\n end\n end",
"title": ""
},
{
"docid": "f8861f9f4489a51f18fc2c7414dcee1a",
"score": "0.75757426",
"text": "def new\n # @collection is created in before_filter\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end",
"title": ""
},
{
"docid": "d2babd32fceba49dc92e0e411c9aad59",
"score": "0.7511748",
"text": "def new\n @collectionnode = Collectionnode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collectionnode }\n end\n end",
"title": ""
},
{
"docid": "360d6bc2926b75154ae9636f9ee14cd4",
"score": "0.73712987",
"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": "72704808567a3660b7305d8790efdac1",
"score": "0.7366151",
"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": "f48abbbb49b7d755f623f498d6921a7a",
"score": "0.73368454",
"text": "def new\n\t\t@collection = Collection.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @collection }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "be60113a9d4e1e319ec043bb11b13448",
"score": "0.7235265",
"text": "def new\n @collection = Collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection }\n end\n end",
"title": ""
},
{
"docid": "be60113a9d4e1e319ec043bb11b13448",
"score": "0.7235236",
"text": "def new\n @collection = Collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection }\n end\n end",
"title": ""
},
{
"docid": "c49a460b9c59d410ba97781ba5542ee7",
"score": "0.71685433",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collections_user }\n end\n end",
"title": ""
},
{
"docid": "7e302aec6ab6cab296255e2b2af3bf13",
"score": "0.715127",
"text": "def create\n # @collection is created in before_filter\n\n respond_to do |format|\n if @collection.save\n flash[:notice] = 'Collection was successfully created.'\n format.html { redirect_to(collections_path) }\n format.xml { render :xml => @collection, :status => :created, :location => @collection }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @collection.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f3ad78e1de822e0712ba16b0b3fe5b28",
"score": "0.7094284",
"text": "def new\n @collection = Collection.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection }\n end\n end",
"title": ""
},
{
"docid": "567a6e53f86b218db94493fac639f99a",
"score": "0.7005322",
"text": "def create\n @collection = Collection.new(params[:collection])\n\n respond_to do |format|\n if @collection.save\n flash[:notice] = 'Collection was successfully created.'\n format.html { redirect_to(admin_collection_path(@collection)) }\n format.xml { render :xml => @collection, :status => :created, :location => @collection }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @collection.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "091cc98491c81a78e0140885a81efebe",
"score": "0.6978686",
"text": "def new\n @my_collection_detail = MyCollectionDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @my_collection_detail }\n end\n end",
"title": ""
},
{
"docid": "f366054377689d02cbff195670185288",
"score": "0.692333",
"text": "def new\n @fabric_collection = FabricCollection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fabric_collection }\n end\n end",
"title": ""
},
{
"docid": "9d5d0535e2685ba2646ebd745471715b",
"score": "0.68959737",
"text": "def new\r\n @collection = Collection.new\r\n \r\n @collection.items.build\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @collection }\r\n end\r\n end",
"title": ""
},
{
"docid": "138a3a21d2df498d578cba9705c6520b",
"score": "0.6862517",
"text": "def new\n @link_collection = LinkCollection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @link_collection }\n end\n end",
"title": ""
},
{
"docid": "bea24dd34ef053dc669cd001063717e1",
"score": "0.685129",
"text": "def new\n @archive = Archive.find( params[:archive_id] )\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": "d7de80ea173e7eac3fbea9b95082d08e",
"score": "0.6841422",
"text": "def new\n @az_collection_template = AzCollectionTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @az_collection_template }\n end\n end",
"title": ""
},
{
"docid": "9263426721acba6fed088970c9756ee8",
"score": "0.6764831",
"text": "def create\n @collection = Collection.new(params[:collection])\n\n respond_to do |format|\n if @collection.save && @collection.update_relations(params[:collection])\n format.html { redirect_to(@collection, :notice => 'Collection was successfully created.') }\n format.xml { render :xml => @collection, :status => :created, :location => @collection }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @collection.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f4a65de2ebca7556c3b0ad32d2a4d92c",
"score": "0.6760552",
"text": "def new\n @events_collection = EventsCollection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @events_collection }\n end\n end",
"title": ""
},
{
"docid": "91f1cdd24426f7d3698aa8cbe588c051",
"score": "0.6733758",
"text": "def new\n @collection = @book_series.collections.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection }\n end\n end",
"title": ""
},
{
"docid": "1c0019be1a304646ad54300295667545",
"score": "0.6733254",
"text": "def create\n\t\t@collection = Collection.new(params[:collection])\n\n\t\trespond_to do |format|\n\t\t\tif @collection.save\n\t\t\t\tformat.html { redirect_to(admin_collection_url(@collection), :notice => 'Collection was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @collection, :status => :created, :location => @collection }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @collection.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "b36c6189370cde3fdca76ddf6dae50f1",
"score": "0.6684768",
"text": "def create\n @my_collection = MyCollection.new(params[:my_collection])\n\n respond_to do |format|\n if @my_collection.save\n format.html { redirect_to(@my_collection, :notice => 'MyCollection was successfully created.') }\n format.xml { render :xml => @my_collection, :status => :created, :location => @my_collection }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @my_collection.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bc3957b93bf2b53acb343d53a1d40e0b",
"score": "0.6675281",
"text": "def create\n @collection = Collection.new(@params)\n puts @collection.inspect\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, notice: 'Collection was successfully created.' }\n format.json { render action: 'show', status: :created, location: @collection }\n else\n format.html { render action: 'new' }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bbbe69805315a18ad2c37d6908f354d5",
"score": "0.66652036",
"text": "def new\n @collection = current_user.own_collections.new\n @collection.s_date = Time.now.strftime(\"%Y-%m-%d\")\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection }\n end\n end",
"title": ""
},
{
"docid": "37c81bfd51ed75d30ca2281764c5fca5",
"score": "0.66339105",
"text": "def new\n @content = current_user.collections.find(params[:collection_id]).contents.new(collection_id: params[:collection_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end",
"title": ""
},
{
"docid": "131180d9bf4390f15ae2a0718327c74d",
"score": "0.6615324",
"text": "def new\n @collect = Collect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collect }\n end\n end",
"title": ""
},
{
"docid": "d4fa6828743e22184cd809c2a4ff1ad6",
"score": "0.66116756",
"text": "def create\n @collection = Collection.new(params[:collection])\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to collections_path, notice: 'Collection was successfully created.' }\n format.json { render json: @collection, status: :created, location: @collection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0279ab3320c11375810901fae0010a4f",
"score": "0.6608375",
"text": "def new\n @book_collection = BookCollection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_collection }\n end\n end",
"title": ""
},
{
"docid": "626b0c825a6177bf513ca4bffc4e17b0",
"score": "0.6583994",
"text": "def create\r\n \r\n @collection = Collection.new(params[:collection])\r\n\r\n respond_to do |format|\r\n if @collection.save\r\n format.html { redirect_to @collection, notice: 'Collection was successfully created.' }\r\n format.json { render json: @collection, status: :created, location: @collection }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @collection.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "fdaa7e9a2cb73d65b67fc169bf29bb3f",
"score": "0.6552222",
"text": "def create\n @collection = Collection.new(collection_params)\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to collections_path, notice: 'Collection was successfully created.' }\n format.json { render action: 'show', status: :created, location: @collection }\n else\n format.html { render action: 'new' }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5a55b848245a2a7ef79c19389eeb88dd",
"score": "0.65478486",
"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": "db7a2e7e8626eae02debed9bc3fcc77a",
"score": "0.6544934",
"text": "def new\n @collection_content = CollectionContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection_content }\n end\n end",
"title": ""
},
{
"docid": "97d3e108e4eb967fbdaf4907e87396dd",
"score": "0.65337",
"text": "def create\n @collection = Collection.new(collection_params)\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, notice: 'Collection was successfully created.' }\n format.json { render action: 'show', status: :created, collection: @collection }\n else\n format.html { render action: 'new' }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6c9ede00e09719de29aad709ec8ce09d",
"score": "0.6526832",
"text": "def new\n @collection_items_assoc = CollectionItemsAssoc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection_items_assoc }\n end\n end",
"title": ""
},
{
"docid": "30190aa5002fc777f544933995d5bcda",
"score": "0.65215755",
"text": "def new\n @collection = Collection.new\n @project = Project.find params[:project_id]\n @collection.project = @project\n @collection.client_id = @project.client_id\n @collection.space = current_space\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection }\n end\n end",
"title": ""
},
{
"docid": "94ceaaf9250cdc3d062aeb18bbab1a52",
"score": "0.65088224",
"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": "1b4febdf0f45972adb84cd6f74ea5527",
"score": "0.65047634",
"text": "def create\n @collection_name = CollectionName.new(params[:collection_name])\n\n respond_to do |format|\n if @collection_name.save\n format.html { redirect_to(@collection_name, :notice => 'Collection name was successfully created.') }\n format.xml { render :xml => @collection_name, :status => :created, :location => @collection_name }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @collection_name.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d09c99d02334f25ff4238e34dc57315d",
"score": "0.6486005",
"text": "def new\n @category = Category.new\n respond_to do |format|\n format.html { create }\n format.json { render :json => @collection }\n end\n end",
"title": ""
},
{
"docid": "c17ef6df0e91c9dd46325e69f3c9b770",
"score": "0.648044",
"text": "def new\n # XXXFIX P2: Want to have access to new items per category, also with RSS feed\n @new_products = Product.find_new_for_listing()\n options = {\n :feed => {:title => \"#{SmartFlix::Application::SITE_NAME} new titles\", :link => url_for(:format => nil)},\n :item => {\n :title => :listing_name,\n :pub_date => :date_added,\n :link => lambda { |p| url_for(:action => p.action, :id => p.id) }\n }\n }\n end",
"title": ""
},
{
"docid": "85bd72fc186432c1811a6e46336c9e83",
"score": "0.6477495",
"text": "def new\n @collection_page = @collection.collection_pages.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection_page }\n end\n end",
"title": ""
},
{
"docid": "f4169a47ddc05818f58423b18aac3e25",
"score": "0.6453306",
"text": "def create\n @collectionnode = Collectionnode.new(params[:collectionnode])\n\n respond_to do |format|\n if @collectionnode.save\n flash[:notice] = 'Collectionnode was successfully created.'\n format.html { redirect_to(@collectionnode) }\n format.xml { render :xml => @collectionnode, :status => :created, :location => @collectionnode }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @collectionnode.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "571ae8bec656e39857cb90064e2c4192",
"score": "0.64454955",
"text": "def new\n @catalogue = Catalogue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalogue }\n end\n end",
"title": ""
},
{
"docid": "cb90c38690159b2374627d779d72cd2f",
"score": "0.64157987",
"text": "def create\n if !current_user.is_editor\n redirect_to ('/')\n return\n end\n\n @collection = Collection.new(params[:collection])\n\n respond_to do |format|\n if @collection.save\n flash[:notice] = 'Collection was successfully created.'\n format.html { redirect_to(@collection) }\n format.xml { render :xml => @collection, :status => :created, :location => @collection }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @collection.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "41433d74e36719684775ad2d50c3eabe",
"score": "0.6402363",
"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": "e6d50e5c9c7f798c9e4363424640d480",
"score": "0.6388522",
"text": "def new_collection(name)\n Collection.new_collection name\n end",
"title": ""
},
{
"docid": "ee38fb6c252add3f6dd2eeec97e33feb",
"score": "0.6388275",
"text": "def create\n @collection = Admin::Collection.new(collection_params)\n\n if @collection.save\n render json: @collection, status: :created#, location: @collection\n else\n render json: @collection.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "831c7d32e0400c3242a568f8d0b56fb6",
"score": "0.63803744",
"text": "def new\n @collector = Collector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collector }\n end\n end",
"title": ""
},
{
"docid": "0ba707c5683fac93c535545c609922aa",
"score": "0.6355039",
"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": "00406ba645c1dd4e2923f66d10fd3fb5",
"score": "0.633793",
"text": "def create \n\t\tcreate! { collection_url } \n end",
"title": ""
},
{
"docid": "c8ec38933a6992e201376388e42c2252",
"score": "0.6332779",
"text": "def create\n @collection = @current_user.collections.new(collection_params)\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to collection_documents_path(@collection), notice: 'The collection was successfully created.' }\n format.json { render :show, status: :created, location: @collection }\n else\n format.html { render :new }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9979ad8fb59d9a6887a3a371643131cc",
"score": "0.63142973",
"text": "def create\n @collection = Collection.new(params[:collection])\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to user_collections_path(@collection.user_id), notice: 'Collection was successfully created.' }\n format.json { render json: @collection, status: :created, location: @collection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2992c4aba94cd7b7882e41fcb539a8a3",
"score": "0.6293876",
"text": "def create\n @collection = current_empresa.collections.build(collection_params)\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, notice: 'Coleção criada com sucesso.' }\n format.json { render :show, status: :created, location: @collection }\n else\n format.html { render :new }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "93850d9db01142c00de91a3a72bc621a",
"score": "0.62923837",
"text": "def new\n @collection = Collection.new\n @books = Book.search(params[:q])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection }\n end\n end",
"title": ""
},
{
"docid": "f9e3bda28f1ac73b798c77a837306ec7",
"score": "0.6291483",
"text": "def new\n @collection_product = CollectionProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection_product }\n end\n end",
"title": ""
},
{
"docid": "22694a7378009b8ec5cd6763c801feb6",
"score": "0.6288588",
"text": "def new\n @categories = Category.find(:all)\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"title": ""
},
{
"docid": "0bb1a9a1b44b86d8aff7d61930d8f97b",
"score": "0.6288004",
"text": "def new \n\t\t@voc = Voc.new \n\t\tdata = get_select_data\n\t\t@grms = data.at(0)\n\t\t@cats = data.at(1)\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @voc }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "a121c5a9bf593d04ae642680c093ac24",
"score": "0.6285124",
"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": "b155fc03c8764b79646f226a69db67f7",
"score": "0.6276134",
"text": "def new\n @collection_creator_relationship = CollectionCreatorRelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection_creator_relationship }\n end\n end",
"title": ""
},
{
"docid": "6a2170fca82ff4febb8851faae0fc75b",
"score": "0.627197",
"text": "def create\n item = Item.new()\n\n item.collection = Collection.find(create_params[:collection])\n set_item_attributes(item, create_params)\n\n respond_with item, location: '', root: :item\n end",
"title": ""
},
{
"docid": "d8ea74214e44961b9d0ea299ddf00ae2",
"score": "0.6266383",
"text": "def new\n @pool = Pool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pool }\n end\n end",
"title": ""
},
{
"docid": "69f371f21f1d6bb4461cd19d6d38281a",
"score": "0.625856",
"text": "def new\n if session[:user_id]\n @collection = Collection.new\n else\n flash[:error] = 'You are not authorized to create a new collection.'\n redirect_to collections_path\n end\n end",
"title": ""
},
{
"docid": "98b9e3f8abe14223cbdc372b0c8b6f3c",
"score": "0.62521315",
"text": "def create\n @my_collection_detail = MyCollectionDetail.new(params[:my_collection_detail])\n\n respond_to do |format|\n if @my_collection_detail.save\n format.html { redirect_to(my_collections_url, :notice => 'MyCollectionDetail was successfully created.') }\n format.xml { head :ok }\n# format.html { redirect_to(@my_collection_detail, :notice => 'MyCollectionDetail was successfully created.') }\n# format.xml { render :xml => @my_collection_detail, :status => :created, :location => @my_collection_detail }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @my_collection_detail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2dbcd6b474d402429bcdb8c7859d5c20",
"score": "0.62334377",
"text": "def create\n create! do |format|\n format.html { redirect_to collection_url }\n end\n end",
"title": ""
},
{
"docid": "1572043787fb1ce6cc13d4a754584bc7",
"score": "0.62239045",
"text": "def new_rest\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"title": ""
},
{
"docid": "6f118fd2c50d93379c70a66e9180a8e5",
"score": "0.62221754",
"text": "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @catalog }\n end\n end",
"title": ""
},
{
"docid": "6f118fd2c50d93379c70a66e9180a8e5",
"score": "0.62221754",
"text": "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @catalog }\n end\n end",
"title": ""
},
{
"docid": "3c6fea231b17235aa5d5be1212d6a8cc",
"score": "0.6221612",
"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": "b47d70607489846a54f78f2c71487d2f",
"score": "0.6215385",
"text": "def new\n @clicks = Click.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clicks }\n end\n end",
"title": ""
},
{
"docid": "ae3a3f04e5554c6926235d27f2c1c80c",
"score": "0.62138146",
"text": "def new\n @add = Add.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @add }\n end\n end",
"title": ""
},
{
"docid": "b9db97e401c689fe0cb54115549b5667",
"score": "0.62118876",
"text": "def create\n c= Compare.find(params[:compare])\n c.collections << Collection.new(collection_params)\n @collection = c.collections.last\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to [@collection.compare.site,@collection], notice: 'Collection was successfully created.' }\n format.json { render :show, status: :created, location: @collection }\n else\n format.html { render :new }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d364e92db1692a7f0e8dc70d5b0079ea",
"score": "0.62071943",
"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": "e62586e601ab0025830474ea02aa70e6",
"score": "0.6196614",
"text": "def new\n @life_catalog = LifeCatalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @life_catalog }\n end\n end",
"title": ""
},
{
"docid": "cf634a7a3f3bd85288dd764b756ffc75",
"score": "0.6181",
"text": "def create\n collection = Collection.find(params[:collection_id])\n p collection\n p \"8\" * 25\n tag = collection.tags.new(name: params[:name])\n \n if tag.save\n p tag\n p tag.collections\n render json: tag\n else\n render(status 404)\n end\n end",
"title": ""
},
{
"docid": "eb5d7ce0de94a0fca249fc33d4dec1eb",
"score": "0.6172024",
"text": "def create\n @collection_resource = CollectionResource.new collection_resource_params\n @collection_resource.collection = @collection\n\n respond_to do |format|\n if @collection_resource.save\n format.html do\n redirect_to collection_collection_resource_path(@collection,\n @collection_resource),\n notice: I18n.t('meta.defaults.messages.success.created',\n entity: 'Collection Resource')\n end\n else\n format.html { render :new }\n end\n end\n end",
"title": ""
},
{
"docid": "2f8b0a02548ca38dc9310b51cd5b2859",
"score": "0.61653966",
"text": "def new\n @catalog_item = CatalogItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog_item }\n end\n end",
"title": ""
},
{
"docid": "c0e71008f8a497dd20a6a067aadcaefb",
"score": "0.6151003",
"text": "def new\n @xmlstore = Xmlstore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @xmlstore }\n end\n end",
"title": ""
},
{
"docid": "cd37aa5fe27e5b6a566d1e0a8eb1282d",
"score": "0.61480814",
"text": "def create\n # TODO: impl\n collection = Occi::Collection.new\n respond_with(collection, status: 501)\n end",
"title": ""
},
{
"docid": "cd37aa5fe27e5b6a566d1e0a8eb1282d",
"score": "0.61480814",
"text": "def create\n # TODO: impl\n collection = Occi::Collection.new\n respond_with(collection, status: 501)\n end",
"title": ""
},
{
"docid": "05ddae4620fc03686e34446885ffce30",
"score": "0.614044",
"text": "def new\n @notecollection = Notecollection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notecollection }\n end\n end",
"title": ""
},
{
"docid": "f853b2ff1d33fa7fc0249ef68cca3be8",
"score": "0.6139617",
"text": "def new\n @container = Container.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @container }\n end\n end",
"title": ""
},
{
"docid": "6dcf5af5a79eacb9ec3366f33c181424",
"score": "0.6135258",
"text": "def new\n @verb = Verb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @verb }\n end\n end",
"title": ""
},
{
"docid": "6dcf5af5a79eacb9ec3366f33c181424",
"score": "0.6135258",
"text": "def new\n @verb = Verb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @verb }\n end\n end",
"title": ""
},
{
"docid": "9389eb13c510560bf2bd9537f31a628f",
"score": "0.6133855",
"text": "def new\n @cal_event_cat = CalEventCat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cal_event_cat }\n end\n end",
"title": ""
},
{
"docid": "eaf7c079c97688813129e7d4a515be0c",
"score": "0.6132129",
"text": "def new\n @materials_collection = MaterialsCollection.new\n respond_to do |format|\n format.html # new.html.haml\n format.json { render json: @materials_collection }\n end\n end",
"title": ""
},
{
"docid": "87eff216cdb11dc4c494c21fcc575949",
"score": "0.6125847",
"text": "def create\n @collection = Collection.new(collection_params)\n @collection.user = current_user\n\n respond_to do |format|\n if @collection.save\n format.html { redirect_to collections_path, notice: 'Collection was successfully created.' }\n format.json { render :index, status: :created, location: @collection }\n else\n format.html { render :new }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e284720809fd9693be4160c34e056810",
"score": "0.6119088",
"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": "91f6cb7da866b604b00c9ac68b60e0ef",
"score": "0.61146003",
"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": "1fc613ead1b26b43bc5e6a286dfe4e7a",
"score": "0.6112234",
"text": "def create\n @collection = Collection.new(collection_params)\n\n respond_to do |format|\n if @collection.save\n record_activity(@collection)\n format.html {redirect_to admin_collection_path(@collection), notice: 'Коллекция была успешно добавлена.'}\n format.json {render :show, status: :created, location: @collection}\n else\n format.html {render :new}\n format.json {render json: @collection.errors, status: :unprocessable_entity}\n end\n end\n end",
"title": ""
},
{
"docid": "b5881a690fdab76a37b462d41588be24",
"score": "0.6111319",
"text": "def new\n @document = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document }\n end\n end",
"title": ""
},
{
"docid": "093eda69dbd711658046a3f12435a663",
"score": "0.61047226",
"text": "def new\n @collection_centers_charge = CollectionCentersCharge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection_centers_charge }\n end\n end",
"title": ""
},
{
"docid": "21212c7a280b41f8a7f565d861b6bac3",
"score": "0.61029",
"text": "def create\n @events_collection = EventsCollection.new(params[:events_collection])\n\n respond_to do |format|\n if @events_collection.save\n format.html { redirect_to @events_collection, notice: 'Events collection was successfully created.' }\n format.json { render json: @events_collection, status: :created, location: @events_collection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @events_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1080ee712cd174c5440b5843d66c31e1",
"score": "0.6097559",
"text": "def new\n @recent = Recent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recent }\n end\n end",
"title": ""
},
{
"docid": "7b689672fb051affca32a268fdcb4736",
"score": "0.60953283",
"text": "def new\n\tuuid = SecureRandom.uuid\n\t@new_url = searches_url + \"/\" + uuid # creates http://localhost/search/123-34552-adsfrjha-234\n\tresponse.set_header(\"Location\", @new_url)\n respond_to do |format|\n format.html { render :new, status: 201 }\n format.json { render :new, status: 201 }\n format.jsonld { render :new, formats: :json, status: 201 }\n end\n\t\n end",
"title": ""
},
{
"docid": "5da16b2c91298b65822f602999d1754d",
"score": "0.6094175",
"text": "def new_stories\n get('/newstories.json')\n end",
"title": ""
},
{
"docid": "423e97710f0399a64601282000746357",
"score": "0.6092637",
"text": "def create\n @collection = Collection.new(allowed_params)\n if @collection.save\n redirect_to @collection\n else\n render 'new'\n end\n end",
"title": ""
},
{
"docid": "de3c1804874114cd978cccdb2064edf5",
"score": "0.60909057",
"text": "def new\n @catalogs_event_type = Catalogs::EventType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalogs_event_type }\n end\n end",
"title": ""
}
] |
b65029a3e5e708269f8b6ae4d0328803 | GET /ciclos/1 GET /ciclos/1.xml | [
{
"docid": "338731e69bb49d9cd6c76976bfe9b047",
"score": "0.5997165",
"text": "def show\n @ciclo = Ciclo.find(params[:id])\n @tab = :recursos\n @nav = @ciclo\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ciclo }\n end\n end",
"title": ""
}
] | [
{
"docid": "5dee9270c0db382a1a71cd1c05a49094",
"score": "0.65111655",
"text": "def index\n @convenios = Convenio.where(:clinica_id => session[:clinica_id])\n respond_to do |format|\n format.html\n format.xml {render :xml => @convenios}\n format.json {render :json => @convenios}\n end\n end",
"title": ""
},
{
"docid": "89be0c55fedea36b7adb47d6c104e576",
"score": "0.65095085",
"text": "def show\n @coasilicon = Coasilicon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @coasilicon }\n end\n end",
"title": ""
},
{
"docid": "b9e4a0d23e92422d7841805be8496a60",
"score": "0.64738375",
"text": "def show\n @contato_interno = ContatoInterno.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contato_interno }\n end\n end",
"title": ""
},
{
"docid": "8274c194073516e4cab96a9ce2f6ebff",
"score": "0.6459842",
"text": "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comic }\n end\n end",
"title": ""
},
{
"docid": "e34c8c75feb8cbd75364f31b23fb15bc",
"score": "0.64527947",
"text": "def consultar\n @curso = Curso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @curso }\n end\n end",
"title": ""
},
{
"docid": "3d748badb25a04365a0a80d776c72b1e",
"score": "0.6440095",
"text": "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @alumnos_ciclos }\n end\n end",
"title": ""
},
{
"docid": "85c7eb312356f4b0d53e0f90e44d1723",
"score": "0.64381343",
"text": "def index\n @criancas = Crianca.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @criancas }\n end\n end",
"title": ""
},
{
"docid": "2cb5b3d21b154432b8797843cff47d33",
"score": "0.64122236",
"text": "def show\n @censo = Censo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @censo }\n end\n end",
"title": ""
},
{
"docid": "0d5d21d0d3865390d1fb3853ca5ebe7d",
"score": "0.63857687",
"text": "def show\n @concurso = Concurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @concurso }\n end\n end",
"title": ""
},
{
"docid": "7fc20cc36588ff2c07a0be10583feb40",
"score": "0.63443625",
"text": "def show\n @coleccion = Coleccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @coleccion }\n end\n end",
"title": ""
},
{
"docid": "02ff51ea6c1f2e121cf526cf96a0fde7",
"score": "0.6320218",
"text": "def index\n @ciclos = Ciclo.find(:all)\n @tab = :recursos\n @nav = :ciclos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ciclos }\n end\n end",
"title": ""
},
{
"docid": "25fb4f4d80a5d9e69ddc01cdc1c1f244",
"score": "0.6308778",
"text": "def show\n @calcmecanico = Calcmecanico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calcmecanico }\n end\n end",
"title": ""
},
{
"docid": "5fd6d2bf4ef7c9dfe3a4ac8afee442e2",
"score": "0.6285278",
"text": "def get\n @xml = @paths.map { |path|\n puts \"GET\\t#{@host + path}\"\n RestClient.get(@host + path) { |response, request, result|\n puts \"RESPONSE #{response.code}\"\n response.body\n }\n }.map { |response|\n Nokogiri::XML(response).xpath(\"/*\").to_s\n }\n self\n end",
"title": ""
},
{
"docid": "5036f674213c7aba8e8e12c541f81e91",
"score": "0.62590003",
"text": "def show\n @curso = Curso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @curso }\n end\n end",
"title": ""
},
{
"docid": "7308fd9b8ad13c669d30a7d30a3e9f3c",
"score": "0.6254386",
"text": "def show\n @comic_request = ComicRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comic_request }\n end\n end",
"title": ""
},
{
"docid": "ad9ce7644b240a2f609e4aa6f319b212",
"score": "0.6246159",
"text": "def show\n @serie_cronologica = SerieCronologica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @serie_cronologica }\n end\n end",
"title": ""
},
{
"docid": "f45689fc76a4ddfd5976403ab5f02701",
"score": "0.62382823",
"text": "def show\n @calle = Calle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calle }\n end\n end",
"title": ""
},
{
"docid": "6cccd9cb3da498373cb4fce66a66dd3d",
"score": "0.6224646",
"text": "def show\n @servico = Servico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @servico }\n end\n end",
"title": ""
},
{
"docid": "21d6eae31bf57f65862e268c5229f7d5",
"score": "0.6219957",
"text": "def index\n @convidados = Convidado.find_all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @convidados }\n end\n end",
"title": ""
},
{
"docid": "7444aa25f5eb1bfebdca91fa393fcc84",
"score": "0.6218633",
"text": "def show\n @carrinho = Carrinho.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @carrinho }\n end\n end",
"title": ""
},
{
"docid": "45265ba73f1c7e43f0fccbe7576a80f0",
"score": "0.62172437",
"text": "def index\n cadena = getactividades(params[:id].to_i)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => cadena }\n end\n end",
"title": ""
},
{
"docid": "509eeeb7137714aa02a0bbefe5c4c52c",
"score": "0.62031114",
"text": "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @alumno_ciclo }\n end\n end",
"title": ""
},
{
"docid": "4325fe17243a001ff69ea6a7d4947724",
"score": "0.6185179",
"text": "def index\n @concessionaires = Concessionaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @concessionaires }\n end\n end",
"title": ""
},
{
"docid": "5eec291d2c5193d01b88b5461ffaac9a",
"score": "0.6180712",
"text": "def show\n @congregacoes = Congregacoes.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @congregacoes }\n end\n end",
"title": ""
},
{
"docid": "6d345c3b08d30038cb9b619f5c6a2684",
"score": "0.61779994",
"text": "def show\n @clilab = Clilab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clilab }\n end\n end",
"title": ""
},
{
"docid": "254ea8afe2dcbc5d22929c257746f3f8",
"score": "0.61747533",
"text": "def index\n @contas = Conta.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contas }\n end\n end",
"title": ""
},
{
"docid": "0d06868790f67c0b9af173f7a51323e2",
"score": "0.6161722",
"text": "def index\n @cst_pis = CstPis.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cst_pis }\n end\n end",
"title": ""
},
{
"docid": "d4eedbf64bb2e3ec66aae649ec872b75",
"score": "0.616167",
"text": "def show\n @comitestipo = Comitestipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comitestipo }\n end\n end",
"title": ""
},
{
"docid": "21d4c3713c8972042debea453ed33a88",
"score": "0.6151508",
"text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profesor_ciclo }\n end\n end",
"title": ""
},
{
"docid": "103f9efcbeead46d2a1682376327de61",
"score": "0.6148296",
"text": "def show\n @estado_civil = EstadoCivil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estado_civil }\n end\n end",
"title": ""
},
{
"docid": "9deae65821943e949f2d8042e6e98b58",
"score": "0.61470485",
"text": "def show\n @condclima = Condclima.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @condclima }\n end\n end",
"title": ""
},
{
"docid": "fbe1b9163a088436f204b742e8dea6e8",
"score": "0.6136105",
"text": "def show\n @contratista = Contratista.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contratista }\n end\n end",
"title": ""
},
{
"docid": "2294e5814164e41b2e8979d7c3d67a3d",
"score": "0.6132906",
"text": "def index\n @vehiculos = Vehiculo.all\n \n cadena = getvehiculos(@vehiculos) \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => cadena }\n end\n end",
"title": ""
},
{
"docid": "b8308025bc59e330ca62eb164b5972da",
"score": "0.61131585",
"text": "def show\n @convidados = Convidado.find_all_by_tipo(params[:id])\n\n respond_to do |format|\n format.html { render :action => \"index\" }\n format.xml { render :xml => @convidados }\n end\n end",
"title": ""
},
{
"docid": "a53e102aee7f925c7c98451ba03a7944",
"score": "0.6106829",
"text": "def show\n @covecaysale = Covecaysale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @covecaysale }\n end\n end",
"title": ""
},
{
"docid": "b95280db5056145efe0f0ba925ff2f67",
"score": "0.6094491",
"text": "def show\n @circule = Circule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @circule }\n end\n end",
"title": ""
},
{
"docid": "9f62047fbf108195f85d5575c6007e56",
"score": "0.6084416",
"text": "def show\n @ceo = Ceo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ceo }\n end\n end",
"title": ""
},
{
"docid": "00a21b6ef9e00406934c1b63dd560d45",
"score": "0.6084255",
"text": "def show\n @topico = Topico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @topico }\n end\n end",
"title": ""
},
{
"docid": "48cad7d4283292d69b953258e9f018b4",
"score": "0.6081343",
"text": "def index\n @cierre_ciclos = CierreCiclo.all\n end",
"title": ""
},
{
"docid": "15d67f69a862d1dad441cc8367e7d35b",
"score": "0.6059644",
"text": "def index\n @cursus = Cursu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cursus }\n end\n end",
"title": ""
},
{
"docid": "bb18814cf05f7638f98b5d039da7dedc",
"score": "0.6056268",
"text": "def show\n @cobros_detalhe = CobrosDetalhe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cobros_detalhe }\n end\n end",
"title": ""
},
{
"docid": "b21d83ba090f60431998ebdf9dd73cef",
"score": "0.60324186",
"text": "def show\n @cofile = Cofile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cofile }\n end\n end",
"title": ""
},
{
"docid": "b21d83ba090f60431998ebdf9dd73cef",
"score": "0.60324186",
"text": "def show\n @cofile = Cofile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cofile }\n end\n end",
"title": ""
},
{
"docid": "18989b8ac3132ac6378c6b9bbdd92602",
"score": "0.6030187",
"text": "def show\n @comissionado = Comissionado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comissionado }\n end\n end",
"title": ""
},
{
"docid": "0fb52a14714a94a51488a04e6fd3d1cf",
"score": "0.60161495",
"text": "def show\n @carrera = Carrera.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @carrera }\n end\n end",
"title": ""
},
{
"docid": "68e91af0ee3ff473a550ad95a182e78c",
"score": "0.60136116",
"text": "def show\n @gloscon = Gloscon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gloscon }\n end\n end",
"title": ""
},
{
"docid": "51a95a395f94727688143b03496f032e",
"score": "0.6011966",
"text": "def show\n @condicioniva = Condicioniva.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @condicioniva }\n end\n end",
"title": ""
},
{
"docid": "f267e7417c083833bd5adec02a70b82c",
"score": "0.6007392",
"text": "def index\n @catalogo_accions = CatalogoAccion.all.paginate(:page => params[:page], :per_page => 15)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @catalogo_accions }\n end\n end",
"title": ""
},
{
"docid": "bf9961a42267a9ee8846215a8c1fa9ec",
"score": "0.6007084",
"text": "def show\n @contacter = Contacter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contacter }\n end\n end",
"title": ""
},
{
"docid": "b41d597e41d566cbcbe37e438a169130",
"score": "0.60051835",
"text": "def index\n @cst_cofins = CstCofins.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cst_cofins }\n end\n end",
"title": ""
},
{
"docid": "7d53563b7536aa3c7f4400b9dcd08dae",
"score": "0.60037047",
"text": "def index\n @cursos = Curso.find(:all, :order=>:codigo)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cursos }\n end\n end",
"title": ""
},
{
"docid": "a22240d1eee570ddec73cd457f55381e",
"score": "0.5996655",
"text": "def show\n @catalogo_accion = CatalogoAccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catalogo_accion }\n end\n end",
"title": ""
},
{
"docid": "ebb13877d9ad91db99fc9716e86a0594",
"score": "0.5995533",
"text": "def show\n @cotizacione = Cotizacione.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cotizacione }\n end\n end",
"title": ""
},
{
"docid": "c0a5a758d818c79df581f0e7e4d123e6",
"score": "0.59857124",
"text": "def show\n @clinic = Clinic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clinic }\n end\n end",
"title": ""
},
{
"docid": "181bcf42260a574a4e1aa300723077ba",
"score": "0.59807724",
"text": "def show\n @carro_som = CarroSom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @carro_som }\n end\n end",
"title": ""
},
{
"docid": "e805ad5b314cf1a32a9aa7717f2b338b",
"score": "0.5974012",
"text": "def show\n @societe = Societe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @societe }\n end\n end",
"title": ""
},
{
"docid": "bf5a665502fc04a01b950513a00091b1",
"score": "0.5970343",
"text": "def show\n @contenuto = Contenuto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contenuto }\n end\n end",
"title": ""
},
{
"docid": "553f0c40ca146f9adbabf1018791b8a6",
"score": "0.59606594",
"text": "def index\n @cfops = Cfop.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cfops }\n end\n end",
"title": ""
},
{
"docid": "6a519d772f5c331fd41576f689938010",
"score": "0.5948509",
"text": "def show\n @comida = Comida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @comida }\n end\n end",
"title": ""
},
{
"docid": "be9784ce077d1d68a1ad9f2ad31f81a0",
"score": "0.59475005",
"text": "def show\n @cst_cofin = CstCofins.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cst_cofin }\n end\n end",
"title": ""
},
{
"docid": "49a340ee97a950931b75a80cacc69d00",
"score": "0.59440476",
"text": "def index\n @cios = Cio.all\n end",
"title": ""
},
{
"docid": "2a7298af4503f083df4cd138c86ae0bc",
"score": "0.5943342",
"text": "def show\n @servicios = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @servicios }\n end\n end",
"title": ""
},
{
"docid": "b5eea45aaaa7fedbc070d2226eaaf911",
"score": "0.59424996",
"text": "def show\n @seccione = Seccione.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @seccione }\n end\n end",
"title": ""
},
{
"docid": "752a67ad12af0c424ba4e951feb8bc4e",
"score": "0.59413946",
"text": "def index\n @careroles = Carerole.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @careroles }\n end\n end",
"title": ""
},
{
"docid": "fcfdc08e3fa4db2bfdca33d3308b844e",
"score": "0.59410834",
"text": "def opciones\n @sitio = Sitio.find(params[:id])\n respond_to do |format|\n format.html # opciones.html.erb\n format.xml { render :xml => @sitio }\n end\n end",
"title": ""
},
{
"docid": "fcfdc08e3fa4db2bfdca33d3308b844e",
"score": "0.59410834",
"text": "def opciones\n @sitio = Sitio.find(params[:id])\n respond_to do |format|\n format.html # opciones.html.erb\n format.xml { render :xml => @sitio }\n end\n end",
"title": ""
},
{
"docid": "308ae73dab0c6f877d86f9f39141151e",
"score": "0.592871",
"text": "def index\n @servico_cruzeiros = Servico::Cruzeiro.all\n end",
"title": ""
},
{
"docid": "228ca8b2bbe73248867fad973042dc40",
"score": "0.5927807",
"text": "def show\n @historico = Historico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @historico }\n end\n end",
"title": ""
},
{
"docid": "50cf1394b3d0bac44f1619d3973a0fc0",
"score": "0.5923671",
"text": "def show\n @carrot = Carrot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @carrot }\n end\n end",
"title": ""
},
{
"docid": "57e0e1ab5934216ca7f82798de4f1cff",
"score": "0.591692",
"text": "def show\n @colaborador = Colaborador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @colaborador }\n end\n end",
"title": ""
},
{
"docid": "bbea0f171d6cae40f18bff9fdedfe401",
"score": "0.5910415",
"text": "def show\n @companium = Companium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @companium }\n end\n end",
"title": ""
},
{
"docid": "8f1b8dbb5c98ec528547f70bf442a7bb",
"score": "0.59101516",
"text": "def show\n @convo = Convo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @convo }\n end\n end",
"title": ""
},
{
"docid": "78b39b00845f1a5a845b6eb32ea95782",
"score": "0.5908961",
"text": "def show\n @catastrosinterseccion = Catastrosinterseccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catastrosinterseccion }\n end\n end",
"title": ""
},
{
"docid": "551c70fb02d8d55a0f13cb70fd96f5d3",
"score": "0.59057724",
"text": "def show\n @vaga_crianca = VagaCrianca.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vaga_crianca }\n end\n end",
"title": ""
},
{
"docid": "ea8229ec36acf4363185a69b38de8d3f",
"score": "0.59052974",
"text": "def show\n @caracteristica = Caracteristica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @caracteristica }\n end\n end",
"title": ""
},
{
"docid": "ea8229ec36acf4363185a69b38de8d3f",
"score": "0.59052974",
"text": "def show\n @caracteristica = Caracteristica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @caracteristica }\n end\n end",
"title": ""
},
{
"docid": "46b779e9719692196d7179978be23e74",
"score": "0.5903755",
"text": "def index\n @receitas = Conta.find_all_by_tipo_conta('R')\n @despesas = Conta.find_all_by_tipo_conta('D')\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contas }\n end\n end",
"title": ""
},
{
"docid": "7cfac15ddfccbbeeea3c4eea63082e2e",
"score": "0.5903248",
"text": "def index\n @catalogo_institucions = CatalogoInstitucion.all.paginate(:page => params[:page], :per_page => 15)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @catalogo_institucions }\n end\n end",
"title": ""
},
{
"docid": "5e63972bbbc8a5066a7e530d59c90b32",
"score": "0.5899957",
"text": "def show\n @contabilidade = Contabilidade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contabilidade }\n end\n end",
"title": ""
},
{
"docid": "75cbcf56e70b6f05f18bf63abd4293fd",
"score": "0.5898663",
"text": "def index\n self.class.get(\"/cards/index.xml\");\n end",
"title": ""
},
{
"docid": "83f23fba3f6f4e50762e20091e924589",
"score": "0.5896712",
"text": "def index\n @feria2010calificacionrecursos = Feria2010calificacionrecurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2010calificacionrecursos }\n end\n end",
"title": ""
},
{
"docid": "ff51dd888d465a3e7810f5d307883b9f",
"score": "0.58956164",
"text": "def show\n @conductor = Conductor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @conductor }\n end\n end",
"title": ""
},
{
"docid": "8ac2f9813b0d8a720754e75337dc52fc",
"score": "0.58887297",
"text": "def show\n @conta = Conta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @conta }\n end\n end",
"title": ""
},
{
"docid": "8ac2f9813b0d8a720754e75337dc52fc",
"score": "0.58887297",
"text": "def show\n @conta = Conta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @conta }\n end\n end",
"title": ""
},
{
"docid": "8ac2f9813b0d8a720754e75337dc52fc",
"score": "0.58887297",
"text": "def show\n @conta = Conta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @conta }\n end\n end",
"title": ""
},
{
"docid": "b0790741141ab542d25ad6cce7e81b98",
"score": "0.58868384",
"text": "def show\n @catalogo_institucion = CatalogoInstitucion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @catalogo_institucion }\n end\n end",
"title": ""
},
{
"docid": "2ce71030029832752f1aeda1b84417f3",
"score": "0.58843184",
"text": "def show\n @seccion = Seccion.find(params[:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @secciones }\n end\n end",
"title": ""
},
{
"docid": "a378256ce3d6338af7180ff544f22b3c",
"score": "0.58818793",
"text": "def xml_report\n RestClient::get \"#{@base}/OTHER/core/other/xmlreport/\"\n end",
"title": ""
},
{
"docid": "9bf3ada7d78f1c323f788d7cf518f6a1",
"score": "0.5873184",
"text": "def show\n @conteudoprogramatico = Conteudoprogramatico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @conteudoprogramatico }\n end\n end",
"title": ""
},
{
"docid": "ae1e94509163de2b35623bbb77a071ea",
"score": "0.5872299",
"text": "def new\n @coasilicon = Coasilicon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coasilicon }\n end\n end",
"title": ""
},
{
"docid": "edd72910eef68db6856c0f0e229e60e8",
"score": "0.58681226",
"text": "def show\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @consortia }\n end\n end",
"title": ""
},
{
"docid": "aaf0f92ab1e9b64e76d4f9f999c7142d",
"score": "0.58642083",
"text": "def index\n @aviso = Aviso.find(params[:aviso_id])\n @comentarios = @aviso.comentarios.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comentarios }\n end\n end",
"title": ""
},
{
"docid": "7cc0dd9b93337b785efad476ad723fbf",
"score": "0.5859705",
"text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cursos }\n end\n end",
"title": ""
},
{
"docid": "6cc45a325a11239a9fcbe979fb303aa8",
"score": "0.5857042",
"text": "def show\n @lance_unico = LanceUnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lance_unico }\n end\n end",
"title": ""
},
{
"docid": "f11babc2f5e89288c786f473d6c728fa",
"score": "0.5856567",
"text": "def show\n @cst_pi = CstPis.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cst_pi }\n end\n end",
"title": ""
},
{
"docid": "8fa740fd4bfe7089017fb74d65a52d76",
"score": "0.5848685",
"text": "def show\n @computadores = Computadore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @computadores }\n end\n end",
"title": ""
},
{
"docid": "7f6602e3bba5316c79ed8d046de804ec",
"score": "0.5847988",
"text": "def new\n @comentario = Comentario.new\n respond_to do |format| \n format.xml { render xml: @comentario }\n end\n end",
"title": ""
},
{
"docid": "19546c71ec9820f6f33cf5fb14d8a556",
"score": "0.5847771",
"text": "def show\n @lsrs_climatedata = LsrsClimate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lsrs_climatedata }\n end\n end",
"title": ""
},
{
"docid": "a52f5fcbf841899c288e7d40e4748ee6",
"score": "0.58470094",
"text": "def show\n @comptype = Comptype.find(params[:id]).to_xml(:dasherize => false)\n\n respond_to do |format|\n format.xml { render :xml => @comptype }\n end\n end",
"title": ""
},
{
"docid": "d47d3d95b6457ef1dda77e9872ae02d4",
"score": "0.5845022",
"text": "def index\n @calendario_recursos = CalendarioRecurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @calendario_recursos }\n end\n end",
"title": ""
}
] |
aaf44a5ddf4d6c44cf5bcf07728f403f | put focus on previous field will cycle by default, unless navigation policy not :CYCLICAL in which case returns :NO_PREV_FIELD. | [
{
"docid": "5b7f2be3238ca5ed61acd2b3f90148b3",
"score": "0.74152845",
"text": "def select_prev_field\n return :UNHANDLED if @focusables.nil? or @focusables.empty?\n index = nil\n if @_focussed_widget\n index = @focusables.index @_focussed_widget\n else\n index = @focusables.length \n end\n index -= 1\n index = @focusables.length-1 if index < 0 # CYCLICAL 2018-03-11 - \n select_widget @focusables[index]\n end",
"title": ""
}
] | [
{
"docid": "11c5a5391cd4513d96b8b1f1810cb429",
"score": "0.72269404",
"text": "def goto_prev_component\n if @current_component != nil \n leave_current_component\n if on_first_component?\n @_entered = false\n return :UNHANDLED\n end\n @current_index = @components.index(@current_component)\n index = @current_index -= 1\n index.downto(0) do |i|\n f = @components[i]\n if f.focusable\n @current_index = i\n @current_component = f\n return set_form_row\n end\n end\n end\n return :UNHANDLED\n end",
"title": ""
},
{
"docid": "c2fccb04de117cce80db317a73550080",
"score": "0.7077943",
"text": "def sel_focus_prev(&block)\n self.connect(SEL_FOCUS_PREV, &block)\n end",
"title": ""
},
{
"docid": "2799ce77d39004a7bedf2421eb7d8373",
"score": "0.68191046",
"text": "def requires_previous_field\n @requires_previous_field\n end",
"title": ""
},
{
"docid": "24aac84559fb9cd5d53c754832df71b8",
"score": "0.6781825",
"text": "def before_prev\n prev.prev\n end",
"title": ""
},
{
"docid": "5adc0359ebc0bf63ab9029b21c2b2e46",
"score": "0.6678185",
"text": "def goto_prev_component\n if @current_component != nil \n @current_component.on_leave\n if on_first_component?\n return :UNHANDLED\n end\n @current_index -= 1\n @current_component = @components[@current_index] \n if @current_index < @_first_column_print\n # TODO need to check for zero\n @_first_column_print -= 1\n @_last_column_print -= 1\n @repaint_required = true\n end\n # shoot if this this put on a form with other widgets\n # we would never get out, should return nil -1 in handle key\n unless @current_component\n @current_index = 0\n @current_component = @components[@current_index] \n end\n else\n # this happens in one_tab_expand\n #@current_component = @second_component if @first_component.nil?\n #@current_component = @first_component if @second_component.nil?\n # XXX not sure what to do here, will it come\n @current_index = 0\n @current_component = @components[@current_index] \n end\n set_form_row\n return 0\n end",
"title": ""
},
{
"docid": "6a75c5a6611cb1b3f8bbada15105b065",
"score": "0.6617761",
"text": "def previous\n #TODO: Add cycle tracking to enable previous\n end",
"title": ""
},
{
"docid": "356390645aad1c661fabb75c60ff6159",
"score": "0.64850307",
"text": "def move_prev\n self.current = self.current&.prev\n end",
"title": ""
},
{
"docid": "cb97485c7f8a142edefc2a28898b67a0",
"score": "0.64642787",
"text": "def on_prev\n if !paging_enabled || page_number == 0\n return\n end\n self.page_number -= 1\n on_page_change\n end",
"title": ""
},
{
"docid": "b1a0ed49d9d7ee09d919c873ec37b575",
"score": "0.64492756",
"text": "def previous()\n while assert_selector '#userwizzard fieldset:nth-of-type(1)', visible: :visible == false do\n if page.has_css?(\".previous\")\n begin\n click_on \"Previous\" if page.has_css?(\".previous\")\n rescue\n #\n end\n else\n break\n end\n end\n end",
"title": ""
},
{
"docid": "231c4a802ba414946bf5d2afd29a3c6d",
"score": "0.6350785",
"text": "def prev!\n @_prev\n end",
"title": ""
},
{
"docid": "83f53ddab202012e5b47c9504c0ad92a",
"score": "0.6258293",
"text": "def previous_step!\n self.stepper_current_step = self.previous_step\n self\n end",
"title": ""
},
{
"docid": "591eabfc2439097d7eede36014a7614a",
"score": "0.6223891",
"text": "def prev()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "591eabfc2439097d7eede36014a7614a",
"score": "0.6223891",
"text": "def prev()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "591eabfc2439097d7eede36014a7614a",
"score": "0.6223891",
"text": "def prev()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "591eabfc2439097d7eede36014a7614a",
"score": "0.6223891",
"text": "def prev()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "485c068946357e80c8d1625fd3d9bb17",
"score": "0.621667",
"text": "def previous!\n @page -= 1 if @page > 1\n step { @selected = first_for_page }\n end",
"title": ""
},
{
"docid": "890706d07ad216e24c9ea7c59b68ad69",
"score": "0.61959404",
"text": "def prev\n @prev ||= begin\n if has_prev?\n parent.children[position - 2]\n else\n nil\n end\n end\n end",
"title": ""
},
{
"docid": "8bd2a75de5f1c5eb666ff5a8b6e19b67",
"score": "0.6187754",
"text": "def previous; end",
"title": ""
},
{
"docid": "8bd2a75de5f1c5eb666ff5a8b6e19b67",
"score": "0.6187754",
"text": "def previous; end",
"title": ""
},
{
"docid": "8bd2a75de5f1c5eb666ff5a8b6e19b67",
"score": "0.6187754",
"text": "def previous; end",
"title": ""
},
{
"docid": "c45e764efc44505a7a8ea0f6c6ecbe8c",
"score": "0.61617076",
"text": "def previous!\n clear_pagination\n @params[:before] = before_cursor\n reload\n end",
"title": ""
},
{
"docid": "4cc1b235b6c398c2784d74a8debd3596",
"score": "0.61591375",
"text": "def prev\n @prev\n end",
"title": ""
},
{
"docid": "12240c91a0c3b8b360460efa160224a4",
"score": "0.6158827",
"text": "def prev?\n !@prev.nil?\n end",
"title": ""
},
{
"docid": "689f329b85828124160672eb261edecb",
"score": "0.6148546",
"text": "def load_prev_next\n offset = current_offset\n @previous_doc = offset > 1 ? single_doc_by_index(offset-1, session[:search]) : nil\n @next_doc = single_doc_by_index(offset+1, session[:search])\n end",
"title": ""
},
{
"docid": "48cc415f5b483b79c29fe4a05fda0d9c",
"score": "0.6127161",
"text": "def goto_prev_selection\n return if selected_rows().length == 0 \n row = selected_rows().sort{|a,b| b <=> a}.find { |i| i < @current_index }\n row ||= @current_index\n @current_index = row\n @repaint_required = true # fire list_select XXX\n end",
"title": ""
},
{
"docid": "e1d0d2e24e52e210f662821455fb3dac",
"score": "0.611635",
"text": "def previous!\n @prev\n end",
"title": ""
},
{
"docid": "942a97874c0e657b533f32933d8d903c",
"score": "0.61081374",
"text": "def previous_sibling()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "2bcee4ca786a37e7354470a534f8962d",
"score": "0.60988045",
"text": "def prev?\r\n not self.prev.nil?\r\n end",
"title": ""
},
{
"docid": "5f8a8f255d48752ef4f533f479bbc9db",
"score": "0.60772824",
"text": "def prev() ask \"prev\", false end",
"title": ""
},
{
"docid": "1727fbd6f614a81582be51ef1f42df8b",
"score": "0.60759306",
"text": "def prev\n return if first?\n\n @curr -= 1\n curr\n end",
"title": ""
},
{
"docid": "acc11f0e69f0041746c9856a40af9987",
"score": "0.60661787",
"text": "def prev(window)\n Tk.execute(:tk_focusPrev, window)\n end",
"title": ""
},
{
"docid": "dfb3c301b3885dd101c299d70abb90e2",
"score": "0.60465604",
"text": "def previous\n next_or_previous :lt\n end",
"title": ""
},
{
"docid": "33fb75172a5ae25a2343fb82b09d5a25",
"score": "0.6041565",
"text": "def prev_page!\n raise(\"You are on the first page\") if page == first_page\n self.page = prev_page\n all\n end",
"title": ""
},
{
"docid": "a16fc053572977bbe5f78b90681f49c2",
"score": "0.6033596",
"text": "def previous_step\n reference_step_position(-1)\n end",
"title": ""
},
{
"docid": "c62f426350c3c77eeaef54e8c7c684da",
"score": "0.60316175",
"text": "def prev?()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "42707731bdff5dfd13d8098fa6ff7102",
"score": "0.602926",
"text": "def prev_record\n Innodb::Stats.increment :index_cursor_prev_record\n\n if (rec = @page_cursor.record)\n return rec\n end\n\n return unless (prev_page = @page.prev)\n\n move_cursor(prev_page, :max)\n\n @page_cursor.record\n end",
"title": ""
},
{
"docid": "d59a170c2bc4b3f672351946fb5555f7",
"score": "0.602177",
"text": "def prev_page\n detect { |link| link.rel == Link::Rel::PREVIOUS }\n end",
"title": ""
},
{
"docid": "c32bd4cf60c15c7e2c761f5f85e5ba6d",
"score": "0.6013315",
"text": "def nav_prev_next_label_prev\n extensions[:MiddlemanPageGroups].options[:nav_prev_next_label_prev]\n end",
"title": ""
},
{
"docid": "9ee2353a44afd8f5731c25fc4c00fa2a",
"score": "0.6008332",
"text": "def prev?\n not self.prev.nil?\n end",
"title": ""
},
{
"docid": "0f8aaa5a0dada40a2ef8b1e68d56fa40",
"score": "0.600727",
"text": "def previous_step\n self.current_step=steps[steps.index(current_step)-1]\n end",
"title": ""
},
{
"docid": "a67f6f9927474888d580e76bfd358519",
"score": "0.6006039",
"text": "def prev\n @pager.page(@number - 1) if prev?\n end",
"title": ""
},
{
"docid": "a67f6f9927474888d580e76bfd358519",
"score": "0.6006039",
"text": "def prev\n @pager.page(@number - 1) if prev?\n end",
"title": ""
},
{
"docid": "d0cec6e68ff2e1e0163d02732016f3de",
"score": "0.59997433",
"text": "def previous\n raise \"Unable to build sequence. No Comic Defined For Page.\" if self.comic_id == nil\n end",
"title": ""
},
{
"docid": "7fafda4026ef4f960bbc8e6ec95af3b0",
"score": "0.5999216",
"text": "def select_next_field\n return :UNHANDLED if @focusables.nil? || @focusables.empty?\n index = nil\n if @_focussed_widget\n index = @focusables.index @_focussed_widget\n end\n index = index ? index+1 : 0\n index = 0 if index >= @focusables.length # CYCLICAL 2018-03-11 - \n select_widget @focusables[index]\n end",
"title": ""
},
{
"docid": "aeee74c1e408b3d5520e4c6a8baf5b84",
"score": "0.5992439",
"text": "def prev?\n @page == @current_page - 1\n end",
"title": ""
},
{
"docid": "a1119989b6c926bf7f76392a595436b8",
"score": "0.59878767",
"text": "def previous\n next_or_previous :lt\n end",
"title": ""
},
{
"docid": "64751b025e3f77a7a4f08e74be387637",
"score": "0.5985394",
"text": "def prev\n @pointer = 0 if not @pointer\n @pointer = down\n current\n end",
"title": ""
},
{
"docid": "db3e73b32b886635980027036ab53866",
"score": "0.59836525",
"text": "def prev\n @pager.page(@number - 1) if prev?\n end",
"title": ""
},
{
"docid": "3087b2cd78e0c369f771eadb398a4481",
"score": "0.5972059",
"text": "def prev?\n self.action == :prev\n end",
"title": ""
},
{
"docid": "de2d9447a5d1e20429732be3e3d52182",
"score": "0.59679294",
"text": "def prev\n Document.traverse self, 'previousSibling', nil, false\n end",
"title": ""
},
{
"docid": "28d6d0b66d789c7e6f5d86aeffb1d96e",
"score": "0.5963993",
"text": "def prev?\n @page > 0\n end",
"title": ""
},
{
"docid": "8d17e8a8fa81512b5f144ac80cebad47",
"score": "0.5963969",
"text": "def previous_step\n @step = @step - 1\n end",
"title": ""
},
{
"docid": "1f2a0b53133fa2f0baae63a5c909bf20",
"score": "0.59379405",
"text": "def prev?\r\n not prev.nil?\r\n end",
"title": ""
},
{
"docid": "1ecbc30657396ca120d62c3c06216ed1",
"score": "0.5935254",
"text": "def prev_page\n return current_page if current_page.zero?\n\n @current_page -= 1\n self\n end",
"title": ""
},
{
"docid": "639bf75e51588d69de5b4a57738a47b5",
"score": "0.59334314",
"text": "def prev_item\r\n end",
"title": ""
},
{
"docid": "6f6861a5d4277b409517d455a902410b",
"score": "0.5915816",
"text": "def previous_page!\n move!(previous_page) if previous_page?\n end",
"title": ""
},
{
"docid": "43053be31036ab786d3f3ae28f6eb95b",
"score": "0.59059775",
"text": "def previous\n\t\treplace( '2.0', \"#{@lines - 1}.end\", \n\t\t\t@main_pane.previous_page.join( @sub_pane.current_page ) )\n\tend",
"title": ""
},
{
"docid": "f48820ee4df66b2bc9aeeb6fc480a961",
"score": "0.5905364",
"text": "def previous_column num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier)\n v = @current_column - num # 2010-05-13 12:44 1 to num\n # returning unhandled so focus can go to prev field auto\n if v < @_first_column_print and @current_index <= 0\n return :UNHANDLED\n end\n if v < @_first_column_print\n if v > 0\n scroll_left\n current_column v\n elsif @current_index > 0\n @current_column = @table_column_model.column_count-1\n @current_column = @_last_column_print # added 2009-02-17 00:01 \n $log.debug \" XXXXXX prev col #{@current_column}, las #{@_last_column_print}, fi: #{@_first_column_print}\"\n set_form_col\n previous_row 1\n end\n else\n current_column v\n end\n end",
"title": ""
},
{
"docid": "f3058e3499e276cdf73bda67fe804f12",
"score": "0.5887543",
"text": "def prev; @pager.page(@page-1); end",
"title": ""
},
{
"docid": "bd52c43de704be053f13f0b24c3e9714",
"score": "0.58736795",
"text": "def previous_step \n self.current_step = steps[steps.index(current_step)-1] \n end",
"title": ""
},
{
"docid": "de12bb6f90ed0a39efeb2845b8c3cc84",
"score": "0.5871459",
"text": "def previous\n dup.tap(&:previous!)\n end",
"title": ""
},
{
"docid": "c7edaa8c9bb2c7ce8b733697827b9a33",
"score": "0.58674735",
"text": "def match_previous\n @components[@pos] == 'previous'\n end",
"title": ""
},
{
"docid": "c0a56c544a32e981753e24d1dbf49d20",
"score": "0.5862317",
"text": "def previous_page!\n previous_page.tap { |page| update_self(page) }\n end",
"title": ""
},
{
"docid": "d834640018c296e4d0cfa2f4da0b5afd",
"score": "0.58568126",
"text": "def autofocus_for_field(name)\n if @form_state[:errors]\n if @form_state[:errors].key?(name)\n ' autofocus'\n else\n ''\n end\n else\n @fields.empty? ? ' autofocus' : ''\n end\n end",
"title": ""
},
{
"docid": "007a78cc33e33ad90ebbd292c9154cb1",
"score": "0.58563423",
"text": "def prev_page\n current_page > 1 ? (current_page - 1) : nil\n end",
"title": ""
},
{
"docid": "f75e05b2efd3a584fbfe2112b2469ca3",
"score": "0.58525866",
"text": "def previous!\n self.current_selected_index -= 1\n end",
"title": ""
},
{
"docid": "ecbede21dc841ab9a989eb1c7c623196",
"score": "0.58408105",
"text": "def prevSlide\n\t\tif @currentSlide != 0\n\t\t\t@currentSlide -= 1\n\t\t\tdisplaySlide\n\t\tend\n\n\tend",
"title": ""
},
{
"docid": "cdb29a9720ea829216ce12376d9bc13e",
"score": "0.58330643",
"text": "def previous\n @previous ||= self.class.last :conditions => {:rev => self.prev_rev}\n end",
"title": ""
},
{
"docid": "712f6943c50daaa96c6671124f24a634",
"score": "0.58329237",
"text": "def prev_line; end",
"title": ""
},
{
"docid": "4428081d337843b9166b3a543bce8bcd",
"score": "0.5825833",
"text": "def prev\n if(position == 0) then\n @position = self.size - 1\n else\n @position = @position - 1\n end\n current\n end",
"title": ""
},
{
"docid": "74776c53aa1fa2ea188621bb8d3d30cc",
"score": "0.5824474",
"text": "def previous\n raise 'No such element' if @size == 0\n @current = @current.previous\n end",
"title": ""
},
{
"docid": "7ee693c41aea0571c937354058810e5d",
"score": "0.5824195",
"text": "def focus_next\n current_control.blur\n unless (@stack_pos + 1 == @control_stack.length)\n @stack_pos += 1 \n else \n @stack_pos = 0 \n end\n current_control.hover\n end",
"title": ""
},
{
"docid": "2db36c2979c3603f3f6df3e4a73d759b",
"score": "0.5817777",
"text": "def sibling_prev\n @parent.get(index - 1) unless is_first_sibling?\n end",
"title": ""
},
{
"docid": "4c9f01b9fc434366887ad816f575c512",
"score": "0.58151925",
"text": "def prev\n Chain.prev chain, self\n end",
"title": ""
},
{
"docid": "e10f51bf57643e6a53d4d10167608c44",
"score": "0.58109355",
"text": "def prev\n\tself-1\n\tend",
"title": ""
},
{
"docid": "b101892df15c223f6026d53b9a9a113d",
"score": "0.5805434",
"text": "def previous_item(field = nil)\n field ||= default_orderable_field\n orderable_scope(field).where(orderable_field(field) => send(field) - 1).first\n end",
"title": ""
},
{
"docid": "fb52b1000938b42aa57db3828c5b8f53",
"score": "0.5795116",
"text": "def prev_column\n @coffsets = @tabular._calculate_column_offsets unless @coffsets\n #c = @column_pointer.next\n current_column = current_column_offset() -1\n if current_column < 0 # \n current_column = @tabular.column_count-1\n end\n cp = @coffsets[current_column] \n @curpos = cp if cp\n $log.debug \" next_column #{@coffsets} :::: #{cp}, curpos=#{@curpos} \"\n set_col_offset @curpos\n #down() if c < @column_pointer.last_index\n #fire_column_event :ENTER_COLUMN\n end",
"title": ""
},
{
"docid": "59eeceedbe4cda3f89cfe581bdb56aec",
"score": "0.57888126",
"text": "def prev_node\n goto_node(@list.prev(@node))\n end",
"title": ""
},
{
"docid": "92755e2abdd1348a5bb7b4352bfdddf0",
"score": "0.5782362",
"text": "def prev_key!\n @current_index = current_index - 1\n current_key\n end",
"title": ""
},
{
"docid": "47a5f28d8857caf1e35ecf4a270d7040",
"score": "0.5782079",
"text": "def previous(key)\n raise \"implement me!\"\n end",
"title": ""
},
{
"docid": "ef8d9eb24fd9222bc110b15ab49fd6a2",
"score": "0.57750136",
"text": "def previous=(_arg0); end",
"title": ""
},
{
"docid": "ef8d9eb24fd9222bc110b15ab49fd6a2",
"score": "0.57750136",
"text": "def previous=(_arg0); end",
"title": ""
},
{
"docid": "ef8d9eb24fd9222bc110b15ab49fd6a2",
"score": "0.57750136",
"text": "def previous=(_arg0); end",
"title": ""
},
{
"docid": "af6ad17c179721b57eb8b312c8788e5a",
"score": "0.5763335",
"text": "def pagy_prev_link(pagy, text: pagy_t('pagy.nav.prev'), link_extra: '')\n if pagy.prev\n %(<span class=\"page prev\"><a href=\"#{\n pagy_url_for(pagy, pagy.prev, html_escaped: true)\n }\" rel=\"prev\" aria-label=\"previous\" #{\n pagy.vars[:link_extra]\n } #{link_extra}>#{text}</a></span>)\n else\n %(<span class=\"page prev disabled\">#{text}</span>)\n end\n end",
"title": ""
},
{
"docid": "9eb65ae246e232e2022d443f1e095ed6",
"score": "0.5761034",
"text": "def previous\n scroll -1\n end",
"title": ""
},
{
"docid": "2e536f188fa0b2e388ada7ba0cce72cc",
"score": "0.57563055",
"text": "def menu_prev!\n Vedeu.bind(:_menu_prev_) { |name| Vedeu.menus.by_name(name).prev_item }\n end",
"title": ""
},
{
"docid": "f07abeb17891ea0a041c25c873e3819f",
"score": "0.5745104",
"text": "def go_previous!\n check_page_availability!(:previous)\n\n response = UserEngage.client.get(previous)\n update_page_related_attributes!(response)\n\n @attributes[:current_page] -= 1\n self\n end",
"title": ""
},
{
"docid": "a01e633792644f4157202202430a268a",
"score": "0.5737086",
"text": "def previous\n @interface.Prev\n end",
"title": ""
},
{
"docid": "1589dbfbc07205f9e2f204b9ea955e46",
"score": "0.5730712",
"text": "def page_focus\n self.get_nth_page(self.page).set_focus\n end",
"title": ""
},
{
"docid": "ae759bb73f3299eb5f605070b674d623",
"score": "0.5728229",
"text": "def previous_page \n current_page > 1 ? (current_page - 1) : nil\n end",
"title": ""
},
{
"docid": "2abc193bb4a67d96162c084b68280a26",
"score": "0.5723453",
"text": "def previous_sibling\n walker = System::Windows::Automation::TreeWalker.ControlViewWalker\n potential_previous_sibling = walker.get_previous_sibling(@automation_element)\n potential_previous_sibling.nil? ? nil : Bewildr::Element.new(potential_previous_sibling)\n end",
"title": ""
},
{
"docid": "34428ab10589b8dc57776431cf0c7a17",
"score": "0.57124287",
"text": "def prev_page\n current_page - 1 unless first_page?\n end",
"title": ""
},
{
"docid": "aa59b6b3e78fa5e2ef65986b3dbd50bf",
"score": "0.5706223",
"text": "def previous_page!\n return unless previous_page?\n @page -= 1\n clear!\n end",
"title": ""
},
{
"docid": "aa59b6b3e78fa5e2ef65986b3dbd50bf",
"score": "0.5706223",
"text": "def previous_page!\n return unless previous_page?\n @page -= 1\n clear!\n end",
"title": ""
},
{
"docid": "daf5a25d91a5ae7aca3c84ce7a365614",
"score": "0.5702933",
"text": "def setPrev(node)\n\t\t@prev = node\n\tend",
"title": ""
},
{
"docid": "cac6e001a659bb8150c9c01eb59bd7aa",
"score": "0.57003963",
"text": "def cursor_to_prev\n @cursor = case cursor\n when nil then nil\n when 1 then 1\n else\n cursor - per_page\n end\n nil\n end",
"title": ""
},
{
"docid": "240fa53ae1201ba35d622cb05b9e2761",
"score": "0.5695801",
"text": "def previous_link\n return if @links.empty?\n\n write_link @current_link, @driver.link_style\n\n @current_link -= 1\n @current_link = @links.length - 1 if @current_link < 0\n\n write_link @current_link, @driver.hover_style\n\n scroll_to @links[@current_link].first\n end",
"title": ""
},
{
"docid": "26918b60cc909d3eb9ff2f3b92907fce",
"score": "0.5694117",
"text": "def prev_comment # :nologin: :norobots:\n redirect_to_next_object(:prev, Comment, params[:id].to_s)\n end",
"title": ""
},
{
"docid": "b68feeee257bce59c2ebdc6e55a839e3",
"score": "0.56933147",
"text": "def prev_option!\n @selected = (@selected - 1) % @options.size\n end",
"title": ""
},
{
"docid": "8a868301315e02848fbadf7c5f06e1b0",
"score": "0.5685372",
"text": "def set_FindPrevious(value)\n set_input(\"FindPrevious\", value)\n end",
"title": ""
}
] |
f34c62663c63f901a62724f04d23daff | Instantiate the referenced class and run the perform action | [
{
"docid": "60281f72c76f69cfa736a833a8f0f473",
"score": "0.0",
"text": "def perform_with(delegatee, *args)\n handler = delegatee.new\n raise InvalidDelegatee, \"#{delegatee} does not have a #perform method defined\" unless handler.respond_to?(:perform)\n handler.perform *args\n end",
"title": ""
}
] | [
{
"docid": "bd69fa9e9a24542cd03f07f4d1c5f865",
"score": "0.7008578",
"text": "def perform(*args)\n new(*args).call\n end",
"title": ""
},
{
"docid": "65dba056d32de9c861cc379ba7a95a1d",
"score": "0.68496054",
"text": "def run; new.run; end",
"title": ""
},
{
"docid": "ce1014a5cc8275940b1e44bf9f711c0d",
"score": "0.66831195",
"text": "def run(*args)\n @instance ||= new(*args)\n @instance.run \n end",
"title": ""
},
{
"docid": "4c37e75def3a06919f4c7c521c565ef6",
"score": "0.6552153",
"text": "def run(*args)\n new(*args)\n end",
"title": ""
},
{
"docid": "09f4066a01a5b72f5ee369a22126183a",
"score": "0.65150696",
"text": "def perform(klass, method_name, *args)\n client = klass.constantize.new\n client.send method_name, *args\n end",
"title": ""
},
{
"docid": "6268b310fc86048c47c8e6f1a4db2f05",
"score": "0.6362576",
"text": "def perform\n raise NoMethodError, \"No method #{self.class.name}#perform defined!\"\n end",
"title": ""
},
{
"docid": "290a6351162190590ac036f02e6d457c",
"score": "0.632501",
"text": "def instanciate(plan, arguments = Hash.new)\n run(action_interface_model.new(plan), arguments)\n end",
"title": ""
},
{
"docid": "ffd97a4f682c246edb31a91b7cc0d5ce",
"score": "0.62369156",
"text": "def run(clazz, method, options = {})\n spawn(SpawnRunner.options) do # exceptions are trapped in here. \n dispatch!(clazz, method, options)\n end\n \n return nil # that means nothing!\n end",
"title": ""
},
{
"docid": "ab5ccfd291c9e89db992c1fa736571a9",
"score": "0.6162665",
"text": "def call(*args)\n build_class_for(*args).\n new(*args)\n end",
"title": ""
},
{
"docid": "83236cfc0d6b70cb373a9cb1bf34ea6a",
"score": "0.6160491",
"text": "def run(*args)\n self.new(*args).run\n end",
"title": ""
},
{
"docid": "83236cfc0d6b70cb373a9cb1bf34ea6a",
"score": "0.6160491",
"text": "def run(*args)\n self.new(*args).run\n end",
"title": ""
},
{
"docid": "e2e6bf315308ded9ab37f66c8575a4c6",
"score": "0.6144013",
"text": "def run_example\n Example.new(target)\n end",
"title": ""
},
{
"docid": "3949f2d35ece7c01cf148483cf713df0",
"score": "0.61162615",
"text": "def run\n # abstract\n end",
"title": ""
},
{
"docid": "3949f2d35ece7c01cf148483cf713df0",
"score": "0.61162615",
"text": "def run\n # abstract\n end",
"title": ""
},
{
"docid": "3949f2d35ece7c01cf148483cf713df0",
"score": "0.61162615",
"text": "def run\n # abstract\n end",
"title": ""
},
{
"docid": "ee3e91fe64222466e6af67900e748ef7",
"score": "0.6086077",
"text": "def call_on_instance(obj, *args, &block)\n @executable.invoke(@name, @defined_in, obj, args, block)\n end",
"title": ""
},
{
"docid": "d2dbaabc2023a7f7bc5ff1a074dbaec4",
"score": "0.6084747",
"text": "def spawn( klass, *arguments, &block )\n scorpion.spawn( self, klass, *arguments, &block )\n end",
"title": ""
},
{
"docid": "912dfec02796549d8f9f3a3a781121d4",
"score": "0.6032246",
"text": "def invoke\n Console.p \"TODO: Implement #{self.class.name}.invoke\"\n end",
"title": ""
},
{
"docid": "127bef395badf20e4fdad4a2dbe65291",
"score": "0.602431",
"text": "def instantiate_action(obj)\n return obj.new if obj.is_a?(Class) && obj < Action\n obj\n end",
"title": ""
},
{
"docid": "1c2f0d2915736c2f34d47b3a8508ba3e",
"score": "0.59546864",
"text": "def run\n Runner.new(self).run\n end",
"title": ""
},
{
"docid": "506cab8e712663d851e8abdfa1bc945b",
"score": "0.59372646",
"text": "def perform\n raise NotImplementedError, 'Implement this in a subclass'\n end",
"title": ""
},
{
"docid": "506cab8e712663d851e8abdfa1bc945b",
"score": "0.59372646",
"text": "def perform\n raise NotImplementedError, 'Implement this in a subclass'\n end",
"title": ""
},
{
"docid": "a0c75a7628efe5b9952e04a8d0d857cc",
"score": "0.59261584",
"text": "def execute\n resource_class.import!(object: self, execute: execute_on_create)\n end",
"title": ""
},
{
"docid": "0e4c1578863905878b1b10ccb250234e",
"score": "0.5903492",
"text": "def run( *args )\n action = klass.new # one of the action classes (New or Git or Epub, etc.)\n puts( \"Sending args to Action(#{self.keyword}) : #{ 'NO ARGS' if args.fwf_blank? }\".paint(:pink) ) if EpubForge.gem_test_mode?\n for arg, i in args.each_with_index\n puts \" #{i}: #{arg.inspect}\".paint(:pink) if verbose?\n end\n \n if args.first.is_a?(Project)\n action.project( args.first )\n action.args( args[1..-1] )\n else\n action.args( args )\n end\n \n action.instance_exec( &@proc )\n end",
"title": ""
},
{
"docid": "ce7fcbd6c53e9b47b3a94f08e0e450eb",
"score": "0.58727986",
"text": "def perform\n raise NoMethodError.new('perform')\n end",
"title": ""
},
{
"docid": "e1e04dc87a1c7ec5308e0b4058f11cc0",
"score": "0.58618116",
"text": "def run\n raise NotImplementedError, \"subclass responsibility\"\n end",
"title": ""
},
{
"docid": "212ffc240610ad950fbf809d558a71d9",
"score": "0.5850111",
"text": "def perform\n raise \"#{self.class.name} doesn't implement `perform`!\"\n end",
"title": ""
},
{
"docid": "ac4a80ac8c2359ed75d2a017fd548b26",
"score": "0.5844901",
"text": "def perform\n end",
"title": ""
},
{
"docid": "ac4a80ac8c2359ed75d2a017fd548b26",
"score": "0.5844901",
"text": "def perform\n end",
"title": ""
},
{
"docid": "e885afd03756f4c082e5452577fce2f0",
"score": "0.584368",
"text": "def action(instance); end",
"title": ""
},
{
"docid": "97a61134dfba73209c5f712d491e5320",
"score": "0.58429533",
"text": "def _create_target # :nodoc:\n @target_class.new\n end",
"title": ""
},
{
"docid": "97a61134dfba73209c5f712d491e5320",
"score": "0.58429533",
"text": "def _create_target # :nodoc:\n @target_class.new\n end",
"title": ""
},
{
"docid": "36a35a3b3da3297f8e95de8639e4dbb9",
"score": "0.5840193",
"text": "def objectify_performer(performer) ; Performer.new(performer) ; end",
"title": ""
},
{
"docid": "a0fc8022ce0bb20b408d45a52bccd90f",
"score": "0.5831415",
"text": "def perform\n raise NotImplementedError,\n \"Please implement 'perform' method in your #{self.class.name}\"\n end",
"title": ""
},
{
"docid": "358dade6d04f140a649639524bfa0f54",
"score": "0.58285975",
"text": "def run_on(klass_instance, action, *arguments)\n block = self[action.to_sym] or raise ArgumentError, \"No callback for #{action}\"\n klass_instance.instance_exec(*arguments, &block)\n end",
"title": ""
},
{
"docid": "b2b437101cb8c6f9891ab26639e05bd0",
"score": "0.58103734",
"text": "def launch\n raise NotImplementedError, 'Abstract method'\n end",
"title": ""
},
{
"docid": "adc143d9921490a32ce81e2ec1b81602",
"score": "0.5805707",
"text": "def invoke; end",
"title": ""
},
{
"docid": "adc143d9921490a32ce81e2ec1b81602",
"score": "0.5805707",
"text": "def invoke; end",
"title": ""
},
{
"docid": "adc143d9921490a32ce81e2ec1b81602",
"score": "0.5805707",
"text": "def invoke; end",
"title": ""
},
{
"docid": "b86ed1d927e4123faa25a23c8926e65c",
"score": "0.57957125",
"text": "def method_missing(method_name, *args)\n self.instance_eval \"def #{method_name}(*args)\n puts 'Creating #{method_name} method...'\n puts 'instansiating class...'\n new_toy = Toy.new(*args)\n end\"\n self.send method_name, args\n end",
"title": ""
},
{
"docid": "dc4b54c45e8e9392fd517df47f225613",
"score": "0.5786938",
"text": "def instantiate(inst)\n @inst = inst\n self\n end",
"title": ""
},
{
"docid": "b5526fa7c668c3a1cfb722a81d1b56c7",
"score": "0.57779866",
"text": "def run\n raise 'A subclass should override the `CLAide::Command#run` method to ' \\\n 'actually perform some work.'\n end",
"title": ""
},
{
"docid": "d885f36e0984b0bbac171c7b3d6b7a15",
"score": "0.57583165",
"text": "def run\n a ||= Class.new(Test::A) do\n\n def hello_world\n puts \"Hello world\"\n end\n\n end.new(self)\n\n a.hello_world\nend",
"title": ""
},
{
"docid": "805df5abe246d829552b73f7a853cf8a",
"score": "0.5749583",
"text": "def perform(*args)\n job = self.new(args)\n job.perform(*args)\n end",
"title": ""
},
{
"docid": "74e7e28091ecea6c2452343e686eb81a",
"score": "0.5733731",
"text": "def perform\n\n r = validate\n return r unless r.success?\n\n instantiate_ost_sdk\n\n end",
"title": ""
},
{
"docid": "228e2b76fbf8e5dccbc27f30cd8356fe",
"score": "0.5733641",
"text": "def _invoke_for_class_method(klass, command = T.unsafe(nil), *args, &block); end",
"title": ""
},
{
"docid": "805535324f564b5e7380871fb5045b00",
"score": "0.57325864",
"text": "def perform\n run\n end",
"title": ""
},
{
"docid": "b68d447b814df014c1704e1734f7ce30",
"score": "0.5719939",
"text": "def perform; end",
"title": ""
},
{
"docid": "b68d447b814df014c1704e1734f7ce30",
"score": "0.5719939",
"text": "def perform; end",
"title": ""
},
{
"docid": "b68d447b814df014c1704e1734f7ce30",
"score": "0.5719939",
"text": "def perform; end",
"title": ""
},
{
"docid": "b68d447b814df014c1704e1734f7ce30",
"score": "0.5719939",
"text": "def perform; end",
"title": ""
},
{
"docid": "b68d447b814df014c1704e1734f7ce30",
"score": "0.5719939",
"text": "def perform; end",
"title": ""
},
{
"docid": "b68d447b814df014c1704e1734f7ce30",
"score": "0.5719939",
"text": "def perform; end",
"title": ""
},
{
"docid": "b68d447b814df014c1704e1734f7ce30",
"score": "0.5719939",
"text": "def perform; end",
"title": ""
},
{
"docid": "87ef153283c90ab2b91e702dc57fbe26",
"score": "0.5704011",
"text": "def run\n $0 = \"OpenGov#{name}Component\"\n class_object.new(@config).daemonize\n end",
"title": ""
},
{
"docid": "b15a30b805c7618deb458b43354f49f3",
"score": "0.5677987",
"text": "def initialize(name, run_context=nil)\n super\n @action = :run\n @tarball = nil\nend",
"title": ""
},
{
"docid": "4f195736ac83abba420feaf89fdcca79",
"score": "0.56757617",
"text": "def run_instance!\n instance.run! if instance\n end",
"title": ""
},
{
"docid": "aecd05ed33ed643cbefae1736c416c0b",
"score": "0.5672497",
"text": "def initialize(*args)\n super\n @action = :execute\nend",
"title": ""
},
{
"docid": "aecd05ed33ed643cbefae1736c416c0b",
"score": "0.5672497",
"text": "def initialize(*args)\n super\n @action = :execute\nend",
"title": ""
},
{
"docid": "4fdc87c84444ed9c548f5d32862b213e",
"score": "0.5671205",
"text": "def perform(executable_class, *job_args)\n self.create(executable_class: executable_class, args: job_args).perform\n end",
"title": ""
},
{
"docid": "4d539e771a4b2aa644567458e17c208a",
"score": "0.56662077",
"text": "def dispatch(clazz, method, options = {})\n stdin = Workling::Remote.routing.queue_for(clazz, method) + \n \" \" + \n options.to_xml(:indent => 0, :skip_instruct => true)\n \n Bj.submit \"./script/runner ./script/bj_invoker.rb\", \n :stdin => stdin\n \n return nil # that means nothing!\n end",
"title": ""
},
{
"docid": "eb9f9d0f5a939d6a9b64b4f96514ac4b",
"score": "0.56627667",
"text": "def perform\n fail NotImplementedError, \"Please implement #{self.class}#perform\"\n end",
"title": ""
},
{
"docid": "3f9867afbf20787ad3125adb6e046a34",
"score": "0.5661901",
"text": "def initialize\n\n\n def run\n puts \"running around\"\n end\nend",
"title": ""
},
{
"docid": "dfb375cb73ea12c063beb9c63e36cefd",
"score": "0.56606734",
"text": "def perform\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "edf99200e99bb114745677378fa8eb05",
"score": "0.5644328",
"text": "def run\n raise ArgumentError, \"You must override #run method in class ''#{self.class.policy_name}'\"\n end",
"title": ""
},
{
"docid": "e8685765c131989ef0b06b3b28ea71d8",
"score": "0.5639225",
"text": "def invoke_action(target)\n controller, action = target.split('#')\n\n controller_file = \"#{controller}_controller\"\n # require \"./#{controller_file}\"\n require_relative controller_file\n\n controller_class = Kernel.const_get(\"#{controller.capitalize}Controller\")\n controller_instance = controller_class.new\n\n result = controller_instance.send(action)\n\n puts result\nend",
"title": ""
},
{
"docid": "c9c84d88de906a7f69c36314e5c166ad",
"score": "0.5638299",
"text": "def perform(class_name, object_id, method, *args)\n Rails.logger.debug { \"performing #{class_name}##{method} with args #{args.inspect}\" }\n clazz = class_name.constantize\n object = object_id.present? ? clazz.find(object_id) : clazz\n object.send(method, *args)\n end",
"title": ""
},
{
"docid": "6a6e25a84c5958d6d41208bc65b5151c",
"score": "0.563573",
"text": "def run\n raise \"not implemented\"\n end",
"title": ""
},
{
"docid": "4c3aa7ec663c6e44f82b01f8146920a6",
"score": "0.5627775",
"text": "def new(class_name, *args, &block)\n #We need to check finalizers first, so we wont accidently reuse an ID, which will then be unset in the process.\n self.check_finalizers\n \n #Spawn and return the object.\n return self.spawn_object(class_name, nil, *args, &block)\n end",
"title": ""
},
{
"docid": "2fd3cfeecc281e4880befbf0580da854",
"score": "0.5620749",
"text": "def dispatch &block\n # run action definitions\n block.call(self)\n\n # get action and instance\n @called_action, @called_instance = distinct_action_and_instance\n action = get_action(@called_action)\n @current_instance = instance = Mcir::Instance.new(self, @called_instance)\n @logger.debug \"dispatching action `#{@called_action}' on instance `#{@current_instance.name}'\"\n\n # prepare action\n prepare_action(action)\n\n # parse arguments\n begin\n @args = opt.parse!(ARGV)\n rescue OptionParser::InvalidArgument => e\n abort(e.message, help: true)\n rescue OptionParser::InvalidOption => e\n abort(e.message, help: true)\n end\n\n # dispatch!\n r = ARGV.select{|s| s.start_with?(\"-\")}\n if r.length > 0\n abort(\"Unknown parameters #{r.inspect}\", help: true)\n else\n dispatch!(action, instance)\n @logger.debug \"/dispatched\"\n end\n rescue Interrupt\n @logger.info \"Interrupted, exiting\"\n end",
"title": ""
},
{
"docid": "2657c79803e36027200ce3a2528a1b94",
"score": "0.56196815",
"text": "def method_missing(meth, *args)\n meth = meth.to_s\n initialize_thorfiles(meth)\n klass, task = Thor::Util.find_class_and_task_by_namespace(meth)\n args.unshift(task) if task\n klass.start(args, :shell => self.shell)\n end",
"title": ""
},
{
"docid": "e011e07c9e97e1d77e0c183adc85b631",
"score": "0.5619646",
"text": "def run\r\n raise \"You must implement this!\"\r\n end",
"title": ""
},
{
"docid": "3c74eb344b292f0bc56b56a3ba95666a",
"score": "0.5614151",
"text": "def run\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "3c74eb344b292f0bc56b56a3ba95666a",
"score": "0.5614151",
"text": "def run\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "ac9123c98b6d47dee94947385bffb861",
"score": "0.5607215",
"text": "def load_target!\n end",
"title": ""
},
{
"docid": "7b4b68235a02e5bdf722768693dc1ea2",
"score": "0.558909",
"text": "def perform\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "7b4b68235a02e5bdf722768693dc1ea2",
"score": "0.558909",
"text": "def perform\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "0537579e22622f8124dfac1d3d3310dd",
"score": "0.55863625",
"text": "def execute\n # Override when sub classing\n end",
"title": ""
},
{
"docid": "90f1ae7b7f3fee9e049b30bf83a0d985",
"score": "0.55804014",
"text": "def run\n raise 'Not implemented'\n end",
"title": ""
},
{
"docid": "1b7809af402c3cc9c02c11349eeb94dd",
"score": "0.5579121",
"text": "def run_instance(o={}); cloud_provider.run_instance(o);end",
"title": ""
},
{
"docid": "1b7809af402c3cc9c02c11349eeb94dd",
"score": "0.5579121",
"text": "def run_instance(o={}); cloud_provider.run_instance(o);end",
"title": ""
},
{
"docid": "5fbe3c2b4aff5b0efe5eaea73b960607",
"score": "0.5569299",
"text": "def perform\n end",
"title": ""
},
{
"docid": "d6d5b362ad84d5c9006975a82f776dfc",
"score": "0.5563079",
"text": "def spawn(*args, &block)\n actor = allocate\n proxy = actor.__start_actor\n proxy.send(:initialize, *args, &block)\n proxy\n end",
"title": ""
},
{
"docid": "7942282cf0020cd6ce015a3b8ad618d3",
"score": "0.5559729",
"text": "def run!\n perform!\n end",
"title": ""
},
{
"docid": "613a8e040a7596af8348364440cde65c",
"score": "0.555837",
"text": "def launch\n end",
"title": ""
},
{
"docid": "4337504a930c3ce07916980efdd0365e",
"score": "0.55524737",
"text": "def perform\n response = HTTP.with(request_headers).public_send(@request_method, uri, params: @options)\n klass = @klass.new JSON.parse(response.to_s).merge(client: @client)\n klass.coerce! if klass.respond_to?(:coerce!)\n klass\n end",
"title": ""
},
{
"docid": "7e696f55a4f23e728de2e54890ead281",
"score": "0.5542907",
"text": "def create( target_class, *args )\n #@class_loader.newInstance(target_class, *args )\n if args.size > 0\n @class_loader._invoke('newInstance', 'Ljava.lang.String;[Ljava.lang.Object;', target_class, args )\n else\n @class_loader._invoke('newInstance', 'Ljava.lang.String;', target_class )\n end\n end",
"title": ""
},
{
"docid": "a109296a0a320dd6f7811e3d5e3f4b58",
"score": "0.5539529",
"text": "def call(*args)\n instance_exec(*args, &self.class.body)\n end",
"title": ""
},
{
"docid": "5ec044284bceba03fc4edad6ec0bba42",
"score": "0.55371135",
"text": "def instanciate(plan, variables = Hash.new)\n arguments = action.arguments.map_value do |key, value|\n if value.respond_to?(:evaluate)\n value.evaluate(variables)\n else value\n end\n end\n action.as_plan(arguments)\n end",
"title": ""
},
{
"docid": "91e153ef10d909db287de3bcac318c34",
"score": "0.55323374",
"text": "def method_missing(meth, *args)\n\t\t\t#meth = meth.to_s\n\t\t\t#initialize_thorfiles(meth)\n\t\t\t#klass, command = Thor::Util.find_class_and_command_by_namespace(meth)\n\t\t\t#self.class.handle_no_command_error(command, false) if klass.nil?\n\t\t\t#args.unshift(command) if command\n\t\t\t#klass.start(args, :shell => shell)\n\t\tend",
"title": ""
},
{
"docid": "bc3e0880d8b9c0c44e60030e2f8d8933",
"score": "0.55256605",
"text": "def run\n\n\t\tend",
"title": ""
},
{
"docid": "ab61fc16e603e27ec26cf77b779b667d",
"score": "0.5520805",
"text": "def _run\n raise Sparrow::Error, \"#_run is not implemented\"\n end",
"title": ""
},
{
"docid": "f154b78b034bf431255aeadab76c829d",
"score": "0.5520733",
"text": "def perform(opts = {})\n logger.info \"#{self} running...\"\n self.new(decode_opts(opts)).perform\n logger.info \"#{self} done.\"\n end",
"title": ""
},
{
"docid": "1374f6e4089302422a4e00636921da25",
"score": "0.55204135",
"text": "def perform\n \n end",
"title": ""
},
{
"docid": "74695d5e7da8ed5af2651f2b07dcf639",
"score": "0.5519948",
"text": "def run\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "503f3d637286cff8973acf19ac244753",
"score": "0.5512299",
"text": "def run\n raise Exception.new(\"This method must be implemented in subclasses.\")\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.5510265",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "72d8776d1dbf3d526b053632cd83ab09",
"score": "0.5505625",
"text": "def method_missing(meth, *args)\n meth = meth.to_s\n klass, task = Thor::Util.find_class_and_task_by_namespace(meth)\n args.unshift(task) if task\n klass.start(args, :shell => self.shell)\n end",
"title": ""
},
{
"docid": "e8b47561a4eb1023a263f09308bf58fd",
"score": "0.5500929",
"text": "def run\n error \"Implement the run method in subclass #{self.class}\"\n 1\n end",
"title": ""
},
{
"docid": "f79d059914471adf23ea254eb6d3e21d",
"score": "0.54984814",
"text": "def launch!\n run!\n end",
"title": ""
},
{
"docid": "32b4f66c83fe97f626114e395f7e34c9",
"score": "0.5496484",
"text": "def invoke;end",
"title": ""
}
] |
38e581ba70f5c1d947489e29d0862a45 | PATCH/PUT /el_sockets/1 PATCH/PUT /el_sockets/1.json | [
{
"docid": "4b8ce747b52bc2c8a44e9515b472c017",
"score": "0.7164548",
"text": "def update\n respond_to do |format|\n if @el_socket.update(el_socket_params)\n format.html { redirect_to @el_socket, notice: 'El socket was successfully updated.' }\n format.json { render :show, status: :ok, location: @el_socket }\n else\n format.html { render :edit }\n format.json { render json: @el_socket.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] | [
{
"docid": "7a77109188b574e6a88f97a6bd2188d1",
"score": "0.6443891",
"text": "def update\n @socket_gem = SocketGem.find(params[:id])\n\n respond_to do |format|\n if @socket_gem.update_attributes(params[:socket_gem])\n format.html { redirect_to @socket_gem, notice: 'Socket gem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @socket_gem.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "455d1b7d7f30b3f202054496198ee961",
"score": "0.64034396",
"text": "def update\n respond_to do |format|\n if @socket_load.update(socket_load_params)\n format.html { redirect_to @socket_load, notice: 'Socket load was successfully updated.' }\n format.json { render :show, status: :ok, location: @socket_load }\n else\n format.html { render :edit }\n format.json { render json: @socket_load.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ab9d2e7f60c4707bd9e2aab191afe28a",
"score": "0.6402112",
"text": "def update\n respond_to do |format|\n if @sock.update(sock_params)\n format.html { redirect_to @sock, notice: 'Sock was successfully updated.' }\n format.json { render :show, status: :ok, location: @sock }\n else\n format.html { render :edit }\n format.json { render json: @sock.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "17cd4b0e3263d83b40a83a1094f6422e",
"score": "0.6143497",
"text": "def update\n @socket_state = SocketState.find(params[:id])\n\n respond_to do |format|\n if @socket_state.update_attributes(params[:socket_state])\n format.html { redirect_to(@socket_state, :notice => 'Socket state was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @socket_state.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8d6a61f3186174209e44862cb0ae05d7",
"score": "0.59758323",
"text": "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"title": ""
},
{
"docid": "4e0e59715d19dce2a47fccc2c67326dd",
"score": "0.59323746",
"text": "def patch!\n request! :patch\n end",
"title": ""
},
{
"docid": "f7c3e6bac5c0e33ccc4049e2da031a4f",
"score": "0.57685536",
"text": "def update\n @frozen_tunnel_io = FrozenTunnelIo.find(params[:id])\n\n respond_to do |format|\n if @frozen_tunnel_io.update_attributes(params[:frozen_tunnel_io])\n format.html { redirect_to @frozen_tunnel_io, notice: 'El tunel de congelado fue editado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @frozen_tunnel_io.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2c6378e09e016487e9790d63801a3692",
"score": "0.57607675",
"text": "def update\n @my_room = MyRoom.find(params[:my_room_id])\n respond_to do |format|\n if @my_rack.update(my_rack_params)\n format.html { redirect_to my_room_my_rack_path(@my_room, @my_rack), notice: 'Стелаж успешно обновлен.' }\n format.json { render :show, status: :ok, location: @my_rack }\n else\n format.html { render :edit }\n format.json { render json: @my_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2e34c4bf6f8b34c6824b6acc9735996c",
"score": "0.57208616",
"text": "def websocket_update\n UpdatesChannel.broadcast_to(user, {loadModels: [self.to_jsonapi]})\n end",
"title": ""
},
{
"docid": "7625e33d8fbd86612b3488cf651ea38c",
"score": "0.56053346",
"text": "def update\n @serverroom = Serverroom.find(params[:id])\n\n respond_to do |format|\n if @serverroom.update_attributes(params[:serverroom])\n format.html { redirect_to @serverroom, notice: 'Serverroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serverroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b1dbba6d0493c2de2e92422e25ac45a3",
"score": "0.557739",
"text": "def set_el_socket\n @el_socket = ElSocket.find(params[:id])\n end",
"title": ""
},
{
"docid": "b1dbba6d0493c2de2e92422e25ac45a3",
"score": "0.557739",
"text": "def set_el_socket\n @el_socket = ElSocket.find(params[:id])\n end",
"title": ""
},
{
"docid": "855f81d29ee8ff100cfefb3479cedcdd",
"score": "0.55727553",
"text": "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"title": ""
},
{
"docid": "eeabc168c7e51de3f6cbc43c6875cb72",
"score": "0.5560172",
"text": "def update\n @fight = Fight.find(params[:id])\n \n secret = '9f8urg90$u3#92u8rh_gu(rfhi8rj*fih'\n\tbegin\n\t\tclient = SocketIO.connect(\"http://localhost:8190\") do\n\t\t after_start do\n\t\t\tobj = { :secret => secret, :action => 'fight', :info => { :status => 'changed' } }\n\t\t\temit(\"tournament-ruby\", obj)\n\t\t\tdisconnect \n\t\t end\n\t\tend\n\trescue\n\tend\n\n respond_to do |format|\n if @fight.update_attributes(params[:fight])\n format.html { redirect_to @fight, notice: 'Fight was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fight.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "576f27e4c99d0868b0454fedc7deba0c",
"score": "0.5554103",
"text": "def update # PATCH\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "6df371222eb48c1e0308fba3fae0c0e0",
"score": "0.55527675",
"text": "def update\n respond_to do |format|\n if @restroom.update(restroom_params)\n format.html { redirect_to @restroom, notice: 'Restroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @restroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "30cd38da8960f6f995a65d39ba883262",
"score": "0.5488531",
"text": "def modify_server(server_uuid, params)\n data = { \"server\" => params }\n json = JSON.generate data\n response = put \"server/#{server_uuid}\", json\n\n response\n end",
"title": ""
},
{
"docid": "9836c8472904b042615f9667b3bc760d",
"score": "0.54863375",
"text": "def update\n @restroom = Restroom.find(params[:id])\n authorize @restroom\n\n respond_to do |format|\n if @restroom.update_attributes(params[:restroom])\n format.html { redirect_to @restroom, notice: 'Restroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @restroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2ec1c39a0f44fe4df453b27be566c436",
"score": "0.54842716",
"text": "def update\n @jetty = Jetty.find(params[:id])\n\n respond_to do |format|\n if @jetty.update_attributes(params[:jetty])\n format.html { redirect_to @jetty, notice: 'Jetty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jetty.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4d885992a555781e3010d3a6c2d22d75",
"score": "0.5482425",
"text": "def update\n respond_to do |format|\n if @chat_room.update_attributes(params[:chat_room])\n format.html { redirect_to @chat_room, notice: 'Chat room was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chat_room.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "57039a2e0ccc62e3ed084530fe7cfb50",
"score": "0.5474027",
"text": "def update\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n respond_to do |format|\n if @server.update_attributes(params[:server])\n @server.send_update\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d2ccd6f3a989d221ab7994853c7da50b",
"score": "0.5472419",
"text": "def update\n respond_to do |format|\n if @smpl_chat.update(smpl_chat_params)\n format.html { redirect_to @smpl_chat, notice: 'Smpl chat was successfully updated.' }\n format.json { render :show, status: :ok, location: @smpl_chat }\n else\n format.html { render :edit }\n format.json { render json: @smpl_chat.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "060fa61671f82610a76ad0ac8cf874e3",
"score": "0.5468104",
"text": "def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"title": ""
},
{
"docid": "df8948b082c66813a5b75b255fd36e3c",
"score": "0.54671854",
"text": "def update\n respond_to do |format|\n if @net_rack.update(net_rack_params)\n format.html { redirect_to @net_rack, notice: 'Net rack was successfully updated.' }\n format.json { render :show, status: :ok, location: @net_rack }\n else\n format.html { render :edit }\n format.json { render json: @net_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d4ef989d8743bdf8c57e55d4d894dddc",
"score": "0.5466511",
"text": "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"title": ""
},
{
"docid": "ce0305ec10eaa8cb7031bee795427c7c",
"score": "0.5438351",
"text": "def update\n if @room.update(room_params)\n head :no_content\n else\n render json: @room.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "c46fe188e2f9b7019c2a94ea74853cb6",
"score": "0.5432597",
"text": "def update_app data={}\n put '/app', data\n end",
"title": ""
},
{
"docid": "ff1847eb5e36c1e05dde029eb6a38bef",
"score": "0.5431627",
"text": "def update\n @protocol = Protocol.find(params[:id])\n\n respond_to do |format|\n if @protocol.update_attributes(params[:protocol])\n format.html { redirect_to @protocol, notice: 'Protocol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @protocol.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "54f95a361000b6219275e377b8bf4555",
"score": "0.54259735",
"text": "def update options={}\n client.put(\"/#{id}\", options)\n end",
"title": ""
},
{
"docid": "dbb344abb971369ada7f4157e97368a9",
"score": "0.5425443",
"text": "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"title": ""
},
{
"docid": "e811f8afab0689e454ed89a8641b8996",
"score": "0.5420563",
"text": "def update\n @room = Room.find(params[:id])\n\n if @room.update_attributes(params[:room])\n head :ok\n else\n render :json => @room.errors, :status => :unprocessable_entity \n end\n end",
"title": ""
},
{
"docid": "b474562a86e8900ab8353bdba73a54b3",
"score": "0.5419276",
"text": "def update\n @restroom = Restroom.find(params[:id])\n authorize! :update, @restroom\n\n respond_to do |format|\n if @restroom.update_attributes(params[:restroom])\n format.html { redirect_to @restroom, notice: 'Restroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b474562a86e8900ab8353bdba73a54b3",
"score": "0.5419276",
"text": "def update\n @restroom = Restroom.find(params[:id])\n authorize! :update, @restroom\n\n respond_to do |format|\n if @restroom.update_attributes(params[:restroom])\n format.html { redirect_to @restroom, notice: 'Restroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c14d150fffadad858f44f395661920f1",
"score": "0.5416857",
"text": "def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end",
"title": ""
},
{
"docid": "30cc9cc9936690c31bd11cc03d087439",
"score": "0.5394819",
"text": "def update\n authenticate_user!\n @server = Server.find(params[:id])\n\n respond_to do |format|\n if @server.update_attributes(params[:server])\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "040c39c830e48d2f28b9090b537a2d18",
"score": "0.5393903",
"text": "def update\n # actions\n path = URI(@endpoint).path\n action = URI(@req.request_uri).path.sub(path, '').split('/')\n action -= ['']\n if action.include?('_history')\n @actions = [action[0], '_history']\n else\n @actions = [action[0]]\n end\n\n # search param\n req_query = URI(@req.request_uri).query\n unless req_query.nil?\n @req_params = URI::decode_www_form(req_query).to_h\n end\n\n # requst method\n if @req.request_method == \"GET\" and @actions.include? '_history'\n @req_method = 'vread'\n elsif @req.request_method == \"GET\" and @req_params != nil\n @req_method = 'search-type'\n elsif @req.request_method == \"PUT\"\n @req_method = 'update'\n elsif @req.request_method == \"POST\"\n @req_method = 'create'\n else\n @req_method = 'read'\n end\n\n # interaction\n int1 = Interaction.last type: @actions[0], code: @req_method\n if int1.nil?\n @present = 0\n else\n @present = int1.id\n @intCode = int1.valueCode\n end\n end",
"title": ""
},
{
"docid": "f422b652745a86d74b3af509a074381f",
"score": "0.5384006",
"text": "def update\n @heartbeat = Heartbeat.find(params[:id])\n\n respond_to do |format|\n if @heartbeat.update_attributes(params[:heartbeat])\n format.html { redirect_to @heartbeat, notice: 'Heartbeat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heartbeat.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a67e85557f4cc68744d51b47ac8ca0cd",
"score": "0.537222",
"text": "def update\n @server_rack = ServerRack.find(params[:id])\n\n respond_to do |format|\n if @server_rack.update_attributes(params[:server_rack])\n format.html { redirect_to(@server_rack, :notice => 'Server rack was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @server_rack.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "52a1d0bf81e6f43c5e09e1b77ee6019c",
"score": "0.53695226",
"text": "def update\n @server1 = Server1.find(params[:id])\n\n respond_to do |format|\n if @server1.update_attributes(params[:server1])\n format.html { redirect_to @server1, notice: 'Server was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server1.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d4857011dad2c0f4a109e5c5e32e401f",
"score": "0.53556323",
"text": "def patch(uri, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "74a644257224417cf75fed8fcd1f1629",
"score": "0.53383684",
"text": "def patch_resource(payload)\n execute(resource_path, method: :patch, payload: payload.to_json)\n end",
"title": ""
},
{
"docid": "73c11f08f04afff5d614d585e07c086c",
"score": "0.533643",
"text": "def update\n @chatroom = Chatroom.find(params[:id])\n\n respond_to do |format|\n if @chatroom.update_attributes(params[:chatroom])\n format.html { redirect_to @chatroom, notice: 'Chatroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chatroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c0987bfad4b92fad137d6b0c6cc30490",
"score": "0.53301424",
"text": "def update\n\t\t\t# assumes body is JSON - more handling could be done using the params (which hold parsed JSON data).\n\t\t\tbroadcast :_push, request[:body] \n\t\t\t{message: 'write_chat', data: {id: params[:id], token: cookies['example_token'], example_data: 'message sent.'}}.to_json\n\t\tend",
"title": ""
},
{
"docid": "37e24e6e93aef54bfeb35cb340945ff1",
"score": "0.53208977",
"text": "def update\n @hostel_room = HostelRoom.find(params[:id])\n\n respond_to do |format|\n if @hostel_room.update_attributes(params[:hostel_room])\n format.html { redirect_to @hostel_room, notice: 'Hostel room was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hostel_room.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cb2ec389af41aa9c5369533f287c4dbf",
"score": "0.5305409",
"text": "def update\n @serv = Serv.find(params[:id])\n olddomain=@serv.domain\n oldname=@serv.name\n oldip=@serv.conn.ip\n oldport=@serv.conn.port\n @serv2 = Serv.new(params[:serv])\n if @serv2.mother\n params[:serv][:domain]= @serv2.mother.name\n params[:serv][:mother]=@serv2.mother\n params[:serv][:conn][:ip]=@serv2.mother.conn.ip\n else\n params[:serv][:domain]=nil\n params[:serv][:mother]=nil\n params[:serv][:conn][:ip]=''\n end\n pass=@serv.update_attributes(params[:serv])\n\n if pass\n if @serv.mngbl\n #Si se modifico algo se reinicia el MR a través de los llamados a webservices registrar y remover del núcleo\n http = Net::HTTP.new(\"192.168.119.163\",9999)\n post_params = {'ip' => oldip, 'port' => oldport}\n request = Net::HTTP::Delete.new(\"/mbs/#{olddomain}/#{oldname}\")\n request.set_form_data(post_params)\n begin\n response = http.request(request)\n rescue Errno::ECONNREFUSED\n end\n post_params = {'ip' => @serv.conn.ip, 'port' => @serv.conn.port, 'domain' => @serv.domain, 'type' => @serv.name}\n request = Net::HTTP::Post.new(\"/mbs/register\")\n request.set_form_data(post_params)\n begin\n response = http.request(request)\n rescue Errno::ECONNREFUSED\n end\n end\n end\n respond_to do |format|\n if pass\n newname=@serv.name\n modify_links(oldname,newname)\n format.html { redirect_to servs_url, notice: t('servs.update.notice') }\n format.json { head :no_content }\n else\n @net_eles = NetEle.all\n format.html { render action: \"edit\" }\n format.json { render json: @serv.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4b0e47a033825b896e397e26e8e5aba9",
"score": "0.53043854",
"text": "def update\n @polling_session = PollingSession.find(params[:id])\n\n respond_to do |format|\n if @polling_session.update_attributes(params[:polling_session])\n format.html { redirect_to @polling_session, notice: 'Polling session was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @polling_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e7663d0348b74542ff1d2f4fd96156fe",
"score": "0.5301208",
"text": "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"title": ""
},
{
"docid": "2cf056dd558dee231a7dda2eacee34d1",
"score": "0.52985334",
"text": "def websocket_update\n json = self.to_jsonapi\n watching_users.each do |user|\n UpdatesChannel.broadcast_to(user, {loadModels: [json]})\n end\n end",
"title": ""
},
{
"docid": "27bf2343b43b279f3787ae78d10bd689",
"score": "0.5287078",
"text": "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"title": ""
},
{
"docid": "a67b079364d1fda9fc8f62901b71c8be",
"score": "0.52860767",
"text": "def update(options)\n message = symbolize_keys(options)\n\n debug \"Sending via Web API\", message\n client.web_client.chat_update(message)\n end",
"title": ""
},
{
"docid": "5c794d10cf973c44cf6b2540429a22f2",
"score": "0.528606",
"text": "def update\n respond_to do |format|\n if @room_config.update(room_config_params)\n format.html { redirect_to @room_config, notice: 'Room config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @room_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9e2ffb957c058b89d11e9af7e97cf595",
"score": "0.52755",
"text": "def update\n respond_to do |format|\n if @room.update_attributes(params[:room])\n format.html { redirect_to @room, notice: 'Room was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "765d7164cee41701ef01fb20d8645882",
"score": "0.5269098",
"text": "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"title": ""
},
{
"docid": "420a0e6a243b80e0b53a3e3a1232256f",
"score": "0.52687764",
"text": "def update\n @server = Server.find(params[:id])\n\n respond_to do |format|\n if @server.update_attributes(params[:server])\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3904a41c961af1d5411eea93fbb04a8b",
"score": "0.5267524",
"text": "def update\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+params[:name]+'\",\n \"description\" : \"'+params[:description]+'\"\n }}'\n response = RestClient::Request.new({\n method: :put,\n url: ENV['API_URL'] + '/widgets/' + params[:id],\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }\n format.json { render :show, status: :ok, location: @widget }\n else\n format.html { render :edit }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a32347d1851af2e30e6f12bd32c60410",
"score": "0.5258767",
"text": "def update\n # NOTE: API V1 dropped support for updating client keys via update (aka PUT),\n # but this code never supported key updating in the first place. Since\n # it was never implemented, we will simply ignore that functionality\n # as it is being deprecated.\n # Delete this comment after V0 support is dropped.\n payload = { name: name }\n payload[:validator] = validator unless validator.nil?\n\n # DEPRECATION\n # This field is ignored in API V1, but left for backwards-compat,\n # can remove after API V0 is no longer supported.\n payload[:admin] = admin unless admin.nil?\n\n begin\n new_client = chef_rest_v1.put(\"clients/#{name}\", payload)\n rescue Net::HTTPClientException => e\n # rescue API V0 if 406 and the server supports V0\n supported_versions = server_client_api_version_intersection(e, SUPPORTED_API_VERSIONS)\n raise e unless supported_versions && supported_versions.include?(0)\n\n new_client = chef_rest_v0.put(\"clients/#{name}\", payload)\n end\n\n Chef::ApiClientV1.from_hash(new_client)\n end",
"title": ""
},
{
"docid": "79b37079894e1e99af9441e3cdb1c4ed",
"score": "0.525617",
"text": "def UpdateForum id,params = {}\n \n APICall(path: \"forums/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"title": ""
},
{
"docid": "544895d43feaa7193e851a5423ea7b3c",
"score": "0.5254204",
"text": "def patch(attrs = nil)\n attrs ||= attributes.changed_attributes\n\n execute_request('PATCH') do |uri, headers|\n HTTP.http_client.patch(\n uri,\n body: adapter.serialize(attrs),\n header: headers.merge(CONTENT_TYPE_HEADERS)\n )\n end\n end",
"title": ""
},
{
"docid": "22884b3cb25ad9875fc7502cf9d64318",
"score": "0.5251507",
"text": "def update\n @cable = Cable.find(params[:id])\n respond_to do |format|\n if @cable.update_attributes(params[:cable])\n format.html { render(:json => {:success => true}) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cable.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7a68825d01521920a556a2e521ee872e",
"score": "0.52484035",
"text": "def update\n respond_to do |format|\n \n if @poll.update(poll_params)\n format.html { redirect_to polls_url, notice: 'Poll was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @poll.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dd18d7e3ed816465d123c0b385caf973",
"score": "0.52465343",
"text": "def update\n respond_to do |format|\n if @api_v1_groups_poll.update(api_v1_groups_poll_params)\n format.html { redirect_to @api_v1_groups_poll, notice: 'Groups poll was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_groups_poll }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_groups_poll.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "806822eceabf5fcd0261bd9acb58283f",
"score": "0.52432954",
"text": "def update\n url = single_url\n payload = attributes_to_payload\n payload[:reset_data] = true\n to_server url, payload\n end",
"title": ""
},
{
"docid": "5d1d0a1cfae8d276693aa145776d8152",
"score": "0.524222",
"text": "def update\n respond_with []\n end",
"title": ""
},
{
"docid": "3d36840cfb38596b3a78bc94e9d23c93",
"score": "0.5242032",
"text": "def update(uri, payload)\n url = \"#{@config[:base_url]}#{@config[:rest_path]}/#{extract_pid(uri)}\"\n request = Request.new(\n \"Put\", url, payload.to_s, {\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json\",\n \"Content-Length\" => \"nnnn\",\n @auth_header => @token\n }\n )\n response = request.perform\n response\n end",
"title": ""
},
{
"docid": "b954969aa342d44c2b5787a374326a7b",
"score": "0.52305156",
"text": "def patch(attrs = nil)\n attrs ||= attributes.changed_attributes\n execute_request do\n faraday_connection.patch { |req| req.body = adapter.serialize(attrs) }\n end\n end",
"title": ""
},
{
"docid": "909b760f54f181542cb95aee2413689b",
"score": "0.5228027",
"text": "def patch\n end",
"title": ""
},
{
"docid": "98ffa158acbf02cbf2dc20af8c117e34",
"score": "0.5223243",
"text": "def update\n put :update\n end",
"title": ""
},
{
"docid": "edbf5fd8e0ed362a99a20d5bdbd18cbf",
"score": "0.52139235",
"text": "def update\n @scrobble = Scrobble.find(params[:id])\n\n respond_to do |format|\n if @scrobble.update_attributes(params[:scrobble])\n format.html { redirect_to @scrobble, notice: 'Scrobble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scrobble.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0069f67c551ec0d8ed7de0067d307e80",
"score": "0.52130204",
"text": "def update\n respond_to do |format|\n if @endpoint.update(endpoint_params)\n format.html { redirect_to root_url, notice: 'Endpoint was successfully updated.' }\n format.json { head :ok }\n else\n format.html { head :unprocessable_entity }\n format.json { render json: @endpoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "58bcec6a5a31f99db11bee208c847cf8",
"score": "0.52129513",
"text": "def updateClients request\n @clients.each do |client|\n unless client == @lastClient\n client.socket.write request\n end\n end\n end",
"title": ""
},
{
"docid": "d37b39a795a6e081d6480942ece1c538",
"score": "0.5210861",
"text": "def put!\n request! :put\n end",
"title": ""
},
{
"docid": "dceba71f520bee003b3d75965ac7c649",
"score": "0.5201769",
"text": "def update\n respond_to do |format|\n if @request_room.update(request_room_params)\n format.html { redirect_to @request_room, notice: 'Request room was successfully updated.' }\n format.json { render :show, status: :ok, location: @request_room }\n else\n format.html { render :edit }\n format.json { render json: @request_room.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de318c04f3162f041169dbcafed85575",
"score": "0.5193137",
"text": "def update\n @server = Server.find(params[:id])\n if params[:tag_ids]\n @server.tags = params[:tag_ids].map { |id| Tag.find(id) }\n end\n respond_to do |format|\n if @server.update_attributes(params[:server])\n format.html { redirect_to servers_path, notice: 'Server was successfully updated.' }\n format.json { render json: @server, status: :updated, location: @server }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "38106303e4fbb5860e1b0ab94343cbe6",
"score": "0.51862377",
"text": "def update\n\n respond_to do |format|\n if @room.update(room_params_update)\n format.html { redirect_to @room, :flash => { success: 'Room was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "95c3a59299dfe9bfb3d89590ccb85f11",
"score": "0.5182256",
"text": "def update\n if @room.update(room_params)\n render json: @room, status: :ok, serializer: RoomSerializer\n else\n render json: @room.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "695d2fd5fb64aa54b2787be68f016e7c",
"score": "0.5181818",
"text": "def update\n respond_to do |format|\n name = Server.find(params[:id]).name\n n = Neography::Node.find('servers', 'name', name)\n n.name = server_params[:name]\n n.add_to_index('servers', 'name', server_params[:name]) #TODO: is this necessary?\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e9c2f02c1becff571541e0efe2067cb6",
"score": "0.5178977",
"text": "def update\n @heartbeat = Heartbeat.find(params[:id])\n\n if @heartbeat.update(heartbeat_params)\n head :no_content\n else\n render json: @heartbeat.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "9333ff4eb6c420cf30cbdf0d3874a211",
"score": "0.51757425",
"text": "def update\n respond_to do |format|\n if @room.update(room_params)\n format.html { redirect_to @room, notice: 'Room was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "71b7fe0e3d519152b900f2a51d8e98cd",
"score": "0.5175689",
"text": "def update\n @chat = Chat.find(params[:id])\n\n respond_to do |format|\n if @chat.update_attributes(params[:chat])\n format.html { redirect_to @chat, notice: 'Chat was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chat.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ffcc3f9a7dcc39e738fcb58e85a57f35",
"score": "0.51733404",
"text": "def update\n @protocol = Protocol.find(params[:id])\n\n respond_to do |format|\n if @protocol.update_attributes(params[:protocol])\n flash[:notice] = 'Protocol was successfully updated.'\n format.html { redirect_to(@protocol) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @protocol.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "85d2ed02d760acd40f7badcfec78a18a",
"score": "0.5169769",
"text": "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"title": ""
},
{
"docid": "f4d43ce52d8f679704d6a8990c46d4ad",
"score": "0.5169264",
"text": "def update\n @poll = Poll.find(params[:id])\n\n respond_to do |format|\n if @poll.update_attributes(params[:poll])\n format.html { redirect_to @poll, notice: 'Poll was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poll.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f4d43ce52d8f679704d6a8990c46d4ad",
"score": "0.5169264",
"text": "def update\n @poll = Poll.find(params[:id])\n\n respond_to do |format|\n if @poll.update_attributes(params[:poll])\n format.html { redirect_to @poll, notice: 'Poll was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poll.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e4d546ad8ff1b8a69358795759c24d37",
"score": "0.51618016",
"text": "def update\n respond_to do |format|\n if @chat.update(chat_params)\n format.html { redirect_to @chat, notice: 'Chat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chat.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e4d546ad8ff1b8a69358795759c24d37",
"score": "0.51618016",
"text": "def update\n respond_to do |format|\n if @chat.update(chat_params)\n format.html { redirect_to @chat, notice: 'Chat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chat.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "593a44661145186c50e85fe3c02ffd96",
"score": "0.5159299",
"text": "def patch(path, params = {})\n request(:patch, path, params)\n end",
"title": ""
},
{
"docid": "593a44661145186c50e85fe3c02ffd96",
"score": "0.5159299",
"text": "def patch(path, params = {})\n request(:patch, path, params)\n end",
"title": ""
},
{
"docid": "1c8484a8480f3ea22af3d572d7532e9e",
"score": "0.51520395",
"text": "def update\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.attributes = params[:physical_rack]\n @physical_rack.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @physical_rack.save\n format.html { redirect_to @physical_rack, notice: 'Physical rack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physical_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fb88fef9ffa0d872f40dcfb6a7c29bc5",
"score": "0.5151909",
"text": "def patch(path, opts = {})\n request(:patch, path, opts).body\n end",
"title": ""
},
{
"docid": "dfc587cff004deee048079dbf1d83051",
"score": "0.5150934",
"text": "def update\n @telecom_room = TelecomRoom.find(params[:id])\n\n respond_to do |format|\n if @telecom_room.update_attributes(params[:telecom_room])\n format.html { redirect_to(@telecom_room, :notice => 'TelecomRoom was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @telecom_room.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2d3ab68c9f829ce3988758360e75ed21",
"score": "0.51484203",
"text": "def update\n respond_to do |format|\n if @protocol.update(protocol_params)\n format.html { redirect_to protocols_url, notice: 'Protocolo actualizado.' }\n format.json { head :no_content }\n else\n format.html { render :show }\n format.json { render json: @protocol.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f8cca4716bd9fcdc52d48da8ebcfd335",
"score": "0.51481706",
"text": "def update\n @protocol = Protocol.find(params[:id])\n @title = \"Protocol\"\n\n respond_to do |format|\n if @protocol.update_attributes(params[:protocol])\n format.html { redirect_to(@protocol, :notice => 'Protocol was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @protocol.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "21c1ee1de0e343512014e708a46bef14",
"score": "0.5142254",
"text": "def updateX\n @server = Server.find(params[:id])\n\n respond_to do |format|\n if @server.update_attributes(params[:server])\n format.html { redirect_to(@server, :notice => 'Server was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @server.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "888d9429671974540c73ad50c723fb41",
"score": "0.51376295",
"text": "def update\n respond_to do |format|\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "888d9429671974540c73ad50c723fb41",
"score": "0.51376295",
"text": "def update\n respond_to do |format|\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "888d9429671974540c73ad50c723fb41",
"score": "0.51376295",
"text": "def update\n respond_to do |format|\n if @server.update(server_params)\n format.html { redirect_to @server, notice: 'Server was successfully updated.' }\n format.json { render :show, status: :ok, location: @server }\n else\n format.html { render :edit }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3ebf3ea74e334d724a09203238d5c027",
"score": "0.5137109",
"text": "def update\n respond_to do |format|\n if @chatroom.update(chatroom_params)\n format.html { redirect_to @chatroom, notice: 'Chatroom was successfully updated.' }\n format.json { render :show, status: :ok, location: @chatroom }\n else\n format.html { render :edit }\n format.json { render json: @chatroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3ebf3ea74e334d724a09203238d5c027",
"score": "0.5137109",
"text": "def update\n respond_to do |format|\n if @chatroom.update(chatroom_params)\n format.html { redirect_to @chatroom, notice: 'Chatroom was successfully updated.' }\n format.json { render :show, status: :ok, location: @chatroom }\n else\n format.html { render :edit }\n format.json { render json: @chatroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9c5494909f90f4513f3de8c9e2017737",
"score": "0.51361024",
"text": "def update!(**args)\n @actor = args[:actor] if args.key?(:actor)\n @etag = args[:etag] if args.key?(:etag)\n @events = args[:events] if args.key?(:events)\n @id = args[:id] if args.key?(:id)\n @ip_address = args[:ip_address] if args.key?(:ip_address)\n @kind = args[:kind] if args.key?(:kind)\n @owner_domain = args[:owner_domain] if args.key?(:owner_domain)\n end",
"title": ""
}
] |
18e488c509d7b1f824e9fbeff6e494db | Returns "Test Acct Continue" button | [
{
"docid": "440ba2ec9467b1ec936d097eebe7375c",
"score": "0.7484411",
"text": "def paypal_test_acct_continue_button\n\t\t$tracer.trace(__method__)\n\t\t# return ToolTag.new(input.id(\"continue\"), __method__, self)\n return ToolTag.new(input.className(\"/continueButton/\"), __method__, self)\n\tend",
"title": ""
}
] | [
{
"docid": "0c3744669a591f818b76e389fb960c6e",
"score": "0.7716119",
"text": "def click_continue_button\n click_button(@continue_button_text)\n end",
"title": ""
},
{
"docid": "0c3744669a591f818b76e389fb960c6e",
"score": "0.7716119",
"text": "def click_continue_button\n click_button(@continue_button_text)\n end",
"title": ""
},
{
"docid": "0c3744669a591f818b76e389fb960c6e",
"score": "0.7716119",
"text": "def click_continue_button\n click_button(@continue_button_text)\n end",
"title": ""
},
{
"docid": "0c3744669a591f818b76e389fb960c6e",
"score": "0.7716119",
"text": "def click_continue_button\n click_button(@continue_button_text)\n end",
"title": ""
},
{
"docid": "f9c47eec60eba05220cc063f852f3d07",
"score": "0.7553636",
"text": "def paypal_test_acct_continue_button\n\t\t# unit_test_no_generate: paypal_test_acct_continue_button, input.id(\"continue\")\n $tracer.trace(__method__)\n return ToolTag.new(input.id(\"continue\"), __method__, self)\n end",
"title": ""
},
{
"docid": "2df40cbe7a562c127a1d4dfc12d051f3",
"score": "0.73763317",
"text": "def paypal_test_acct_continue_button\n # unit_test_no_generate: paypal_test_acct_continue_button, input.id(\"continue\")\n $tracer.trace(__method__)\n return ToolTag.new(input.className(\"/continueButton/\"), __method__, self)\n end",
"title": ""
},
{
"docid": "af25ffa0692e9d9502070db3ab2caa8e",
"score": "0.71788245",
"text": "def continue\n @browser.button(text: 'Continue').click\n @browser.h1(text: 'Success!').present?\n end",
"title": ""
},
{
"docid": "2b1f114412a7d5a498aaf63e1cfb6da2",
"score": "0.7082615",
"text": "def pur_continue_button\n\t\t# unit_test_no_generate: pur_continue_button, button.className(create_ats_regex_string(\"ats-pursuccesscontinuebtn\"))\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(button.className(create_ats_regex_string(\"ats-pursuccesscontinuebtn\")), __method__)\n end",
"title": ""
},
{
"docid": "4d12197661c825781f2edc11d1f38671",
"score": "0.7072305",
"text": "def click_continue\n page.execute_script('$(\"input[value=\\\"Continue\\\"]\").trigger(\"click\")')\n # click_button 'Continue'\nend",
"title": ""
},
{
"docid": "8950a90bffd63d8b1dafb2cdbe5f335e",
"score": "0.7043956",
"text": "def continue_button\n\t\t# unit_test_no_generate: continue_button, jquery(\"a[class~='ats-continue-button'], input[class~='ats-continue-button']\")\n $tracer.trace(__method__)\n return ToolTag.new(jquery(\"a[class~='ats-continue-button'], input[class~='ats-continue-button']\"), __method__, self)\n end",
"title": ""
},
{
"docid": "32fb1d66e86a8ae71111c37163063136",
"score": "0.6997843",
"text": "def activate_pur_continue_button\n\t\t# unit_test_no_generate: activate_pur_continue_button, button.className(create_ats_regex_string(\"ats-purcontinuebtn\"))\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(button.className(create_ats_regex_string(\"ats-purcontinuebtn\")), __method__)\n\tend",
"title": ""
},
{
"docid": "bcf224a5d359f2815b67c13ecfa4dc96",
"score": "0.69201595",
"text": "def continue\n frm.button(:value=>\"Continue\").click\n ConfirmSiteSetup.new(@browser)\n end",
"title": ""
},
{
"docid": "0fe5574e745bc7a515f37092f5ab8edb",
"score": "0.6885075",
"text": "def attack_and_confirm\n click_button 'Attack'\n click_button 'OK'\nend",
"title": ""
},
{
"docid": "5181f55f1cff06f2381e2d9f1e1883ea",
"score": "0.68080676",
"text": "def redemption_continue_button\n\t\t# unit_test_no_generate: redemption_continue_button, jquery(\"a[class~='ats-continue-button'], input[class~='ats-continue-button']\")\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(jquery(\"a[class~='ats-continue-button'], input[class~='ats-continue-button']\"), __method__, self)\n\tend",
"title": ""
},
{
"docid": "2126dbc31094551b11c9768e176de484",
"score": "0.67473656",
"text": "def begin_assessment\n frm.button(:value=>\"Begin Assessment\").click\n end",
"title": ""
},
{
"docid": "2126dbc31094551b11c9768e176de484",
"score": "0.67473656",
"text": "def begin_assessment\n frm.button(:value=>\"Begin Assessment\").click\n end",
"title": ""
},
{
"docid": "9996b0142734ad94311ad23b7d9298cb",
"score": "0.65779567",
"text": "def select_external_claim_admin_confirm_continune\n Element.new(\"aaaa.EntitlementResultsView.Continue\", key: :id, wait: @explicit_wait_time).click\n end",
"title": ""
},
{
"docid": "2968e7b2b10273ec9c2767bff69baa90",
"score": "0.65696424",
"text": "def paypal_continue_button\n $tracer.trace(__method__)\n return ToolTag.new(button(\"Continue To PayPal\"), __method__, self)\n end",
"title": ""
},
{
"docid": "b87947a82ed469d2fa0b1ddd4a0e8980",
"score": "0.65175414",
"text": "def proceed_to_checkout\n custom_click_button :title, 'Proceed to Checkout'\n end",
"title": ""
},
{
"docid": "711dc54a0e3e80cbc38575b6c32bf517",
"score": "0.6470327",
"text": "def continue\n frm.button(:value=>\"Continue\").click\n BuildTemplate.new(@browser)\n end",
"title": ""
},
{
"docid": "711dc54a0e3e80cbc38575b6c32bf517",
"score": "0.6470327",
"text": "def continue\n frm.button(:value=>\"Continue\").click\n BuildTemplate.new(@browser)\n end",
"title": ""
},
{
"docid": "05d7a5f8e4e9d7941009bcc38299bd5c",
"score": "0.64046866",
"text": "def click_on_confirm_ok\n verify_confirm_dialog_visible!\n click_on 'tb-confirm-ok-btn'\n end",
"title": ""
},
{
"docid": "9b8de5a5cb383389d82820152a2ffbee",
"score": "0.6353984",
"text": "def continue\n frm.button(:value=>\"Continue\").click\n TakeAssessmentList.new(@browser)\n end",
"title": ""
},
{
"docid": "9b8de5a5cb383389d82820152a2ffbee",
"score": "0.6353984",
"text": "def continue\n frm.button(:value=>\"Continue\").click\n TakeAssessmentList.new(@browser)\n end",
"title": ""
},
{
"docid": "8c0263fd515e2818b61735dc22c1bc0b",
"score": "0.6317998",
"text": "def come_on_in_button\n $tracer.trace(__method__)\n # unit_test_no_generate: come_on_in_button, a.className(create_ats_regex_string('ats-continue-button'))\n return ToolTag.new(a.className(create_ats_regex_string('ats-continue-button')), __method__, self)\n end",
"title": ""
},
{
"docid": "2faec81c1146de2fc79ad0f350f0d6df",
"score": "0.63014007",
"text": "def test_dtm_st_053\n printf \"\\n+ Test 053\"\n open_target_setting_page\n assert $display_metric[\"add_subtask_button\"], @selenium.get_text($display_metric_xpath[\"add_subtask_button\"])\n logout\n end",
"title": ""
},
{
"docid": "fb952467df9a21578ab5b2ae7db7b87e",
"score": "0.6224466",
"text": "def ContinueWithoutAccountButton\n if (ENV['PLATFORM']=='Android')\n wait{$driver.find_element(:id, \"vivino.web.app.beta:id/continue_without_account\").displayed? }\n return $driver.find_element(:id, \"vivino.web.app.beta:id/continue_without_account\")\n else\n raise \"This control is not implemented yet\"\n end\n end",
"title": ""
},
{
"docid": "bf567c291ddf7a64081f273dace84006",
"score": "0.620843",
"text": "def expect_main_cta\n page.assert_selector('.manager__cockpit__add-insurances-cta__btn__large-text')\n end",
"title": ""
},
{
"docid": "0efbec0955ed5a971150667940b9cf31",
"score": "0.6206683",
"text": "def comp_create_account_button\n click_button 'Create an account'\n end",
"title": ""
},
{
"docid": "204388b46dde842948274e5c093eca9f",
"score": "0.6202094",
"text": "def signup_page_element\n @browser.button(value: 'Continue').wait_until(&:present?)\n end",
"title": ""
},
{
"docid": "6d186dc96b10321b5968122b77b7ad57",
"score": "0.61970955",
"text": "def choose_ok_on_next_confirmation()\n do_command(\"chooseOkOnNextConfirmation\", [])\n end",
"title": ""
},
{
"docid": "7386e45ed83cbd40d4c8c54277d40cd7",
"score": "0.6183336",
"text": "def continue\n frm.button(:value=>\"Continue\").click\n EditSiteTools.new(@browser)\n end",
"title": ""
},
{
"docid": "35ec104db61e4e249c7ed3fd71b3e27f",
"score": "0.6171638",
"text": "def sub_b\n \t@browser.button(:text, \"Create Account\").click\n end",
"title": ""
},
{
"docid": "e101122296303e0255d4d28e1487dee1",
"score": "0.61529",
"text": "def test_successfull_login \n Keywords.new().enter_valid_user_id(@driver,\"user-id\")\n Keywords.new().enter_password(@driver,\"password\")\n Keywords.new().click_button(@driver)\n assert_equal(ObjectRepository::NEXT_PAGE_TITLE,@driver.title(),\"Login Successful\")\n end",
"title": ""
},
{
"docid": "72816d6fd8d05217d5ad32755beff823",
"score": "0.61396223",
"text": "def continue\n frm.button(:value=>\"Continue\").click\n CourseSiteInfo.new(@browser)\n end",
"title": ""
},
{
"docid": "5cfc6d2b68ae60a698f9dcc1837f40b6",
"score": "0.6139533",
"text": "def click_continue\n logger.debug 'Clicking continue'\n wait_for_load_and_click_js continue_button_element\n end",
"title": ""
},
{
"docid": "9f62b067eb41e0bb19883d4127d4932d",
"score": "0.61183894",
"text": "def test_015\n printf \"\\n+ Test 015\"\n access_analysis_result_report_page_as_reviewer\n\n # checks \"WarningListing\" button\n assert(is_element_present(element_xpath(\"warning_listing_button\")))\n\n # \"Show comments\" button must exist\n assert(is_element_present(element_xpath(\"show_comments_button\")))\n\n logout\n end",
"title": ""
},
{
"docid": "7b711f1c765385a46c1bfa9c6f92cb69",
"score": "0.61033344",
"text": "def continue\n frm.button(:value=>\"Continue\").click\n SupportingFilesPortfolio.new(@browser)\n end",
"title": ""
},
{
"docid": "7b711f1c765385a46c1bfa9c6f92cb69",
"score": "0.61033344",
"text": "def continue\n frm.button(:value=>\"Continue\").click\n SupportingFilesPortfolio.new(@browser)\n end",
"title": ""
},
{
"docid": "6f3fec5afa986a658de82309560e768e",
"score": "0.6086974",
"text": "def test_without_a_credit_card_set_we_prompt_you_to_add_one\n login_as(@user)\n get settings_billing_path\n\n assert css_select(\".button\").collect(&:text).any? { |t| t.include?(\"Add credit card\") }\n end",
"title": ""
},
{
"docid": "8ef7548fc264cd4e2fede00489958a7f",
"score": "0.6084257",
"text": "def click_accept_button\n click_button(@accept_button_text)\n end",
"title": ""
},
{
"docid": "440bf2b5a501b3c69bbfb86ec9117262",
"score": "0.6068322",
"text": "def foresee_decline?\n @browser.button(:id => \"decline\").exists? && @browser.button(:id => \"decline\").visible?\nend",
"title": ""
},
{
"docid": "91e56486c2d63445ac9573e812d923ce",
"score": "0.6056038",
"text": "def test_dtm_st_051\n printf \"\\n+ Test 051\"\n open_target_setting_page\n assert $display_metric[\"save_button\"], @selenium.get_text($display_metric_xpath[\"save_button\"])\n logout\n end",
"title": ""
},
{
"docid": "1f08522a07b81e7744ccb87bdde59342",
"score": "0.6050568",
"text": "def comp_signin_button\n click_button 'Sign in'\n end",
"title": ""
},
{
"docid": "c10f033b9970339f5519da11219681b3",
"score": "0.60488576",
"text": "def test_request_button_auth_redirect\n skip \"Horizon Unavailable\" if horizon_unavailable?\n visit '/catalog/bib_305929'\n first('div.holding-visible').click\n first('a.item-children-link').click\n first('a.request').click\n assert page.has_no_content?('Network Error')\n assert page.has_content?('Login')\n end",
"title": ""
},
{
"docid": "d51d5a6249916476730f103dcc89723e",
"score": "0.60476685",
"text": "def next\n frm.button(:value=>\"Next\").click\n BeginAssessment.new(@browser)\n end",
"title": ""
},
{
"docid": "d51d5a6249916476730f103dcc89723e",
"score": "0.60476685",
"text": "def next\n frm.button(:value=>\"Next\").click\n BeginAssessment.new(@browser)\n end",
"title": ""
},
{
"docid": "2e15788c98f66aff0f541b2c19c9d751",
"score": "0.6024548",
"text": "def select_external_claim_admin_continue\n Element.new(\"aaaa.EntitleClaimView.Continue\", key: :id, wait: @explicit_wait_time).click\n sleep(@explicit_wait_time)\n\n # Handle incorrect Service Delivery Type\n errors = nil\n begin\n errors = read_errors\n if errors.include? @settings[:errors][:service_delivery_type_not_authorized]\n select_service_delivery_type(\"Carry-in\")\n end\n sleep(@explicit_wait_time)\n Element.new(\"aaaa.EntitleClaimView.Continue\", key: :id, wait: @explicit_wait_time).click\n sleep(@explicit_wait_time)\n rescue\n end\n\n\n # Handle existing claim within 30 days warning\n begin\n switch_to_popup_iframe\n continue_button = Element.new(\"//table[@class=\\\"urPWButtonTable\\\"]/tbody/tr/td[1]/a\", key: :xpath)\n rescue\n ExistingClaimError.new(\"Claim already exists for this serial. #{details_message}\\n\")\n ensure\n switch_to_external_claim_admin_iframe\n end\n end",
"title": ""
},
{
"docid": "d07767dc1d876e94ec3ba99cdc6ed5e8",
"score": "0.5986392",
"text": "def set_btn_name\n !(@target =~ /invoice/i).nil? ? 'Next' : 'Save'\n end",
"title": ""
},
{
"docid": "9ede8fbea0cad0846453a6e46e253023",
"score": "0.5983141",
"text": "def NextButtonCreateAccount\n if (ENV['PLATFORM']=='Android')\n wait{$driver.find_element(:id, \"vivino.web.app.beta:id/action_next\").displayed? }\n return $driver.find_element(:id, \"vivino.web.app.beta:id/action_next\")\n else\n raise \"This control is not implemented yet\"\n end\n end",
"title": ""
},
{
"docid": "ef45b0a33bb149c8dfdfd0b72517c7a9",
"score": "0.5981071",
"text": "def continue_shopping_button\n $tracer.trace(__method__)\n # unit_test_no_generate: continue_shopping_button, input.className(create_ats_regex_string(\"ats-continue-shopping-button\"))\n return ToolTag.new(input.className(create_ats_regex_string(\"ats-continue-shopping-button\")), __method__, self)\n end",
"title": ""
},
{
"docid": "01568b0edfe235e0c31a327ff1aac1db",
"score": "0.59631634",
"text": "def test_cancel\n # TODO\n end",
"title": ""
},
{
"docid": "07eb1cb70cfaea75c24f00ac5129b773",
"score": "0.59601027",
"text": "def done\n frm.button(:value=>/Done/).click\n SiteSetup.new(@browser)\n end",
"title": ""
},
{
"docid": "8c6d28f880d2111c7104015dbe6beb59",
"score": "0.5956052",
"text": "def secure_checkout_button\n @page.button('ctl00_contentBody_submit')\n end",
"title": ""
},
{
"docid": "201c1a51147c208cab3ae135d7f86907",
"score": "0.59522873",
"text": "def paypal_test_acct_login_button\n\t\t# unit_test_no_generate: paypal_test_acct_login_button, input.id(\"submitLogin\")\n $tracer.trace(__method__)\n return ToolTag.new(input.id(\"submitLogin\"), __method__, self)\n end",
"title": ""
},
{
"docid": "17f065c10446878a2f6b6a0c35e94e39",
"score": "0.59369946",
"text": "def next_button start\n button \"Next\", :width => 50 do\n if start\n if validate_user_input\n start_tests\n end\n else\n next_page\n end\n end\nend",
"title": ""
},
{
"docid": "ad974e6b4f56df6ee02903d2fe751df1",
"score": "0.59284586",
"text": "def paypal_test_acct_login_button\n\t\t$tracer.trace(__method__)\n\t\t# return ToolTag.new(input.id(\"submitLogin\"), __method__, self)\n return ToolTag.new(input.className(\"/loginBtn/\"), __method__, self)\n\tend",
"title": ""
},
{
"docid": "fb1d19537beb0b8cae36d7908d39ac39",
"score": "0.59258914",
"text": "def botao_entrar\n click_button \"Entrar\"\n end",
"title": ""
},
{
"docid": "3164c9e449f9649e4392f15588104869",
"score": "0.59207326",
"text": "def continue_checkout_button()\n $tracer.trace(__method__)\n return ToolTag.new(a.className(create_ats_regex_string(\"ats-checkoutbtn\")), __method__)\n end",
"title": ""
},
{
"docid": "632bf72859dc1773024dbb87fedb5838",
"score": "0.5919124",
"text": "def continue\n touch(\"* id:'#{button_continue}'\")\n page(LoginScreen)\n end",
"title": ""
},
{
"docid": "df271e02b62d0bac361402bb436720f4",
"score": "0.59155416",
"text": "def confirm_submit pb\n text_reply(pb, \"Thanks for interacting with me.\")\n text_reply(pb, \"Please feel free to talk to me further as specified by the menu.\")\n text_reply(pb, \"Else, hope to see you again tomorrow! FYI, click on the menu icon and tap 'I'll create an entry now.' to make another entry.\")\n end",
"title": ""
},
{
"docid": "b5b0beb355398b43d5fab8f1dc4a9f34",
"score": "0.5914039",
"text": "def tap_button_test\n tap_when_element_exists(trait, timeout: 36)\n print \"TestDemo \\n\"\n end",
"title": ""
},
{
"docid": "4457325d3fa114a8561de550799ea099",
"score": "0.590146",
"text": "def view_account_cta()\n return $test_driver.find_element(:xpath => \"//div[@class='account-dropdown logged']/a[@class='button']\")\n end",
"title": ""
},
{
"docid": "7544baf142c5ac3d87af897852dbbb91",
"score": "0.59012514",
"text": "def click_finalizar_compra_button\nclick_on 'Finalizar Compra'\nend",
"title": ""
},
{
"docid": "4c9b1601d1956fb545ff7eb005c0395f",
"score": "0.5891074",
"text": "def continue\n frm.button(:value=>\"Continue\").click\n PortfolioContent.new(@browser)\n end",
"title": ""
},
{
"docid": "4c9b1601d1956fb545ff7eb005c0395f",
"score": "0.5891074",
"text": "def continue\n frm.button(:value=>\"Continue\").click\n PortfolioContent.new(@browser)\n end",
"title": ""
},
{
"docid": "d1ee351e3c7bbece02b7fbf056454b1d",
"score": "0.5882584",
"text": "def login_button # :doc:\n @browser.button(:class => \"submit\")\n end",
"title": ""
},
{
"docid": "f6c663e8e1425fdfcce3ca85b54cca93",
"score": "0.5882269",
"text": "def display_continue_button situation, group\n display = ''\n if group.get_next_displayable_question(situation).blank?\n display = submit_tag \"Continue\", :class => \"button\", :id => \"continue\", :name => \"continue\"\n else\n\t\t display = submit_to_remote(\"continue\", \"Continue\", \n \t\t\t:html \t\t\t=> { :class => \"button\", :id => \"continue\" },\n :url\t\t\t\t=> { :controller => \"situations\", :action => \"jwoww\", :group_id => @group.id, :submit => 'continue'},\n \t\t\t:update\t\t\t=> \"group\",\n :before\t\t\t=> \"Element.show('continue_spinner')\",\n :complete\t\t=> \"Element.hide('continue_spinner')\",\n :with => \"Form.serialize(this.form)\"\n )\n end\n\t\tdisplay << image_tag('ajax-loader.gif', :id => \"continue_spinner\", :style => \"float:right; display:none;\")\n end",
"title": ""
},
{
"docid": "727d31811c17eafde17ddf8d3c8b85bb",
"score": "0.586245",
"text": "def clickGoButton()\n @driver.find_element(GO_BUTTON).click()\n end",
"title": ""
},
{
"docid": "5958a4ea104334906b36b4e85813c431",
"score": "0.5856759",
"text": "def start_run\n 'Click the <b>Start Run</b> button'\n end",
"title": ""
},
{
"docid": "009b0059157e5b1c25cb18a3b415ef39",
"score": "0.58566546",
"text": "def click_go\n $browser.button(:id=>'Go').click\n end",
"title": ""
},
{
"docid": "9c34849a43dc28d726b078446077b699",
"score": "0.5855784",
"text": "def click\n wait_until_exists\n @button.click\n end",
"title": ""
},
{
"docid": "2ba76cfb09d5880065e7c0092369be9f",
"score": "0.5852302",
"text": "def tap_button_text\n print \"Click button Text \\n\"\n tap_when_element_exists(trait, timeout: 60)\n print \"Clicked button Text \\n\"\n end",
"title": ""
},
{
"docid": "81eda596cfc81bf8bcaac8d91557cef2",
"score": "0.5851047",
"text": "def clickOnConfirm()\n el= @driver.find_element(:xpath, \"//a[contains(text(),'Yes, Flag this Post')]\")\n el.click\n end",
"title": ""
},
{
"docid": "ab103057c8bff0e5338c5463e52edb5a",
"score": "0.5850175",
"text": "def test_confirm\n assert_raise( RuntimeError) { Tui::Core::Term::confirm( '', 'x'); }\n end",
"title": ""
},
{
"docid": "c42e107953c01a499875c81d5eef1e17",
"score": "0.5832445",
"text": "def complete\n\t\tclick(Comp_Btn)\n\tend",
"title": ""
},
{
"docid": "4d06c07c1bca95c215fde7191a8ee1bd",
"score": "0.5831663",
"text": "def continue #FIXME\n if frm.button(:id, \"submitBuildOwn\").enabled?\n frm.button(:id, \"submitBuildOwn\").click\n elsif frm.button(:id, \"submitFromTemplateCourse\").enabled?\n frm.button(:id, \"submitFromTemplateCourse\").click\n elsif frm.button(:id, \"submitFromTemplate\").enabled?\n frm.button(:id, \"submitFromTemplate\").click\n=begin\n elsif frm.button(:value=>\"Continue\", :index=>$frame_index).enabled?\n frm.button(:value=>\"Continue\", :index=>$frame_index).fire_event(\"onclick\")\n elsif frm.button(:value=>\"Continue\", :index=>$frame_index).enabled?\n frm.button(:value=>\"Continue\", :index=>$frame_index).fire_event(\"onclick\")\n elsif frm.button(:value=>\"Continue\", :index=>2).enabled?\n frm.button(:value=>\"Continue\", :index=>2).fire_event(\"onclick\")\n else\n frm.button(:value=>\"Continue\", :index=>2).fire_event(\"onclick\")\n=end\n end\n \n if frm.div(:class=>\"portletBody\").h3.text==\"Course/Section Information\"\n CourseSectionInfo.new(@browser)\n elsif frm.div(:class=>\"portletBody\").h3.text==\"Project Site Information\"\n ProjectSiteInfo.new(@browser)\n elsif frm.div(:class=>\"portletBody\").h3.text==\"Portfolio Site Information\"\n PortfolioSiteInfo.new(@browser)\n else\n puts \"Something is wrong on Saturn 3\"\n end\n end",
"title": ""
},
{
"docid": "453939f8aca647b62e6804ce0e32da4c",
"score": "0.5828604",
"text": "def start_again\n click_link(@start_again_link_text)\n end",
"title": ""
},
{
"docid": "023fa6360f09dbcc2901c8f15997e43a",
"score": "0.5818834",
"text": "def login_button_click\r\n click LOGIN_BUTTON\r\n end",
"title": ""
},
{
"docid": "b1ee6e743b6a346b4e7ef456f12deba2",
"score": "0.58138096",
"text": "def continue_action\n RS::AuthorisationHelper.const_get(\"#{srv_code}_CONTINUE\")\n end",
"title": ""
},
{
"docid": "a4fb0ca346ce15c505b97f1d0749ed88",
"score": "0.5812132",
"text": "def positive_test_submit_form\nmytest = TestSteps.new\nmytest.navigate_to_form\nmytest.fill_up_form\nmytest.submit_form\nmytest.assert_form_submission\nend",
"title": ""
},
{
"docid": "0505fd4e9731a0dcbc55c34392a8f5a3",
"score": "0.5811905",
"text": "def click button = \"1\"\n\t\t\tcmd \"click #{button}\"\n\t\tend",
"title": ""
},
{
"docid": "e2c47be59e730fe1a6142ce3bf8dd42c",
"score": "0.5807115",
"text": "def authentication_cancel_button\n # unit_test_no_generate: authentication_cancel_button, button.className(create_ats_regex_string(\"ats-authcancelbtn\"))\n $tracer.trace(__method__)\n return ToolTag.new(button.className(create_ats_regex_string(\"ats-authcancelbtn\")), __method__)\n end",
"title": ""
},
{
"docid": "23813dca0f007e5a208281a93bd47d85",
"score": "0.58039325",
"text": "def activation_account_login_page_navigate()\n continue_link.click\n end",
"title": ""
},
{
"docid": "e2636ad842a19ec444e1db1be1a42f90",
"score": "0.58008206",
"text": "def click_dialog_ok_button\n\tjs = Watir::JavascriptDialog.new\n\tjs.button(\"OK\").click\nend",
"title": ""
},
{
"docid": "c4a3103fdc8039afceb2fcc08e983694",
"score": "0.5785237",
"text": "def click_go\n go_btn.click\n end",
"title": ""
},
{
"docid": "fb09b490456522ba0cdfbedae93f3ca9",
"score": "0.5779983",
"text": "def test_positive\n @driver.find_element(NAME_BOX).send_keys 'Test User'\n @driver.find_element(CHECK_BOX).click\n dropdown_list = @driver.find_element(DROPDOWN_LIST)\n options = dropdown_list.find_elements(tag_name: 'option')\n options.each { |option| option.click if option.text == 'Cucumber' }\n @driver.find_element(TEXT_BOX).send_keys 'In software testing, test automation is the use of special software (separate from the software being tested) to control the execution of tests and the comparison of actual outcomes with predicted outcomes.'\n # Submit google form\n @driver.find_element(SUBMIT_BUTTON).click\n # Make sure Thanks page comes after submitting a response\n assert_nothing_raised do\n assert_equal(\"Thanks!\", @driver.title())\n @wait.until { @driver.find_element :xpath => '//div[.=\"Your response has been recorded.\"]' }\n # Sleep is used to induce delay for aesthetic purposes to show in demo. Not needed for actual test case.\n sleep 5\n end\n end",
"title": ""
},
{
"docid": "8c1a8cf106188db6f1b59837784d76ea",
"score": "0.5777397",
"text": "def clickEditnRespond (decision)\n\tsleep 5\n\tcallfw = $wait.until { \n\t\t$driver.find_element(:id, 'edit_settings_call_forwarding') \n\t}\n\tsleep 5\n\tcallfw.click\n\tsleep 5\n\tbutton = $waitlong.until {\n\t\t#$driver.find_element(:link_text, decision)\n\t\t$driver.find_element(:xpath, \"//a[starts-with(@class, 'confirm_popup_#{decision}')]\")\n\t}\n\tsleep 3\n\tbutton.click\n\tputs \"---> #{decision} selected.\"\n\tsleep 5\nend",
"title": ""
},
{
"docid": "2f5aeff8ddba8012b27be8988241d7db",
"score": "0.57737345",
"text": "def revert_and_continue\n logger.info 'Clicking the Revert and continue button'\n wait_for_element_and_click revert_and_continue_button\n end",
"title": ""
},
{
"docid": "7c8ab63c243769ac77ac08e4d415c38f",
"score": "0.5773584",
"text": "def TryUsOutNextButton\n if (ENV['PLATFORM']=='Android')\n wait{$driver.find_element(:id, \"vivino.web.app.beta:id/next\").displayed? }\n return $driver.find_element(:id, \"vivino.web.app.beta:id/next\")\n else\n raise \"This control is not implemented yet\"\n end\n end",
"title": ""
},
{
"docid": "b81396131d2d7406c1fbb8064fe2ea0a",
"score": "0.57723224",
"text": "def prompt_for_continue\n result = @env.ui.ask(\"Deployment paused for manual review. Would you like to continue? (y/n) \")\n if result.upcase != \"Y\"\n @env.ui.info(\"Deployment push action cancelled by user\")\n return false\n end\n true\n end",
"title": ""
},
{
"docid": "201d6e05eb78c688bbcf15f75509a270",
"score": "0.57708937",
"text": "def comp_register_button\n click_button 'Register'\n end",
"title": ""
},
{
"docid": "7e9545f6624247ef258da6502d9f7b2c",
"score": "0.57685333",
"text": "def clickNextButton()\n @driver.find_element(NEXT_BUTTON).click()\n end",
"title": ""
},
{
"docid": "6923423653b8f3920c55d52db51f51ea",
"score": "0.5766518",
"text": "def test_hb; det.button(:name, 'hbTestButton'); end",
"title": ""
},
{
"docid": "48ed6b04ec6cc8d3ce76247abe7b418b",
"score": "0.5754745",
"text": "def click_hello()\n hello_button.click\n end",
"title": ""
},
{
"docid": "6b14461a7780234a62ecae6da5c3eac4",
"score": "0.57507145",
"text": "def expect_download_button(name, cand_id, dev_path)\n expect(page).to have_selector(\"form[action=\\\"/#{dev_path}download_document/#{cand_id}/.#{name}\\\"]\")\n expect(page).to have_button(I18n.t('views.common.download'))\nend",
"title": ""
},
{
"docid": "5b173d7170eef0bbc59906104dc7940c",
"score": "0.5740731",
"text": "def click\n @button.click\n end",
"title": ""
},
{
"docid": "dfe19ca99bab9a71817f90fc5a7c889a",
"score": "0.5737965",
"text": "def show\n loop do\n if is_present?\n break\n else\n $browser.click_at(@@button_locator,\"1,1\")\n sleep(1)\n end\n end\n end",
"title": ""
},
{
"docid": "e643e8dd3b4d7f7590b0d1fea525a610",
"score": "0.573781",
"text": "def confirm_button_text\n confirm_button.value\n end",
"title": ""
},
{
"docid": "a272aacd19436204968622baf6fb2899",
"score": "0.57367176",
"text": "def test_139\n #test_000\n printf \"\\n+ Test 139\"\n open_metric_tab($link_texts[\"metric_tab\"][5])\n assert(is_element_present($xpath[\"metric\"][\"customize_button\"]))\n logout\n end",
"title": ""
}
] |
d20542906853f1b14c92d1bb4beed83a | GET /library_books/1 GET /library_books/1.json | [
{
"docid": "641f6fc4bc403985e10fbdbcdc045e27",
"score": "0.77463233",
"text": "def show\n @library_book = LibraryBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @library_book }\n end\n end",
"title": ""
}
] | [
{
"docid": "a613f6e6f0318023e97fa4ad7cee0b91",
"score": "0.76484346",
"text": "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"title": ""
},
{
"docid": "8d857430f012b60f65eec6a7b11bbca7",
"score": "0.72506696",
"text": "def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\nend",
"title": ""
},
{
"docid": "41dbdd0d58e121d8e5f10fde62db969a",
"score": "0.7226033",
"text": "def book\n @book = Book.published.find(params[:id])\n render json: @book\n end",
"title": ""
},
{
"docid": "38df07333d5a37bd45c9a43bc70bcc5d",
"score": "0.72009724",
"text": "def fetch_book_info\n url = \"#{BASE_URL}/#{book_id}\"\n resp = RestClient::Request.execute(url: url, method: \"GET\")\n resp_obj = JSON.parse(resp)\n\n {\n id: book_id,\n title: resp_obj[\"volumeInfo\"][\"title\"],\n author: resp_obj[\"volumeInfo\"][\"authors\"][0],\n image: resp_obj[\"volumeInfo\"][\"imageLinks\"] ? resp_obj[\"volumeInfo\"][\"imageLinks\"][\"thumbnail\"] : DEFAULT_IMAGE\n }\n end",
"title": ""
},
{
"docid": "7bb10f8bec95ff4e1ce24f68a20a550a",
"score": "0.714775",
"text": "def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\n end",
"title": ""
},
{
"docid": "c73ec363878f55a062c9ea7200db1340",
"score": "0.71305555",
"text": "def new\n @library_book = LibraryBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @library_book }\n end\n end",
"title": ""
},
{
"docid": "622b6566dd5c0142d916b76de166b3bc",
"score": "0.71221006",
"text": "def list_books\n books = Book.all\n \n if books.count > 0\n render json: books\n else\n render json: {e:\"No books added\"}, :status => :error\n end\n end",
"title": ""
},
{
"docid": "c4746dc91005a0d372416b076d43946f",
"score": "0.7102937",
"text": "def index\n @books = Book.all\n render json: @books\n end",
"title": ""
},
{
"docid": "e4f2e80f3ba548504b638f5d3577da7b",
"score": "0.7094928",
"text": "def index\n @library_books = LibraryBook.all\n end",
"title": ""
},
{
"docid": "a86660014d2096ddc216ce18a7c87c08",
"score": "0.7008717",
"text": "def show\n @library = Library.find(Book.find(params[:id]).library_id)\n end",
"title": ""
},
{
"docid": "49e7866abbdc587ac49d176dad036cfa",
"score": "0.6991245",
"text": "def get_book(search)\n\trequest_string = \"https://www.googleapis.com/books/v1/volumes?q=#{search.gsub(\" \",\"+\")}\"\n\t\n\tsample_uri = URI(request_string) #opens a portal to the data at that link\n\tsample_response = Net::HTTP.get(sample_uri) #go grab the data in the portal\n\tsample_parsedResponse = JSON.parse(sample_response) #makes data easy to read\n\tsample_parsedResponse[\"items\"]\nend",
"title": ""
},
{
"docid": "ab5e00d42926740abfdd881b0a7c82f8",
"score": "0.6933206",
"text": "def index\n @books = Book.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"title": ""
},
{
"docid": "9be371c89f52822c4214c1b8c860af7a",
"score": "0.68838155",
"text": "def get_book_with_api(title)\n uri = URI.parse(URI.encode(\"https://www.googleapis.com/books/v1/volumes?q=#{title}\"))\n service = Books::ApiConnectService.new(uri)\n book_response = service.execute[\"items\"].first[\"volumeInfo\"]\n .select{ |key, value| key == \"title\" || key == \"description\" || key == \"publisher\" || key == \"publishedDate\" || key == \"imageLinks\"}\n @book_info_hash = book_response.inject({}) do |hash, (key, value)|\n if key.underscore == \"image_links\"\n hash[key.underscore] = book_response[\"imageLinks\"][\"smallThumbnail\"]\n else\n hash[key.underscore] = value\n end\n hash\n end\n end",
"title": ""
},
{
"docid": "43ace69b1ac0ba0b7022de4e1678bbaf",
"score": "0.6881594",
"text": "def index\n @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"title": ""
},
{
"docid": "772f01bff230b04c26f89cdcfbfca073",
"score": "0.6868203",
"text": "def book\n fetch('harry_potter.books')\n end",
"title": ""
},
{
"docid": "9165dbb7d5c6b91cd003808b540cbbee",
"score": "0.68197745",
"text": "def index\n if params[:book_id]\n @book = Book.find(params[:book_id])\n recipes = @book.recipes\n render json: RecipeSerializer.new(recipes).to_serialized_json\n else \n recipes = Recipe.all.order(:name)\n render json: RecipeSerializer.new(recipes).to_serialized_json\n end\n end",
"title": ""
},
{
"docid": "cc0180a163887afd17b42cb52e678dd5",
"score": "0.677741",
"text": "def index\n @libraries = Library.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @libraries }\n end\n end",
"title": ""
},
{
"docid": "8b5eb0364e76cd2646c3ad4d80df7b84",
"score": "0.6750451",
"text": "def index\n render jsonapi: Book.search(params), include: [:genre, :author, :libraries]\n end",
"title": ""
},
{
"docid": "d9503e4e2c0abd56fae0716fab35b724",
"score": "0.6728434",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "f11abda1c26efd128f080a6dd4164b99",
"score": "0.67245257",
"text": "def book_info_open_library\n client = Openlibrary::Client.new\n results = client.search(params[:q])\n end",
"title": ""
},
{
"docid": "f11abda1c26efd128f080a6dd4164b99",
"score": "0.67245257",
"text": "def book_info_open_library\n client = Openlibrary::Client.new\n results = client.search(params[:q])\n end",
"title": ""
},
{
"docid": "106ca7e327779f57223363d4da839956",
"score": "0.6693683",
"text": "def get_books(response)\n response[\"items\"]\nend",
"title": ""
},
{
"docid": "c2de927024c50641df2dab9505940baa",
"score": "0.6691855",
"text": "def index\n @cookbooks = Cookbook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cookbooks }\n end\n end",
"title": ""
},
{
"docid": "8cc9660cb815847e0d4ce2c2e15c6db6",
"score": "0.66845727",
"text": "def show\n render json: @api_book\n end",
"title": ""
},
{
"docid": "c03c7920e223528e931a13090db15030",
"score": "0.6667332",
"text": "def index\n @books = @collection.books\n #original: @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"title": ""
},
{
"docid": "369f9398d9c9693f866eb18afd2396b2",
"score": "0.66428906",
"text": "def index\n @books = Book.find_all_by_user_id(current_user)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n end",
"title": ""
},
{
"docid": "caad5c99a26326c023e790883c05cfff",
"score": "0.6629906",
"text": "def index\n @resumes = Resume.where(:book_id => params[:book_id])\n\n render json: @resumes\n end",
"title": ""
},
{
"docid": "92f86a85073bacb7fce3c75e2107e3c0",
"score": "0.6620245",
"text": "def index\n @library_books = Library::Book.all.paginate(:page => params[:page], :per_page => 10)\n end",
"title": ""
},
{
"docid": "97e6394566082a7ee69b3cb68797e001",
"score": "0.6616731",
"text": "def index\n @books = Book.get_avaible_books\n end",
"title": ""
},
{
"docid": "41ea86ae862e98e30fd3985ef2241e76",
"score": "0.661381",
"text": "def search_for_google_books(search_term)\n url = \"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\"\n response = RestClient.get(url)\n hash = JSON.parse(response)\n hash[\"items\"]\nend",
"title": ""
},
{
"docid": "9def848aa2d95578e23089f50f316a40",
"score": "0.66109306",
"text": "def show\n find_book(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "fe541b6d25c01072787d1a102ee2d34b",
"score": "0.66039944",
"text": "def index\n @user_books = UserBook.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_books }\n end\n end",
"title": ""
},
{
"docid": "5eb8140d353d43589191cfe65b0be6df",
"score": "0.6595542",
"text": "def index\n @library_book_lists = LibraryBookList.all\n end",
"title": ""
},
{
"docid": "9c9f1842c0bd13717e63226649828f78",
"score": "0.65936214",
"text": "def index\n @books = Book.extended_details\n\n render json: @books.as_json(\n only: [:id, :title, :author, :created_at, :total_income_cents, :copies_count, :remaining_copies_count, :loaned_copies_count]\n )\n end",
"title": ""
},
{
"docid": "113f10272b550c24000bc844822f742e",
"score": "0.65876997",
"text": "def index\n if current_user\n @books = current_user.books\n render json: @books, status: 201\n end\n end",
"title": ""
},
{
"docid": "41f6b6c03821ea3e021464c68aa3a3d0",
"score": "0.65866715",
"text": "def show\n render json: @book\n end",
"title": ""
},
{
"docid": "01b3ef88d31149ca731fa751837f311c",
"score": "0.65799433",
"text": "def index\n books = current_user.books.all\n render json: { books: books }\n end",
"title": ""
},
{
"docid": "a5156b90c98da7080e9c142c1cd24df6",
"score": "0.6569274",
"text": "def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end",
"title": ""
},
{
"docid": "c8d4de2ee4e7d97d65893f0944d6635d",
"score": "0.6562684",
"text": "def show\n @librarybook = Librarybook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @librarybook }\n end\n end",
"title": ""
},
{
"docid": "a682f8d74b1cd46fceebf0729141efe9",
"score": "0.6559803",
"text": "def index\n @librarybooklists = Librarybooklist.all\n end",
"title": ""
},
{
"docid": "0dbe44314d2756846c083db667afc594",
"score": "0.6558146",
"text": "def get_book\n @book_series = BookSeries.find(params[:book_series_id])\n @book_series_1 = BookSeries.first\n @collection = @book_series.collections.find(params[:collection_id])\n @book = @collection.books.find(params[:book_id])\n end",
"title": ""
},
{
"docid": "0dbe44314d2756846c083db667afc594",
"score": "0.6558146",
"text": "def get_book\n @book_series = BookSeries.find(params[:book_series_id])\n @book_series_1 = BookSeries.first\n @collection = @book_series.collections.find(params[:collection_id])\n @book = @collection.books.find(params[:book_id])\n end",
"title": ""
},
{
"docid": "32782868a09dfc9bf99e4c9af586a8d3",
"score": "0.6554106",
"text": "def index\n @books = Book.order('created_at DESC').page(params[:page]).per_page(10).search(params[:search], params[:id])\n respond_to do |format|\n format.json\n format.html\n end\n end",
"title": ""
},
{
"docid": "0dc493af5c849e44987c2ad096b9e92f",
"score": "0.6550929",
"text": "def book_info_open_library\n client = Openlibrary::Client.new\n results = client.search(params[:q])\n rescue\n []\n end",
"title": ""
},
{
"docid": "046447c59671a92d1b60fc8164bd696a",
"score": "0.6539679",
"text": "def get_book( book_id )\n response = if book_id.to_s.length >= 10\n Amazon::Ecs.item_lookup( book_id, :id_type => 'ISBN', :search_index => 'Books', \n :response_group => 'Large,Reviews,Similarities,AlternateVersions' )\n else\n Amazon::Ecs.item_lookup( book_id, :response_group => 'Large,Reviews,Similarities' )\n end\n response.items.each do |item|\n binding = item.get('ItemAttributes/Binding')\n next if binding.match(/Kindle/i)\n return Book.new( item )\n end\n return nil\n end",
"title": ""
},
{
"docid": "7c1263a2260af154e27b34fb32589e7b",
"score": "0.65359664",
"text": "def index\r\n @books = Book.paginate(:page => params[:page], :per_page => 30)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @books }\r\n end\r\n end",
"title": ""
},
{
"docid": "6b79a63ce219cc8110f5d506e616dc93",
"score": "0.6532127",
"text": "def get_books()\n @books_out\n end",
"title": ""
},
{
"docid": "6b79a63ce219cc8110f5d506e616dc93",
"score": "0.6532127",
"text": "def get_books()\n @books_out\n end",
"title": ""
},
{
"docid": "4d45eb42ed558e15adca72af383f838d",
"score": "0.6505041",
"text": "def index\n #@books = Book.all\n @books = Book.find(:all, :order => \"isbn\")\n @book_images = BookImage.find(:all, :include => :book)\n #@book_images = []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"title": ""
},
{
"docid": "aad4cb7ec9bede048fb7b266a36d5f24",
"score": "0.6504743",
"text": "def set_library_book\n @library_book = Library::Book.find(params[:id])\n end",
"title": ""
},
{
"docid": "1d7c93268e4411b3745138f15b9d8fbf",
"score": "0.64902043",
"text": "def show\n @library_info = LibraryInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @library_info }\n end\n end",
"title": ""
},
{
"docid": "00189ad5dd2930c7ac9d2c070913a795",
"score": "0.6490009",
"text": "def book(id)\n\t\t\tresponse = request('/book/show', :id => id)\n\t\t\tHashie::Mash.new(response['book'])\n\t\tend",
"title": ""
},
{
"docid": "6ea2a7f1c80c7499126da810e6af9c67",
"score": "0.648812",
"text": "def index\n @title = \"List Books\"\n @books = Book.paginate :page=>params[:page], :per_page => 100, :order => 'title'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"title": ""
},
{
"docid": "f567bf1eb238a3d314418c96cd57e20b",
"score": "0.64663804",
"text": "def order_book(params)\n Client.current.get(\"#{resource_url}/book\", params)\n end",
"title": ""
},
{
"docid": "bdcc1453933b4ccf3030e53fbeb3bf1a",
"score": "0.6462169",
"text": "def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "bdcc1453933b4ccf3030e53fbeb3bf1a",
"score": "0.6462169",
"text": "def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.64611316",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.64611316",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.64611316",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.64611316",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.64611316",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.64611316",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.64611316",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.64611316",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.64611316",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "c5a81c7cbd43c34e57686b7eac68ff46",
"score": "0.6437152",
"text": "def show\n @authors_book = AuthorsBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @authors_book }\n end\n end",
"title": ""
},
{
"docid": "bb056b271f233f0c8af2bfe76f6351f9",
"score": "0.6436006",
"text": "def book_info_goodreads_library\n client = Goodreads::Client.new(Goodreads.configuration)\n results = client.book_by_title(params[:q])\n rescue\n []\n end",
"title": ""
},
{
"docid": "71cfc06356451a33b0de72d394d8e786",
"score": "0.64350706",
"text": "def index\n if params[:search]\n @lib_books = []\n @library.lib_books.each do |lib_book|\n @book = Book.find_by_id(lib_book.book_id)\n if params[:title] != \"\"\n next if !@book.title.downcase.include? params[:title].downcase\n end\n if params[:author] != \"\"\n next if !@book.author.downcase.include? params[:author].downcase\n end\n if params[:published] != \"\"\n next if !@book.published.to_s.eql? params[:published]\n end\n if params[:subject] != \"\"\n next if !@book.subject.downcase.include? params[:subject].downcase\n end\n @lib_books.push(lib_book)\n end\n else\n @lib_books = @library.lib_books\n end\n end",
"title": ""
},
{
"docid": "a08e839d646c4224ea47877f9dfdde39",
"score": "0.643289",
"text": "def search_book_by_name(book)\n url = \"https://www.googleapis.com/books/v1/volumes?q=#{URI::encode(book)}&key=#{get_access_key}\"\n\tres = JSON.load(RestClient.get(url))\n return res\t\nend",
"title": ""
},
{
"docid": "48666caef223489edce989cca385a139",
"score": "0.64271706",
"text": "def get_book( book_id )\n response = if book_id.to_s.length >= 10\n Amazon::Ecs.item_lookup( book_id, :id_type => 'ISBN', :search_index => 'Books', :response_group => 'Large,Reviews,Similarities' )\n else\n Amazon::Ecs.item_lookup( book_id, :response_group => 'Large,Reviews,Similarities' )\n end\n response.items.each do |item|\n binding = item.get('ItemAttributes/Binding')\n next if binding.match(/Kindle/i)\n return parse_item( item )\n end\n end",
"title": ""
},
{
"docid": "7bdce55509d1964693fb0b16b0cb6cc8",
"score": "0.6422623",
"text": "def show\n @book = Book.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "661ad9ec33f9b663f6348a706b64fb74",
"score": "0.64212245",
"text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @library }\n end\n end",
"title": ""
},
{
"docid": "1fe43974270e9b1ebd3eb417e770e2b0",
"score": "0.6417494",
"text": "def index\n @book = Book.find(params[:book_id])\n end",
"title": ""
},
{
"docid": "47dec79154067a80a71efc90ca82185c",
"score": "0.64138925",
"text": "def index\n @books = []\n if (params[:q])\n @books = Book.where(params[:q])\n end\n render :json => @books\n end",
"title": ""
},
{
"docid": "a62d42d22adb9d6d077d5287d65aa29c",
"score": "0.64105046",
"text": "def book\n @books=Book.all\n @book=Book.find(params[:id])\n end",
"title": ""
},
{
"docid": "2e314a2707b3ac470d99fc43e5278928",
"score": "0.64076936",
"text": "def show\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"title": ""
},
{
"docid": "cc4d4fb2972538c0e84bf01db848d09a",
"score": "0.64062816",
"text": "def set_library_book\n @library_book = LibraryBook.find(params[:id])\n end",
"title": ""
},
{
"docid": "14db97ca2136382dbde0938718a602f9",
"score": "0.6382989",
"text": "def retrieve_book\n @book = Book.find(params[:book_id])\n end",
"title": ""
},
{
"docid": "ccdf0a42f2ad912c8fa25f53850a28eb",
"score": "0.6381135",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @book }\n end\n end",
"title": ""
},
{
"docid": "5d867b27de7e236230583f531a084a65",
"score": "0.637537",
"text": "def index\n authorize! :query, Book\n @books = Book.order(:title)\n respond_to do |format|\n format.html\n format.json {render text: @books.to_json}\n format.xml {render text: @books.to_xml}\n end\n end",
"title": ""
},
{
"docid": "ac8355d07e1353ac36659b08db8f2002",
"score": "0.63702244",
"text": "def index\n @bookings = Booking.all\n\n render json: @bookings\n end",
"title": ""
},
{
"docid": "64de668d6ea1adbf410ce5ac8b795f3e",
"score": "0.6368307",
"text": "def get_book\n @book = Book.where(id: params[:book_id]).first\n end",
"title": ""
},
{
"docid": "2e5500b474128db1c2321115f1cded1d",
"score": "0.63671684",
"text": "def book_info_goodreads_library\n client = Goodreads::Client.new(Goodreads.configuration)\n results = client.book_by_title(params[:q]) if (params[:t] == \"title\" || params[:t].blank?)\n results = client.book_by_isbn(params[:q]) if params[:t] == \"isbn\"\n return results\n end",
"title": ""
},
{
"docid": "2e5500b474128db1c2321115f1cded1d",
"score": "0.63671684",
"text": "def book_info_goodreads_library\n client = Goodreads::Client.new(Goodreads.configuration)\n results = client.book_by_title(params[:q]) if (params[:t] == \"title\" || params[:t].blank?)\n results = client.book_by_isbn(params[:q]) if params[:t] == \"isbn\"\n return results\n end",
"title": ""
},
{
"docid": "d8f23ee56963958f28ada23bd174b06f",
"score": "0.63606465",
"text": "def make_request(search_term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\")\n final_response = JSON.parse(response)\nend",
"title": ""
},
{
"docid": "a34699761ca6e32fce05d26a3a2a159e",
"score": "0.63543737",
"text": "def new\n @library = Library.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @library }\n end\n end",
"title": ""
},
{
"docid": "a34699761ca6e32fce05d26a3a2a159e",
"score": "0.63543737",
"text": "def new\n @library = Library.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @library }\n end\n end",
"title": ""
},
{
"docid": "57176c5e7cfbf86f54cfdfac3c58622d",
"score": "0.63511366",
"text": "def index\n @books = Book.all\n do_response @books\n #\n #respond_to do |format|\n # format.html # index.html.erb\n #format.json { render :json => @books }\n #end\n end",
"title": ""
},
{
"docid": "11adfc4e8d7094375cf052ae18d7097b",
"score": "0.6341733",
"text": "def new\n @book = Book.new\n @publishers = Publisher.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "498fbd5a8d93fb5188ce8a9fc836fa6f",
"score": "0.63363737",
"text": "def index\n @book_genres = BookGenre.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_genres }\n end\n end",
"title": ""
},
{
"docid": "ca12816f820c983a87f142a3a8179ff9",
"score": "0.6331322",
"text": "def index\n\t\tif (params[:data] != nil)\n\t\t\t@book = Book.new\n\t\t\t@client = Goodreads::Client.new(api_key: \"rSkvvZY8Wx27zcj4AfHA\", api_secret: \"S5WOpmY8pVtaEu1IwNn51DBafjoEIbjuxZdE6sNM\")\n\t\t\t@search = @client.search_books(params[:data])\n\t\t\t#@search = @client.search_books(\"the lord of the rings\")\n\t\t\t@results = @search.results.work\n\t\t\t#https://image.tmdb.org/t/p/w300_and_h450_bestv2\n\t\tend\n\n @books = Book.all\n end",
"title": ""
},
{
"docid": "a7bc61286050d431cf1268d1516615cf",
"score": "0.63131213",
"text": "def set_library_book_list\n @library_book_list = LibraryBookList.find(params[:id])\n end",
"title": ""
},
{
"docid": "f4a0a76026c66a6309446cac0dca41d0",
"score": "0.62973714",
"text": "def index\n library = apply_pagination @user.library\n\n library = library.as_json(\n only: [:id, :expires_at], \n include: [ \n gallery_item: { only: [:title, :plot, :type] }, \n purchase_option: { only: [:id, :price, :video_quality] }\n ]\n )\n render json: library\n end",
"title": ""
},
{
"docid": "b6e8547cb2d3064e6c65eee07a902f69",
"score": "0.62972826",
"text": "def auto_complete\n q = params[:term].gsub(/\\s/, \"\").gsub(\" \", \"\")\n uri = Addressable::URI.parse(\"https://www.googleapis.com/books/v1/volumes?q=#{q}&country=JP&maxResults=40&orderBy=relevance\")\n begin\n response = Net::HTTP.get_response(uri)\n result = JSON.parse(response.body)\n book_result = result[\"items\"]\n .select{|item| item.has_key?(\"volumeInfo\") && item[\"volumeInfo\"].has_key?(\"title\")}\n .take(40)\n .map{|item|\n {\n title: item[\"volumeInfo\"][\"title\"],\n subtitle: item[\"volumeInfo\"][\"subtitle\"],\n authors: item[\"volumeInfo\"][\"authors\"],\n categories: item[\"volumeInfo\"][\"categories\"],\n google_books_id: item[\"id\"],\n info: item[\"volumeInfo\"][\"industryIdentifiers\"]\n }\n }\n @results = Book.auto_complete_map(book_result)\n\n render json: @results.to_json\n rescue => e\n p e.message\n end\n end",
"title": ""
},
{
"docid": "508f90e1a6e8118ecfe26d38352739c0",
"score": "0.62949836",
"text": "def show\n @cook_book = CookBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cook_book }\n end\n end",
"title": ""
},
{
"docid": "977a4ff9f4f33a676f4da31a341f57ba",
"score": "0.629076",
"text": "def create\n @library_book = LibraryBook.new(params[:library_book])\n\n respond_to do |format|\n if @library_book.save\n format.html { redirect_to @library_book, notice: 'Library book was successfully created.' }\n format.json { render json: @library_book, status: :created, location: @library_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "93fa7ca91a8157eab85fbaf101903dfa",
"score": "0.6290553",
"text": "def create\n @lib_book = LibBook.new(lib_book_params)\n\n respond_to do |format|\n if @lib_book.save\n format.html { redirect_to university_library_lib_books_path, notice: 'Lib book was successfully created.' }\n format.json { render :show, status: :created, location: @lib_book }\n else\n format.html { render :new }\n format.json { render json: @lib_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a787afb3593b4f5702df955b1d1b135b",
"score": "0.627874",
"text": "def show\n @library = Library.find(params[:id])\n end",
"title": ""
},
{
"docid": "ec2e8f169c5d5bae6cb5c4d4acf4742c",
"score": "0.62734526",
"text": "def make_request(search_term)\n JSON.parse(RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\"))\nend",
"title": ""
},
{
"docid": "7e8f9834e2167f79d62289baba3396e2",
"score": "0.6264248",
"text": "def index\n @books = Book.order(\"year DESC\").paginate(page: params[:page], per_page: params[:per_page] ? params[:per_page] : 10)\n @books_all = @books\n\n if params[:type]\n if params[:type] == 'collections'\n @books = @books.where('book_type NOT IN (?)', ['Monograph', 'Monograph in a serial'])\n elsif params[:type] == 'monographs'\n @books = @books.where('book_type IN (?)', ['Monograph', 'Monograph in a serial'])\n end\n end\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @books }\n end\n end",
"title": ""
}
] |
460b4a5892735c5a9b0a04a6dfd6143f | Returns the value of attribute tags. source://cucumbermessages//lib/cucumber/messages.dtos.rb401 | [
{
"docid": "9ecb3e21eb0272cf371ebff09e2f402c",
"score": "0.0",
"text": "def tags; end",
"title": ""
}
] | [
{
"docid": "935136d8c6742e3fa0519995da1f1722",
"score": "0.7551213",
"text": "def tags\n attributes.fetch(:tags)\n end",
"title": ""
},
{
"docid": "935136d8c6742e3fa0519995da1f1722",
"score": "0.7551213",
"text": "def tags\n attributes.fetch(:tags)\n end",
"title": ""
},
{
"docid": "935136d8c6742e3fa0519995da1f1722",
"score": "0.7551213",
"text": "def tags\n attributes.fetch(:tags)\n end",
"title": ""
},
{
"docid": "935136d8c6742e3fa0519995da1f1722",
"score": "0.7551213",
"text": "def tags\n attributes.fetch(:tags)\n end",
"title": ""
},
{
"docid": "935136d8c6742e3fa0519995da1f1722",
"score": "0.7551213",
"text": "def tags\n attributes.fetch(:tags)\n end",
"title": ""
},
{
"docid": "64de850ef60a7321d121c944acff2514",
"score": "0.7222766",
"text": "def tags\n attributes[:tags].split(',').map(&:strip)\n end",
"title": ""
},
{
"docid": "27a9e748e12ae40d9280bf00c215fb6a",
"score": "0.6969531",
"text": "def tags\n attributes[:tags] || []\n end",
"title": ""
},
{
"docid": "2fd28d7d8312ec7eea8fd7544ad4c2a8",
"score": "0.6855453",
"text": "def tags\n t = read_attribute(:tags)\n t.nil? ? \"\" : t.join(', ')\n end",
"title": ""
},
{
"docid": "7a3ccb8c3068fbe3571ff24ed876199b",
"score": "0.6825496",
"text": "def get_tags()\n self.tags.collect { |t| t.value }\n end",
"title": ""
},
{
"docid": "4d1e2cbdc95c5051def718b610bff677",
"score": "0.65372795",
"text": "def tags\n data[:tags]\n end",
"title": ""
},
{
"docid": "4d1e2cbdc95c5051def718b610bff677",
"score": "0.65372795",
"text": "def tags\n data[:tags]\n end",
"title": ""
},
{
"docid": "4d1e2cbdc95c5051def718b610bff677",
"score": "0.65372795",
"text": "def tags\n data[:tags]\n end",
"title": ""
},
{
"docid": "4d1e2cbdc95c5051def718b610bff677",
"score": "0.65372795",
"text": "def tags\n data[:tags]\n end",
"title": ""
},
{
"docid": "4d1e2cbdc95c5051def718b610bff677",
"score": "0.65372795",
"text": "def tags\n data[:tags]\n end",
"title": ""
},
{
"docid": "4d1e2cbdc95c5051def718b610bff677",
"score": "0.65372795",
"text": "def tags\n data[:tags]\n end",
"title": ""
},
{
"docid": "b7336313a9bfbff1fdc441aebeaa2695",
"score": "0.6521035",
"text": "def tag_values\n tags.map(&value_mapper).join(',')\n end",
"title": ""
},
{
"docid": "68421f14e2c7656246da1046f9cdb81d",
"score": "0.65176326",
"text": "def get_tags\n\ttags = self.tags.map do |tag|\n\t\ttag.tag.to_s\n\tend\n end",
"title": ""
},
{
"docid": "19114db3be7111cce227a928300acb3f",
"score": "0.6494958",
"text": "def values\n @attribute.values.collect {|val| val.content}\n end",
"title": ""
},
{
"docid": "9cebf6abefd22a6f219dd88e475a2568",
"score": "0.646463",
"text": "def tags\n data.tags\n end",
"title": ""
},
{
"docid": "9cebf6abefd22a6f219dd88e475a2568",
"score": "0.646463",
"text": "def tags\n data.tags\n end",
"title": ""
},
{
"docid": "9cebf6abefd22a6f219dd88e475a2568",
"score": "0.646463",
"text": "def tags\n data.tags\n end",
"title": ""
},
{
"docid": "9cebf6abefd22a6f219dd88e475a2568",
"score": "0.646463",
"text": "def tags\n data.tags\n end",
"title": ""
},
{
"docid": "49f69d63844cb4ee05062935ade98003",
"score": "0.64159447",
"text": "def attributes\n %i[value]\n end",
"title": ""
},
{
"docid": "b887670d5f9903f7461ffbc95fb2a772",
"score": "0.63974196",
"text": "def tags\n @values.keys.map {|tag| Values.tag_map[tag]}\n end",
"title": ""
},
{
"docid": "0de3e524d0755c3075534482f6f32149",
"score": "0.6371188",
"text": "def tags\n @data['tags']\n end",
"title": ""
},
{
"docid": "e22334c0ad05ed8759f21fe2d496d5f9",
"score": "0.6356951",
"text": "def get_tag_attribute(tags, attribute)\n marked_tags = []\n tags.each do |tag, options|\n if options.delete(attribute.to_sym) or options.delete(attribute.to_s)\n marked_tags << tag\n end\n end\n marked_tags\n end",
"title": ""
},
{
"docid": "a4547717c9804d79ee4db434521e11a7",
"score": "0.6268876",
"text": "def tags\n obj[12]\n end",
"title": ""
},
{
"docid": "0afd9f1d0daf23b72a443a202d757774",
"score": "0.62603754",
"text": "def tags() \n self[:tags].join(\",\") \n end",
"title": ""
},
{
"docid": "089488e6894c433ee1ba2b37d3d3fefa",
"score": "0.6250046",
"text": "def tags() \n self[:tags].join(\",\") \n end",
"title": ""
},
{
"docid": "fb0feb610e9e2e1ab6163701c8a57025",
"score": "0.6210209",
"text": "def tags\n extract_hash(:tags, :key, :value)\n end",
"title": ""
},
{
"docid": "1d797c1cb186dfb4d79bc25fba632fc1",
"score": "0.6202079",
"text": "def tags\n @tags\n end",
"title": ""
},
{
"docid": "4ecdd7b8870de34938842314a06f9146",
"score": "0.6194824",
"text": "def attr_strings\n @attr_strings\n end",
"title": ""
},
{
"docid": "83b0311510452aeab884096ab2a6b07c",
"score": "0.6177081",
"text": "def tag_names\n self.tags.map(&:name)\n end",
"title": ""
},
{
"docid": "6c10243ae8fd01e80156a46c24b141d0",
"score": "0.6163876",
"text": "def tag_value\n @gapi.tag_value\n end",
"title": ""
},
{
"docid": "2f62e9e17a340e9782c8e7c5cac06188",
"score": "0.6127205",
"text": "def tag_names\n @tags\n end",
"title": ""
},
{
"docid": "fd94dbdd4d09b45e07a493dcf47eba6f",
"score": "0.6112678",
"text": "def get_tags\n self.tags.split(',')\n end",
"title": ""
},
{
"docid": "65e51e7095f39b0253f675c15f811c70",
"score": "0.61115223",
"text": "def attribute_values\n end",
"title": ""
},
{
"docid": "65e51e7095f39b0253f675c15f811c70",
"score": "0.61115223",
"text": "def attribute_values\n end",
"title": ""
},
{
"docid": "df01d0cdbe7fea294d98466f7ce2e62d",
"score": "0.6103323",
"text": "def tags\n @tags\n end",
"title": ""
},
{
"docid": "df01d0cdbe7fea294d98466f7ce2e62d",
"score": "0.6103213",
"text": "def tags\n @tags\n end",
"title": ""
},
{
"docid": "df01d0cdbe7fea294d98466f7ce2e62d",
"score": "0.6103213",
"text": "def tags\n @tags\n end",
"title": ""
},
{
"docid": "df01d0cdbe7fea294d98466f7ce2e62d",
"score": "0.6103213",
"text": "def tags\n @tags\n end",
"title": ""
},
{
"docid": "df01d0cdbe7fea294d98466f7ce2e62d",
"score": "0.6103213",
"text": "def tags\n @tags\n end",
"title": ""
},
{
"docid": "df01d0cdbe7fea294d98466f7ce2e62d",
"score": "0.6102858",
"text": "def tags\n @tags\n end",
"title": ""
},
{
"docid": "df01d0cdbe7fea294d98466f7ce2e62d",
"score": "0.6102858",
"text": "def tags\n @tags\n end",
"title": ""
},
{
"docid": "2fa0ade3d5858abdd9dcfb7ab6df0920",
"score": "0.60976964",
"text": "def strings\n values = []\n if self.atype == Atype_String\n attribute_ranges.each do |v|\n values[v.priority - 1] = v.string_val\n end\n end\n values\n end",
"title": ""
},
{
"docid": "6c2bf9f8696974528900ffee65165d72",
"score": "0.60843176",
"text": "def attribute_values\n data.attribute_values\n end",
"title": ""
},
{
"docid": "cd52114e42f3e76a67359f775f108f46",
"score": "0.60777086",
"text": "def values\n attributes.values\n end",
"title": ""
},
{
"docid": "29cca51334f5412bb0a89ac99caa048c",
"score": "0.60747445",
"text": "def tag_names\n tags.map(&:name)\n end",
"title": ""
},
{
"docid": "2204b9265f23c376901dbeae3b0018fc",
"score": "0.6018491",
"text": "def tag_list\t#Reading function to read the attribute tag_list in Article class\n\t\tself.tags.collect do |tag| \n\t\t\ttag.name\n\t\tend.join(\", \")\n\tend",
"title": ""
},
{
"docid": "30d06673100ce8a29edc49e6bd5d763a",
"score": "0.60087997",
"text": "def tag_list\n data[:tag_list]\n end",
"title": ""
},
{
"docid": "30d06673100ce8a29edc49e6bd5d763a",
"score": "0.60087997",
"text": "def tag_list\n data[:tag_list]\n end",
"title": ""
},
{
"docid": "30d06673100ce8a29edc49e6bd5d763a",
"score": "0.60087997",
"text": "def tag_list\n data[:tag_list]\n end",
"title": ""
},
{
"docid": "73bce372ca30d46456a381a8e859f59b",
"score": "0.60056955",
"text": "def supported_tags\n [\n # attributes\n\n # simple tags\n :alert, :riskdesc, :desc,:severity,\n :confidence, :solution,:otherinfo,\n\t:reference,:cweid,:wascid\n ]\n end",
"title": ""
},
{
"docid": "7615f8bb6b48e7529d770545561cb0cc",
"score": "0.5997007",
"text": "def tag_names\n self.tags.map { |t| t.name }.join(' ')\n end",
"title": ""
},
{
"docid": "6960d9998dc8a0e79686abd692202541",
"score": "0.5990619",
"text": "def tags\n return @tags if @tags\n tagz = self.tag.split(/([\\w\\d]+)|\"([\\w \\d]+)\"/)\n tagz.delete(' ')\n tagz.delete('')\n @tags = tagz\n end",
"title": ""
},
{
"docid": "4826a2ad16da47ed5c1322b46de2af0d",
"score": "0.59897363",
"text": "def get_attribute_values\n json_response({ message: 'NOT IMPLEMENTED' })\n end",
"title": ""
},
{
"docid": "cf93173b30184689c4565e12bc93b2fd",
"score": "0.59796506",
"text": "def items\n self.attrs[:value].items\n end",
"title": ""
},
{
"docid": "43170e8c376b0d9bcfd2010e5461b8d3",
"score": "0.5967102",
"text": "def attribute_values\n attributes.values\n end",
"title": ""
},
{
"docid": "368ee0d8d1b235f7123b6e5fdd700362",
"score": "0.5965211",
"text": "def tags\n return @mydata.keys\n end",
"title": ""
},
{
"docid": "01924cf5a041a173227ec26cc6ae0578",
"score": "0.59556407",
"text": "def get_attributes()\n\t\treturn self.get(\"attribute\",\"\")\n\tend",
"title": ""
},
{
"docid": "36bdb481d6be054bd773cd960d3c2a46",
"score": "0.59510934",
"text": "def tags\n return @tags\n end",
"title": ""
},
{
"docid": "36bdb481d6be054bd773cd960d3c2a46",
"score": "0.59510934",
"text": "def tags\n return @tags\n end",
"title": ""
},
{
"docid": "36bdb481d6be054bd773cd960d3c2a46",
"score": "0.59510934",
"text": "def tags\n return @tags\n end",
"title": ""
},
{
"docid": "36bdb481d6be054bd773cd960d3c2a46",
"score": "0.59510934",
"text": "def tags\n return @tags\n end",
"title": ""
},
{
"docid": "36bdb481d6be054bd773cd960d3c2a46",
"score": "0.59510934",
"text": "def tags\n return @tags\n end",
"title": ""
},
{
"docid": "36bdb481d6be054bd773cd960d3c2a46",
"score": "0.59510934",
"text": "def tags\n return @tags\n end",
"title": ""
},
{
"docid": "d0f99ec5486ad9170a2e17314bb2a091",
"score": "0.5948882",
"text": "def data\n tag_attrs.data\n end",
"title": ""
},
{
"docid": "61504d270ca8e74d9da6eb85d2912473",
"score": "0.5943229",
"text": "def tag_names \n tags.map(&:name).join(' ') \n end",
"title": ""
},
{
"docid": "a1d4e31588e260ae8184320694bcd6b1",
"score": "0.5934112",
"text": "def get_tags_with_attribute(*args)\n logger.debug \"get_tags_with_attribute call\"\n attr_name = \"#{args.first}=\\\"\" || nil\n value = args.second || nil\n return nil if attr_name.nil? || value.nil?\n # options hash\n options = args.third || {}\n tags = Array.new\n done = false\n last_index = 0\n last_index = after_body_index(options[:after_body], last_index)\n until done\n attr_index = self.content.index(attr_name, last_index)\n if attr_index.nil?\n done = true\n else\n value_start = attr_index + attr_name.size\n value_end = self.content.index('\"', value_start)-1\n attr_value = self.content[value_start..value_end]\n if (options[:contains] && attr_value.index(value)) || (attr_value == value)\n tag_start = self.content.rindex('<', attr_index)\n # check to ensure the first < doesn't have a closing > before the attribute\n unless self.content.index('>', tag_start) < attr_index\n end_ele = self.content.index(/>|\\/>/, tag_start)\n if self.content[end_ele,2] == '/>'\n tag_end = end_ele + 1\n elsif self.content[end_ele,1] == '>'\n tag_name = self.content[(tag_start + 1)..self.content.index(/\\s/, tag_start)-1]\n tag_end = self.content.index(\"</#{tag_name}>\", end_ele) + (tag_name.size+3)\n end\n last_index = end_ele\n tags << self.content[tag_start..tag_end]\n else\n last_index = attr_index + attr_value.size\n end\n else\n last_index = attr_index + attr_value.size\n end\n last_index += 1 \n end\n attr_index = nil\n end\n tags\n end",
"title": ""
},
{
"docid": "e436f3846355c92058799fae7409456d",
"score": "0.5925621",
"text": "def tag_names\n tags.map(&:name)\n end",
"title": ""
},
{
"docid": "e436f3846355c92058799fae7409456d",
"score": "0.5925621",
"text": "def tag_names\n tags.map(&:name)\n end",
"title": ""
},
{
"docid": "e436f3846355c92058799fae7409456d",
"score": "0.5925621",
"text": "def tag_names\n tags.map(&:name)\n end",
"title": ""
},
{
"docid": "fdc80997bf75e9fd7c2c591f3333521f",
"score": "0.59240276",
"text": "def tags\r\n @data[:tags] || []\r\n end",
"title": ""
},
{
"docid": "3d4869287ae535ae8f03b7403418faa5",
"score": "0.59129447",
"text": "def tags(*tags)\n if tags.size == 0\n attribute(\"tags\")\n else\n tags = tags[0] if tags.size == 1 && tags[0].is_a?(Array)\n attribute(\"tags\", tags.map(&:to_s))\n end\n end",
"title": ""
},
{
"docid": "89f9428e449ce34c294c08e23ce9e75b",
"score": "0.59069794",
"text": "def tag_names\n tags.collect(&:name)\n end",
"title": ""
},
{
"docid": "751e2168b98120955cc83438ce0897ff",
"score": "0.59009385",
"text": "def tags\n @@tags\n end",
"title": ""
},
{
"docid": "735d6df8309319e973ee622ade45a244",
"score": "0.5886065",
"text": "def tags_as_string\n self.tags.map{|t| t.tag}.join(',')\n end",
"title": ""
},
{
"docid": "c771b7c65e1995e863ab27b9b4ae4e4b",
"score": "0.58815944",
"text": "def tags\n\t\treturn (@tags || {}).keys\n\tend",
"title": ""
},
{
"docid": "8dfb3f322c02ba661ad2ad9da6006458",
"score": "0.5879759",
"text": "def tags=(value)\n Rails.logger.info(\">>>TAGS===: #{value}\")\n write_attribute(:tags, value.split(/\\W+/))\n end",
"title": ""
},
{
"docid": "e02f65369ffcac7162492d4fe9ea24c2",
"score": "0.5867534",
"text": "def tags\n CSV.parse(@tags)\n end",
"title": ""
},
{
"docid": "d464d02530f8cd2b4989a1feca9f7f9f",
"score": "0.5867415",
"text": "def collect_tags\n mail[:tags].to_s.split(', ').map { |tag| tag }\n end",
"title": ""
},
{
"docid": "d464d02530f8cd2b4989a1feca9f7f9f",
"score": "0.5867415",
"text": "def collect_tags\n mail[:tags].to_s.split(', ').map { |tag| tag }\n end",
"title": ""
},
{
"docid": "e9be0854a10ee3141578c159a60a85d8",
"score": "0.58538336",
"text": "def tags\n if @item[:tags].nil?\n return ''\n end\n @item[:tags].join(', ')\n end",
"title": ""
},
{
"docid": "2b29df9be78eefc0514de0d21ba051ae",
"score": "0.5853013",
"text": "def tagsname\n self.tags.map {|tag| tag.name}\n end",
"title": ""
},
{
"docid": "2b29df9be78eefc0514de0d21ba051ae",
"score": "0.5853013",
"text": "def tagsname\n self.tags.map {|tag| tag.name}\n end",
"title": ""
},
{
"docid": "c1a2a3320e93ac479d73c4d28872a3c5",
"score": "0.5850944",
"text": "def tag_name\n @value[:name]\n end",
"title": ""
},
{
"docid": "e7e98217bca5e2feab4a96d99bfbb9d5",
"score": "0.5849383",
"text": "def states\n @tags\n end",
"title": ""
},
{
"docid": "02c209722a5fa6f5639e691baa655fc4",
"score": "0.5846488",
"text": "def raw_tags_plist\n plist_virtual_attribute_get(:raw_tags)\n end",
"title": ""
},
{
"docid": "02c209722a5fa6f5639e691baa655fc4",
"score": "0.5846488",
"text": "def raw_tags_plist\n plist_virtual_attribute_get(:raw_tags)\n end",
"title": ""
},
{
"docid": "516ec7db24037e557efca465e2e64dfc",
"score": "0.584125",
"text": "def house_attributes\n ['tag.non_smoking', 'tag.lift_elevator', 'tag.suitable_for_disabled_people', 'tag.car_necessary', 'tag.use_exchange_of_car', 'tag.seclusion_privacy', 'tag.use_of_boat', 'tag.pet_care_wanted', 'tag.security_doorman']\n end",
"title": ""
},
{
"docid": "6b10280a0203aef044bb0b5221737d2e",
"score": "0.5830494",
"text": "def tag_list\n tags.map(&:to_s)\n end",
"title": ""
},
{
"docid": "19603cabf881035239d1a693c019484e",
"score": "0.58279574",
"text": "def tag_names\n\t\ttags.map(&:name).join\n\tend",
"title": ""
},
{
"docid": "25879246cbcd5b4238f175d7f9baa189",
"score": "0.580949",
"text": "def attribute_value\n end",
"title": ""
},
{
"docid": "3914dfbf2e6146352cb438a2071cc5c4",
"score": "0.5807077",
"text": "def supported_tags\n [\n # attributes\n :number, :severity, :cveid,\n\n # simple tags\n :title, :last_update, :cvss_base, :cvss_temporal, :pci_flag, :diagnosis,\n :consequence, :solution, :compliance, :result,\n\n # multiple tags\n :vendor_reference_list, :cve_id_list, :bugtraq_id_list\n ]\n end",
"title": ""
},
{
"docid": "2e4361999c7295690ec05a02603bc137",
"score": "0.58053315",
"text": "def tag\n\t\ttags\n\tend",
"title": ""
},
{
"docid": "b9a0bccacca31212dba4d929fdb28859",
"score": "0.5805074",
"text": "def attribute_value\n end",
"title": ""
},
{
"docid": "0c895457920999b0741a1ddd3e434657",
"score": "0.58038133",
"text": "def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"title": ""
},
{
"docid": "0c895457920999b0741a1ddd3e434657",
"score": "0.58038133",
"text": "def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"title": ""
},
{
"docid": "0c895457920999b0741a1ddd3e434657",
"score": "0.58038133",
"text": "def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"title": ""
},
{
"docid": "0c895457920999b0741a1ddd3e434657",
"score": "0.58038133",
"text": "def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"title": ""
}
] |
2d3f2f6291224ca401594a24c4ec21ba | GET /projects GET /projects.json | [
{
"docid": "77fff7e9aa18f251958d9fdd94bc4d0d",
"score": "0.0",
"text": "def index\n @projects = Project.page(params[:page]).per(10)\n end",
"title": ""
}
] | [
{
"docid": "dc8505687156cb859adc07f1e0435407",
"score": "0.8865399",
"text": "def projects\n return get(\"/projects/list\")\n end",
"title": ""
},
{
"docid": "e5cff083faf736771900db26645e7ffe",
"score": "0.87301385",
"text": "def get_projects\n self.class.get(\"/projects.json\")\n end",
"title": ""
},
{
"docid": "d0b43a945df8ac3143faff08578a6c1d",
"score": "0.85306555",
"text": "def projects\n get_request 'projects'\n end",
"title": ""
},
{
"docid": "853333d135e01193f216baf64566acf2",
"score": "0.8451925",
"text": "def projects\n request(\"/projects\").projects\n end",
"title": ""
},
{
"docid": "bab4e5c3d0fbbbb8103433e7b8671be3",
"score": "0.8291269",
"text": "def projects\n execute(:get, 'projects')\n end",
"title": ""
},
{
"docid": "80cd221cebf874cf2261e75652e5205f",
"score": "0.82888454",
"text": "def projects(query={})\n get('/projects', query)\n end",
"title": ""
},
{
"docid": "501b703f1b3e5a8241ac8aa4dfda89d7",
"score": "0.81016487",
"text": "def projects\n ret = RestClient.get \"#{@url}/projects\", \n { Authorization: \"Basic #{auth_string}\"}\n json = JSON.parse(ret.body)\n\n json['values']\n end",
"title": ""
},
{
"docid": "951158bcd1e7fdbcff93b273c7223d10",
"score": "0.8034061",
"text": "def projects\n uri = URI.parse(build_url \"projects\")\n\n fetch uri\n end",
"title": ""
},
{
"docid": "a380acb61eb74c4c7488b698727350a5",
"score": "0.80310625",
"text": "def get_projects\n @projects = Project.where(:client_id => params[:id])\n render :json => @projects, :nothing => true\n end",
"title": ""
},
{
"docid": "4a23323b482bb1d376c7eebacc47a087",
"score": "0.8012491",
"text": "def list\n get('projects')['projects']\n end",
"title": ""
},
{
"docid": "282303f3170fa38d46f6765afa1753a9",
"score": "0.8000307",
"text": "def projects(query={})\n perform_get(\"/api/1/projects\", :query => query)\n end",
"title": ""
},
{
"docid": "224d34e29ac266471b7ef3d13ad053e7",
"score": "0.79284865",
"text": "def get_projects\n projects = []\n res = send_authenticated_request_and_parse('/httpAuth/app/rest/projects')\n if !res.nil? and res.key?(\"project\")\n res['project'].each do |project|\n if project['id'] == '_Root'\n next\n end\n projects << project['id'].downcase\n end\n end\n projects\n end",
"title": ""
},
{
"docid": "056a9e8dc02b675786143e67e6ac060d",
"score": "0.7868031",
"text": "def projects(params={})\n resource = endpoint_for(:projects)\n request_with_auth(resource)\n end",
"title": ""
},
{
"docid": "4f5630e29821bef6d57cb56e656012a4",
"score": "0.78593457",
"text": "def index\n @projects = Project.all\n render json: @projects\n end",
"title": ""
},
{
"docid": "423037e939fecc75fd5b24d7e29a81a0",
"score": "0.78498614",
"text": "def index\n @projects = Project.all\n\n render json: @projects\n end",
"title": ""
},
{
"docid": "2cedb65d21bc0c03383f9749f8cf09c0",
"score": "0.78391945",
"text": "def projects\n render json: @current_user.projects_list\n end",
"title": ""
},
{
"docid": "b2a525db1b49d086a4547b1cfbdf0b60",
"score": "0.7823788",
"text": "def projects\n\t\trender json: Timesheet.projects(timesheet_user), each_serializer: ProjectSimpleSerializer\n\tend",
"title": ""
},
{
"docid": "16851c84f0487f76d9b710941a1910a6",
"score": "0.78182733",
"text": "def get_projects\n request('project', 'list', nil, resource[:auth]).collect do |project|\n project[:name]\n end\n end",
"title": ""
},
{
"docid": "16851c84f0487f76d9b710941a1910a6",
"score": "0.78182733",
"text": "def get_projects\n request('project', 'list', nil, resource[:auth]).collect do |project|\n project[:name]\n end\n end",
"title": ""
},
{
"docid": "88269cd1b27ded53e4ed4cc030db0548",
"score": "0.7806861",
"text": "def index\n @projects = Project.roots\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "e9ba6df30b08b4bc08a2430aa42831db",
"score": "0.78001654",
"text": "def index\n @projects = Project.all\n render json: @projects\n end",
"title": ""
},
{
"docid": "6bd2125c523abd6e7ddfedfb77978e94",
"score": "0.77985007",
"text": "def index\n @projects = @current_user.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @projects }\n end\n end",
"title": ""
},
{
"docid": "2e5417264e1a587c5586be4c8bba5a2d",
"score": "0.77792805",
"text": "def index\n @projects = current_user.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "2e5417264e1a587c5586be4c8bba5a2d",
"score": "0.77792805",
"text": "def index\n @projects = current_user.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "ecaeaa6c2fee59acecf6c0c8fa66520a",
"score": "0.7758861",
"text": "def index\n projects = current_user.projects.all\n render json: { projects: projects }\n end",
"title": ""
},
{
"docid": "5c8f52dacd1afdd9fc9e9017fcb77fec",
"score": "0.77159643",
"text": "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html {}\n format.json { render json: @projects }\n end\n # render json: @projects\n end",
"title": ""
},
{
"docid": "70feb1554ff3c792c4c296cacc17574a",
"score": "0.7708359",
"text": "def projects\n @projects ||= api.get('/projects.json').collect { |hash|\n Ketchup::Project.new(api, hash)\n }\n end",
"title": ""
},
{
"docid": "dfbe4e6b5bd888dea7a9d84a7337b488",
"score": "0.7695938",
"text": "def projects optional_params = {}\n request('projects', optional_params)['projects']\n end",
"title": ""
},
{
"docid": "6e1ca3a9e609427c72f7a9248c9e43a3",
"score": "0.7695487",
"text": "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "6e1ca3a9e609427c72f7a9248c9e43a3",
"score": "0.7695487",
"text": "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "6e1ca3a9e609427c72f7a9248c9e43a3",
"score": "0.7695487",
"text": "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "6e1ca3a9e609427c72f7a9248c9e43a3",
"score": "0.7695487",
"text": "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "6e1ca3a9e609427c72f7a9248c9e43a3",
"score": "0.7695487",
"text": "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "6e1ca3a9e609427c72f7a9248c9e43a3",
"score": "0.7695487",
"text": "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "6e1ca3a9e609427c72f7a9248c9e43a3",
"score": "0.7695487",
"text": "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "6e1ca3a9e609427c72f7a9248c9e43a3",
"score": "0.7695487",
"text": "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "6e1ca3a9e609427c72f7a9248c9e43a3",
"score": "0.7695487",
"text": "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "6e1ca3a9e609427c72f7a9248c9e43a3",
"score": "0.7695487",
"text": "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "6e1ca3a9e609427c72f7a9248c9e43a3",
"score": "0.7695487",
"text": "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "6e1ca3a9e609427c72f7a9248c9e43a3",
"score": "0.76947474",
"text": "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "c334db0e40f755ebee55a4c7b169ccd6",
"score": "0.7679312",
"text": "def index\n load_projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "5ab304f7931e8f3bdcbeb45ed978140b",
"score": "0.7676111",
"text": "def index\n @client = current_client\n @projects = @client.projects\n @actual_projects = @projects.actual\n @offered_projects = @projects.offered\n @completed_projects = @projects.completed\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "0c9324ac3c7b0ee8bd0b533050a85653",
"score": "0.7655845",
"text": "def index\n @projects = current_user.projects\n authorize! :read, Project\n respond_to do |format|\n format.html\n format.json { render json: @projects.as_json, status: :ok }\n end\n end",
"title": ""
},
{
"docid": "4a454f57d2fc22894901471feb24af9e",
"score": "0.765246",
"text": "def all_projects\n resp = @conn.get 'projects.json'\n resp.body\n end",
"title": ""
},
{
"docid": "bc8c7b1787dadfe4d9b8231b2b779cd0",
"score": "0.7641209",
"text": "def index\n @projects = Project.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @projects }\n end\n end",
"title": ""
},
{
"docid": "dfda27747394b2bf6d76ca669d0843f4",
"score": "0.7605187",
"text": "def projects ; get_projects ; end",
"title": ""
},
{
"docid": "a5daad967e6e41ec5780aa8b81a22dd0",
"score": "0.7593542",
"text": "def index\n @root = \"projects\"\n \n @roles = Role.all\n @projects = Project.all\n @path = projects_path\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "8a281112e559422d3053f7737a0b52bc",
"score": "0.75833386",
"text": "def getProjects\n \tif params[:status_id] \n\t\t\t@projects = Project.where(:status_id => params[:status_id])\n\t\telse\n \t\t@projects = Project.all\n \tend\n \trender :json => @projects, include: ['user', 'client', 'assigned'] \n end",
"title": ""
},
{
"docid": "f94aa93fff8cf3d0516bdc572c661cf0",
"score": "0.75039005",
"text": "def index\n @projects = Project.scoped\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Project.published.to_json(only: [:code, :name]) }\n end\n end",
"title": ""
},
{
"docid": "d3d7ba04690738fbdadaac1ef2a5a5e5",
"score": "0.7499818",
"text": "def index\n @projects = Project.where(:user_id => session[:user_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "132b05510fb4b0e45c09fe3cfdd5f136",
"score": "0.7471867",
"text": "def index\n @projects_json = self.class.get('/project?fields=name')\n @projects_hash = JSON.parse(@projects_json.body)\n @projects_names = []\n @projects_hash.each do |project|\n @projects_names << project['name']\n end\n @projects_names\n end",
"title": ""
},
{
"docid": "a5c28e2268a42e0d9d3ea08ef15eb4f1",
"score": "0.74702597",
"text": "def project(id)\n get(\"/projects/#{id}\")\n end",
"title": ""
},
{
"docid": "13a81a8cc7bacabb334b26eeaf83b07c",
"score": "0.7465419",
"text": "def projects_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TtsApi.projects ...\"\n end\n # resource path\n local_var_path = \"/projects\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ProjectsCollection')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TtsApi#projects\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "7ca95226ed557703083cafb547fbe59c",
"score": "0.7451758",
"text": "def index\n @projects = Project.all\n \n @projects_json = []\n @projects.each do |p|\n @projects_json.push(p.to_json)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects_json }\n end\n end",
"title": ""
},
{
"docid": "23d810faf3c33e4633f5fb292e070517",
"score": "0.7446955",
"text": "def index\n @project = Project.new\n @projects = current_user.company.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "078c154643b6a933df6f663fe190a2c2",
"score": "0.7443802",
"text": "def projects(options = {})\n post(\"/projects\", options)[\"projects\"].map {|obj| Hashie::Mash.new obj }\n end",
"title": ""
},
{
"docid": "99e1cf55b13ebd5ed6ed420c2b064788",
"score": "0.74404895",
"text": "def projects\n @projects ||= Harvest::API::Projects.new(credentials)\n end",
"title": ""
},
{
"docid": "0e4c591ec71651ef7abd33c707332851",
"score": "0.74312586",
"text": "def index\n @project_resources = ProjectResource.all\n render json: @project_resources, status: :ok\n end",
"title": ""
},
{
"docid": "ae2a5b59137ba2dd7cc819558addbc83",
"score": "0.74088264",
"text": "def index\n @projects = Project.find(:all, :conditions => { :user_id => current_user.id} )\n \n\trespond_to do |format|\n\t format.html # index.html.erb\n\t format.json { render :json => @projects }\n\tend\n end",
"title": ""
},
{
"docid": "1b644311a0e854fd14a95d0dd913c111",
"score": "0.7384277",
"text": "def projects\n projects = Project.all_manager_of(@user) + Project.all_subscribed_to(@user)\n # Only return relevant attributes\n response = projects.map do |project|\n perm = ProjectPermission.get_user_permission(@user, project).permission\n next {\n :id => project.id,\n :name => project.name,\n :created_ts => project.created_at.to_i,\n :last_commit_hash => ProjectChange.all_project_updates(project, 1).first.commit_hash,\n :can_write => [ProjectPermission::OWNER, ProjectPermission::COAUTHOR].include?(perm)\n }\n end\n render json: response\n end",
"title": ""
},
{
"docid": "91ed61ffc92a094642a498a4478649f4",
"score": "0.7382023",
"text": "def projects(options = {})\n url = options[:starred].nil? ? \"projects\" : \"projects/starred\"\n objects_from_response(:get, url, \"projects\", options)\n end",
"title": ""
},
{
"docid": "8085e3bd29549bec962e860c3281443f",
"score": "0.7359771",
"text": "def projects_list(page, per_page)\n path = sprintf(\"/api/v2/projects\")\n data_hash = {}\n post_body = nil\n \n reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)\n rc, err = PhraseApp.send_request_paginated(@credentials, \"GET\", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)\n if err != nil\n return nil, err\n end\n \n return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Project.new(item) }, err\n end",
"title": ""
},
{
"docid": "212be722bb21ccc7d4f409acfe39fad3",
"score": "0.73452514",
"text": "def index\n @projects = Project.all\n\n respond_with @project\n end",
"title": ""
},
{
"docid": "659799b14be30b251cce71333e74f2a5",
"score": "0.73414",
"text": "def getProjects\n\t\ttoken = params[:token]\n\t\trender User.getProjectsAsJSon(token)\n\tend",
"title": ""
},
{
"docid": "69166a276345d8b20fef95d0525e229a",
"score": "0.7337497",
"text": "def projects\n @projects = Project.all\n end",
"title": ""
},
{
"docid": "34ddd4b99383b89540bb7269fa7a027c",
"score": "0.7329359",
"text": "def projects\n make_call(\"tl.getProjects\", {}, \"1.0b5\" )\n end",
"title": ""
},
{
"docid": "42f1aa71728764865d783f298c28a5a0",
"score": "0.7311636",
"text": "def get_projects\n @projects = current_user.projects\n projects = []\n @projects.each do |project|\n projects << {\n :id => project.id,\n :title => project.acc,\n :description => project.description,\n :start => project.start_date,\n :end => project.dead_line,\n :color => case project.status\n when 'running'\n 'red'\n when 'complete'\n 'green'\n end\n }\n end\n render :text => projects.to_json\n end",
"title": ""
},
{
"docid": "8183dd2bce9fbb8e679f8602fd280724",
"score": "0.72940016",
"text": "def index\n # @projects = project.all\n @projects = @department.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "ae61f8106a086e0275ba2fb40aae031c",
"score": "0.7290418",
"text": "def show\n @project = Project.find(params[:id])\n render json: @project\n end",
"title": ""
},
{
"docid": "ae61f8106a086e0275ba2fb40aae031c",
"score": "0.7290418",
"text": "def show\n @project = Project.find(params[:id])\n render json: @project\n end",
"title": ""
},
{
"docid": "6960ee5cb5e2593d797b48827f0bc915",
"score": "0.72838986",
"text": "def projects_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProductsApi.projects_get ...'\n end\n # resource path\n local_var_path = '/projects'\n\n # query parameters\n query_params = {}\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'public'] = opts[:'public'] if !opts[:'public'].nil?\n query_params[:'owner'] = opts[:'owner'] if !opts[:'owner'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].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', 'text/plain'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Project>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProductsApi#projects_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "64bb4390d135316df7d3cb122ba19f5d",
"score": "0.727488",
"text": "def show\n @project = Project.find(params[:id])\n\n render json: @project\n end",
"title": ""
},
{
"docid": "1f9acc2fe0ffdfa37d77f32d3e36ca2a",
"score": "0.7269888",
"text": "def listProjects\n @projects = Project.all\n end",
"title": ""
},
{
"docid": "1f9acc2fe0ffdfa37d77f32d3e36ca2a",
"score": "0.7269888",
"text": "def listProjects\n @projects = Project.all\n end",
"title": ""
},
{
"docid": "40aa789963139227a6e46db59b694b16",
"score": "0.72349304",
"text": "def show\n @project = Project.find(params[:id])\n @projects = @project.children\n respond_to do |format|\n if @projects.empty?\n # Requesting a project that has no sub projects gives its info.\n format.html # show.html.erb\n format.json { render json: @project }\n else \n # Requesting a project that has sub projects gives a list of all of its sub projects. \n format.html { render \"index\" } # index.html.erb\n format.json { render json: @projects }\n end\n end\n end",
"title": ""
},
{
"docid": "f9ba1cb3aec5173f331a42f326b7172f",
"score": "0.72339207",
"text": "def projects(workspace_id)\n get(\"/workspaces/#{workspace_id}/projects\")\n end",
"title": ""
},
{
"docid": "64e56eb926bb94a91f01de19dfba56d4",
"score": "0.72320867",
"text": "def project id\n get_request \"projects/#{id}\"\n end",
"title": ""
},
{
"docid": "ee036b99280361654f537ee7ba0950ff",
"score": "0.72126997",
"text": "def show\n @project = Project.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @project }\n end\n end",
"title": ""
},
{
"docid": "fbce83c24fc5e2eef37e2f502a8c8a1d",
"score": "0.7211629",
"text": "def show\n begin\n account = current_user.accounts.find(params[:id]) #required as a part of the route\n if (account)\n account.fetch_projects\n account.reload\n json = account.as_json\n json[\"projects\"] = account.projects\n render json: { account: json }, status: :ok\n end\n rescue ActiveRecord::RecordNotFound\n render json: { error: I18n.t('request.forbidden') }, status: :forbidden\n end\n end",
"title": ""
},
{
"docid": "fcdda66f50db5c37431380d3e078559f",
"score": "0.7204275",
"text": "def index\n @projects = Project.all\n render json: @projects, include: [:tasks, {collaborators: {include: [:user]}}]\n end",
"title": ""
},
{
"docid": "09f8ed3aed897cd86669c8df9de26dc0",
"score": "0.7194145",
"text": "def project_names\n @projects = current_user.projects\n\n render json: @projects.map { |project| { id: project.id, name: project.name, slug: project.slug } }, status: 200\n end",
"title": ""
},
{
"docid": "722caf6e470e5c5ed4af0b176d64a386",
"score": "0.719055",
"text": "def show\n @projects = Project.find(params[:id])\n end",
"title": ""
},
{
"docid": "dede57c067cba8f4877d15c730a1e0e1",
"score": "0.71758777",
"text": "def index\n @projects = @projects.page(params[:page])\n respond_with @projects\n end",
"title": ""
},
{
"docid": "188ede7d53df0d8d2a37ab2d2e6bc92a",
"score": "0.7167758",
"text": "def show\n render json: @project\n end",
"title": ""
},
{
"docid": "a39760f3142f74ae391703121111298c",
"score": "0.71661323",
"text": "def index\n render json: current_user.projects.ordered\n end",
"title": ""
},
{
"docid": "1c6b81d1854536fd101e92dbb0e9c4bc",
"score": "0.7163045",
"text": "def index\n if current_user.admin?\n @projects= Project.all\n render json: @projects\n else\n \t@projects= Project.where(\"user_id = ?\", current_user)\n \trender json: @projects\n end\n end",
"title": ""
},
{
"docid": "6973852d2907b21b246a73d1f3883453",
"score": "0.7160099",
"text": "def index\n # show only projects I am member of and get only root projects (have no parents)\n @projects = current_user.projects.where(:ancestry => nil)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "72111bd5022f67789789d6bdda903da4",
"score": "0.71556973",
"text": "def project(project, options = {})\n get \"projects/#{project}\", options\n end",
"title": ""
},
{
"docid": "a81e991e448f9d2a656eb009be5fde75",
"score": "0.71460885",
"text": "def index\n @projects = Project.all\n respond_with(@projects)\n end",
"title": ""
},
{
"docid": "929cef3b88c052ca80ecb77a2be15b20",
"score": "0.71346575",
"text": "def show\n json_response(@degree_projects)\n end",
"title": ""
},
{
"docid": "33674df489259280cedb0dfe43225b16",
"score": "0.71267027",
"text": "def list\n projects = []\n current_user.accounts.each { |account|\n account.fetch_projects\n account.reload\n projects.concat account.projects\n }\n render json: { projects: projects }, status: :ok\n end",
"title": ""
},
{
"docid": "4996fafa9cbbf3cab2a8a06c1fd6c0ff",
"score": "0.7124004",
"text": "def projects\n @projects\n end",
"title": ""
},
{
"docid": "b7917d367f406901a6a3e8395d9152c7",
"score": "0.7123349",
"text": "def index\n if params[:query].present?\n @projects = Project.search(params[:query], load: true)\n else\n @projects = Project.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"title": ""
},
{
"docid": "ff3457f85266158df4632e19aa919300",
"score": "0.71164864",
"text": "def show\n @projects = Project.find_by(id: params[:id])\n end",
"title": ""
},
{
"docid": "79f5965047ae4517f27b0da9eb87f82a",
"score": "0.7114364",
"text": "def projects\n Harvest::Resources::Project\n end",
"title": ""
},
{
"docid": "7c8e74e4f1e1ded6eafd37950973a439",
"score": "0.7113263",
"text": "def get_project_info()\n GitBox::base_uri @server\n GitBox::basic_auth @user, @pass\n GitBox::get(\"/projects/#{@project}.json\")\n end",
"title": ""
},
{
"docid": "1d9f6c580bbe7eea70cf6c57071f2f94",
"score": "0.71123296",
"text": "def index\n respond_with(projects)\n end",
"title": ""
},
{
"docid": "138a3231b2bbceaa9e4fe9385b7965bb",
"score": "0.7106387",
"text": "def projects(options = {})\n paginate \"/projects\", options\n end",
"title": ""
},
{
"docid": "4ca2263cc5c8e1c96443894b0f93c397",
"score": "0.7101176",
"text": "def get_project(project_id)\n get \"projects/#{project_id}\"\n end",
"title": ""
},
{
"docid": "9e1355b4953f84d7e86c46fc4a275ca8",
"score": "0.709913",
"text": "def projects(opts = {})\n find_collection(\"projects\", opts)\n end",
"title": ""
},
{
"docid": "ef2141c96c99e9548a3423be63ac22d3",
"score": "0.70919305",
"text": "def projects\n tmp = client.get @json['user']['links']['projects']\n tmp['projects'].map do |project_meta|\n project_uri = project_meta['project']['links']['self']\n project = client.get project_uri\n client.factory.create(GoodData::Project, project)\n end\n end",
"title": ""
}
] |
ee79465d3218530b6d8eb24d9f6599fd | builds a prop that is not a List or Map type PrimitiveType is one of Boolean, Double, Integer, Json, String, or Timestamp | [
{
"docid": "4836582a059df38acb7f3c7048fc977e",
"score": "0.0",
"text": "def singular_from(key, spec, substructs)\n primitive = spec['PrimitiveItemType'] || spec['PrimitiveType']\n\n if primitive\n primitive = 'Integer' if primitive == 'Long'\n const_get(:\"#{primitive}Prop\").new(key, spec)\n else\n StructureProp.new(key, spec, substructs)\n end\n end",
"title": ""
}
] | [
{
"docid": "434a303cafa05aa5565e9b416608c891",
"score": "0.6256127",
"text": "def build_simple_property(values)\n values.collect do |value|\n case value\n when RDF::Literal::Integer\n value.to_i\n when RDF::Literal::Double\n value.to_f\n when RDF::Literal::Decimal\n value.to_f\n when RDF::Literal::Boolean\n value.true?\n when RDF::Literal::Time\n value.to_s\n when RDF::Literal::Date\n value.to_s\n when RDF::Literal::DateTime\n value.to_s\n when RDF::Literal\n value.to_s\n else\n value.to_s\n end\n end\n end",
"title": ""
},
{
"docid": "434a303cafa05aa5565e9b416608c891",
"score": "0.62538856",
"text": "def build_simple_property(values)\n values.collect do |value|\n case value\n when RDF::Literal::Integer\n value.to_i\n when RDF::Literal::Double\n value.to_f\n when RDF::Literal::Decimal\n value.to_f\n when RDF::Literal::Boolean\n value.true?\n when RDF::Literal::Time\n value.to_s\n when RDF::Literal::Date\n value.to_s\n when RDF::Literal::DateTime\n value.to_s\n when RDF::Literal\n value.to_s\n else\n value.to_s\n end\n end\n end",
"title": ""
},
{
"docid": "45862f0fc067d993267255b86cea76fa",
"score": "0.59679735",
"text": "def munge_value(prop_value,prop_type=nil)\n munged = nil\n wrap = nil\n\n # This initially started as per-type handling but it doesn't\n # seem that it really needs to be that different\n case prop_type\n when :boolean, :count, :integer, :time, # mostly numbers\n :fmri, :host, :hostname, :net_address, :net_address_v4,\n :net_address_v6, :uri, # more complex strings\n :array # a processing hint for arrays of string type arguments\n wrap = prop_value.kind_of?(Array) ? true : false\n munged = to_svcs(prop_value)\n when :astring, :ustring, :opaque\n # Arrays of string type arguments to be treated as list values\n # must be provided with the hint type :array\n # Debug command output will be somewhat misleading due to \\s being eaten\n munged = [prop_value].flatten.map{ |val| to_svcs(val) }.join(\"\\ \")\n else\n # Fall through processing fully escapes the prop_value if we\n # get here without some known type. This will almost certainly be wrong\n # for complex types\n warning \"Unknown property type (#{prop_type})\" unless prop_type.nil?\n munged = to_svcs(prop_value.to_s)\n end\n\n if wrap && munged.kind_of?(Array)\n munged.unshift \"(\"\n munged.push \")\"\n end\n return munged\n end",
"title": ""
},
{
"docid": "a74380da9f1f838fe87ab61f7969bb2e",
"score": "0.58934844",
"text": "def format_property_value(attr, type)\n return unless send(attr.to_sym).present?\n case type.to_sym\n when :integer\n send(\"#{attr.to_sym}=\", send(attr.to_sym).to_i)\n when :float\n send(\"#{attr.to_sym}=\", send(attr.to_sym).to_f)\n when :boolean\n send(\"#{attr.to_sym}=\", ActiveModel::Type::Boolean.new.cast(send(attr.to_sym)))\n else\n raise ArgumentError, 'Supported types are :boolean, :integer, :float'\n end\n end",
"title": ""
},
{
"docid": "36181afc3fb98fa7ef44b91929d18907",
"score": "0.5864638",
"text": "def untyped_props(param0); end",
"title": ""
},
{
"docid": "da962e562bae3313e60baaf3ba6a1e86",
"score": "0.58236444",
"text": "def primitive\n @property_hash[:primitive]\n end",
"title": ""
},
{
"docid": "da962e562bae3313e60baaf3ba6a1e86",
"score": "0.58236444",
"text": "def primitive\n @property_hash[:primitive]\n end",
"title": ""
},
{
"docid": "da962e562bae3313e60baaf3ba6a1e86",
"score": "0.58236444",
"text": "def primitive\n @property_hash[:primitive]\n end",
"title": ""
},
{
"docid": "da962e562bae3313e60baaf3ba6a1e86",
"score": "0.58236444",
"text": "def primitive\n @property_hash[:primitive]\n end",
"title": ""
},
{
"docid": "5615440dfe86f00a198f6daea92d6dfe",
"score": "0.57840574",
"text": "def compile_property(field)\n new_property = \" property :#{field['name']}, #{find_type(field)}\"\n new_property += \", :length => #{field['length']}\" if field['length']\n new_property += \", :default => #{field['default']}\" if field['default'] and not field['default'].blank?\n if field['validations'] and field['validations'].key?('required')\n new_property += \", :nullable => #{field['validations']['required'] ? 'false' : 'true'}\"\n end\n new_property\n end",
"title": ""
},
{
"docid": "5aa72ab7c01d0c45f32988ccbff08bff",
"score": "0.5772376",
"text": "def test_s47_Defining_bad_property_type\n p1 = Metakit::IntProp.new(\"p2\");\n\n Metakit::Storage.create {|s1|\n v1 = s1.get_as(\"v1[p1:A]\");\n# #else \n# // assertions are enabled, turn this into a dummy test instead\n# c4_View v1 = s1.GetAs(\"v1[p1:I]\");\n# #endif \n v1.add(p1[123]);\n\n assert_equal 1, v1.get_size\n assert_equal 123, p1.get(v1[0])\n }\n end",
"title": ""
},
{
"docid": "ff895e91dcca36b5f0f876d62440bfc2",
"score": "0.57581794",
"text": "def primitive_type\n @property_hash[:primitive_type]\n end",
"title": ""
},
{
"docid": "73cd1f5ecb5921a894e492b11a557855",
"score": "0.5686014",
"text": "def result\n calling_mapper.for(Property.new(value.key, \"boolean-#{value.value}\")).result\n end",
"title": ""
},
{
"docid": "46cd819ad556615e4d2b70e7dada5bb7",
"score": "0.5685506",
"text": "def to_prop_call\n call = \"prop :#{name}, #{String === @type ? @type : @type.generate_rbi}\"\n\n EXTRA_PROPERTIES.each do |extra_property|\n value = send extra_property\n call += \", #{extra_property}: #{value}\" unless value.nil?\n end\n\n call\n end",
"title": ""
},
{
"docid": "33e8959910ff35db74082fb680acf7a3",
"score": "0.5672523",
"text": "def primitive?(property)\n array_primitive = (property.is_a?(Api::Type::Array)\\\n && !property.item_type.is_a?(::Api::Type::NestedObject))\n property.is_a?(::Api::Type::Primitive)\\\n || array_primitive\\\n || property.is_a?(::Api::Type::KeyValuePairs)\\\n || property.is_a?(::Api::Type::Map)\\\n || property.is_a?(::Api::Type::Fingerprint)\\\n || property.is_a?(::Api::Type::ResourceRef)\n end",
"title": ""
},
{
"docid": "5eaf37ef14f610fb67e50300c6f8a42f",
"score": "0.56064934",
"text": "def type_of_property\n \t[\n \t\t['Apartment', 'Apartment'],\n ['Condo', 'Condo'],\n ['Efficiency', 'Efficiency'],\n ['Multifamily', 'Multifamily'],\n ['Single', 'Single'],\n ['Townhouse', 'Townhouse'],\n ['Villa', 'Villa'],\n ['--Not Applicable--', 'Not Applicable']\n \t]\n end",
"title": ""
},
{
"docid": "6c837339d9c00597fdeec3fcdef96732",
"score": "0.5579423",
"text": "def template_string_property(opts)\n opts = check_params(opts,[:property_types])\n super(opts)\n end",
"title": ""
},
{
"docid": "5e48dd54a39b4eefdd907492218a2797",
"score": "0.5571752",
"text": "def generate_base_property(data) end",
"title": ""
},
{
"docid": "88d293d02161d2252f96fb681a19c22e",
"score": "0.556491",
"text": "def init_jaxb_json_hash(_o)\n super _o\n if !_o['literalValue'].nil?\n _oa = _o['literalValue']\n if(_oa.is_a? Hash)\n @literalValue = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @literalValue = Boolean.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @literalValue = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @literalValue.push Boolean.from_json(_item)\n else\n @literalValue.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @literalValue = _oa\n end\n end\n end",
"title": ""
},
{
"docid": "fee0af05acc8319ae05269798da0c62c",
"score": "0.5552012",
"text": "def isPropvalue\n @RecordType == PROPVALUE\n end",
"title": ""
},
{
"docid": "c1a667a7fd038dda89bdcbfbd4d206a7",
"score": "0.54486406",
"text": "def type_with_compatibility(type)\n return PropertyType::TYPE_STRING if type == 's'\n return PropertyType::TYPE_STRING if type == PARAM_TYPE_STRING_LIST\n return PropertyType::TYPE_INTEGER if type == 'i'\n return PropertyType::TYPE_INTEGER if type == PARAM_TYPE_INTEGER_LIST\n return PropertyType::TYPE_BOOLEAN if type == 'b'\n return PropertyType::TYPE_REGULAR_EXPRESSION if type == 'r'\n return PropertyType::TYPE_STRING if is_set(type)\n\n type\n end",
"title": ""
},
{
"docid": "5e9b2caa8909d462ae473562fe216cde",
"score": "0.54243714",
"text": "def boolean_type?(property)\n property ? property.primitive == TrueClass : false\n end",
"title": ""
},
{
"docid": "c0767c8f6ff2459e8fcc7719a8b44ea4",
"score": "0.5409119",
"text": "def set_simple_properties\n prop_set([:X__PROPERTY_INT__X, :X__PROPERTY_BOOL__X])\n end",
"title": ""
},
{
"docid": "ef863de66d5bfd32600eb8ddc04ef1db",
"score": "0.53792757",
"text": "def properties\n { 'object_type' => 'boolean', 'value' => @value }\n end",
"title": ""
},
{
"docid": "f68fc29246b76576bb0ed3d5238a4b22",
"score": "0.5347958",
"text": "def property(property_name, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "f68fc29246b76576bb0ed3d5238a4b22",
"score": "0.5347958",
"text": "def property(property_name, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "a6ff085b52d2b0789cdadc063b53bf34",
"score": "0.53459525",
"text": "def msg_not_boolean(parent, key, value)\n \"#{Rainbow('').reset}\" \\\n \"Property #{Rainbow(key).yellow} of cop #{Rainbow(parent).yellow}\" \\\n \" is supposed to be a boolean and #{Rainbow(value).yellow} is not.\"\n end",
"title": ""
},
{
"docid": "3247343889c3c849c76b2dff75ee512c",
"score": "0.5341645",
"text": "def primitives=(should)\n @property_hash[:primitives] = should\n end",
"title": ""
},
{
"docid": "3247343889c3c849c76b2dff75ee512c",
"score": "0.5341645",
"text": "def primitives=(should)\n @property_hash[:primitives] = should\n end",
"title": ""
},
{
"docid": "4aac5667d35770bd907b749793b38ad8",
"score": "0.5337664",
"text": "def boolean_type?(property)\n property ? property.type == 'Boolean' : false\n end",
"title": ""
},
{
"docid": "ad6477464b3e6523105eca27c1d511e6",
"score": "0.53289926",
"text": "def primitives\n @property_hash[:primitives]\n end",
"title": ""
},
{
"docid": "ad6477464b3e6523105eca27c1d511e6",
"score": "0.53289926",
"text": "def primitives\n @property_hash[:primitives]\n end",
"title": ""
},
{
"docid": "4282c53ed1259f7c0ce4d4b0a2d22708",
"score": "0.5317805",
"text": "def primitive=(should)\n @property_hash[:primitive] = should\n end",
"title": ""
},
{
"docid": "4282c53ed1259f7c0ce4d4b0a2d22708",
"score": "0.5317805",
"text": "def primitive=(should)\n @property_hash[:primitive] = should\n end",
"title": ""
},
{
"docid": "4282c53ed1259f7c0ce4d4b0a2d22708",
"score": "0.5317805",
"text": "def primitive=(should)\n @property_hash[:primitive] = should\n end",
"title": ""
},
{
"docid": "4282c53ed1259f7c0ce4d4b0a2d22708",
"score": "0.5317805",
"text": "def primitive=(should)\n @property_hash[:primitive] = should\n end",
"title": ""
},
{
"docid": "6427f826e853eb88b1dd4ac461b06279",
"score": "0.5274095",
"text": "def compile_properties_representation!( via, schema, from, to, hash, out_hash, is_parser = false )\n var = ::Proper::Api::Entity.random_variable!\n code = \"#{var} = #{from}\\n\"\n\n code << \"if #{var}.nil?\\n\"\n code << \"raise Respect::ValidationError.new(\\\"Found nil under \\#{_field_name} for object \\#{_object}\\\")\\n\" unless schema.allow_nil? \n code << \"#{to} = nil\\n\" if schema.allow_nil?\n code << \"else\\n\"\n code << \"_object = #{var}\\n\"\n\n if out_hash\n code << \"#{to} ||= {}\\n\"\n end\n\n schema.properties.inject({}) do |memo, (name, property_schema)|\n property_value_chunk = unless is_parser\n if getter = property_schema.options[:get]\n ::Proper::Api::Entity.store_proc!( getter ) + \"[ #{var}, options ]\"\n else fname = (property_schema.options[:from] || name)\n hash ? \"#{var}[#{fname.inspect}]\" : \"#{var}.#{fname}\"\n end\n else\n hash ? \"#{var}[#{name.inspect}]\" : \"#{var}.#{name}\"\n end\n\n code << \"_field_name = #{ name.inspect }\\n\"\n \n if is_parser\n code << property_schema.compile_parser!( via, property_value_chunk, \"#{to}\" + (out_hash ? \"[#{name.inspect}]\" : \".#{name}\") )\n else\n code << property_schema.compile_representer!( via, property_value_chunk, \"#{to}\" + (out_hash ? \"[#{name.inspect}]\" : \".#{name}\") )\n end\n end\n\n code << \"end\\n\"\n\n code\n end",
"title": ""
},
{
"docid": "bc41e3ff730c6b40d6e7d5f7db1b73ee",
"score": "0.5265161",
"text": "def add_property(prop, value_type)\n properties[prop.to_s] = Item.new(prop, self) if(!properties[prop.to_s])\n if(!properties[prop.to_s]['valueType'])\n properties[prop.to_s]['valueType'] = value_type\n end\n properties[prop.to_s].id\n end",
"title": ""
},
{
"docid": "622929f703dfdf20b819e1d2bf4c0446",
"score": "0.52576506",
"text": "def anything_property(property)\n Schema::Object::Property.new(property.name, Schema::Anything.instance, property.required)\n end",
"title": ""
},
{
"docid": "c6ea50d26a3007abc0b6ed1384ef8f35",
"score": "0.52424645",
"text": "def template_integer_property(opts)\n opts = check_params(opts,[:property_types])\n super(opts)\n end",
"title": ""
},
{
"docid": "eafe5ef2c91bd9bac64bb3c874eb59ef",
"score": "0.52041036",
"text": "def write_local_property_with_type_conversion(property, value)\n @properties_before_type_cast[property.to_sym]=value if self.class._decl_props.has_key? property.to_sym\n write_local_property_without_type_conversion(property, Neo4j::TypeConverters.to_java(self.class, property, value))\n end",
"title": ""
},
{
"docid": "a57236ccc1dc71c701fdd7991b2bbd8b",
"score": "0.51997614",
"text": "def read_cast(property, value)\n # Short-circuit on 'NA'\n return nil if value == 'NA' or value == 'DISABLE'\n\n case property\n when # Integer values\n 'use_count',\n 'pin_len',\n 'pin_length',\n 'pin_min_len',\n 'pin_minimum_length',\n 'last_time_shift',\n 'virtual_token_remain_use',\n 'error_count',\n 'event_value',\n 'last_event_value',\n 'max_dtf_number',\n 'response_len',\n 'response_length',\n 'time_step'\n value.to_i\n\n when # Boolean values\n 'time_based_algo',\n 'event_based_algo',\n 'pin_supported',\n 'unlock_supported',\n 'pin_ch_on',\n 'pin_change_enabled',\n 'pin_enabled',\n 'pin_ch_forced',\n 'pin_change_forced',\n 'sync_windows',\n 'primary_token_enabled',\n 'virtual_token_supported',\n 'virtual_token_enabled',\n 'derivation_supported',\n 'response_chk',\n 'response_checksum',\n 'triple_des_used',\n 'use_3des'\n\n case value\n when 'YES' then true\n when 'NO' then false\n end\n\n when # Date/time values\n 'last_time_used',\n 'virtual_token_grace_period'\n\n # AAL2 returns UTC values, we add the timezone.\n Time.strptime(\"#{value} UTC\", '%a %b %d %H:%M:%S %Y %Z')\n\n when\n 'auth_mode'\n\n case value\n when 'RO' then :response_only\n when 'SG' then :signature_application\n when 'CR' then :challenge_response\n when 'MM' then :multi_mode\n when 'UL' then :unlock_v2\n else\n value\n end\n\n else # String values\n\n value\n end\n end",
"title": ""
},
{
"docid": "d749569c088721d2adc0df6707b7d196",
"score": "0.51612294",
"text": "def value_before_type_cast; end",
"title": ""
},
{
"docid": "d749569c088721d2adc0df6707b7d196",
"score": "0.51612294",
"text": "def value_before_type_cast; end",
"title": ""
},
{
"docid": "d749569c088721d2adc0df6707b7d196",
"score": "0.51612294",
"text": "def value_before_type_cast; end",
"title": ""
},
{
"docid": "f117ac94f67194e436e98e2005fe0e84",
"score": "0.51508045",
"text": "def data_type\n :Boolean\n end",
"title": ""
},
{
"docid": "c8c2300c146e15c6977062b7a79ea908",
"score": "0.51453346",
"text": "def short_prop_map; end",
"title": ""
},
{
"docid": "f58872861871178db5d1ba6011d78dfd",
"score": "0.5140208",
"text": "def define_java_property(pd)\n if transient?(pd) then\n logger.debug { \"Ignoring #{name.demodulize} transient attribute #{pd.name}.\" }\n return\n end\n # the standard underscore lower-case attributes\n prop = add_java_property(pd)\n # delegate the standard attribute accessors to the attribute accessors\n alias_property_accessors(prop)\n # add special wrappers\n wrap_java_property(prop)\n # create Ruby alias for boolean, e.g. alias :empty? for :empty\n if pd.property_type.name[/\\w+$/].downcase == 'boolean' then\n # Strip the leading is_, if any, before appending a question mark.\n aliaz = prop.to_s[/^(is_)?(\\w+)/, 2] << '?'\n delegate_to_property(aliaz, prop)\n end\n end",
"title": ""
},
{
"docid": "3b7f1c678102b33aca67e3037199fea5",
"score": "0.5139388",
"text": "def typecast_value_boolean(opts={});true;end",
"title": ""
},
{
"docid": "43e0830abd5bf8eb2c39bbbae9796e2c",
"score": "0.5131117",
"text": "def nested_property_create\n result = {}\n @resource.eachproperty do |prop|\n result[prop.name] = prop.should if prop.should.is_a?(Hash)\n end\n convert_puppet_input(result)\n end",
"title": ""
},
{
"docid": "aef79be3f4767181d2ddb1b248d1d789",
"score": "0.5127437",
"text": "def validate_conditional_formatting_value_object_type(v); end",
"title": ""
},
{
"docid": "19c88d49ae832079daa48babd01ecacc",
"score": "0.5113484",
"text": "def build(value)\n if array && value.is_a?(Array)\n CastedArray.new(self, value)\n else\n PropertyCasting.cast(self, value)\n end\n end",
"title": ""
},
{
"docid": "c039495a57469e3266f8bf29c27d3959",
"score": "0.5111116",
"text": "def python_type(prop)\n prop = Module.const_get(prop).new('') unless prop.is_a?(Api::Type)\n # All ResourceRefs are dicts with properties.\n if prop.is_a? Api::Type::ResourceRef\n return 'str' if prop.resource_ref.virtual\n return 'dict'\n end\n PYTHON_TYPE_FROM_MM_TYPE.fetch(prop.class.to_s, 'str')\n end",
"title": ""
},
{
"docid": "8b0e473f6ce481c7145c5f4f0754f9ca",
"score": "0.50997525",
"text": "def custom_property?; end",
"title": ""
},
{
"docid": "3f8afe0d53fa5a5935275eebe0bac4d6",
"score": "0.50901145",
"text": "def serialize_properties?\n properties_type == \"text\" || (properties_type == \"json\" && ActiveRecord::Base.connection.try(:mariadb?))\n end",
"title": ""
},
{
"docid": "df125ecb8b4cc259b13f75206355b5d0",
"score": "0.5089836",
"text": "def validate_new_value_type_for_primitive!(new_value)\n case new_value\n when String, Symbol, Numeric, Time, true, false, nil then true\n else\n raise ArgumentError, \"You've asked your ObjectifiedSession to only allow values of scalar types, but you're trying to store this: #{new_value.inspect}\"\n end\n end",
"title": ""
},
{
"docid": "be440197627b1f8618f50d908bfcf2bb",
"score": "0.50758743",
"text": "def init_jaxb_json_hash(_o)\n super _o\n if !_o['boolean'].nil?\n _oa = _o['boolean']\n if(_oa.is_a? Hash)\n @boolean = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @boolean = Boolean.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @boolean = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @boolean.push Boolean.from_json(_item)\n else\n @boolean.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @boolean = _oa\n end\n end\n if !_o['number'].nil?\n _oa = _o['number']\n if(_oa.is_a? Hash)\n @number = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @number = Boolean.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @number = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @number.push Boolean.from_json(_item)\n else\n @number.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @number = _oa\n end\n end\n if !_o['string'].nil?\n _oa = _o['string']\n if(_oa.is_a? Hash)\n @string = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @string = Boolean.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @string = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @string.push Boolean.from_json(_item)\n else\n @string.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @string = _oa\n end\n end\n end",
"title": ""
},
{
"docid": "ffaff2af9c4a038522e3645f3002c4ac",
"score": "0.5070543",
"text": "def node_from_property(property, value)\n property_class = node_class_for_property(property)\n if property_class == ColorNode\n ColorNode.new(value.to_symbol)\n else\n fail 'Cannot create boolean property node for property off' unless value\n property_class.new\n end\n end",
"title": ""
},
{
"docid": "d70693757388b4cb799ea6920abe608e",
"score": "0.5064405",
"text": "def setup_config_node_property_boolean_response_schema\n config_node_property_boolean_response_schema =\n {\n 'description' => 'Property value',\n 'type' => 'boolean'\n }\n\n setup_config_node_property_response_schema(config_node_property_boolean_response_schema)\nend",
"title": ""
},
{
"docid": "2f60751df7d3b0c3ba3ddde8a2909bad",
"score": "0.50549555",
"text": "def process_single_value(value, properties)\n if properties[:const] || value.nil?\n return properties[:default].call if properties[:default].is_a?(Proc)\n return nil if properties[:default].nil?\n value = properties[:default]\n end\n case properties[:type]\n when :string\n value.to_s\n when :integer\n value.to_i\n when :decimal\n BigDecimal(value)\n when :boolean\n value.is_a?(TrueClass) || value == 'true'\n when :json\n JSON.parse(value)\n when Array\n value\n else\n raise \"Unexpected type '#{type}' for '#{key}'\"\n end\n end",
"title": ""
},
{
"docid": "488e0cac9c36a0c50d61e10ed1adb621",
"score": "0.50448227",
"text": "def init_jaxb_json_hash(_o)\n super _o\n if !_o['string'].nil?\n _oa = _o['string']\n if(_oa.is_a? Hash)\n @string = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @string = Boolean.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @string = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @string.push Boolean.from_json(_item)\n else\n @string.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @string = _oa\n end\n end\n if !_o['number'].nil?\n _oa = _o['number']\n if(_oa.is_a? Hash)\n @number = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @number = Boolean.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @number = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @number.push Boolean.from_json(_item)\n else\n @number.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @number = _oa\n end\n end\n if !_o['boolean'].nil?\n _oa = _o['boolean']\n if(_oa.is_a? Hash)\n @boolean = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @boolean = Boolean.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @boolean = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @boolean.push Boolean.from_json(_item)\n else\n @boolean.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @boolean = _oa\n end\n end\n end",
"title": ""
},
{
"docid": "1e5fe3e903d3424f52b447325c89cdd0",
"score": "0.50368106",
"text": "def create_object_value(value)\n if(@force_type)\n # If we have the \"force_type\" option, we assume that every value\n # we get is a Resource/ActiveSource\n uri = value.respond_to?(:uri) ? value.uri : value\n ActiveSource.new(uri.to_s)\n elsif(value.is_a?(TaliaCore::ActiveSource) || value.is_a?(TaliaCore::SemanticProperty))\n value\n elsif(value.respond_to?(:uri)) # This appears to refer to a Source. We only add if we can find that source\n TaliaCore::ActiveSource.find(value.uri)\n elsif(prop_options[:type].is_a?(Class) && (prop_options[:type] <= TaliaCore::ActiveSource))\n TaliaCore::ActiveSource.find(value)\n else\n # Check if we need to add from a PropertyString\n propvalue = value.is_a?(PropertyString) ? value.to_rdf : value\n TaliaCore::SemanticProperty.new(:value => propvalue)\n end\n end",
"title": ""
},
{
"docid": "5689703ee28b29dd1f2dd0f461e576aa",
"score": "0.50334954",
"text": "def typecast_attributes\n @attributes.each_pair do |name,value|\n attr_type = attr_type_for(name)\n next unless attr_type\n case attr_type\n when \"bool\"\n @attributes[name] = (value == \"1\")\n end\n end\n @attributes\n end",
"title": ""
},
{
"docid": "1e7457413b3e42c5057f6c1a92d97734",
"score": "0.5032422",
"text": "def serialize_prolog(value)\n case value\n when RDF::AllegroGraph::Query::PrologLiteral then value.to_s\n when RDF::Query::Variable then value.to_s\n else \"!#{serialize(value)}\"\n end\n end",
"title": ""
},
{
"docid": "6666a2cd29d63c840da4850d6de0887a",
"score": "0.50318587",
"text": "def build(owner, value)\n obj = nil\n if value.is_a?(type)\n obj = value\n elsif type == Date\n obj = type.parse(value)\n else\n obj = type.new(value)\n end\n obj.casted_by = owner if obj.respond_to?(:casted_by=)\n obj.casted_by_property = self if obj.respond_to?(:casted_by_property=)\n obj\n end",
"title": ""
},
{
"docid": "5abb03338af1f58e0d2cfab3029f8c32",
"score": "0.50237095",
"text": "def property_type\n return '3' if any_lease_review? && @effective_date.present?\n\n @property_type\n end",
"title": ""
},
{
"docid": "983eec32c561bf02819ef2f43d1648c3",
"score": "0.50222397",
"text": "def property(prop)\n \"#{prop[:name]}: #{prop[:ts_type]};\"\n end",
"title": ""
},
{
"docid": "646a2e55ea4715e916f5b1061b79ae8d",
"score": "0.5021191",
"text": "def serialize_attribute(name,value)\n attr_value = value\n case attr_type_for(name)\n when \"bool\"\n attr_value = 0\n attr_value = 1 if value\n end\n {:name => name, :value => attr_value}\n end",
"title": ""
},
{
"docid": "c1fcd8023be01f1f1e5be0908cf32597",
"score": "0.50129557",
"text": "def coerce_value(v, type)\n\t\t\tif v.nil?\n\t\t\t\t'DEFAULT'\n\t\t\telse\n\t\t\t\tcase type\n\t\t\t\twhen :timestamp\n\t\t\t\t\tcase v\n\t\t\t\t\twhen String\n\t\t\t\t\t\t# Parse as RFC3339\n\t\t\t\t\t\t@db.escape_literal(DateTime.rfc3339(v).to_time.utc.strfrm(TimestampFormat))\n\t\t\t\t\twhen Numeric\n\t\t\t\t\t\t# Interpret as Unix time: seconds (with fractions) since epoch\n\t\t\t\t\t\t@db.escape_literal(Time.at(v).utc.strfrm(TimestampFormat))\n\t\t\t\t\telse nil\n\t\t\t\t\tend\n\t\t\t\twhen :string\n\t\t\t\t\t@db.escape_literal(Oj.dump(v, OjOptions))\n\t\t\t\twhen :boolean\n\t\t\t\t\tcase v\n\t\t\t\t\twhen TrueClass; 'true'\n\t\t\t\t\twhen FalseClass; 'false'\n\t\t\t\t\twhen String\n\t\t\t\t\t\t# Accept 't', 'T', 'true', 'TRUE', 'True'..., 1 as true, false otherwise\n\t\t\t\t\t\t(v.downcase == 't' || v.downcase == 'true' || v == '1').to_s\n\t\t\t\t\twhen Numeric\n\t\t\t\t\t\tv != 0\n\t\t\t\t\telse nil\n\t\t\t\t\tend\n\t\t\t\twhen :integer\n\t\t\t\t\tcase v\n\t\t\t\t\twhen TrueClass; '1' # Accept true as 1\n\t\t\t\t\twhen FalseClass; '0' # Accept false as 0\n\t\t\t\t\twhen String; v.to_i(10).to_s # Parse string as decimal\n\t\t\t\t\twhen Integer; v.to_s\n\t\t\t\t\telse nil\n\t\t\t\t\tend\n\t\t\t\twhen :float\n\t\t\t\t\tcase\n\t\t\t\t\twhen Float; v.to_s\n\t\t\t\t\twhen String; v.to_f.to_s # Parse string as float\n\t\t\t\t\telse nil\n\t\t\t\t\tend\n\t\t\t\twhen :json\n\t\t\t\t\tbegin\n\t\t\t\t\t\t@db.escape_literal(Oj.dump(v, OjOptions))\n\t\t\t\t\trescue Oj::Error => e\n\t\t\t\t\t\t# TODO log this\n\t\t\t\t\t\tnil\n\t\t\t\t\tend\n\t\t\t\twhen Array # enums\n\t\t\t\t\treturn @db.escape_literal(v) if type.include?(v)\n\t\t\t\telse nil\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "29c79e72387e77f13a355185d41244eb",
"score": "0.5011035",
"text": "def value_from_data data\n value = case @from_data\n when nil\n # This {Prop} does not have any custom `from_data` instructions, which\n # means we must rely on the {#type} to covert *data* to a *value*.\n # \n if data.is_a?( String ) && type.has_from_s?\n type.from_s data\n elsif type.has_from_data?\n type.from_data data\n else\n data\n end\n \n when Symbol, String\n # The custom `from_data` configuration specifies a string or symbol name,\n # which we interpret as a class method on the defining class and call\n # with the data to produce a value.\n @defined_in.send @from_data, data\n \n when Proc\n # The custom `from_data` configuration provides a procedure, which we\n # call with the data to produce the value.\n @from_data.call data\n \n else\n raise NRSER::TypeError.new \\\n \"Expected `@from_data` to be Symbol, String or Proc\",\n \"found\", @from_data.class,\n :@from_data => @from_data,\n :@defined_in => @defined_in,\n details: <<~END \n Acceptable types:\n \n - Symbol or String\n - Name of class method on the class this property is defined in\n (`@defined_in`) to call with data to convert it to a\n property value.\n \n - Proc\n - Procedure to call with data to convert it to a property value.\n END\n end\n \n end",
"title": ""
},
{
"docid": "296434e8167117b13bb6bb2a280d33fe",
"score": "0.5010787",
"text": "def make_boolean_property(property, method)\n define_method(method) do\n 'true' == @params[property]\n end\n end",
"title": ""
},
{
"docid": "aba1bad8cee2e79af3fab0da7b3eeacf",
"score": "0.49989367",
"text": "def prop_options(prop, config)\n [\n ('required=True' if prop.required),\n \"type=#{quote_string(python_type(prop))}\",\n (if prop.is_a? Api::Type::Enum\n \"choices=[#{prop.values.map do |x|\n quote_string(x.to_s)\n end.join(', ')}]\"\n end),\n (\"elements=#{quote_string(python_type(prop.item_type))}\" \\\n if prop.is_a? Api::Type::Array),\n (if config['aliases']&.keys&.include?(prop.name)\n \"aliases=[#{config['aliases'][prop.name].map do |x|\n quote_string(x)\n end.join(', ')}]\"\n end)\n ].compact\n end",
"title": ""
},
{
"docid": "85dc60136a7840eff44dff64ad2c9dd9",
"score": "0.49926442",
"text": "def _propertyTypeCheck(tree, property, prefix, typeName)\n key = prefix + property\n raise(IncorrectPropertyTypeException, \"#{property} is not of type #{typeName}\") unless tree['pr'].has_key?(key)\n end",
"title": ""
},
{
"docid": "ec82bb00be844b20f3fc359aacebbb93",
"score": "0.49920902",
"text": "def property(name, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "ec82bb00be844b20f3fc359aacebbb93",
"score": "0.49920902",
"text": "def property(name, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "5e0831b5aa0dcc049e72774c2299e7dc",
"score": "0.49889112",
"text": "def property_type(property, value)\n unless property.fields.blank?\n return 'PROPERTY_SET_DEFINITION'\n end\n\n if property.type.to_s=='STRING' && value && value.include?('\\n')\n return 'TEXT'\n end\n\n property.type\n end",
"title": ""
},
{
"docid": "b6fef5306825df40288cddec43b80b29",
"score": "0.49771923",
"text": "def create_property(field_type, description, name)\n return property = Property.create(field_type: field_type, description: description, name: name)\nend",
"title": ""
},
{
"docid": "3c82a6cc4f39ae31ec62eddc8f95465f",
"score": "0.49725348",
"text": "def primitive?\n true\n end",
"title": ""
},
{
"docid": "fe96ab824c5a614e88b9b512783635b7",
"score": "0.49696735",
"text": "def is_date_list_property?\n @property_description['type'] == 'array' && @property_description['items']['type'] == 'number'\n end",
"title": ""
},
{
"docid": "bbb80111f2bf076b34cc93d2d193ab40",
"score": "0.4968948",
"text": "def propertyTypicality(output, prop_data, comp_data, census_output, data_source)\r\n # Property count\r\n count_pass = Liquidity.getCompsCount(output, comp_data, data_source, usage = \"Typicality\")\r\n\r\n # Estimates\r\n propertyEstimateCheck(output, prop_data[:estimate], comp_data[:estimates], data_source)\r\n\r\n # Number of bedrooms comparison\r\n propertyBedroomCheck(output, prop_data[:bd], comp_data[:bds], census_output, data_source)\r\n\r\n # Number of bathroom comparison (Not Zillow)\r\n propertyBathroomCheck(output, prop_data[:ba], comp_data[:bas], data_source) unless data_source.to_s == \"Zillow\"\r\n\r\n # Sqft Check\r\n propertySqFtCheck(output, prop_data[:propSqFt], comp_data[:propSqFts], data_source)\r\n\r\n # Lot Size\r\n propertyLotSizeCheck(output, prop_data[:propType], prop_data[:lotSqFt], comp_data[:lotSizes], data_source)\r\n\r\n # Distance and Nearby Check (Zillow Only right now)\r\n nearbyCompCheck(output, comp_data, count_pass, data_source) if data_source == \"Zillow\"\r\n end",
"title": ""
},
{
"docid": "73661084ec92dc76d3387e3f294136ed",
"score": "0.49629506",
"text": "def property(name, value, important)\n end",
"title": ""
},
{
"docid": "960fe96716aaa959d1fdb728463bb7c1",
"score": "0.496136",
"text": "def isPropattr\n @RecordType == PROPATTR\n end",
"title": ""
},
{
"docid": "df5127b335ff8ae0b37f74ec7c719736",
"score": "0.49591103",
"text": "def prepopulate!(_args = {})\n # Applying the twin filter to schema finds all nested properties\n schema.each(twin: true) do |property|\n property_name = property[:name]\n property_klass = model_type_for(property: property_name)\n next if send(property_name).present?\n if property_klass.respond_to?(:primitive) && property_klass.primitive == Array\n send(:\"#{property_name}=\", property_klass[[{}]])\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "add0db0f4cfbd8bf356825b1626d1100",
"score": "0.49478322",
"text": "def can_construct_from_id_alone?(properties)\n super && @restricted_to_types && @restricted_to_types.length == 1\n end",
"title": ""
},
{
"docid": "b462cc48367202c79eb6164445e1f8ef",
"score": "0.49476916",
"text": "def build_value(aValue)\n BooleanValue.new(validated_value(aValue))\n end",
"title": ""
},
{
"docid": "3e7ef1dedb1ba65aa9a88a802719d838",
"score": "0.4945363",
"text": "def build(property, images, rates, description, security_deposit)\n result = Roomorama::Property.new(property.property_id)\n result.instant_booking!\n\n set_base_info!(result, property)\n set_description!(result, description)\n set_images!(result, images)\n set_rates_and_minimum_stay!(result, rates)\n set_security_deposit_info!(result, property, security_deposit)\n\n result\n end",
"title": ""
},
{
"docid": "55a7387cbe1e33571eeff9e2beac20b8",
"score": "0.49376985",
"text": "def read_prop_object\n token = @reader.read_sint8\n case token\n when PROPERTY_POOL\n read_pool_object\n when PROPERTY_INT\n @reader.read_sint32\n when PROPERTY_LONG\n @reader.read_sint64\n when PROPERTY_DOUBLE\n @reader.read_float64\n when PROPERTY_FLOAT\n @reader.read_float32\n when PROPERTY_TRUE\n true\n when PROPERTY_FALSE\n false\n when PROPERTY_ARRAY\n type = @reader.read_sint8\n case type\n when PROPERTY_POOL\n @reader.read_sint32.times.map do\n read_pool_object\n end\n when PROPERTY_INT\n @reader.read_sint32.times.map do\n @reader.read_sint32\n end\n when PROPERTY_DOUBLE\n @reader.read_sint32.times.map do\n @reader.read_float64\n end\n else\n raise EncodingError, \"unknown BGV property array type 0x#{type.to_s(16)}\"\n end\n when PROPERTY_SUBGRAPH\n @graph_props = read_props\n read_graph\n else\n raise EncodingError, \"unknown BGV property 0x#{token.to_s(16)}\"\n end\n end",
"title": ""
},
{
"docid": "6d2b243e5e91467886f7fe160eaae851",
"score": "0.49236608",
"text": "def make_true; end",
"title": ""
},
{
"docid": "6d2b243e5e91467886f7fe160eaae851",
"score": "0.49236608",
"text": "def make_true; end",
"title": ""
},
{
"docid": "992c9d8f305233338448c5763bc3f657",
"score": "0.49210513",
"text": "def set_data_type_property(value)\n object.send((property.to_s + '='), value)\nend",
"title": ""
},
{
"docid": "9d8804f05cebaa6d02c936e43fd7d4de",
"score": "0.49208638",
"text": "def init_jaxb_json_hash(_o)\n if !_o['value'].nil?\n _oa = _o['value']\n if(_oa.is_a? Hash)\n @value = EnunciateHelpers::LAMB_CLASS_AWARE.call(_oa) if _oa['@class']\n @value = Boolean.from_json(_oa) unless _oa['@class']\n elsif (_oa.is_a? Array)\n #an array(of hashes hopefully) or scalar\n @value = Array.new\n _oa.each { | _item | \n if ((_item.nil? || _item['@class'].nil?)rescue true)\n @value.push Boolean.from_json(_item)\n else\n @value.push EnunciateHelpers::LAMB_CLASS_AWARE.call(_item)\n end\n }\n else\n @value = _oa\n end\n end\n end",
"title": ""
},
{
"docid": "d8c1c15c3edf78c70cd0f5b14fdb75c6",
"score": "0.49193552",
"text": "def typeize(obj, attribute) #:doc:\r\n #Rails::logger.info(\"TableBuilder#typeize\")\r\n type = attribute[:data_type] || attribute_type(obj, attribute[:name])\r\n true_values = [1, true, \"vero\", \"true\", \"yes\", \"si\", \"s\"]\r\n case type\r\n when :Date then\r\n #@template.l(attribute_value(obj,attribute[:name]), :format => :usefull_table_date)\r\n l(attribute_value(obj,attribute[:name]), :format => :usefull_table_date)\r\n when :Time then\r\n #@template.l(attribute_value(obj,attribute[:name]), :format => :usefull_table_time )\r\n l(attribute_value(obj,attribute[:name]), :format => :usefull_table_time )\r\n when :DateTime then\r\n #@template.l(attribute_value(obj,attribute[:name]), :format => :usefull_table_datetime)\r\n l(attribute_value(obj,attribute[:name]), :format => :usefull_table_datetime)\r\n when :Currency then\r\n @template.number_to_currency(currency_attribute_value(obj,attribute[:name]))\r\n when :Percentage then\r\n @template.number_to_percentage(percentage_attribute_value(obj,attribute[:name]), :precision => 0)\r\n when :Bool then\r\n true_values.include?(attribute_value(obj,attribute[:name])) ? true : false\r\n when :Bool_reverse then\r\n true_values.include?(attribute_value(obj,attribute[:name])) ? false : true\r\n else\r\n attribute_value(obj,attribute[:name])\r\n end\r\n end",
"title": ""
},
{
"docid": "effeffdbe8e23faa2d43ca911c697a33",
"score": "0.49191174",
"text": "def visit_prop(node); end",
"title": ""
},
{
"docid": "effeffdbe8e23faa2d43ca911c697a33",
"score": "0.49191174",
"text": "def visit_prop(node); end",
"title": ""
},
{
"docid": "c0db07f1f778f9302c9303af6f4aacdc",
"score": "0.4918529",
"text": "def is_nullable_type(property)\n if ['int', 'long', 'double', 'float', 'bool'].include? find_basic_type(property.type)\n return true\n elsif schema.enum_types[property.type]\n return true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "f9038d5609ce823b44b3f94aba00b6e5",
"score": "0.4918039",
"text": "def build_type(type, options = EMPTY_HASH)\n if options[:read]\n type.meta(source: relation, read: options[:read])\n elsif type.optional? && type.meta[:read]\n type.meta(source: relation, read: type.meta[:read].optional)\n else\n type.meta(source: relation)\n end.meta(Attribute::META_OPTIONS.map { |opt| [opt, options[opt]] if options.key?(opt) }.compact.to_h)\n end",
"title": ""
},
{
"docid": "f48fa5c39afb79d5e48d4ce6cacb6534",
"score": "0.4907523",
"text": "def properties_canonical(properties)\n properties = {\n desc: '',\n type: :string,\n hidden: false,\n const: false\n }.merge(properties)\n properties[:desc] = properties[:desc].to_s\n if properties[:type].is_a?(Array)\n properties[:type] = properties[:type].map { |v| v.to_s }\n elsif properties[:type].is_a?(String)\n properties[:type] = properties[:type].to_sym\n end\n properties[:hidden] = !!properties[:hidden]\n properties[:const] = !!properties[:const]\n properties\n end",
"title": ""
},
{
"docid": "7dbaad71f272322a2abe90c579db031b",
"score": "0.4905239",
"text": "def property(name, type, options = {})\n # if the type can be found within Property then\n # use that class rather than the primitive\n klass = Ardm::Property.determine_class(type)\n\n if !klass || klass == NilClass\n raise ArgumentError, \"+type+ was #{type.inspect}, which is not a supported type\"\n end\n\n property = klass.new(self, name, options)\n\n self.properties << property\n\n # add the property to the child classes only if the property was\n # added after the child classes' properties have been copied from\n # the parent\n descendants.each do |descendant|\n descendant.properties << property\n end\n\n serialize(property.field, property)\n\n set_primary_key_for(property)\n create_reader_for(property)\n create_writer_for(property)\n add_validations_for(property)\n\n # FIXME: explicit return needed for YARD to parse this properly\n return property\n end",
"title": ""
},
{
"docid": "77caa2d501a0effd5abe34128fcc73b1",
"score": "0.49033624",
"text": "def type\n case attributes['type']\n when 'boolean' then :boolean\n when 'fixed' then :fixed\n when 'hidden' then :hidden\n when 'jid-multi' then :jid_multi\n when 'jid-single' then :jid_single\n when 'list-multi' then :list_multi\n when 'list-single' then :list_single\n when 'text-multi' then :text_multi\n when 'text-private' then :text_private\n when 'text-single' then :text_single\n else nil\n end\n end",
"title": ""
},
{
"docid": "f13a7e398aa637ad0415c0f44880f4d5",
"score": "0.49016953",
"text": "def property?(name); end",
"title": ""
},
{
"docid": "5252647d4c60a0b1363dfb36b2a4219b",
"score": "0.489813",
"text": "def typecast_to_primitive(value)\n BOOLEAN_MAP.fetch(value, value)\n end",
"title": ""
}
] |
914e299f818bb9f831e68ef9a39c6fc7 | Retrieve (optionally) and apply a catalog. If a catalog is passed in the options, then apply that one, otherwise retrieve it. | [
{
"docid": "2f3f95f028df0c8a9bfe1eff08b99b15",
"score": "0.7513439",
"text": "def retrieve_and_apply_catalog(options, fact_options)\n unless catalog = (options.delete(:catalog) || retrieve_catalog(fact_options))\n Puppet.err \"Could not retrieve catalog; skipping run\"\n return\n end\n\n report = options[:report]\n report.configuration_version = catalog.version\n report.environment = Puppet[:environment]\n\n benchmark(:notice, \"Finished catalog run\") do\n catalog.apply(options)\n end\n\n report.finalize_report\n report\n end",
"title": ""
}
] | [
{
"docid": "e4b19f7d5118224b8faf88941726b982",
"score": "0.66991943",
"text": "def catalog(id, options={})\n result = catalogs[id]\n if result.nil? && options[:create]\n result = Catalog.new({:server => self, :id => id}, :create => true)\n end\n result\n end",
"title": ""
},
{
"docid": "966e4c9d395a474fa2e727e9143c2800",
"score": "0.6394798",
"text": "def retrieve_catalog(fact_options)\n fact_options ||= {}\n # First try it with no cache, then with the cache.\n unless (Puppet[:use_cached_catalog] and result = retrieve_catalog_from_cache(fact_options)) or result = retrieve_new_catalog(fact_options)\n if ! Puppet[:usecacheonfailure]\n Puppet.warning \"Not using cache on failed catalog\"\n return nil\n end\n result = retrieve_catalog_from_cache(fact_options)\n end\n\n return nil unless result\n\n convert_catalog(result, @duration)\n end",
"title": ""
},
{
"docid": "84b97c772cc875fb0c005f6f7258e673",
"score": "0.59857553",
"text": "def save_catalog(catalog, options)\n if Puppet::Resource::Catalog.indirection.cache?\n terminus = Puppet::Resource::Catalog.indirection.cache\n\n request = Puppet::Indirector::Request.new(terminus.class.name,\n :save,\n options.delete('certname'),\n catalog,\n options)\n\n terminus.save(request)\n end\n end",
"title": ""
},
{
"docid": "bccb246f671e4dd2f88c3b5c77cef7b7",
"score": "0.5976889",
"text": "def set_catalog\n @catalog = params[:id] ? Catalog.find(params[:id]) : Catalog.new(catalog_params)\n end",
"title": ""
},
{
"docid": "b9c835ae8009b45fe4a3795f71b6857d",
"score": "0.59436333",
"text": "def set_catalog\n @catalog = Catalog.find(catalog_params)\n end",
"title": ""
},
{
"docid": "2ff32f82393fd152267ef531b6a71dc5",
"score": "0.58570415",
"text": "def catalog\n @catalog ||= CatalogApi.new config\n end",
"title": ""
},
{
"docid": "825030d3dd739382f3fefb28d824858a",
"score": "0.5849224",
"text": "def get_catalog(opts = {})\n data, _status_code, _headers = get_catalog_with_http_info(opts)\n return data\n end",
"title": ""
},
{
"docid": "5922de8ee3811638f81aaccd82f36f11",
"score": "0.5793293",
"text": "def get_catalog_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CatalogsApi.get_catalog ...\"\n end\n # resource path\n local_var_path = \"/raas/v2/catalogs\"\n\n # query parameters\n query_params = {}\n query_params[:'verbose'] = opts[:'verbose'] if !opts[:'verbose'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CatalogViewVerbose')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CatalogsApi#get_catalog\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "83888febf04523facdf5fec82bd78700",
"score": "0.57089204",
"text": "def get_catalog(catalog_id)\n end",
"title": ""
},
{
"docid": "5ba56d2acb3def0982de26411ef1c33b",
"score": "0.5680128",
"text": "def apply(options = {})\n @applying = true\n\n Puppet::Util::Storage.load if host_config?\n\n transaction = Puppet::Transaction.new(self, options[:report])\n register_report = options[:report].nil?\n\n transaction.tags = options[:tags] if options[:tags]\n transaction.ignoreschedules = true if options[:ignoreschedules]\n transaction.for_network_device = options[:network_device]\n\n transaction.add_times :config_retrieval => self.retrieval_duration || 0\n\n begin\n Puppet::Util::Log.newdestination(transaction.report) if register_report\n begin\n transaction.evaluate\n ensure\n Puppet::Util::Log.close(transaction.report) if register_report\n end\n rescue Puppet::Error => detail\n puts detail.backtrace if Puppet[:trace]\n Puppet.err \"Could not apply complete catalog: #{detail}\"\n rescue => detail\n puts detail.backtrace if Puppet[:trace]\n Puppet.err \"Got an uncaught exception of type #{detail.class}: #{detail}\"\n ensure\n # Don't try to store state unless we're a host config\n # too recursive.\n Puppet::Util::Storage.store if host_config?\n end\n\n yield transaction if block_given?\n\n return transaction\n ensure\n @applying = false\n end",
"title": ""
},
{
"docid": "8028fd6b1c70a68ddf152da16f4fc64b",
"score": "0.56771475",
"text": "def set_catalog\n @catalog = Catalog.friendly.find(params[:id])\n end",
"title": ""
},
{
"docid": "31908685d6763811fc6e31f494ca8de1",
"score": "0.56306803",
"text": "def set_catalog\n @catalog = Catalog.find(params[:id])\n end",
"title": ""
},
{
"docid": "31908685d6763811fc6e31f494ca8de1",
"score": "0.56305486",
"text": "def set_catalog\n @catalog = Catalog.find(params[:id])\n end",
"title": ""
},
{
"docid": "31908685d6763811fc6e31f494ca8de1",
"score": "0.56305486",
"text": "def set_catalog\n @catalog = Catalog.find(params[:id])\n end",
"title": ""
},
{
"docid": "31908685d6763811fc6e31f494ca8de1",
"score": "0.56305486",
"text": "def set_catalog\n @catalog = Catalog.find(params[:id])\n end",
"title": ""
},
{
"docid": "31908685d6763811fc6e31f494ca8de1",
"score": "0.56305486",
"text": "def set_catalog\n @catalog = Catalog.find(params[:id])\n end",
"title": ""
},
{
"docid": "31908685d6763811fc6e31f494ca8de1",
"score": "0.56305486",
"text": "def set_catalog\n @catalog = Catalog.find(params[:id])\n end",
"title": ""
},
{
"docid": "996a93de2ae4b5407763b1872941be08",
"score": "0.5601288",
"text": "def set_catalog\n\t\t@catalog = current_user.catalogs.find(params[:id])\n\tend",
"title": ""
},
{
"docid": "af93ed5525175994188617b641606e42",
"score": "0.5543105",
"text": "def catalog=(value)\n @catalog = value\n end",
"title": ""
},
{
"docid": "af93ed5525175994188617b641606e42",
"score": "0.5543105",
"text": "def catalog=(value)\n @catalog = value\n end",
"title": ""
},
{
"docid": "c68877d6b7e2085bd55ce14eb4e3a700",
"score": "0.5487614",
"text": "def catalog\n return nil unless @raw_series.include?(\"catalog\")\n return @catalog unless @catalog.nil?\n @catalog = OpenStruct.new(@raw_series[\"catalog\"])\n end",
"title": ""
},
{
"docid": "036d423fc9a697fe66e1e1e34fbe6e5f",
"score": "0.5474975",
"text": "def catalog\n @catalog ||= CatalogApi.new @global_configuration\n end",
"title": ""
},
{
"docid": "504b3efa7575df148ed594cd0f4c2b13",
"score": "0.5463027",
"text": "def set_catalog\n @catalog = Category.find_by_slug!(params[:id])\n end",
"title": ""
},
{
"docid": "346428e8541f82ae7d4d88dcb89bb049",
"score": "0.5357313",
"text": "def set_catalogs_resource\n @catalogs_resource = Catalogs::Resource.find(params[:id])\n end",
"title": ""
},
{
"docid": "4c52bea830b6f9e740c95955e4504f3c",
"score": "0.5320259",
"text": "def catalog\n return @catalog\n end",
"title": ""
},
{
"docid": "4c52bea830b6f9e740c95955e4504f3c",
"score": "0.5320259",
"text": "def catalog\n return @catalog\n end",
"title": ""
},
{
"docid": "8a4ff6ae6d5db6f2a182c3ef514c17b8",
"score": "0.5299994",
"text": "def catalog\n @catalog ||= Vra::Catalog.new(self)\n end",
"title": ""
},
{
"docid": "7104c9437fba04b93236da2aada43097",
"score": "0.52925265",
"text": "def backend(options)\n # Hard-coded backend\n if options[:backend]\n return OctocatalogDiff::Catalog::JSON.new(options) if options[:backend] == :json\n return OctocatalogDiff::Catalog::PuppetDB.new(options) if options[:backend] == :puppetdb\n return OctocatalogDiff::Catalog::PuppetMaster.new(options) if options[:backend] == :puppetmaster\n return OctocatalogDiff::Catalog::Computed.new(options) if options[:backend] == :computed\n return OctocatalogDiff::Catalog::Noop.new(options) if options[:backend] == :noop\n raise ArgumentError, \"Unknown backend :#{options[:backend]}\"\n end\n\n # Determine backend based on arguments\n return OctocatalogDiff::Catalog::JSON.new(options) if options[:json]\n return OctocatalogDiff::Catalog::PuppetDB.new(options) if options[:puppetdb]\n return OctocatalogDiff::Catalog::PuppetMaster.new(options) if options[:puppet_master]\n\n # Default is to build catalog ourselves\n OctocatalogDiff::Catalog::Computed.new(options)\n end",
"title": ""
},
{
"docid": "b8f31bd36b8867153be88b3d45d9bfb7",
"score": "0.5285781",
"text": "def set_catalog\n @catalog = Catalog.find params[:id]\n authorize @catalog\n end",
"title": ""
},
{
"docid": "55924c6b46cad9a17543d5a32afc9c05",
"score": "0.5279027",
"text": "def update!(**args)\n @catalog_attribute = args[:catalog_attribute] if args.key?(:catalog_attribute)\n end",
"title": ""
},
{
"docid": "7e582844c5b54305700214f49d597688",
"score": "0.5278502",
"text": "def set_catalog\n @catalog = Catalog.friendly.find(params[:id])\n #if @catalog.present? && @catalog.user == current_user || current_user.role_admin?\n #end\n end",
"title": ""
},
{
"docid": "bd136cae6006306e7a52b6f496907335",
"score": "0.51972103",
"text": "def set_market_catalog\n @market_catalog = MarketCatalog.find(params[:id])\n end",
"title": ""
},
{
"docid": "63a13d88eea3a6b981beca22eb8d1b39",
"score": "0.5136055",
"text": "def get_available_catalogs(include_extra_content = false)\n response_class = Cadooz::Immutable::Catalog\n\n deserialize(@call.(__callee__, {include_extra_content: include_extra_content }), response_class, __callee__)\n end",
"title": ""
},
{
"docid": "de39d8836facbc1c1fefc3752d70c09c",
"score": "0.5117024",
"text": "def set_admin_catalog\n @admin_catalog = catalog_model.find(params[:id])\n end",
"title": ""
},
{
"docid": "1fea021bd4938a29332c7b377c404db1",
"score": "0.51071227",
"text": "def CatalogSelect\n sources = deep_copy(SourceManager.newSources)\n Builtins.y2milestone(\"New sources: %1\", sources)\n\n if Builtins.size(sources) == 0\n # error report\n Report.Error(_(\"No software repository found on medium.\"))\n Builtins.y2milestone(\"CatalogSelect Dialog ret: %1\", :back)\n return :back\n end\n\n if Builtins.size(sources) == 1\n if AddOnProduct.last_ret != :next\n Builtins.y2milestone(\"Deleting source %1\", Ops.get(sources, 0, 0))\n Pkg.SourceDelete(Ops.get(sources, 0, 0))\n\n Builtins.y2milestone(\n \"CatalogSelect Dialog ret: %1\",\n AddOnProduct.last_ret\n )\n return AddOnProduct.last_ret\n end\n\n # busy message\n UI.OpenDialog(\n Label(Id(:add_on_popup_id), _(\"Initializing new source...\"))\n )\n src_id = Ops.get(SourceManager.newSources, 0, 0)\n\n # BNC #481828: Using LABEL from content file as a repository name\n Packages.AdjustSourcePropertiesAccordingToProduct(src_id)\n\n # a little hack because of packager leaving\n # windows open...\n if UI.WidgetExists(:add_on_popup_id)\n UI.CloseDialog\n elsif UI.WidgetExists(:contents)\n Builtins.y2warning(\"Already in base dialog!\")\n else\n Builtins.y2error(\"Error in packager, closing current dialog!\")\n while !UI.WidgetExists(:contents)\n Builtins.y2milestone(\"Calling UI::CloseDialog\")\n UI.CloseDialog\n end\n end\n\n AddOnProduct.src_id = src_id\n SourceManager.newSources = [src_id]\n Builtins.y2milestone(\"Only one source available - skipping dialog\")\n\n Builtins.y2milestone(\n \"CatalogSelect Dialog ret: %1\",\n AddOnProduct.last_ret\n )\n return AddOnProduct.last_ret\n end\n\n Builtins.y2milestone(\"Running catalog select dialog\")\n catalogs = Builtins.maplist(sources) do |src|\n data = Pkg.SourceGeneralData(src)\n # placeholder for unknown directory\n dir = Ops.get_locale(data, \"product_dir\", _(\"Unknown\"))\n dir = \"/\" if dir == \"\"\n Item(\n Id(src),\n Builtins.sformat(\n _(\"URL: %1, Directory: %2\"),\n Ops.get_locale(\n # place holder for unknown URL\n data,\n \"url\",\n _(\"Unknown\")\n ),\n dir\n )\n )\n end\n\n # dialog caption\n title = _(\"Software Repository Selection\")\n # help text\n help_text = _(\n \"<p><big><b>Software Repository Selection</b></big><br>\\n\" +\n \"Multiple repositories were found on the selected medium.\\n\" +\n \"Select the repository to use.</p>\\n\"\n )\n\n contents = HBox(\n HSpacing(4),\n VBox(\n VSpacing(2),\n SelectionBox(Id(:catalogs), _(\"Repositories &Found\"), catalogs),\n VSpacing(2)\n ),\n HSpacing(4)\n )\n Wizard.SetContents(title, contents, help_text, true, true)\n ret = nil\n selected = nil\n while ret == nil\n ret = Convert.to_symbol(UI.UserInput)\n if ret == :abort || ret == :cancel\n ret = :abort\n break if Popup.YesNo(_(\"Really abort add-on product installation?\"))\n next\n elsif ret == :back\n break\n elsif ret == :next\n selected = Convert.to_integer(\n UI.QueryWidget(Id(:catalogs), :CurrentItem)\n )\n if selected == nil\n ret = nil\n # popup message\n Popup.Message(_(\"Select a repository.\"))\n end\n end\n end\n\n if ret != :next\n Builtins.foreach(SourceManager.newSources) do |src|\n Builtins.y2milestone(\"Deleting source %1\", src)\n Pkg.SourceDelete(src)\n end\n else\n Builtins.foreach(SourceManager.newSources) do |src|\n if src != selected\n Builtins.y2milestone(\"Deleting unused source %1\", src)\n Pkg.SourceDelete(src)\n end\n end\n\n # BNC #481828: Using LABEL from content file as a repository name\n Packages.AdjustSourcePropertiesAccordingToProduct(selected)\n\n AddOnProduct.src_id = selected\n SourceManager.newSources = [selected]\n end\n\n AddOnProduct.last_ret = ret\n Builtins.y2milestone(\n \"CatalogSelect Dialog ret: %1\",\n AddOnProduct.last_ret\n )\n ret\n end",
"title": ""
},
{
"docid": "82b7932ce17d4a30961d3e2890d4cbbe",
"score": "0.510611",
"text": "def add_catalog_command\r\n add_command(\"Catalogue\", :catalogue, catalog_enabled)\r\n end",
"title": ""
},
{
"docid": "d96847ba77a81f4cf3b6df7d03b38e5c",
"score": "0.5062455",
"text": "def catalog_lookup(entity_id: nil, object: :product, object_id: nil, child_objects: false, cache: false)\n entity_reference = entity_id.blank? ? 'Default' : entity_id\n\n if object_id.present? && ![Array, String].include?(object_id.class)\n raise \"Object Id can only be a string or an array of strings\"\n end\n\n if defined?(Redis.current) && object_id.present? && object_id.class == String && object_id.present?\n stub_catalog = cache ? decrypt_data(data: Redis.current.get(\"Catalog:#{self.id}:#{object_id}:Children:#{child_objects}\")) : nil\n object_hierarchy = decrypt_data(data: Redis.current.get(\"Catalog:#{self.id}:#{object_id}:Hierarchy\"))\n end\n\n if defined?(object_hierarchy)\n object_hierarchy ||= (JSON.parse(ActiveRecord::Base.connection.execute('SELECT catalog_mapping #> \\'{%s}\\' AS item FROM \"public\".\"zuora_connect_app_instances\" WHERE \"id\" = %s LIMIT 1' % [entity_reference, self.id]).first[\"item\"] || \"{}\") [object_id] || {\"productId\" => \"SAFTEY\", \"productRatePlanId\" => \"SAFTEY\", \"productRatePlanChargeId\" => \"SAFTEY\"})\n end\n\n case object\n when :product\n if object_id.nil?\n string =\n \"SELECT \"\\\n \"json_object_agg(product_id, product #{child_objects ? '' : '- \\'productRatePlans\\''}) AS item \"\\\n \"FROM \"\\\n \"\\\"public\\\".\\\"zuora_connect_app_instances\\\", \"\\\n \"jsonb_each((\\\"public\\\".\\\"zuora_connect_app_instances\\\".\\\"catalog\\\" #> '{%s}' )) AS e(product_id, product) \"\\\n \"WHERE \"\\\n \"\\\"id\\\" = %s\" % [entity_reference, self.id]\n else\n if object_id.class == String\n string =\n \"SELECT \"\\\n \"(catalog #> '{%s, %s}') #{child_objects ? '' : '- \\'productRatePlans\\''} AS item \"\\\n \"FROM \"\\\n \"\\\"public\\\".\\\"zuora_connect_app_instances\\\" \"\\\n \"WHERE \"\\\n \"\\\"id\\\" = %s\" % [entity_reference, object_id.blank? ? BLANK_OBJECT_ID_LOOKUP : object_id, self.id]\n elsif object_id.class == Array\n string =\n \"SELECT \"\\\n \"json_object_agg(product_id, product #{child_objects ? '' : '- \\'productRatePlans\\''}) AS item \"\\\n \"FROM \"\\\n \"\\\"public\\\".\\\"zuora_connect_app_instances\\\", \"\\\n \"jsonb_each((\\\"public\\\".\\\"zuora_connect_app_instances\\\".\\\"catalog\\\" #> '{%s}' )) AS e(product_id, product) \"\\\n \"WHERE \"\\\n \"\\\"product_id\\\" IN (\\'%s\\') AND \"\\\n \"\\\"id\\\" = %s\" % [entity_reference, object_id.join(\"\\',\\'\"), self.id]\n end\n end\n\n when :rateplan\n if object_id.nil?\n string =\n \"SELECT \"\\\n \"json_object_agg(rateplan_id, rateplan #{child_objects ? '' : '- \\'productRatePlanCharges\\''}) AS item \"\\\n \"FROM \"\\\n \"\\\"public\\\".\\\"zuora_connect_app_instances\\\", \"\\\n \"jsonb_each((\\\"public\\\".\\\"zuora_connect_app_instances\\\".\\\"catalog\\\" #> '{%s}' )) AS e(product_id, product), \"\\\n \"jsonb_each(product #> '{productRatePlans}') AS ee(rateplan_id, rateplan) \"\\\n \"WHERE \"\\\n \"\\\"id\\\" = %s\" % [entity_reference, self.id]\n else\n if object_id.class == String\n string =\n \"SELECT \"\\\n \"(catalog #> '{%s, %s, productRatePlans, %s}') #{child_objects ? '' : '- \\'productRatePlanCharges\\''} AS item \"\\\n \"FROM \"\\\n \"\\\"public\\\".\\\"zuora_connect_app_instances\\\" \"\\\n \"WHERE \"\\\n \"\\\"id\\\" = %s\" % [entity_reference, object_hierarchy['productId'], object_id.blank? ? BLANK_OBJECT_ID_LOOKUP : object_id, self.id]\n elsif object_id.class == Array\n string =\n \"SELECT \"\\\n \"json_object_agg(rateplan_id, rateplan #{child_objects ? '' : '- \\'productRatePlanCharges\\''}) AS item \"\\\n \"FROM \"\\\n \"\\\"public\\\".\\\"zuora_connect_app_instances\\\", \"\\\n \"jsonb_each((\\\"public\\\".\\\"zuora_connect_app_instances\\\".\\\"catalog\\\" #> '{%s}' )) AS e(product_id, product), \"\\\n \"jsonb_each(product #> '{productRatePlans}') AS ee(rateplan_id, rateplan) \"\\\n \"WHERE \"\\\n \"\\\"rateplan_id\\\" IN (\\'%s\\') AND \"\\\n \"\\\"id\\\" = %s\" % [entity_reference, object_id.join(\"\\',\\'\"), self.id]\n end\n end\n\n when :charge\n if object_id.nil?\n string =\n \"SELECT \"\\\n \"json_object_agg(charge_id, charge) as item \"\\\n \"FROM \"\\\n \"\\\"public\\\".\\\"zuora_connect_app_instances\\\", \"\\\n \"jsonb_each((\\\"public\\\".\\\"zuora_connect_app_instances\\\".\\\"catalog\\\" #> '{%s}' )) AS e(product_id, product), \"\\\n \"jsonb_each(product #> '{productRatePlans}') AS ee(rateplan_id, rateplan), \"\\\n \"jsonb_each(rateplan #> '{productRatePlanCharges}') AS eee(charge_id, charge) \"\\\n \"WHERE \"\\\n \"\\\"id\\\" = %s\" % [entity_reference, self.id]\n else\n if object_id.class == String\n string =\n \"SELECT \"\\\n \"catalog #> '{%s, %s, productRatePlans, %s, productRatePlanCharges, %s}' AS item \"\\\n \"FROM \"\\\n \"\\\"public\\\".\\\"zuora_connect_app_instances\\\" \"\\\n \"WHERE \"\\\n \"\\\"id\\\" = %s\" % [entity_reference, object_hierarchy['productId'], object_hierarchy['productRatePlanId'], object_id.blank? ? BLANK_OBJECT_ID_LOOKUP : object_id , self.id]\n\n elsif object_id.class == Array\n string =\n \"SELECT \"\\\n \"json_object_agg(charge_id, charge) AS item \"\\\n \"FROM \"\\\n \"\\\"public\\\".\\\"zuora_connect_app_instances\\\", \"\\\n \"jsonb_each((\\\"public\\\".\\\"zuora_connect_app_instances\\\".\\\"catalog\\\" #> '{%s}' )) AS e(product_id, product), \"\\\n \"jsonb_each(product #> '{productRatePlans}') AS ee(rateplan_id, rateplan), \"\\\n \"jsonb_each(rateplan #> '{productRatePlanCharges}') AS eee(charge_id, charge) \"\\\n \"WHERE \"\\\n \"\\\"charge_id\\\" IN (\\'%s\\') AND \"\\\n \"\\\"id\\\" = %s\" % [entity_reference, object_id.join(\"\\',\\'\"), self.id]\n end\n end\n else\n raise \"Available objects include [:product, :rateplan, :charge]\"\n end\n\n stub_catalog ||= JSON.parse(ActiveRecord::Base.connection.execute(string).first[\"item\"] || \"{}\")\n\n if defined?(Redis.current) && object_id.present? && object_id.class == String && object_id.present?\n if cache\n Redis.current.sadd(\"Catalog:#{self.id}:Keys\", [\"Catalog:#{self.id}:#{object_id}:Hierarchy\", \"Catalog:#{self.id}:#{object_id}:Children:#{child_objects}\"])\n Redis.current.set(\"Catalog:#{self.id}:#{object_id}:Hierarchy\", encrypt_data(data: object_hierarchy))\n Redis.current.set(\"Catalog:#{self.id}:#{object_id}:Children:#{child_objects}\", encrypt_data(data: stub_catalog))\n else\n Redis.current.sadd(\"Catalog:#{self.id}:Keys\", [\"Catalog:#{self.id}:#{object_id}:Hierarchy\"])\n Redis.current.set(\"Catalog:#{self.id}:#{object_id}:Hierarchy\", encrypt_data(data: object_hierarchy))\n end\n end\n\n return stub_catalog\n end",
"title": ""
},
{
"docid": "214b3c2b925bb5fbd379e79dd40f1a63",
"score": "0.5058901",
"text": "def set_catalog\n @catalog = Catalog.find params[:id]\n authorize @catalog\n end",
"title": ""
},
{
"docid": "36d65ad5ef40300fb5446f36105600ac",
"score": "0.5041639",
"text": "def clihelper(command, options = nil)\n if resource and resource.catalog\n options ||= {}\n options[:catalog] ||= resource.catalog\n end\n\n args = []\n args << command\n args << options unless options.nil?\n self.class.clihelper(*args)\n end",
"title": ""
},
{
"docid": "15db5c723afd0531f69ce4f1e2e300d0",
"score": "0.49838603",
"text": "def has_catalog?\n true\n end",
"title": ""
},
{
"docid": "15db5c723afd0531f69ce4f1e2e300d0",
"score": "0.49838603",
"text": "def has_catalog?\n true\n end",
"title": ""
},
{
"docid": "f25c0c306e91e39534967fe9b363b3f3",
"score": "0.49590287",
"text": "def set_catalogue\n @catalogue = Catalogue.find(params[:id])\n end",
"title": ""
},
{
"docid": "f25c0c306e91e39534967fe9b363b3f3",
"score": "0.49590287",
"text": "def set_catalogue\n @catalogue = Catalogue.find(params[:id])\n end",
"title": ""
},
{
"docid": "8fd11e646a9a7beec888a3bb5839f907",
"score": "0.49437693",
"text": "def set_article_catalog\n @article_catalog = ArticleCatalog.find(params[:id])\n end",
"title": ""
},
{
"docid": "f54a6783d0f776caa8b2a9212a9056d6",
"score": "0.49422538",
"text": "def set_catalogo\n @catalogo = Catalogo.find(params[:id])\n end",
"title": ""
},
{
"docid": "f54a6783d0f776caa8b2a9212a9056d6",
"score": "0.49422538",
"text": "def set_catalogo\n @catalogo = Catalogo.find(params[:id])\n end",
"title": ""
},
{
"docid": "6b591b4431a2795175e63d20cf19a8f6",
"score": "0.49412027",
"text": "def set_main_catalog\n @main_catalog = MainCatalog.find(params[:id])\n end",
"title": ""
},
{
"docid": "e50ad3f6626b0414fb6be5594f071b50",
"score": "0.4924137",
"text": "def get_catalog_by_name(organization, catalog_name)\n end",
"title": ""
},
{
"docid": "70daf68bbc96f4be8734853fa7e33a62",
"score": "0.4904773",
"text": "def create_ral_catalog(context)\n catalog = context.subject\n catalog = catalog.call if catalog.is_a? Proc\n ral_catalog = catalog.to_ral\n ral_catalog.resources.each do |resource|\n if resource.respond_to? :generate\n generated = resource.generate\n elsif resource.respond_to? :eval_generate\n generated = resource.eval_generate\n else\n next\n end\n next unless generated.is_a? Array\n generated.each do |generated_resource|\n next unless generated_resource.is_a? Puppet::Type\n ral_catalog.add_resource generated_resource\n end\n end\n lambda { ral_catalog }\n end",
"title": ""
},
{
"docid": "a91d4c3c0c8daca7a4983360894bea33",
"score": "0.49032494",
"text": "def catalog_resources_for(klass, options = {})\n resources klass.name.underscore.pluralize, options.merge(controller: 'catalogs', klass: klass.name)\n end",
"title": ""
},
{
"docid": "311607520a465ba23d1641361ee48709",
"score": "0.48994148",
"text": "def set_catalogo\r\n @catalogo = Item.find(params[:id])\r\n end",
"title": ""
},
{
"docid": "23dc182393305db7e5ed7a1577c08af9",
"score": "0.48628595",
"text": "def catalog\n return YAML.load_data!(\"#{ECON_DATA_PATH}/catalogue.yml\")\n end",
"title": ""
},
{
"docid": "27c724e5a2bb7dc02eb459017050681f",
"score": "0.48574194",
"text": "def set_sub_catalog\n @sub_catalog = SubCatalog.find_by_sub_catalog_url(params[:sub_catalog_url])\n end",
"title": ""
},
{
"docid": "1140955ed778e7c55cd3f816884a22a3",
"score": "0.4841764",
"text": "def catalog\n mutex.synchronize do\n catalog_inlock\n end\n end",
"title": ""
},
{
"docid": "0316a82af09940adae10d0cdc3d9894b",
"score": "0.48193645",
"text": "def retrieve(opts = {})\n verify_control_presence(\"retrieve\")\n return @retrieve_method.call(opts)\n end",
"title": ""
},
{
"docid": "878613f883b0cacfba049561cb438592",
"score": "0.48117113",
"text": "def has_catalog?(id)\n catalogs.has_key?(id)\n end",
"title": ""
},
{
"docid": "f5d854ce4d3d6cee4eed67a2915e7763",
"score": "0.47875342",
"text": "def set_catalog_item\n @catalog_item = CatalogItem.find(params[:id])\n end",
"title": ""
},
{
"docid": "faefed9820215a94cbd10e069a04e55f",
"score": "0.47827327",
"text": "def each_catalog(&block)\n catalogs.values.each(&block)\n end",
"title": ""
},
{
"docid": "661674966559a7a0a3f6e30b513b54a6",
"score": "0.47785255",
"text": "def read_catalog_from_file(context)\n file_path = catalog_dump_file_path(context)\n return unless File.exists? file_path\n debug \"Read catalog from: '#{file_path}'\"\n File.read file_path\n end",
"title": ""
},
{
"docid": "eb6afdf4926dda8c52d30a4f3f87fcc1",
"score": "0.4777936",
"text": "def get_catalog_json_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CatalogApi.get_catalog_json ...\"\n end\n # resource path\n local_var_path = \"/1.0/kb/catalog\"\n\n # query parameters\n query_params = {}\n query_params[:'requestedDate'] = opts[:'requested_date'] if !opts[:'requested_date'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StaticCatalog')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CatalogApi#get_catalog_json\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "7209c95ad29b94e2781784592f962551",
"score": "0.47714725",
"text": "def set_catalogs_department\n @resource = Catalogs::Department.find(params[:id])\n end",
"title": ""
},
{
"docid": "5eb90450297d3fcef977d1a165b6aedc",
"score": "0.4761513",
"text": "def findresource(*args)\n @catalog.resource(*args)\n end",
"title": ""
},
{
"docid": "bf45143811e536020ea98572922add0f",
"score": "0.47430363",
"text": "def catalog_item(catalog_type, name, type)\n cat = catalog catalog_type\n items = cat.catalog_items name\n result = nil\n items.any? do |item|\n object = resolve_link item\n result = object if object.entity['type'] == type\n result\n end if items\n result\n end",
"title": ""
},
{
"docid": "649bf69f392732a99d989bff3fad726d",
"score": "0.47383466",
"text": "def load_catalogue\n catalogue_file = parse_catalogue_file(\"product_catalogue.json\")\n catalogue_file ? catalogue_file[:list] : PRODUCTS\n end",
"title": ""
},
{
"docid": "eee096a983d9fded11d38055da4b9031",
"score": "0.47380427",
"text": "def catalog_info\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/catalog/info',\n 'default')\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"title": ""
},
{
"docid": "abffb63c961c50bf708a88d569e6d437",
"score": "0.47324097",
"text": "def set_url_catalog\n @url_catalog = UrlCatalog.find(params[:id])\n end",
"title": ""
},
{
"docid": "d852d9b4541f2b3b8dd00ccc5012b09d",
"score": "0.47150844",
"text": "def get_catalog_by_name(organization, catalog_name)\n result = nil\n\n organization[:catalogs].each do |catalog|\n if catalog[0].downcase == catalog_name.downcase\n result = get_catalog(catalog[1])\n end\n end\n\n result\n end",
"title": ""
},
{
"docid": "67f888398dc934854933078784063f90",
"score": "0.47142705",
"text": "def product_from_catalog\n @product_found_in_catalog ||= DeviceModel.find_complete_or_clip( product) # cache\n end",
"title": ""
},
{
"docid": "1ad550036158db3bfba40a512797e0ad",
"score": "0.47083545",
"text": "def catalog_value(key)\n return catalog[key]\n end",
"title": ""
},
{
"docid": "088572314a4258b6e4031714590cd984",
"score": "0.46980676",
"text": "def execute(*args)\n @cartage.send(:resolve_config!, *Array(with_plugins))\n perform(*args)\n end",
"title": ""
},
{
"docid": "a180ea4b719d930bb5eff0d2acc20932",
"score": "0.46910477",
"text": "def run(options = {})\n options[:report] ||= Puppet::Transaction::Report.new(\"apply\")\n report = options[:report]\n\n Puppet::Util::Log.newdestination(report)\n begin\n prepare(options)\n\n if Puppet::Resource::Catalog.indirection.terminus_class == :rest\n # This is a bit complicated. We need the serialized and escaped facts,\n # and we need to know which format they're encoded in. Thus, we\n # get a hash with both of these pieces of information.\n fact_options = facts_for_uploading\n end\n\n # set report host name now that we have the fact\n report.host = Puppet[:node_name_value]\n\n begin\n execute_prerun_command or return nil\n retrieve_and_apply_catalog(options, fact_options)\n rescue SystemExit,NoMemoryError\n raise\n rescue => detail\n puts detail.backtrace if Puppet[:trace]\n Puppet.err \"Failed to apply catalog: #{detail}\"\n return nil\n ensure\n execute_postrun_command or return nil\n end\n ensure\n # Make sure we forget the retained module_directories of any autoload\n # we might have used.\n Thread.current[:env_module_directories] = nil\n end\n ensure\n Puppet::Util::Log.close(report)\n send_report(report)\n end",
"title": ""
},
{
"docid": "2a945ea565e2ea694e1c077ed114874e",
"score": "0.4689568",
"text": "def retriever(options)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "41468e6f092fff0146ac6fbea711af44",
"score": "0.4686351",
"text": "def putcatalog\n out('/Type /Catalog')\n out('/Pages 1 0 R')\n if @ZoomMode=='fullpage'\n out('/OpenAction [3 0 R /Fit]')\n elsif @ZoomMode=='fullwidth'\n out('/OpenAction [3 0 R /FitH null]')\n elsif @ZoomMode=='real'\n out('/OpenAction [3 0 R /XYZ null null 1]')\n elsif not @ZoomMode.kind_of?(String)\n out('/OpenAction [3 0 R /XYZ null null '+(@ZoomMode/100)+']')\n end\n\n if @LayoutMode=='single'\n out('/PageLayout /SinglePage')\n elsif @LayoutMode=='continuous'\n out('/PageLayout /OneColumn')\n elsif @LayoutMode=='two'\n out('/PageLayout /TwoColumnLeft')\n elsif @LayoutMode=='tworight'\n out('/PageLayout /TwoColumnRight') \n end\n end",
"title": ""
},
{
"docid": "ba816206f214b5610711682052857b9e",
"score": "0.46751383",
"text": "def get_catalog_sale_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StoreSalesApi.get_catalog_sale ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling StoreSalesApi.get_catalog_sale\"\n end\n # resource path\n local_var_path = \"/store/sales/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'CatalogSale')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StoreSalesApi#get_catalog_sale\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "b89738307d11ac2f3ec02b5bf642d161",
"score": "0.46745193",
"text": "def set_beer_catalog\n @beer_catalog = BeerCatalog.find(params[:id])\n end",
"title": ""
},
{
"docid": "6f7af04fd96baff0f4db16dd65672fe9",
"score": "0.4666012",
"text": "def has_catalog?\n false\n end",
"title": ""
},
{
"docid": "fc014c2b2289946edcb5bdc668496e0e",
"score": "0.4663552",
"text": "def search_catalog 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_search_catalog_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::DataCatalog::V1beta1::SearchCatalogResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"title": ""
},
{
"docid": "9c472d55a540d9f6c2ce1cd0ffe961ba",
"score": "0.465957",
"text": "def set_admin_catalogue\n @admin_catalogue = Admin::Catalogue.find(params[:id])\n end",
"title": ""
},
{
"docid": "7b825edfc5d674cbd330ba1c6faee4cd",
"score": "0.4656971",
"text": "def search_catalog 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_search_catalog_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::DataCatalog::V1::SearchCatalogResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"title": ""
},
{
"docid": "a65c0397b6498a0c3546787b4e2894f4",
"score": "0.46522748",
"text": "def set_catalogs_resource_type\n @catalogs_resource_type = Catalogs::ResourceType.find(params[:id])\n end",
"title": ""
},
{
"docid": "540a52cde6c59f0ae3b47b986ac580c5",
"score": "0.4648179",
"text": "def get_catalog_sales_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StoreSalesApi.get_catalog_sales ...\"\n end\n # resource path\n local_var_path = \"/store/sales\"\n\n # query parameters\n query_params = {}\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'PageResourceCatalogSale')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StoreSalesApi#get_catalog_sales\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "fa927836745aa6e4346503d62c6cbec5",
"score": "0.46427205",
"text": "def execute!\n if !@options[:recipes].empty?\n execute_recipes!\n elsif @options[:apply_to]\n execute_apply_to!\n end\n end",
"title": ""
},
{
"docid": "7d791a9cf76d7a12d62fbe10fe03c4d7",
"score": "0.46194515",
"text": "def get_all_catalogs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EcommerceApi.get_all_catalogs ...'\n end\n # resource path\n local_var_path = '/catalogs'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CatalogCollection'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['Apikey']\n\n new_options = opts.merge(\n :operation => :\"EcommerceApi.get_all_catalogs\",\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: EcommerceApi#get_all_catalogs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "79df9412fafeb1dec0c3a8751688bcb2",
"score": "0.46137208",
"text": "def fetch\n if Settings.opt_batch\n priorities.each {|rn| Catalog.instance.get(rn).fetch}\n else\n Catalog.instance.get(priorities.last).fetch\n end\n end",
"title": ""
},
{
"docid": "1a959ee268c7019ee80db8126e6cf39f",
"score": "0.46052593",
"text": "def update\n @catalog = current_user.catalogs.find(params[:id])\n\n respond_to do |format|\n if @catalog.update_attributes(params[:catalog])\n format.html { redirect_to @catalog, :notice => 'Catalog was successfully updated.' }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"title": ""
},
{
"docid": "e758ee7d2a1b1f9d9a6362c3acd8915a",
"score": "0.46032995",
"text": "def retrieve_catalog_object(object_id:,\n include_related_objects: false,\n catalog_version: nil)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/catalog/object/{object_id}',\n 'default')\n .template_param(new_parameter(object_id, key: 'object_id')\n .should_encode(true))\n .query_param(new_parameter(include_related_objects, key: 'include_related_objects'))\n .query_param(new_parameter(catalog_version, key: 'catalog_version'))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"title": ""
},
{
"docid": "8f71d8f03355637c8593299695a342a8",
"score": "0.4589789",
"text": "def mount_to_catalogs\n self.account.catalogs.each do |catalog|\n mount_to_catalog catalog \n end\n end",
"title": ""
},
{
"docid": "aa730d3dd89451046ef548d04e2cf885",
"score": "0.4589061",
"text": "def get_catalog_by_name(organization, catalogName)\n result = nil\n\n organization[:catalogs].each do |catalog|\n if catalog[0].downcase == catalogName.downcase\n result = get_catalog(catalog[1])\n end\n end\n\n result\n end",
"title": ""
},
{
"docid": "10b73228c0c5342eb882ef83ed4c782c",
"score": "0.45866343",
"text": "def raw_get(option)\n value = options_storage[option]\n Confo.callable_without_arguments?(value) ? value.call : value\n end",
"title": ""
},
{
"docid": "b355e72ae48ea4ae52f00e06c0b7bd06",
"score": "0.4583878",
"text": "def update!(**args)\n @data_catalog_entry = args[:data_catalog_entry] if args.key?(:data_catalog_entry)\n @fully_qualified_name = args[:fully_qualified_name] if args.key?(:fully_qualified_name)\n @google_cloud_resource = args[:google_cloud_resource] if args.key?(:google_cloud_resource)\n @system = args[:system] if args.key?(:system)\n end",
"title": ""
},
{
"docid": "34ce9e74efbed13bb86fc64fb07eba4b",
"score": "0.45777977",
"text": "def set_movie_catalog\n @movie_catalog = MovieCatalog.find(params[:id])\n end",
"title": ""
},
{
"docid": "fb320feb1a5cec68a9d04d91d041e563",
"score": "0.45754725",
"text": "def create_catalog_sale_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StoreSalesApi.create_catalog_sale ...\"\n end\n # resource path\n local_var_path = \"/store/sales\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'catalog_sale'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'CatalogSale')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StoreSalesApi#create_catalog_sale\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "457be8ba2a0e17335c1dc90d9126a28f",
"score": "0.45748448",
"text": "def set_catalog\n @redemption = Cart.includes(:cart_details).find(params[:id])\n end",
"title": ""
},
{
"docid": "6a122ee2667092b7a09944c08a15ae91",
"score": "0.45694342",
"text": "def show\n @catalog = current_user.catalogs.find(params[:id])\n\n respond_to do |format|\n format.html\n end\n end",
"title": ""
},
{
"docid": "b6ab60cb24a09bf6d8f2a0040f68e2aa",
"score": "0.4568243",
"text": "def InitializeCatalogs\n Initialize(true)\n\n nil\n end",
"title": ""
},
{
"docid": "3b4c7abea42f2e66107f3bd71927cfea",
"score": "0.45470825",
"text": "def catalogs_get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CatalogsApi.catalogs_get_categories ...\"\n end\n # resource path\n local_var_path = \"/api/Categories\"\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\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<Category1>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CatalogsApi#catalogs_get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "ffa812afa2f26d5a76b08e217e4a3978",
"score": "0.45451218",
"text": "def get_catalog_item_with_http_info(marketplace_id, asin, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CatalogApi.get_catalog_item ...'\n end\n # verify the required parameter 'marketplace_id' is set\n if @api_client.config.client_side_validation && marketplace_id.nil?\n fail ArgumentError, \"Missing the required parameter 'marketplace_id' when calling CatalogApi.get_catalog_item\"\n end\n # verify the required parameter 'asin' is set\n if @api_client.config.client_side_validation && asin.nil?\n fail ArgumentError, \"Missing the required parameter 'asin' when calling CatalogApi.get_catalog_item\"\n end\n # resource path\n local_var_path = '/catalog/v0/items/{asin}'.sub('{' + 'asin' + '}', asin.to_s)\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'MarketplaceId'] = marketplace_id\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n return_type = opts[:return_type] || 'GetCatalogItemResponse' \n\n auth_names = opts[: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 => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CatalogApi#get_catalog_item\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "576854dd6c357e257ee205153acb8346",
"score": "0.45432603",
"text": "def get_catalog(catalog_name)\n url = \"#{base_url}/mondrian/cubecrudapi/catalog/#{catalog_name}\"\n resp = Net::HTTP.get_response(URI.parse(url))\n response_xml = resp.body.strip\n parse_response(response_xml)\n response_xml\n end",
"title": ""
},
{
"docid": "5a5e4bbdd5129808b383833b07b6c385",
"score": "0.4538904",
"text": "def show\n # introducing present\n @catalog_op = present Catalog::Show\n @catalog = @catalog_op.model\n end",
"title": ""
},
{
"docid": "e0e5be4774f28946ffca9d6b53e7fc4c",
"score": "0.4537708",
"text": "def retrieve(options = {})\n if options[:aliases]\n try{ @cube_view.setAliasNames(true) }\n if options[:alias_table] && options[:alias_table] != try{ @cube_view.getAliasTable() }\n try{ @cube_view.setAliasTable(options[:alias_table]) }\n end\n else\n try{ @cube_view.setAliasNames(false) }\n end\n indent = case options.fetch(:indent_style, :none)\n when :totals then IEssCubeView::EEssIndentStyle::TOTALS\n when :sub_items then IEssCubeView::EEssIndentStyle::SUB_ITEMS\n else IEssCubeView::EEssIndentStyle::NONE\n end\n try {\n @cube_view.setSuppressMissing(options.fetch(:suppress_missing, false))\n @cube_view.setSuppressMissing(options.fetch(:suppress_zero, false))\n @cube_view.setFormulas(options.fetch(:preserve_formulas, true))\n @cube_view.setIndentStyle(indent)\n }\n try { @cube_view.updatePropertyValues() }\n op = try{ @cube_view.createIEssOpRetrieve() }\n instrument \"retrieve\" do\n try{ @cube_view.performOperation(op) }\n end\n end",
"title": ""
}
] |
66106345c7de6b3921c4c00acb0c465b | Reject a message, indicating to the sender that is invalid and should never be delivered again to this or any other receiver. | [
{
"docid": "5105d71cf84e62fea4dbd39c8cd55faa",
"score": "0.5966748",
"text": "def reject() settle REJECTED; end",
"title": ""
}
] | [
{
"docid": "a02e156d0effca7f912ad5d91ce02275",
"score": "0.73940223",
"text": "def reject(message_id)\n end",
"title": ""
},
{
"docid": "964adf6f0390e1db3e1aaf8cea46302b",
"score": "0.7149085",
"text": "def reject!(message, cause)\n log 'message rejected:', message\n\n raise cause if DEBUG\n\n message[:rejected] = true\n\n return false\n end",
"title": ""
},
{
"docid": "419df6cb6ba17bab6a7123ff5e9c7724",
"score": "0.69686854",
"text": "def reject\n General::ChangeStatusService.new(self, StatusLancer::REJECTED).change\n if self.save\n MemberMailerWorker.perform_async(recruitment_id: self.id.to_s, perform: :send_recruitment_rejection)\n return true\n end\n return false\n end",
"title": ""
},
{
"docid": "2a21a139d36848c11ea774a4f20c9e7d",
"score": "0.67763203",
"text": "def reject(delivery)\n self.settle(delivery, Qpid::Proton::Delivery::REJECTED)\n end",
"title": ""
},
{
"docid": "c17b4e489426663b880d6e1309be9719",
"score": "0.67119825",
"text": "def reject(message); @session_impl.reject message.message_impl; end",
"title": ""
},
{
"docid": "f5ea96f7f337a80d2dd8584d881dcb77",
"score": "0.64728",
"text": "def reject(delivery_tag, requeue = true)\n @client.send(Protocol::Basic::Reject.encode(@channel.id, delivery_tag, requeue))\n end",
"title": ""
},
{
"docid": "de5b8526124fde581285402ecd54c5c6",
"score": "0.6454235",
"text": "def reject!(reason)\n return true if self.accepted? || self.rejected?\n self.rejected_because = reason\n self.cancel!(:rejected)\n end",
"title": ""
},
{
"docid": "75f20cb80e6b79374b9038c2b968d0ec",
"score": "0.6452582",
"text": "def reject?(sender)\n false\n end",
"title": ""
},
{
"docid": "75f20cb80e6b79374b9038c2b968d0ec",
"score": "0.6452582",
"text": "def reject?(sender)\n false\n end",
"title": ""
},
{
"docid": "4740dc79e7d6ad65204515322cf3b5af",
"score": "0.63966745",
"text": "def reject(delivery_tag, requeue = true)\n @connection.send_frame(Protocol::Basic::Reject.encode(self.id, delivery_tag, requeue))\n\n self\n end",
"title": ""
},
{
"docid": "3ac8dc434f888219f7450a7632005129",
"score": "0.6371013",
"text": "def reject\n return unless acceptable?\n run_callbacks :reject do\n self.state = Sable::Acceptable::Rejected\n end\n end",
"title": ""
},
{
"docid": "032f7bdbbd106d15d1f3b7d40111ca15",
"score": "0.63424516",
"text": "def reject! &block\n modify_ack_deadline! 0, &block\n end",
"title": ""
},
{
"docid": "877c01f2ce8e228f9da785822fcb9e44",
"score": "0.6309048",
"text": "def reject?(sender)\n false\n end",
"title": ""
},
{
"docid": "877c01f2ce8e228f9da785822fcb9e44",
"score": "0.6309048",
"text": "def reject?(sender)\n false\n end",
"title": ""
},
{
"docid": "877c01f2ce8e228f9da785822fcb9e44",
"score": "0.6309048",
"text": "def reject?(sender)\n false\n end",
"title": ""
},
{
"docid": "d0f2ba5827163da742800a9e5d60365e",
"score": "0.6288464",
"text": "def reject opts = {}\n @mq.callback{\n @mq.send Protocol::Basic::Reject.new(opts.merge(:delivery_tag => properties[:delivery_tag]))\n }\n end",
"title": ""
},
{
"docid": "f8b5869c8e4d2816ea8391d921bdf25c",
"score": "0.62824965",
"text": "def reject\n NotificationMailer.reject\n end",
"title": ""
},
{
"docid": "db98a03a74b6cb8a0e3009c3e5a1b33c",
"score": "0.62497956",
"text": "def mail_rejected\n Notifier.influencer_rejected(self).deliver\n end",
"title": ""
},
{
"docid": "487d8cf00ebda549b754d77a07b89fa3",
"score": "0.62205726",
"text": "def reject(reason = nil)\r\n resolve(Q.reject(@reactor, reason))\r\n end",
"title": ""
},
{
"docid": "f6b1cf0cadb4fd572678f085b88e200e",
"score": "0.61893773",
"text": "def reject\n FriendsMailer.reject\n end",
"title": ""
},
{
"docid": "48d59731e75eea39099027b7b079442d",
"score": "0.6123987",
"text": "def reject(delivery_tag, requeue = true, multi = false)\n if multi\n @connection.send_frame(AMQ::Protocol::Basic::Nack.encode(self.id, delivery_tag, multi, requeue))\n else\n @connection.send_frame(AMQ::Protocol::Basic::Reject.encode(self.id, delivery_tag, requeue))\n end\n\n self\n end",
"title": ""
},
{
"docid": "35280c7eddb82d648dee3efa27b352c3",
"score": "0.6119751",
"text": "def reject(current_member, reason='', send_mail=true)\n General::ChangeStatusService.new(self, StatusLancer::REJECTED, current_member, reason).change\n if self.save\n if send_mail\n MemberMailerWorker.perform_async(service_id: self.id.to_s, perform: :send_service_rejection)\n end\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "d898869eeae3b8e8077998c0f308c1b3",
"score": "0.6107906",
"text": "def reject(delivery_tag, requeue = true, multi = false)\n if multi\n @connection.send_frame(Protocol::Basic::Nack.encode(self.id, delivery_tag, multi, requeue))\n else\n @connection.send_frame(Protocol::Basic::Reject.encode(self.id, delivery_tag, requeue))\n end\n\n self\n end",
"title": ""
},
{
"docid": "3bad122fc9818efe4630d5ee9b7271be",
"score": "0.6102232",
"text": "def reject!(reason)\n @rejection_reason = reason\n destroy\n end",
"title": ""
},
{
"docid": "dbfbf57b226280d0dc24a8c7f5d0c2fa",
"score": "0.6077316",
"text": "def reject\n transition_to :rejected, to_state: 'rejected'\n end",
"title": ""
},
{
"docid": "08bec2d77561f116dc5251dbfd6ffd57",
"score": "0.60735404",
"text": "def reject\n self.update_attribute(:state, REJECTED)\n end",
"title": ""
},
{
"docid": "7f4659d92905aed7b677a946f5cb8565",
"score": "0.6056598",
"text": "def reject(opts = {})\n @server.send(Protocol::Basic::Reject.new(opts.merge(:delivery_tag => properties[:delivery_tag])))\n end",
"title": ""
},
{
"docid": "3a4f9e6f14556ec9445c1c5e6c1f2e13",
"score": "0.6042256",
"text": "def mark_as_disapproved!(msg)\n if (!payment || (payment && payment.refund!) ) && self.destroy\n UserMailer.rejected_promotion(self, msg).deliver # send rejected email\n true\n else\n payment.errors.full_messages.each{|msg| self.errors.add(:base, msg) }\n false\n end\n end",
"title": ""
},
{
"docid": "869ae75cb6a7edb2586b2b993ec38acc",
"score": "0.6002261",
"text": "def reject!(*)\n @lock.synchronize { super }\n end",
"title": ""
},
{
"docid": "2906347e4c17fbb706be40cfabc38209",
"score": "0.5998127",
"text": "def reject(id)\n transmit \"bury #{id}\"\n end",
"title": ""
},
{
"docid": "1006413fe31d19705751cdf9cd461c9c",
"score": "0.5994916",
"text": "def reject(delivery_tag, requeue = false)\n if @acknowledged_state[:pending].key?(delivery_tag)\n delivery, header, body = update_acknowledgement_state(delivery_tag, :rejected)\n delivery.queue.publish(body, header.to_hash) if requeue\n end\n nil\n end",
"title": ""
},
{
"docid": "1c51b141ec06e58d369f9263d1d04e0a",
"score": "0.59824544",
"text": "def reject(reason = nil)\r\n\t\t\t\tresolve(Q.reject(reason))\r\n\t\t\tend",
"title": ""
},
{
"docid": "df46cebc83f46871123cc76475693fd6",
"score": "0.5978706",
"text": "def reject(tracker, flag)\n raise TypeError.new(\"invalid tracker: #{tracker}\") unless valid_tracker?(tracker)\n check_for_error(Cproton.pn_messenger_reject(@impl, tracker.impl, flag))\n end",
"title": ""
},
{
"docid": "fd9bbe8ddde62847b6feb39350129a08",
"score": "0.59786856",
"text": "def reject\n end",
"title": ""
},
{
"docid": "15f83b62ae60774647c47f0a4a4956f0",
"score": "0.5961233",
"text": "def reject!(except)\n if EventManager.has_listener? self\n EventManager.broadcast(self, [:bad, except])\n else\n @value = [:bad, except]\n end\n end",
"title": ""
},
{
"docid": "e0d0acf482753991fdc437f57f19e5e6",
"score": "0.5960835",
"text": "def valid_message?(m)\n if(message_registry)\n if(message_registry.valid?(m))\n true\n else\n warn \"Message was already received. Discarding: #{m.inspect}\"\n false\n end\n else\n true\n end\n end",
"title": ""
},
{
"docid": "97501341aadae8ffa05f5e486b10719a",
"score": "0.59545434",
"text": "def reject\n @current_call.reject\n @agi_response + \"0\\n\"\n rescue => e\n log_error(this_method, e)\n end",
"title": ""
},
{
"docid": "56a1f353bd4b474eb747269520b3c73c",
"score": "0.59384376",
"text": "def reject#!(user = nil)\n run_callbacks :rejection do\n # self.rejected_at = Time.now\n # self.rejecter = user if user\n self.status = 'rejected'\n save!\n # order_items.each(&:reject!)\n # deliver_rejected_order_email\n end\n end",
"title": ""
},
{
"docid": "627f80417eb4ef082a669f591648d064",
"score": "0.5922875",
"text": "def requeue_message(delivery_info)\n channel.reject(delivery_info.delivery_tag, true)\n end",
"title": ""
},
{
"docid": "4876aec7713a4f55d2d3310d4e8ba9ae",
"score": "0.5921243",
"text": "def rejected_promotion(promotion, msg)\n @promotion = promotion\n return unless promotion.user\n @msg = msg\n mail to: promotion.user.email, subject: \"Promotion rejected\"\n end",
"title": ""
},
{
"docid": "673d7c569338b4b50a163b57e6cf6e34",
"score": "0.5897284",
"text": "def reject!\n self.update_attribute(:state, 'rejected')\n end",
"title": ""
},
{
"docid": "484b3644d6afa85227dfb84ad53a7c7c",
"score": "0.58884585",
"text": "def reject(current_member, reason='', send_mail=true)\n General::ChangeStatusService.new(self, StatusLancer::REJECTED, current_member, reason).change\n\n if self.save\n if send_mail == true\n if self.private?\n MemberMailerWorker.perform_async(job_id: self.id.to_s, perform: :send_private_job_rejection)\n else\n MemberMailerWorker.perform_async(job_id: self.id.to_s, perform: :send_job_rejection)\n end\n end\n return true\n else\n return false\n end\n\n end",
"title": ""
},
{
"docid": "6794c48e62bda3a89733accbdaa454bd",
"score": "0.5863974",
"text": "def reject(reason, raise_on_reassign = T.unsafe(nil), reserved = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "3b1e4a08a8caac9be518ec059a7e545f",
"score": "0.585829",
"text": "def reject(id)\n invitation = Invitation.find(id)\n if (invitation.status.to_sym == :SENT)\n rejected_invitation = update_invitation(id, status: :REJECTED)\n InvitationEvent.create(description: 'Invitation rejected', status: rejected_invitation.status,\n invitation: rejected_invitation)\n rejected_invitation\n else\n raise TDJobs::InvalidStatus,\n \"Can't reject Invitation. Invitation is: \" + invitation.status\n end\n end",
"title": ""
},
{
"docid": "68765d48010c89220eafcda93c664444",
"score": "0.58516806",
"text": "def reject_friendship_of(friend)\n unless (!self.pending_friends.include?(friend))\n self.friendships.by_friend(friend).pending.first.destroy #My friendship is destroyed.\n friend.friendships.by_friend(self).requested.first.reject #My friend's friendship is marked as rejected.\n else\n raise NoPendingFriendship, \"There is no pending friendship for \" + user.email + \" requested by \" + friend.email + \".\"\n end\n end",
"title": ""
},
{
"docid": "6fc26c1ca25be0829733aa9077637c72",
"score": "0.58430606",
"text": "def reject\n @current_call.reject\n AGI_SUCCESS_PREFIX + \"0\\n\"\n rescue => e\n log_error(this_method, e)\n end",
"title": ""
},
{
"docid": "648b46655958824a43fd2cdecb4d9dba",
"score": "0.5830098",
"text": "def reject\n if @friend_request.destroy\n success_response(rejected: true)\n else\n active_record_error_response(@friend_request)\n end\n end",
"title": ""
},
{
"docid": "3791488a846a27d5a7797387fb3c381a",
"score": "0.5818166",
"text": "def reject_not_allowed\n # do nothing\n end",
"title": ""
},
{
"docid": "968b72418fb8eb755df0f7ee56a8dd11",
"score": "0.58093923",
"text": "def reject_sale(rejection_reason, response_message = nil)\n if self.update_attributes(:seller_rejected_at => Time.zone.now, :status => \"rejected\", :rejection_reason => rejection_reason, :response_message => response_message)\n self.payment.refund\n self.reject_items!\n end\n end",
"title": ""
},
{
"docid": "40a36afd94eda00fd8b57fcadf3e5c80",
"score": "0.58013237",
"text": "def reject!(user = nil)\n transaction do\n run_callbacks :rejection do\n self.rejected_at = Time.now\n self.rejecter = user if user\n self.status = 'rejected'\n self.save!\n self.order_items.each(&:reject!)\n Shoppe::OrderMailer.rejected(self).deliver\n end\n end\n end",
"title": ""
},
{
"docid": "55ecfd6cd30e1234dd2b0eafb13d326d",
"score": "0.57983935",
"text": "def reject( id )\n put( \"#{resource_uri}/#{id}/reject\", :headers => { \"Content-Length\" => 0 } )\n end",
"title": ""
},
{
"docid": "2076111d13dd6772a485f0424c742f4b",
"score": "0.5777154",
"text": "def reject(delivery_tag, requeue = false)\n guarding_against_stale_delivery_tags(delivery_tag) do\n basic_reject(delivery_tag.to_i, requeue)\n end\n end",
"title": ""
},
{
"docid": "0bc52e2b8b180bd43a4328663b7387e5",
"score": "0.5771641",
"text": "def reject(reason: nil, **keyword_args)\n append(Reject.new(reason: reason, **keyword_args))\n end",
"title": ""
},
{
"docid": "53cfe78807d22d31db055a2608196bec",
"score": "0.5770327",
"text": "def reject\n InterviewMailer.reject\n end",
"title": ""
},
{
"docid": "0ee96305e622f7d31ba3565eaa57d125",
"score": "0.5748995",
"text": "def reject\n @syndicate = Syndicate.find(params[:id])\n @syndicate.status = \"rejected\"\n @syndicate.save\n redirect_to syndicates_url\n SyndicateRejectedMailer.syndicate_rejected_email(@syndicate).deliver\n end",
"title": ""
},
{
"docid": "1d51facdb69ebc430abd301017e000d5",
"score": "0.5743938",
"text": "def basic_reject(delivery_tag, requeue = false)\n guarding_against_stale_delivery_tags(delivery_tag) do\n raise_if_no_longer_open!\n @connection.send_frame(AMQ::Protocol::Basic::Reject.encode(@id, delivery_tag, requeue))\n\n nil\n end\n end",
"title": ""
},
{
"docid": "233257fa64de2fd08a4accf20ccf4095",
"score": "0.5729033",
"text": "def reject(tag)\n channel.reject(tag, false)\n end",
"title": ""
},
{
"docid": "563f4f0de6bc5f20a948125cc0ce4f88",
"score": "0.5727163",
"text": "def cancel_message(msg)\n connection.state_mutex.synchronize {\n messages.delete(msg)\n msg.signal\n }\n end",
"title": ""
},
{
"docid": "30bc10b61c90aa0027332bac657dda8f",
"score": "0.571786",
"text": "def not_friending_yourself\n if self.recipient == self.sender\n errors[:base] << 'You can not friend yourself'\n end\n end",
"title": ""
},
{
"docid": "1ea3f71425d6e640287726c7768e4d63",
"score": "0.5716773",
"text": "def unreceive(message, options = {})\n options = { :dead_letter_queue => \"/queue/DLQ\", :max_redeliveries => 6 }.merge options\n # Lets make sure all keys are symbols\n message.headers = message.headers.symbolize_keys\n \n retry_count = message.headers[:retry_count].to_i || 0\n message.headers[:retry_count] = retry_count + 1\n transaction_id = \"transaction-#{message.headers[:'message-id']}-#{retry_count}\"\n message_id = message.headers.delete(:'message-id')\n \n begin\n self.begin transaction_id\n \n if client_ack?(message) || options[:force_client_ack]\n self.ack(message_id, :transaction => transaction_id)\n end\n \n if retry_count <= options[:max_redeliveries]\n self.publish(message.headers[:destination], message.body, message.headers.merge(:transaction => transaction_id))\n else\n # Poison ack, sending the message to the DLQ\n self.publish(options[:dead_letter_queue], message.body, message.headers.merge(:transaction => transaction_id, :original_destination => message.headers[:destination], :persistent => true))\n end\n self.commit transaction_id\n rescue Exception => exception\n self.abort transaction_id\n raise exception\n end\n end",
"title": ""
},
{
"docid": "c009cda07592e30c4b85bc8025fa9622",
"score": "0.5696868",
"text": "def handle_message(message)\n if !@handlers.handle_message(message) && !@receivers.handle_message(message)\n Internals::Logger.debug \"Discarded message (unhandled): #{message}\"\n end\n\n message\n end",
"title": ""
},
{
"docid": "55fb19cabf31eab36377e96b299c4aaf",
"score": "0.56958866",
"text": "def decline(iq)\n answer = iq.answer(false)\n answer.type = :error\n error = answer.add(ErrorResponse.new('forbidden', 'Offer declined'))\n error.type = :cancel\n @stream.send(answer)\n end",
"title": ""
},
{
"docid": "746116c1fd258d2d51850f3a4fc1a631",
"score": "0.56851727",
"text": "def reject(key, reason)\n reason\n end",
"title": ""
},
{
"docid": "09086748e161e60bc4271c3036c74bf3",
"score": "0.5683821",
"text": "def reject(&block); end",
"title": ""
},
{
"docid": "09086748e161e60bc4271c3036c74bf3",
"score": "0.5683821",
"text": "def reject(&block); end",
"title": ""
},
{
"docid": "09086748e161e60bc4271c3036c74bf3",
"score": "0.5683821",
"text": "def reject(&block); end",
"title": ""
},
{
"docid": "1f6bc49c28c730fbaac95c1588eb7776",
"score": "0.56803435",
"text": "def rejected?\n state == REJECTED\n end",
"title": ""
},
{
"docid": "00d1b5d0c1fbd96c464b96881ebdbd29",
"score": "0.5678572",
"text": "def reject\n @appointment.reject!\n render_success_message 'Counseling appointment successfully cancelled'\n end",
"title": ""
},
{
"docid": "0f72cd2eb33962650609c949fd255955",
"score": "0.5674597",
"text": "def reject(invitee_id)\n @group = self.group\n #check validity of this request\n if self.user_id == invitee_id.to_i && self.expired.nil? && self.accept.nil?\n self.accept = false\n self.expired = true\n self.save\n @group.send_admin_message(@user,\"User #{self.user.name} has rejected your invitation to join the group\", \"Invitation rejected\")\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "67e5a34371f76321267c7b6243e13b1d",
"score": "0.5668324",
"text": "def reject error\n task.cancel if task\n\n self.error = if error.kind_of?(Exception)\n error\n else\n Error.new(error || 'unknown')\n end\n fulfill('', 0, {})\n end",
"title": ""
},
{
"docid": "8637cd2df672bdbef5d5358721251dd0",
"score": "0.56611776",
"text": "def rejected?\n self.state == REJECTED\n end",
"title": ""
},
{
"docid": "3a5058983d6d8cc19b2a7be284908a21",
"score": "0.5660046",
"text": "def reject\n\t\t@user = current_user\n\t\tfriend = User.find_by(id: params[:id])\n\t\t@user.decline_request(friend)\n\t\tredirect_to friendships_path\n\t\tflash[:alert] = \"You have cancelled the friend request of #{friend.user_name}\"\n\tend",
"title": ""
},
{
"docid": "f97e218a2f729671de5baa719e0e29ed",
"score": "0.5659295",
"text": "def reject\n handle_action('reject')\n end",
"title": ""
},
{
"docid": "479237e434fa11ed958c08f64800edda",
"score": "0.5654979",
"text": "def reject_play_again\n GameChannel.broadcast_to @game, action: 'reject_play_again', user_id: current_user.id\n end",
"title": ""
},
{
"docid": "e61030a5b33554c9d14ff944047c920d",
"score": "0.5649056",
"text": "def reject(id)\n\n end",
"title": ""
},
{
"docid": "429901f4faf66d3e6b4a6b9dfa6af9e8",
"score": "0.5646931",
"text": "def reject?(data)\n !accept?(data)\n end",
"title": ""
},
{
"docid": "a1d454c152c5f508c61534efccf8930a",
"score": "0.56338614",
"text": "def reject!(&block); end",
"title": ""
},
{
"docid": "452c9c016b63ca1e43133be10cbcc23c",
"score": "0.5621096",
"text": "def send_rejection_mail\n\t\tProjectMailer.project_invitation_rejected(self.project.owner, self.user, self.project).deliver\n end",
"title": ""
},
{
"docid": "ef4af2f93207f30f28856775732b8f5c",
"score": "0.5617676",
"text": "def reject; end",
"title": ""
},
{
"docid": "a65fa3734e6ff159ddc73172d6cd69e0",
"score": "0.5616243",
"text": "def reject(user, friend)\n transaction do\n rejected_at = Time.now\n reject_one_side(user, friend, rejected_at)\n end\n end",
"title": ""
},
{
"docid": "94415586064accb23706e5992f0d2e00",
"score": "0.56155354",
"text": "def reject\n user_specified_options[:reject]\n end",
"title": ""
},
{
"docid": "a96c7e25ed5dcf1f42cb8849cd39c0fa",
"score": "0.5609313",
"text": "def reject!\n self.status = 'Rejected'\n self.save\n GameInviteResponseEvent.new(self).enqueue\n end",
"title": ""
},
{
"docid": "f2d3cec3b2043ba6c5a8cf97748435f3",
"score": "0.56070846",
"text": "def invalid!(message)\n raise ValidationError, \"#{tracking_id} #{message}\"\n end",
"title": ""
},
{
"docid": "f2d3cec3b2043ba6c5a8cf97748435f3",
"score": "0.56070846",
"text": "def invalid!(message)\n raise ValidationError, \"#{tracking_id} #{message}\"\n end",
"title": ""
},
{
"docid": "b2ad671c07d0aa609f7fe80a5b8b1772",
"score": "0.5600946",
"text": "def reject\n @userService = UserService.find_by_id(params[:id])\n @service = Service.find_by_id(@userService.service_id)\n @service.purchased = false\n @service.save\n @message = Message.new(receiver_id: @userService.buyer_id, user_id: current_user.id, content: current_user.firstName+\" \"+current_user.lastName+\" has declined your request for \"+@service.name)\n @message.save\n @userService.destroy\n end",
"title": ""
},
{
"docid": "cea38e2b5177e16b813461108504f830",
"score": "0.5600898",
"text": "def deny(reason)\n this = self\n messages = build_denied_messages\n if reason.is_a?(Hash) && self.destroy\n GrantMailer.grant_denied(this, reason['email_text']).deliver\n create_notification(messages[:notification])\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "f959fd0ac4e2dc07463ba104c5d3115d",
"score": "0.5594999",
"text": "def reject?\n raise ArsecurityIllegalException.new(\"ArsecurityHandler.reject? should be implemented\")\n end",
"title": ""
},
{
"docid": "28f7d91d5b119d61c230b5b46b04e94f",
"score": "0.55886537",
"text": "def rejected_notification\n UserMailer.rejected_notification\n end",
"title": ""
},
{
"docid": "57ba7e1f920dca203f9275a4ea308aec",
"score": "0.5587357",
"text": "def abort_message subscription, message\n connection(subscription.destination.broker_name).unreceive message, subscription.subscribe_headers\n end",
"title": ""
},
{
"docid": "12159dbee4c1941a0b90882db7923a1f",
"score": "0.5568342",
"text": "def my_reject\n end",
"title": ""
},
{
"docid": "2f885ab51406f666a7f3caa90a89f126",
"score": "0.5562514",
"text": "def unreceive(message, options = {})\n raise Stomp::Error::NoCurrentConnection if @closed_check && closed?\n options = { :dead_letter_queue => \"/queue/DLQ\", :max_redeliveries => 6 }.merge(options)\n # Lets make sure all keys are symbols\n message.headers = message.headers.symbolize_keys\n retry_count = message.headers[:retry_count].to_i || 0\n message.headers[:retry_count] = retry_count + 1\n transaction_id = \"transaction-#{message.headers[:'message-id']}-#{retry_count}\"\n message_id = message.headers.delete(:'message-id')\n\n # Prevent duplicate 'subscription' headers on subsequent receives\n message.headers.delete(:subscription) if message.headers[:subscription]\n\n begin\n self.begin transaction_id\n\n if client_ack?(message) || options[:force_client_ack]\n self.ack(message_id, :transaction => transaction_id)\n end\n\n if message.headers[:retry_count] <= options[:max_redeliveries]\n self.publish(message.headers[:destination], message.body, \n message.headers.merge(:transaction => transaction_id))\n else\n # Poison ack, sending the message to the DLQ\n self.publish(options[:dead_letter_queue], message.body, \n message.headers.merge(:transaction => transaction_id, \n :original_destination => message.headers[:destination], \n :persistent => true))\n end\n self.commit transaction_id\n rescue Exception => exception\n self.abort transaction_id\n raise exception\n end\n end",
"title": ""
},
{
"docid": "ddfeb51328beef9597c3158af44b882f",
"score": "0.5561679",
"text": "def rejected?\n self.from_status==REJECTED or self.to_status==REJECTED\n end",
"title": ""
},
{
"docid": "b65303c9d6d0490ebe475be0335b14e9",
"score": "0.55554056",
"text": "def reject(reason = nil)\n\t\t\t\tresolve(ResolvedPromise.new(@reactor, reason, true))\n\t\t\tend",
"title": ""
},
{
"docid": "a6c9f411ea1e96f9129d996b2d7bd9be",
"score": "0.5546448",
"text": "def reject?\n false\n end",
"title": ""
},
{
"docid": "0c98491b3205ffcb0a48a0050e46c1cb",
"score": "0.55442333",
"text": "def reject\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"title": ""
},
{
"docid": "19d3928ce91e3181cdc5eb991be19646",
"score": "0.5521158",
"text": "def reject(id)\n offer = Offer.find(id)\n if ([:RESENT, :SENT].include?(offer.status.to_sym))\n offer = Offer.update(id, status: :REJECTED)\n # Creating REJECTED event\n OfferEvent.create(offer: offer, description: 'Offer rejected',\n provider_id: offer[:provider_id], status: :REJECTED)\n return offer\n else\n raise TDJobs::InvalidStatus, \"Can't reject a non-sent or non-resent offer\"\n end\n end",
"title": ""
},
{
"docid": "6f37f6bb406bc2501a2b237a567a03d9",
"score": "0.55172265",
"text": "def reject(domain, reason)\n return reason if ENV['RECONCILING']\n\n logger.info \"👎 `#{domain}`: #{reason}\"\n false\n end",
"title": ""
},
{
"docid": "8e60af4203eda2dc91f046145aae1282",
"score": "0.55123276",
"text": "def reject_r &block\n dup.reject_r! &block\n end",
"title": ""
},
{
"docid": "e575742e9c7bf10d31db8dfe73dbfb25",
"score": "0.5502708",
"text": "def reject_user\n # set the enabled flag to false for the user\n # clear activation code (prevents user from showing up as pending user)\n # send out rejection notification\n end",
"title": ""
}
] |
1779d9955615fcf76980f9be9268fb1f | Returns spots corresponding to the newly sunken ship If ambiguous, return empty array | [
{
"docid": "08de7947dfaf5e1b084ea10f41ba7bf1",
"score": "0.68025136",
"text": "def find_sunk_ship_spots(tile, destroyed_ship)\n hs = find_hit_ship_tiles(tile, [:left, :right])\n vs = find_hit_ship_tiles(tile, [:up, :down])\n if hs.size == destroyed_ship && vs.size != destroyed_ship\n return hs\n elsif hs.size != destroyed_ship && vs.size == destroyed_ship\n return vs\n else\n return []\n end\n end",
"title": ""
}
] | [
{
"docid": "51da2215945f2827c2ac3ce54c0ba471",
"score": "0.64496034",
"text": "def all_ships_are_sunk?\n shots_array = []\n shots.where(:is_hit => true).each do |shot|\n shots_array << {:x => shot.x , :y => shot.y}\n end\n\n ships_array = []\n ship_co_ordinates_in_use.each do |ship_co_ordinate|\n ships_array << {:x => ship_co_ordinate.x, :y => ship_co_ordinate.y}\n end\n\n # If this returns an empty array then it means that all items matched, and that the ships have been sunk\n xor(shots_array, ships_array).blank?\n end",
"title": ""
},
{
"docid": "a1253dc4512458d188c7612b0839076e",
"score": "0.6379509",
"text": "def ship_at(*cell)\r\n cell = cell.flatten\r\n return nil if @m.at(cell) == :empty\r\n ship = [cell]\r\n [Direction.up, Direction.right, Direction.down, Direction.left].each do |direction|\r\n coord = cell.go direction\r\n while onboard?(coord) && [:ship, :wounded, :killed].include?(@m.at(coord))\r\n ship << coord\r\n coord = coord.go direction\r\n end\r\n end\r\n ship\r\n end",
"title": ""
},
{
"docid": "9e030845e5bc72b2a4d20239d4846b95",
"score": "0.63686895",
"text": "def ships_at_pos(player)\n grid = Array.new(10){Array.new(10)}\n player.each do |ship|\n ship.each do |array|\n grid[array[1]][array[0]] = \"occupied\"\n end\n end\n grid\n end",
"title": ""
},
{
"docid": "460cdf69229d6d6b247c0cdfbd0aed45",
"score": "0.63282275",
"text": "def ai_sunk( symbol )\n p1 = $last_move\n vals = SHIPS.values.flatten\n length = vals[ vals.index( symbol ) - 1 ]\n \n # there should only be one hit next to $last_move\n p2 = []\n next_to( p1 ).each { |e| p2.push( e ) if grid_value( $ai_grid, e ) == HIT }\n p2.flatten!(1)\n \n # if destroyer then stop there\n if length == 2\n ship = [ p1, p2 ]\n else\n ship = [ p1 ]\n\n # determine direction of rest of ship, count in that direction to build ship array\n case direction( p1, p2 )\n when \"h\"\n \n if p1[1] > p2[1] # count down (left)\n ( length - 1 ).times { ship.push( [ p1[0], ship.last[1] - 1 ] ) }\n elsif p1[1] < p2[1] # count up (right)\n ( length - 1 ).times { ship.push( [ p1[0], ship.last[1] + 1 ] ) }\n end\n \n when \"v\"\n \n if p1[0] > p2[0] # count down (up)\n ( length - 1 ).times { ship.push( [ ship.last[0] - 1, p1[1] ] ) }\n elsif p1[0] < p2[0] # count up (down)\n ( length - 1 ).times { ship.push( [ ship.last[0] + 1, p1[1] ] ) }\n end\n end \n end\n ship.each { |e| set_grid_value( $ai_grid, e, symbol ) }\nend",
"title": ""
},
{
"docid": "63d72f3a35383d1133bcc27c4cc9f27b",
"score": "0.6279469",
"text": "def ships\n @ships ||= []\n end",
"title": ""
},
{
"docid": "b3dec234f869a1a5122bf8dc4278a5a4",
"score": "0.6225082",
"text": "def all_ships_sunk?\n ships.collect(&:position).collect(&:values).flatten.uniq == [:hit]\n end",
"title": ""
},
{
"docid": "ccc9f31d9ccd70b225051ae6ee4debe4",
"score": "0.6119449",
"text": "def place_stones\n @cups.map!.with_index do |cup, idx|\n idx == 13 || idx == 6 ? [] : [:stone, :stone, :stone, :stone]\n end\n end",
"title": ""
},
{
"docid": "0bb4f99d9791ebcd0dd6b7282b164842",
"score": "0.61089253",
"text": "def ship_at_co_ordinate(x, y)\n ship = nil\n ships.each do |s|\n if s.co_ordinates.index {|a| a.x == x && a.y == y}\n ship = s\n break\n end\n end\n ship\n end",
"title": ""
},
{
"docid": "3416e49639eca13a0807c8326e72832d",
"score": "0.6076234",
"text": "def ships; products.find_all {|p| p and p.ship?} || [] end",
"title": ""
},
{
"docid": "af472d9bfcb2e6834751f57403f2eb97",
"score": "0.6043938",
"text": "def ships\n @ships.values\n end",
"title": ""
},
{
"docid": "5cdfde828da483ac3ad46ad30f91c71d",
"score": "0.59941435",
"text": "def spaceships\n space_flights.map{|space_flight|space_flight.spaceship}\n end",
"title": ""
},
{
"docid": "2b15bc26354c92aa16893678826a9aba",
"score": "0.599226",
"text": "def open_spots\n spots = []\n valid_spaces.each do |space_key|\n board_value = @board[space_key]\n spots << space_key if @board[space_key] == ' '\n end\n spots\n end",
"title": ""
},
{
"docid": "2d8099e874b328cc69ba57a550898c83",
"score": "0.5967791",
"text": "def getShips()\n return @ships\n end",
"title": ""
},
{
"docid": "8d6fdd58153642cf18f745ccc2e2fc6d",
"score": "0.5960601",
"text": "def generate_hit_neighbors\n [left, right, up, down].select do |pos|\n moves_used.keys.any? { |used| used == pos && moves_used[used] == :hit } \n end\n end",
"title": ""
},
{
"docid": "02298982e9217b7205f0917d49ca2702",
"score": "0.5870048",
"text": "def shot_at_co_ordinate(x, y)\n shot = nil\n shots.each do |s|\n if s.co_ordinates.index {|a| a.x == x && a.y == y}\n shot = s\n break\n end\n end\n shot\n end",
"title": ""
},
{
"docid": "f03d9a18cde44d1390e7632d043a0ca0",
"score": "0.58639586",
"text": "def player_ship_at_pos\n ships_at_pos(@player_ships)\n end",
"title": ""
},
{
"docid": "5f9f49e1b7ff9a71dd4ab846020a6b96",
"score": "0.58266634",
"text": "def strike position\n if (@ships.collect{|x| x.position}.include?(position)) \n report_hit position\n else\n report_miss position\n :miss\n end \n end",
"title": ""
},
{
"docid": "b5ebc44158e85cb8460d487c3571191d",
"score": "0.5809288",
"text": "def cp_ship_at_pos\n ships_at_pos(@cp_ships)\n end",
"title": ""
},
{
"docid": "ded7d1364e312b34ac40ab4ee16c0f9e",
"score": "0.5790897",
"text": "def player_ships\n [\n @carrier,\n @battleship,\n @cruiser,\n @submarine,\n @destroyer\n ]\n end",
"title": ""
},
{
"docid": "e43ccaa559311d6932784ec2942f495c",
"score": "0.5733097",
"text": "def hidden_ships_grid\n newGrid = Array.new(@n){Array.new(@n)}\n\n @grid.each_with_index do |subArr, idx1|\n subArr.each_with_index do |ele, idx2|\n if ele == :S \n newGrid[idx1][idx2] = :-\n else\n newGrid[idx1][idx2] = ele\n end\n end\n end\n\n return newGrid\n end",
"title": ""
},
{
"docid": "c07d7e65287fba6394244f720b619e83",
"score": "0.5727859",
"text": "def knight_spots_surrounding(location)\n moves = [1, -1].product([2, -2])\n moves += moves.map(&:reverse)\n moves.map { |move| location + Vector.new(move) }\n end",
"title": ""
},
{
"docid": "4dd4a8b45e2337638716177d23b32798",
"score": "0.5713636",
"text": "def immediate_spots_surrounding(location)\n step = [-1, 0, 1]\n moves = step.product(step).reject { |move| move == [0, 0] }\n moves.map { |move| location + Vector.new(move) }\n end",
"title": ""
},
{
"docid": "fc879e8cc4375499339cb996d60c8efc",
"score": "0.56989515",
"text": "def find_neighbors\n @neighbors.clear\n XY_AROUND.each do |coord_change|\n stone = goban.stone_at?(@i+coord_change[0], @j+coord_change[1])\n @neighbors.push(stone) if stone != BORDER\n end\n end",
"title": ""
},
{
"docid": "a1b6d272fe423efdc41ffd7da9163657",
"score": "0.56925845",
"text": "def ship_co_ordinates_in_use\n if @ship_co_ords_in_use.blank?\n @ship_co_ords_in_use = []\n ships.each do |ship|\n @ship_co_ords_in_use = @ship_co_ords_in_use | ship.co_ordinates.all\n end\n end\n @ship_co_ords_in_use\n end",
"title": ""
},
{
"docid": "c19c2ad857aaeeda5090d0e065dc41e7",
"score": "0.5690686",
"text": "def target_result(coordinates, was_hit, ship_sunk)\n @grid.set(@last_r, @last_c, ship_sunk || (was_hit ? :hit : :miss))\n if ship_sunk\n @ships_left -= [ship_sunk]\n # try to mark all the hits with ship type\n DIRECTIONS.each{|y, x|\n all_hits = true\n (1..(SHIP_TYPES[ship_sunk]-1)).each{|p|\n r = @last_r + y * p\n c = @last_c + x * p\n all_hits = false unless @grid.valid_target?(r, c) && @grid.get(r, c) == :hit\n }\n if all_hits\n (1..(SHIP_TYPES[ship_sunk]-1)).each{|p|\n r = @last_r + y * p\n c = @last_c + x * p\n @grid.set(r, c, ship_sunk)\n }\n break\n end\n }\n end\n end",
"title": ""
},
{
"docid": "216a3b94c060eee4034d283e4f189d84",
"score": "0.5689063",
"text": "def shot_co_ordinates_in_use\n if @shot_co_ords_in_use.blank?\n @shot_co_ords_in_use = []\n shots.each do |shot|\n @shot_co_ords_in_use = @shot_co_ords_in_use | shot.co_ordinates.all\n end\n end\n @shot_co_ords_in_use\n end",
"title": ""
},
{
"docid": "7a575d7c6f1deaca7c4d297591b94f70",
"score": "0.5685201",
"text": "def fire_missile(x,y) \n\t\t@ships.each do |ship|\n\t\t\tship.body_parts.each do |part|\n\t\t\t\t\tif part[:coords] == [x, y]\n\t\t\t\t\t\t\tpart[:hit] = true\n\t\t\t\t\t\t\t@hits << [x,y]\n\t\t\t\t\t\t\treturn 'hit'\n\t\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@misses << [x,y]\n\t\t\treturn 'miss'\nend",
"title": ""
},
{
"docid": "2d9d13b2002f316db51fe60ac1dd393c",
"score": "0.5683327",
"text": "def winning_marker\n WINNING_LINES.each do |line|\n markers = @squares.values_at(*line).collect(&:marker)\n if markers.uniq == [markers[0]] && markers[0] != Square::INITIAL_MARKER\n return markers[0]\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "069d2ac7c8be83cf50dfe4d0bf9409c9",
"score": "0.56710887",
"text": "def get_ships\n @@ships\n end",
"title": ""
},
{
"docid": "e4b46891103aa2e44cac7c0f4ba17cdf",
"score": "0.5662726",
"text": "def place_ships\n place_ships_randomly\n end",
"title": ""
},
{
"docid": "a3ff99688ef5f61a645cb0413b744f35",
"score": "0.5658974",
"text": "def shots(*args)\n if args.size == 0\n return @shots.values\n elsif args.size == 1\n return @shots.values.select{|shot| shot.way == args[0]}\n else\n raise ArgumentError.new(\"Unknown criteria: #{args}\")\n end\n end",
"title": ""
},
{
"docid": "3a74991b5c47f90a0290345d3949db24",
"score": "0.5651477",
"text": "def place_ships\n end",
"title": ""
},
{
"docid": "85d3e2a47b7758801531f3a1bc5d1c78",
"score": "0.5640906",
"text": "def ship(ship_id)\n @ships[ship_id]\n end",
"title": ""
},
{
"docid": "d83be6a573923d1610e4776a60e44226",
"score": "0.5630743",
"text": "def get_ship(ship)\n @cells.select { |c| c.content == ship }\n end",
"title": ""
},
{
"docid": "5571af3f6ccf40e5a3583a3e210e46e1",
"score": "0.5630044",
"text": "def place_ships_randomly_no_touching\n # start off with empty 10x10 grid\n grid = Array.new(10) { Array.new(10) }\n\n # place ships in random order\n SHIPS.keys.shuffle.each do |k|\n placement = []\n length = SHIPS[k][:length]\n\n # attempt to choose available on-grid positions\n # only move onto the next position if the previous one succeeded\n # repeat until you get it right\n until placement.length == length\n placement.clear\n\n # choose random starting point\n y1, x1 = random_point\n\n # repeat until it's available and not touching another ship\n until available_isolated_point?(grid, y1, x1)\n y1, x1 = random_point\n end\n\n placement << [ y1, x1 ] # place first\n\n # choose random adjacent point\n y2, x2 = adjacent_points(y1, x1).sample\n\n # only proceed if it's available and not touching another ship\n next unless available_isolated_point?(grid, y2, x2)\n\n placement << [ y2, x2 ] # place 2nd\n\n # place 3rd, 4th, 5th\n count = 2\n\n 3.times do\n next if length == count\n\n y, x = bookend_points(placement).sample\n\n next unless available_isolated_point?(grid, y, x)\n\n placement << [ y, x ]\n count += 1\n end\n end\n\n placement.each { |e| grid[e.first][e.last] = k } # write ship to grid\n end\n\n grid\n end",
"title": ""
},
{
"docid": "90d00992431386a01c1019a8e9bffed0",
"score": "0.56198084",
"text": "def ship_at(coordinates)\n for ship in @ships\n if ship.orientation == Game::Ship::Orientation::HORIZONTAL\n if coordinates.y == ship.coordinates.y\n yield ship if (ship.coordinates.x..(ship.coordinates.x + ship.size - 1)).include? coordinates.x\n end\n else\n if coordinates.x == ship.coordinates.x\n yield ship if (ship.coordinates.y..(ship.coordinates.y + ship.size - 1)).include? coordinates.y\n end\n end\n end\n end",
"title": ""
},
{
"docid": "1245ccb06aadf5646f4825eedaa4dc3e",
"score": "0.56096613",
"text": "def enemy_on(spot, location, piece = self[location].piece)\n if self[spot].piece.is_a? Pawn\n return [spot] if valid_pawn_path?(spot, location, piece)\n else\n return [spot] if valid_general_path?(spot, location, piece)\n end\n []\n end",
"title": ""
},
{
"docid": "294a330f5f57351d58e4d6a634b97a99",
"score": "0.5604649",
"text": "def winning_marker # iterate through winning lines, and see if square\n # in each 3 elements\n # in this line array matches the human marker or computer marker,\n # if so return that marker, if no match return nil\n WINNNING_LINES.each do |line|\n # line is 3 element arr representing winning line\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil # if we dno't put this, then .each will return array\n end",
"title": ""
},
{
"docid": "a6d349218e72bb8d0a604e70bbfb5e64",
"score": "0.5594639",
"text": "def ship_at(a_point)\n index = ships.find_index { |ship| ship.a_point_belongs_to_ship(a_point) }\n ships[index]\n end",
"title": ""
},
{
"docid": "43eaeecb8b7b5193de46a0f34374d8e9",
"score": "0.5589255",
"text": "def get_random_coordinates_for_computer_player\n #number_of_ships_possible_in_battleship = 6\n # if @ship_length == 2\n spaces_for_ship = [\n \"a1 a2\", \"a2 a3\", \"a3 a4\", \"b1 b2\", \"b2 b3\", \"b3 b4\",\n \"c1 c2\", \"c2 c3\", \"c3 c4\", \"d1 d2\", \"d2 d3\", \"d3 d4\",\n \"a1 b1\", \"b1 c1\", \"c1 d1\", \"a2 b2\", \"b2 c2\", \"c2 d2\",\n \"a3 b3\", \"b3 c3\", \"c3 d3\", \"a4 b4\", \"b4 c4\", \"c4 d4\"\n ]\n # elsif @ship_length == 3\n spaces_for_ship = [\n \"a1 b1 c1\", \"a2 b2 c2\", \"a3 b3 c3\", \"a4 b4 c4\",\n \"b1 c1 d1\", \"b2 c2 d2\", \"b3 c3 d3\", \"b4 c4 d4\",\n \"a1 a2 a3\", \"b1 b2 b3\", \"c1 c2 c3\", \"d1 d2 d3\",\n \"a2 a3 a4\", \"b2 b3 b4\", \"c2 c3 c4\", \"d2 d3 d4\"\n ]\n # end\n randomizer = Random.new\n random_index = randomizer.rand(0..2)\n ship_array = spaces_for_ship.values_at(random_index)\n end",
"title": ""
},
{
"docid": "88675616ffe499289282a1c549d4ddb2",
"score": "0.5565172",
"text": "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n return squares.first.marker if winning_line?(squares)\n end\n nil\n end",
"title": ""
},
{
"docid": "6700277d814e1692f7f09fa3777b7a87",
"score": "0.5557864",
"text": "def ship_part_index_hit(attack_coords, defending_player_id)\n # ship_part_index will be nil if there is no ship at the specified coordinate\n player_fleet_coords = defending_player_id == player_1_id ? player_1_fleet_coords : player_2_fleet_coords\n player_fleet_coords.flatten.index(attack_coords) \n end",
"title": ""
},
{
"docid": "df04f2fa17e6546b2c17a97bd066457e",
"score": "0.5555284",
"text": "def shipments_for_planet(shipments, planet_name)\n shipments.select do |shipment|\n shipment[\"Destination\"] == planet_name\n end\nend",
"title": ""
},
{
"docid": "16659fdf6f5b04fa7952e5837ee17f77",
"score": "0.55530936",
"text": "def winning_marker\r\n WINNING_LINES.each do |line|\r\n squares = @squares.values_at(*line)\r\n if three_identical_markers?(squares)\r\n return squares.first.marker\r\n end\r\n end\r\n nil\r\n end",
"title": ""
},
{
"docid": "ea862e8774d3d5a8b2be0902714d1296",
"score": "0.55516195",
"text": "def spacereduce(neighbors)\n puts \" here is neighbors inside of spacereduce #{neighbors}\"\n returnarray = []\n xval = 0\n 8.times do |bim|\n temparray = []\n xval += 1\n yval = 0\n punt = 0\n 8.times do |bap|\n yval += 1\n neighbors.each do |putz|\n if punt == 1\n break\n end\n puts \" this is puzt #{putz}\"\n if putz[:x] == xval && putz[:y] == yval\n temparray.push putz\n if putz[:letter] == \" \"\n punt = 1\n break\n end\n end\n end\n end\n unless temparray == []\n temparray.each do |add|\n returnarray.push add\n end\n end\n end\n return returnarray\nend",
"title": ""
},
{
"docid": "ec7c0bb88ec291a9278b642a365185e7",
"score": "0.5550839",
"text": "def river_tiles\r\n t = []\r\n ((@x-1)..(@x+1)).each do |x|\r\n ((@y-1)..(@y+1)).each do |y|\r\n if @game[x,y] and @game[x,y].river\r\n t << @game[x,y]\r\n end\r\n end\r\n end\r\n return t\r\n end",
"title": ""
},
{
"docid": "657380f349a46b5afd2b74e1e3168771",
"score": "0.5550523",
"text": "def neighbour_locations\n [[location[0]-1,location[1]],[location[0],location[1]-1],\n [location[0]+1,location[1]],[location[0],location[1]+1]]\n end",
"title": ""
},
{
"docid": "8f1193b93fd0c5d12804752cd76aede2",
"score": "0.5537105",
"text": "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if identical_markers?(squares, 3)\n return squares.first.marker\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "e917212c21549a8dcf140da89f64c399",
"score": "0.5535689",
"text": "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "e917212c21549a8dcf140da89f64c399",
"score": "0.5535689",
"text": "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "e917212c21549a8dcf140da89f64c399",
"score": "0.5535689",
"text": "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "e917212c21549a8dcf140da89f64c399",
"score": "0.5535689",
"text": "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "e917212c21549a8dcf140da89f64c399",
"score": "0.5535689",
"text": "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "e917212c21549a8dcf140da89f64c399",
"score": "0.5535689",
"text": "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "e917212c21549a8dcf140da89f64c399",
"score": "0.5535689",
"text": "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "7353abf72824922b90e6ea8c2370f256",
"score": "0.5525319",
"text": "def shared_king_squares(game_state)\n all = game_state.squares.occupied_by_piece(King).map { |s| s.piece.base_destinations(s, game_state) }\n\n all.reduce(nil) do |memo, set|\n if memo\n memo & set\n else\n set\n end\n end\n end",
"title": ""
},
{
"docid": "3539e53b50ad657c875a08e56dff1633",
"score": "0.55246836",
"text": "def winners\n out = []\n @num_legs.times do |player|\n out << player if (0..marbles_per_player - 1).inject(true) do |won, marble|\n won && !!@holes[\"endzone_#{player}_#{marble}\"]\n end\n end\n out\n end",
"title": ""
},
{
"docid": "3a73c504fab58c384754b90c1f7d1353",
"score": "0.5523843",
"text": "def winning_marker\n WINNING_LINES.each do |line|\n line_markers = squares.values_at(*line).map(&:marker)\n next if line_markers.include?(Square::INITIAL_MARKER)\n return line_markers.first if line_markers.uniq.size == 1\n end\n\n nil\n end",
"title": ""
},
{
"docid": "b49769b548ba5f35b13b252e060b170d",
"score": "0.5508475",
"text": "def holes\n round_holes = @rounds[0].scores.collect { |s| s }\n course_holes = @course.holes.collect { |h| h }\n\n arr = Array.new(18) do |index|\n if round_holes[index] && round_holes[index].par\n round_holes[index] \n elsif course_holes[index] && course_holes[index].par\n course_holes[index]\n else\n Hole.new\n end\n end\n arr \n end",
"title": ""
},
{
"docid": "4e25d7c04fbb88e6d29d185fa596e03a",
"score": "0.5503604",
"text": "def available_place_moves\n moves = Array.new()\n open_slots = Array.new()\n #@logger.info \"collecting moves...\"\n open_slots << @board_state.start_slot if not @board_state.moves_made? #FIRST MOVE\n open_slots += second_moves #2nd MOVE\n\n unless @used #Nth MOVE\n empty_slot_type = Hive::Piece.color_to_slot_type(color)\n open_slots = open_slots + @board_state.get_slots_with_type_code(empty_slot_type) \n end\n \n open_slots.delete_if{|slot| slot.z == 1} #only allow slots on the lower level \n open_slots.each do |slot|\n raise \"bla bla: #{@insect_id}\" unless Hive::Piece.valid_id?(@insect_id)\n move = Hive::Move.new(self, slot)\n moves = moves + [move]\n end\n \n return moves\nend",
"title": ""
},
{
"docid": "33e2fdc6cc13f44d4268011579753e3c",
"score": "0.549502",
"text": "def destinations(square, game_state)\n []\n end",
"title": ""
},
{
"docid": "b46ea707745cd3e12c793a1774b8e5ce",
"score": "0.5494997",
"text": "def king_positions\n king_locations = []\n\n @piece_locations.each do |piece, details|\n king_locations << piece if details.fetch(:type) == :king\n end\n\n king_locations\n end",
"title": ""
},
{
"docid": "873df3a7dd53c0fe6e0159e62fe32fee",
"score": "0.5489079",
"text": "def open_spot\n 20.times do # timeout if it's not working\n x = rand(@width)\n y = rand(@height)\n return [x, y] unless solid? x, y\n end\n @height.times do |y|\n @width.times do |x|\n return [x, y] unless solid? x, y\n end\n end\n raise \"No open spots!\"\n end",
"title": ""
},
{
"docid": "1f9dca6a5a12a8ea56516c14d1e6ff12",
"score": "0.54774517",
"text": "def deployableSpots(wMX, wMY, unitClass)\r\n spaceArr = [\r\n @field.getSpace([wMX+1, wMY]),\r\n @field.getSpace([wMX, wMY+1]),\r\n @field.getSpace([wMX-1, wMY]),\r\n @field.getSpace([wMX, wMY-1])\r\n ]\r\n p(\"deployableSpots: unit class: \" + unitClass.to_s)\r\n return spaceArr.delete_if{|space| space == nil || space.terrain.class == Sea || (space.terrain.class == Mountain && unitClass != (Infantry || Mech)) || space.occoupiedWM != nil}\r\nend",
"title": ""
},
{
"docid": "7282ec7fd9a01ce1b2704b8bf86a7ac3",
"score": "0.54771614",
"text": "def streetFighterSelection(fighters, position, moves)\n i = 0\n x = 0\n empty = []\n\n moves.each {|move|\n\n if move == \"up\"\n i -= 1 unless i == 0\n empty.push(fighters[i][x])\n elsif move == \"down\"\n i += 1 unless i == 1\n empty.push(fighters[i][x])\n elsif move == \"left\" && x > -6\n x -= 1\n empty.push(fighters[i][x])\n elsif move == \"left\" && x == -6\n x = -1\n empty.push(fighters[i][x])\n elsif move == \"right\" && x < 5\n x += 1\n empty.push(fighters[i][x])\n elsif move == \"right\" && x == 5\n x = 0\n empty.push(fighters[i][x])\n end\n }\n return empty\nend",
"title": ""
},
{
"docid": "445ab20b524281797662d1e9f2b9164e",
"score": "0.5461789",
"text": "def walks\r\n @atbats.select{|atbat| atbat.ball == 4} \r\n end",
"title": ""
},
{
"docid": "2fe8ad57929dab37c6c32d0eb9c405aa",
"score": "0.54322493",
"text": "def spies\n @spies.values\n end",
"title": ""
},
{
"docid": "4fd29a21bbb11a8104cf7864441a2c7a",
"score": "0.54292244",
"text": "def next_target\n # First shot at the priority positions\n begin\n here = @shot_queue.shift\n end while !shootable?(here) && !@shot_queue.empty?\n # Then shot according to ship discovery\n while !shootable?(here) do\n here = @discovery.next\n break if here.nil?\n end \n field[here] = :shot if here\n here\n end",
"title": ""
},
{
"docid": "8f8eb1e829967f1ed8f7c1cf75c207e1",
"score": "0.5424307",
"text": "def locate_strikes_and_spares(scores)\n spare_locs = []\n strike_locs = []\n scores.each.with_index do |score, i|\n spare_locs << i if score[1] == '/'\n strike_locs << i if score[0] == 'X'\n end\n [strike_locs, spare_locs]\nend",
"title": ""
},
{
"docid": "80cf0439b876e8d24d12d66103e3b2a2",
"score": "0.5410573",
"text": "def ships_where_stored\n list = CONNECTION.execute(\"SELECT * FROM ship_names WHERE ship_locations_id = #{@id};\")\n array_list = []\n \n list.each do |type|\n array_list << ShipName.new(type)\n end\n \n array_list\n end",
"title": ""
},
{
"docid": "59989bb6a2c56ef731ab815721eed267",
"score": "0.54050374",
"text": "def available_shipment\n\n sql = available_shipment_query\n shipment_count = sql.count\n\n Rails.logger.warn \"Found #{shipment_count} shipments, but expected 1: #{sql}\" if shipment_count > 1\n\n sql.order('created_at asc').first\n end",
"title": ""
},
{
"docid": "cd92e36b0d3f12dbe1b783d24fbc82bf",
"score": "0.5399233",
"text": "def place_ships\n big_ship_first_vertical, big_ship_first_horizontal = rand(3), rand(3)\n vertical_or_horizontal = rand(2)\n if vertical_or_horizontal == 1\n if big_ship_first_horizontal == 3\n big_ship_second_vertical, big_ship_second_horizontal = big_ship_first_vertical, big_ship_first_horizontal - 1\n else\n big_ship_second_vertical, big_ship_second_horizontal = big_ship_first_vertical, big_ship_first_horizontal + 1\n end\n else \n if big_ship_first_vertical == 3\n big_ship_second_vertical, big_ship_second_horizontal = big_ship_first_vertical - 1, big_ship_first_horizontal\n else \n big_ship_second_vertical, big_ship_second_horizontal = big_ship_first_vertical + 1, big_ship_first_horizontal\n end\n end\n @big_ship = [[big_ship_first_vertical, big_ship_first_horizontal],[big_ship_second_vertical, big_ship_second_horizontal]]\n @little_ship = [big_ship_first_vertical, big_ship_first_horizontal]\n while @big_ship.include? @little_ship \n little_ship_vertical, little_ship_horizontal = rand(3), rand(3)\n puts little_ship_vertical, little_ship_horizontal\n @little_ship = [little_ship_vertical, little_ship_horizontal]\n\t end \n end",
"title": ""
},
{
"docid": "1842cd2862d68cb9f4cb39274e3f062d",
"score": "0.5395149",
"text": "def place_random_ships\n numShips=(0.25*size).to_i # number of ships that need to be placed\n\n n=@grid.length\n\n # dictionary to keep track of \"free\" positions\n # key=row index, value=col indices array with respect to row\n dict=Hash.new {|h,k| h[k]=[]}\n n.times do |r|\n n.times do |c|\n dict[r]<<c\n end\n end\n\n while numShips>0\n # takes random indices only from available positions\n randRow=dict.keys.sample # takes a random row from available rows\n randCol=dict[randRow].sample # takes random col from available cols\n\n # delete [key=row if value=cols] when array is empty\n dict.delete(randRow) if dict[randRow].empty?\n # delete [value=col with respect to key=row] every single time\n dict[randRow].delete(randCol)\n\n pos=[randRow,randCol]\n self[pos]=:S\n\n numShips-=1 # decre num of remaining ships needing to be placed\n end\n end",
"title": ""
},
{
"docid": "e8fcf01030a15bee9ece6e2eb4c0c70f",
"score": "0.5384489",
"text": "def winning_marker # rtn the winning marker or nil # si4 add\n WINNING_LINES.each do |line|\n # # if @squares[line[0]].marker == TTTGame::HUMAN_MARKER &&\n # # @squares[line[1]].marker == TTTGame::HUMAN_MARKER &&\n # # @squares[line[2]].marker == TTTGame::HUMAN_MARKER\n # if winning_count_reached?(line, TTTGame::HUMAN_MARKER) # si9 del\n # return TTTGame::HUMAN_MARKER # si9 del\n # # elsif @squares[line[0]].marker == TTTGame::COMPUTER_MARKER &&\n # # @squares[line[1]].marker == TTTGame::COMPUTER_MARKER &&\n # # @squares[line[2]].marker == TTTGame::COMPUTER_MARKER\n # elsif winning_count_reached?(line, TTTGame::COMPUTER_MARKER) # si9 del\n # return TTTGame::COMPUTER_MARKER # si9 del\n TTTGame::MARKERS.each do |marker| # si9 add\n # must disable the clear method to display the following debug output:\n # p \"line is #{line}, marker is #{marker}, \" +\n # \"count is #{@squares.values_at(*line).map(&:marker).count(marker)}\"\n return marker if winning_count_reached?(line, marker) # si9 add\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "dcf68643a4b50936fc1f4c1fe2d61eae",
"score": "0.53750855",
"text": "def random_spot\n 25.times do\n x = ((rand * @world_size) - (@world_size / 2)).to_i\n y = ((rand * @world_size) - (@world_size / 2)).to_i\n col, row = world_to_array_coordinates(x, y)\n if @astar[col, row] == @astar.initial_weight\n return Coord.new(x, y)\n end\n end\n return nil\n end",
"title": ""
},
{
"docid": "b2cc718399bb518ae9751bc704cec345",
"score": "0.5370097",
"text": "def find_food_on_grid\n image = self.create_screen_capture Snake::Game.game_rectangle\n for y in 0..(Snake::Game.game_rectangle.height/SQUARE_LENGTH).floor\n for x in 0..(Snake::Game.game_rectangle.width/SQUARE_LENGTH).floor\n if Color.new(image.getRGB(x*SQUARE_LENGTH, y*SQUARE_LENGTH)).compare_hsb_array(0.125, FOOD_COLOR_HSB)\n return GridPoint.new(x, y)\n end\n end\n end\n return nil\n end",
"title": ""
},
{
"docid": "1a457e903fb177df1d670d219b78847e",
"score": "0.53666705",
"text": "def threatened_locations\n create_moves.map { |move| [move[0] + row, move[1] + col] }\n end",
"title": ""
},
{
"docid": "26acb6aeb15bafad27e298c7a1f0785d",
"score": "0.53632116",
"text": "def ship\n fetch('the_expanse.ships')\n end",
"title": ""
},
{
"docid": "af85608550a03f715c1f667dc9b93f11",
"score": "0.5360475",
"text": "def winning_marker\n WINNING_LINES.each do |line|\n if marked_same?(@squares.values_at(*line))\n return @squares[line.first].marker\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "03c9ce079c6bf5613a279c37db37acf6",
"score": "0.5349056",
"text": "def get_empty_locations(row,col)\n options = get_move_options(row,col)\n return nil unless options.length > 0\n\n options.inject(Array.new) do |memo, option| \n case option[1]\n when Sheep, Wolf then nil\n else\n memo << option[0]\n end\n\n memo\n end\n end",
"title": ""
},
{
"docid": "bc679f8c1c325dc8532c8e0d49d050d5",
"score": "0.5347329",
"text": "def board_occupied\n all_occupied = []\n\n # set union of all occupied Coords\n @ships.each do |s|\n all_occupied |= s.occupied_coords\n end\n\n all_occupied\n end",
"title": ""
},
{
"docid": "7d1113efa7c291aaf3fc685f678aed8b",
"score": "0.53439754",
"text": "def index\n #Wenn Schiffe existieren\n @ship = Ship.find(params[:ship_id])\n @ships_stations = @ship.ships_stations\n end",
"title": ""
},
{
"docid": "312dd2b8684838a1d8437a149d9a122c",
"score": "0.53412986",
"text": "def hit(coordinate)\n self.enemy.ships.each do |ship| \n ship.location.delete(coordinate) if ship.location.include?(coordinate)\n end\n end",
"title": ""
},
{
"docid": "7cf90e5e65ad3409275262f32d316fb1",
"score": "0.53345615",
"text": "def neighbors \n neighbors_array = []\n n = []\n \n DIRECTIONS.each do |i|\n n << [@position[0] + i[0], @position[1] + i[1]]\n end\n \n @neighbors_positions = n.select {|neighbor| neighbor[0] < 9 && neighbor[1] < 9 && neighbor[0] >= 0 && neighbor[1] >= 0 }\n \n @neighbors_positions.each do |position|\n neighbors_array << @board.tiles[position[0]][position[1]]\n end \n neighbors_array\n end",
"title": ""
},
{
"docid": "6e70c38901257e2948abe81a53a63b18",
"score": "0.5334005",
"text": "def get_nearby_locations(nelat, nelng, swlat, swlng, user_id)\n @locations = []\n end",
"title": ""
},
{
"docid": "c7c4deb0e0fe0feedf87175765086aca",
"score": "0.53336054",
"text": "def optimal_roster(spots)\n # TODO Get rid of this janky ad-hoc caching when optimal_roster is refactored\n mk_key = ->(s) { s.first.week.to_s + s.map(&:id).join(':') }\n key = mk_key.(spots)\n return optimal_roster_cache[key] if optimal_roster_cache.has_key?(key)\n\n res = spots.map do |spot|\n p \"#{spot.position} eligible_positions: #{spot.eligible_positions.to_a}\"\n other_positions = spot.eligible_positions - [spot.position]\n p \"other_positions: #{other_positions}\"\n swaps_to_try = other_positions.map do |position|\n swaps_to_consider = (spots - [spot]).select do |eligible_spot|\n other_positions.include?(eligible_spot.position) && eligible_spot.swapable_spot?(spot)\n end.compact\n p \"swaps_to_consider: #{swaps_to_consider}\"\n\n swaps_to_consider.map do |swapable_spot|\n p \"spot: #{spot.attributes}\"\n p \"swappable spot: #{swapable_spot.attributes}\"\n new_spot_after_swapping = RosterSpot.new(swapable_spot.attributes)\n new_spot_after_swapping.player = spot.player\n p \"new_spot_after_swapping: #{new_spot_after_swapping.player}\"\n\n original_spot_after_swapping = RosterSpot.new(spot.attributes)\n original_spot_after_swapping.player = swapable_spot.player\n p \"original_spot_after_swapping: #{original_spot_after_swapping.player}\"\n Swap.new(original_spot_after_swapping, new_spot_after_swapping)\n end\n end.flatten\n\n p \"swaps_to_try: #{swaps_to_try}\"\n\n finger_print = ->(candidate_lineup) {\n v = candidate_lineup.sort.map {|s| [s.position, s.yahoo_player_key].join(':')}.join\n p v\n p [v].pack('m0')\n v\n }\n\n compute_points = ->(candidate_lineup) {\n v = candidate_lineup.select(&:starter?).map(&:player).map {|p| p.points_on_week(GameWeek.current.week)}.map(&:total).sum\n p v\n v\n }\n\n original_fp = finger_print.(spots)\n permutations = {original_fp => compute_points.(spots)}\n\n swaps_to_try.each do |swap|\n updated = spots.dup.delete_if do |s|\n b = [swap.spot_1.yahoo_player_key, swap.spot_2.yahoo_player_key].include?(s.yahoo_player_key)\n p \"boolean: #{b}\"\n b\n end\n updated.concat([swap.spot_1, swap.spot_2])\n fp = finger_print.(updated)\n\n permutations[fp] ||= compute_points.(updated)\n p \"number of permutation keys: #{permutations.keys.size}\"\n p permutations\n end\n\n p \"max is #{permutations.values.max}\"\n p \"min is #{permutations.values.min}\"\n [permutations.values.max, permutations.values.min]\n end.flatten\n\n optimal_roster_cache[key] = res\n res\n end",
"title": ""
},
{
"docid": "d0c0c172e4b74efa31ead841c3a91bbb",
"score": "0.5328786",
"text": "def sink_ship(tile, destroyed_ship)\n find_sunk_ship_spots(tile, destroyed_ship).each {|t| t.update(:sunk)}\n end",
"title": ""
},
{
"docid": "93ba8dc43f83c105f5420bc21b7dffdd",
"score": "0.5326474",
"text": "def place_all_ships\n fleet = Board::INITIAL_FLEET.dup\n placements = []\n until fleet.empty?\n placement = self.class.random_placement(fleet.first)\n if board_with_placement = @board.place(placement)\n @board = board_with_placement\n placements << placement\n fleet.shift\n end\n end\n placements\n end",
"title": ""
},
{
"docid": "146240bb29b1b27be9ddceee4a8510e0",
"score": "0.532417",
"text": "def available_squares(board) #Find spaces available to mark\r\n avail_sqrs=[]\r\n board.each_with_index do |row,rw_idx|\r\n row.each_with_index do |elem, elem_idx|\r\n if elem==\"-\"\r\n avail_sqrs << [rw_idx,elem_idx]\r\n end\r\n end\r\n end#each_with_index\r\n return avail_sqrs #array of arrays of coordinates'[[a,b],[c,d],[e,f]]'\r\n end",
"title": ""
},
{
"docid": "01513d4afe52a2f827769a0118b8af38",
"score": "0.5320021",
"text": "def sister_piece_of( a_piece )\n sitting_at = index(a_piece)\n pos, piece = select do |pos, piece| \n piece.side == a_piece.side && \n piece.function == a_piece.function && \n pos != sitting_at\n end.flatten \n [pos, piece]\n end",
"title": ""
},
{
"docid": "6d29b72b10ee6e723fc3132163f4baf1",
"score": "0.53172785",
"text": "def winning_marker\n WINNING_LINES.each do |line|\n TTTGame::MARKERS.each do |marker|\n return marker if count_marker(@squares.values_at(*line), marker) == 3\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "9d4fe861086f5c2b3e40044cd1635acb",
"score": "0.5312317",
"text": "def products_shipped\n shipped_line_items.map(&:product).uniq\n end",
"title": ""
},
{
"docid": "10117d58a9554949057c14b938928383",
"score": "0.53091264",
"text": "def sunk?\n return false if @ships.empty?\n @ships.all? {|s| s.sunk?}\n\n #if @ships != [] && @hits == @ships\n #end\n end",
"title": ""
},
{
"docid": "f6f97b5ea6c3781a7316694d634354c4",
"score": "0.52972215",
"text": "def coords(bots)\n [0, 1, 2, 3].map { |i| bots.flat_map { |b| b[i] }.uniq.sort }\nend",
"title": ""
},
{
"docid": "7c25dd50ce1898560d0dad50c610b6f5",
"score": "0.5296304",
"text": "def place_armies(time)\n [[@world_map.my_regions.sample.id, @round.armies]]\n end",
"title": ""
},
{
"docid": "6e9b70218599357f40d37a8e399408e3",
"score": "0.529298",
"text": "def detect_winning_marker\n WINNING_LINES.each do |line|\n target = @squares.values_at(*line)\n next if target.any?(&:unmarked?)\n if target.uniq(&:marker).size == 1\n @winning_marker = target.first.marker\n end\n end\n end",
"title": ""
},
{
"docid": "57292fa89be94551c78ad0d57c21406f",
"score": "0.52831346",
"text": "def get_via_position(x1, y1, x, y, x2, y2, via_size, via_clearance)\n\t\tcandidate_pos_b = Array.new\n\t\tdir_matrix = [0, 1, 2, 3, 4].product([0, -1, 1, -2, 2])\n\t\tvts = via_size + via_clearance\n\t\t[x1, y1, x2, y2].each_slice(2){|x12, y12|\n\t\t\tl = Math.hypot(x12 - x, y12 - y)\n\t\t\tdx, dy = [x12 - x, y12 - y].map{|el| el / l * vts}\n\t\t\tdxr, dyr = dy, -dx\n\t\t\tcandidate_pos_b += dir_matrix.map{|a, b| [a * dx + b * dxr, a * dy + b * dyr]}\n\t\t}\n\t\t#candidate_pos_b.uniq!.sort_by!{|a, b| a ** 2 + b ** 2}\n\t\tvts *= 0.5\n\t\tfor i in 0..2 do\n\t\t\t#candidate_pos_a = candidate_pos_b.map{|a, b| [a + x, b + y]}\n\t\t\tcandidate_pos_a = candidate_pos_b.uniq.sort_by{|a, b| a ** 2 + b ** 2}.map{|a, b| [a + x, b + y]}\n\t\t\tcandidate_pos_b = Array.new\n\t\t\tcandidate_pos_a.each{|x, y|\n\t\t\t\tintersecting_objects = @rt.intersects?(x - vts, y - vts, x + vts, y + vts)\n\t\t\t\tcol_num = intersecting_objects.length\n\t\t\t\tif col_num == 0\n\t\t\t\t\treturn [[x, y]]\n\t\t\t\telsif (col_num < 2) || (col_num < 3 && i == 0)\n\t\t\t\t\tfor j in 0..(col_num - 1)\n\t\t\t\t\t\talt_positions = move_via(intersecting_objects[j], x, y, via_size, via_clearance).each_slice(2).to_a\n\t\t\t\t\t\tif alt_positions.empty? && col_num < 2\n\t\t\t\t\t\t\treturn [[x, y]]\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tcandidate_pos_b += alt_positions\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t}\n\t\tend\n\t\treturn []\n\tend",
"title": ""
},
{
"docid": "a53663e8eae9b3b7b673a4e016fea5f8",
"score": "0.5278611",
"text": "def hit_ship(cell)\n @ships.each do |ship|\n ship.hit cell\n end\n end",
"title": ""
},
{
"docid": "ca41a3111af1aa3ecccea93866a6ba96",
"score": "0.52690566",
"text": "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.status\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "4f0465764a5bb6c2e731a4da2f20800b",
"score": "0.52685547",
"text": "def get_neighbors\n neighbors = []\n x, y = @pos\n\n surroundings = [\n [x - 1, y - 1], [x, y - 1], [x + 1, y - 1],\n [x - 1, y], [x + 1, y],\n [x - 1, y + 1], [x, y + 1], [x + 1, y + 1]\n ]\n\n surroundings\n .select { |pos| pos.all? { |num| num >= 0 } }\n .each do |pos|\n neighbor = @board[pos]\n neighbors << neighbor unless neighbor.nil?\n end\n\n @neighbors = neighbors\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "e28e328ad28141e2c6f4b992f697619d",
"score": "0.0",
"text": "def set_practice_area\n @practice_area = PracticeArea.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": ""
}
] |
9ba98b13d0d1df7b5e453090a9beb3eb | Returns a hash with day_of_year as keys and arrays of tweet objects as values | [
{
"docid": "834627f5f11cb9dd9a2bf2ec707d7b84",
"score": "0.68744296",
"text": "def group_tweets_by_day(tweets)\n\t\tdays = tweets.group_by{|tweet| tweet[\"date\"].yday}.sort_by{|k,v| k}\n\tend",
"title": ""
}
] | [
{
"docid": "0bc85e5620a6fbbfca4969155566123b",
"score": "0.72488695",
"text": "def tweet_day(array)\n day = {}\n array.each do |tweet|\n if day.has_key?(tweet.created_at.strftime(\"%a\"))\n day[tweet.created_at.strftime(\"%a\")] += 1\n else\n day[tweet.created_at.strftime(\"%a\")] = 1\n end\n end\n day\n end",
"title": ""
},
{
"docid": "d3c0ba3880ce062d72b12dc31d74ab24",
"score": "0.67009324",
"text": "def compute_date_stats tweets\n dates = {}\n tweets.each do |x|\n rec = dates[x.created_at.to_date] ||= 0\n rec+=1\n dates[x.created_at.to_date] = rec\n end\n dates\n end",
"title": ""
},
{
"docid": "20ad1fb75ad10e656aa50928136b81a6",
"score": "0.6675404",
"text": "def tweet_time(array)\n time = {}\n array.each do |tweet|\n if time.has_key?(tweet.created_at.hour)\n time[tweet.created_at.hour] += 1\n else\n time[tweet.created_at.hour] = 1\n end\n end\n time\n end",
"title": ""
},
{
"docid": "d6bf68bb7ca3beb4beab1ddfa06d19f0",
"score": "0.61286026",
"text": "def tweet_objects\n tweet_json = JSON.parse(File.read(tweet_filepath))['tweets']\n tweet_json.map { |tweet| Twitter::Tweet.new(tweet.deep_symbolize_keys) }\n end",
"title": ""
},
{
"docid": "b39e229425ff14f0a33ceb8e213beb81",
"score": "0.61092657",
"text": "def divide_tweets_per_month(tweets)\n result = {};\n\n # Initialize the hash to 0\n today = DateTime.now.to_date\n (0..5).to_a.reverse.each do |i|\n date = today.beginning_of_month - i.month\n\n result[date.beginning_of_month] = 0\n end\n\n # For each tweet add 1 to the number of tweets in the correct month\n tweets.each do |tweet|\n tweet_date = tweet.created_at.to_date\n\n result[tweet_date.beginning_of_month] += 1\n end\n\n return result\n end",
"title": ""
},
{
"docid": "8f894fcd3046c3e91ea0dd570ce39e20",
"score": "0.5730228",
"text": "def count_tweets(username)\n\n # fetch all the tweets for this user,\n # set tweets count to max 200\n fetched_tweets = @client.user_timeline(username, {count: 200})\n\n # init a counter to keep the count of tweet happens in last 24 hours\n hour_counter = Array.new(24) { |e| e = 0 }\n\n # start the timer after fetch all the tweets\n now = Time.now\n fetched_tweets.each do |tweet|\n if now < tweet.created_at + 24 * 60 * 60\n # only consider the 24 hours tweets\n hour_counter[tweet.created_at.hour] += 1\n else\n # if loop to a tweet before 24 hours ago,\n # then terminates the loop\n break\n end\n end\n\n # convert array into hash\n # using array index as key\n # and convert key to string\n hash = Hash.new\n hour_counter.each_with_index {|val, index| hash[index.to_s] = val}\n return hash\n end",
"title": ""
},
{
"docid": "53173140b0eccd83f45a54ff179bf347",
"score": "0.55391574",
"text": "def day_of_year(days, *extras)\n merge(yday: days.array_concat(extras))\n end",
"title": ""
},
{
"docid": "ed1c5dbbe6a11faececb5d245b3b8443",
"score": "0.5525023",
"text": "def recent_tweets\n @_recent_tweets ||= timeline.each_with_object([]) do |tweet, memo|\n age_of_tweet_in_days = (Time.now.to_date - tweet.created_at.to_date).to_i\n memo << tweet if age_of_tweet_in_days <= 7\n end\n end",
"title": ""
},
{
"docid": "a916f4161683d949a9b847a42c30cf93",
"score": "0.5517767",
"text": "def twitter_user_data\n\t\t# IT WOULD BE NICE TO RE-FACTOR THIS SO IT IS THE SAME current_user as for other stats display...\n\t\t@twitter_graph = Authorization.where(\"user_id = ?\", current_user).where(\"provider = ?\", \"twitter\")\n\t\t@twitter_graph_user = TwitterUser.where(\"uid = ?\", @twitter_graph.first['uid'])\n\t\tdata_by_day = @twitter_graph_user.total_grouped_by_date(2.weeks.ago)\n\t\t#twitter_index_by_day = IvolveIndex.twitter_grouped_by_day(2.weeks.ago)\n\t\t(2.weeks.ago.to_date..Time.zone.today).map do |date|\n\t\t\tif !data_by_day[date].nil?\n\t\t\t\tcreated_at = date\n\t\t\t\tfriends_count = data_by_day[date].first.try(:friends_int_count)\n\t\t\t\tfollowers_count = data_by_day[date].first.try(:followers_int_count)\n\t\t\t\ttweets_count = data_by_day[date].first.try(:tweet_int_count)\n\t\t\t\tfavd_count = data_by_day[date].first.try(:favorite_int_count)\n\t\t\t\tlist_count = data_by_day[date].first.try(:listed_int_count)\n\t\t\telse\n\t\t\t\tcreated_at = date\n\t\t\t\tfriends_count = 0\n\t\t\t\tfollowers_count = 0\n\t\t\t\ttweets_count = 0\n\t\t\t\tfavd_count = 0\n\t\t\t\tlist_count = 0\n\t\t\tend\n\n\t\t\t{\n\t\t\t\tcreated_at: date,\n\t\t\t\tnum_friends: friends_count,\n\t\t\t\t#index_friends: twitter_index_friends,\n\t\t\t\tnum_followers: followers_count,\n\t\t\t\t#index_followers: twitter_index_followers,\n\t\t\t\ttweets_sent: tweets_count,\n\t\t\t\t#index_sent: twitter_index_sent,\n\t\t\t\ttweets_favd: favd_count,\n\t\t\t\t#index_favd: twitter_index_favd,\n\t\t\t\tnum_lists: list_count,\n\t\t\t\t#index_lists: twitter_index_lists,\n\t\t\t}\n\t\tend\n\tend",
"title": ""
},
{
"docid": "bad08462ec8e53a2e3ca2c8a595c0574",
"score": "0.54770374",
"text": "def twitter_data(time=Time.now)\n h = {}\n h['1'] = Hashie::Mash.new :id => '1', :in_reply_to_status_id => nil, :user => { :screen_name => 'aaa', :id => '1'}, :text => 'Initial tweet', :created_at => time\n h['2'] = Hashie::Mash.new :id => '2', :in_reply_to_status_id => '1', :user => { :screen_name => 'bbb', :id => '2'}, :text => '@aaa i disagree', :created_at => time += 60\n h['3'] = Hashie::Mash.new :id => '3', :in_reply_to_status_id => '1', :user => { :screen_name => 'ccc', :id => '3'}, :text => '@aaa i agree', :created_at => time += 60\n h['4'] = Hashie::Mash.new :id => '4', :in_reply_to_status_id => '3', :user => { :screen_name => 'ddd', :id => '4'}, :text => '@ccc how can you agree?', :created_at => time += 60\n h['5'] = Hashie::Mash.new :id => '5', :in_reply_to_status_id => '1', :user => { :screen_name => 'eee', :id => '5'}, :text => '@aaa who r u', :created_at => time += 60\n h['6'] = Hashie::Mash.new :id => '6', :in_reply_to_status_id => '4', :user => { :screen_name => 'aaa', :id => '1'}, :text => '@ddd because i can', :created_at => time += 60\n h['7'] = Hashie::Mash.new :id => '7', :in_reply_to_status_id => '5', :user => { :screen_name => 'aaa', :id => '1'}, :text => '@eee i am who i am', :created_at => time += 60\n h['8'] = Hashie::Mash.new :id => '8', :in_reply_to_status_id => '7', :user => { :screen_name => 'eee', :id => '5'}, :text => '@aaa nice one popeye', :created_at => time += 60\n h['9'] = Hashie::Mash.new :id => '9', :in_reply_to_status_id => '6', :user => { :screen_name => 'ddd', :id => '4'}, :text => '@eee you have that right', :created_at => time += 60\n h['10'] = Hashie::Mash.new :id => '10', :in_reply_to_status_id => '9', :user => { :screen_name => 'fff', :id => '6'}, :text => '@ddd wtf is all this?', :created_at => time += 60\n h\n end",
"title": ""
},
{
"docid": "06ae993ce9da2e4a0a1f7f9c0faab7cf",
"score": "0.5453457",
"text": "def time_histogram(time_bin,object_array)\n binned = Hash.new(0)\n p = Proc.new { |date|\n case time_bin\n when :day_of_month then date.strftime(\"%d\")\n when :day_of_week then date.strftime(\"%A\")\n when :time_of_day then date.strftime(\"%H\")\n else \n nil\n end\n }\n \n object_array.each { |v| \n date = yield v\n if date and bin = p.call(date) \n binned[bin] += 1\n end\n } \n binned\n end",
"title": ""
},
{
"docid": "29bfaf44c88728ede051f56514095370",
"score": "0.5422012",
"text": "def day_of_year(*days)\n merge(yday: days)\n end",
"title": ""
},
{
"docid": "234a78354a06d0f093196e275ef51748",
"score": "0.54156065",
"text": "def kindergarten_participation_by_year\n year = @kindergartners.map { |hash| hash.fetch(:timeframe).to_i }\n data = @kindergartners.map { |hash| hash.fetch(:data) }\n Hash[year.zip(data.map { |num| truncate(num) })]\n end",
"title": ""
},
{
"docid": "d47393d2d969718ed489c5cbe1d29e52",
"score": "0.53898203",
"text": "def search_tweets\n results = []\n client = authenticate\n\n # Search tweets using 'twitter' gem\n client.search('100DaysOfCode -rt Day' + @day.to_s, result_type: 'recent')\n .take(5).each do |tweet|\n results.push(tweet.id)\n end\n\n return results\n end",
"title": ""
},
{
"docid": "2570cdf423c7c10411772729b704edbb",
"score": "0.53643143",
"text": "def generate_ymd_indices\n years = {}\n months = {}\n days = {}\n\n sorted_articles.each do |item|\n time = attribute_to_time(item[:created_at])\n\n years[time.year] ||= []\n years[time.year] << item\n\n months[time.year] ||= {}\n months[time.year][time.month] ||= []\n months[time.year][time.month] << item\n\n days[time.year] ||= {}\n days[time.year][time.month] ||= {}\n days[time.year][time.month][time.day] ||= []\n days[time.year][time.month][time.day] << item\n end\n\n ret = []\n years.each do |year, a_year|\n ret << Nanoc::Item.new(\n '<%= render \\'partials/article_list\\', :articles => @item[:list] %>',\n {\n :title => Date.new(year).strftime(@config[:year]),\n :kind => 'fixed', :extension => 'html', :list => a_year\n },\n Date.new(year).strftime('/%Y/')\n )\n\n months[year].each do |month, a_month|\n ret << Nanoc::Item.new(\n '<%= render \\'partials/article_list\\', :articles => @item[:list] %>',\n {\n :title => Date.new(year, month).strftime(@config[:monthyear]),\n :kind => 'fixed', :extension => 'html', :list => a_month\n },\n Date.new(year, month).strftime('/%Y/%m/')\n )\n\n days[year][month].each do |day, a_day|\n ret << Nanoc::Item.new(\n '<%= render \\'partials/article_list\\', :articles => @item[:list] %>',\n {\n :title => Date.new(year, month, day).strftime(@config[:date]),\n :kind => 'fixed', :extension => 'html', :list => a_day\n },\n Date.new(year, month, day).strftime('/%Y/%m/%d/')\n )\n end\n end\n end\n\n ret\nend",
"title": ""
},
{
"docid": "f73f644739dfdc75bdf5074eddd4e114",
"score": "0.534643",
"text": "def year_metrics(metrics = [])\n metric_hash = {}\n\n metrics.each do |metric|\n if metric_hash[metric[:year]].present?\n metric_hash[metric[:year]] += metric[:metric]\n else\n metric_hash[metric[:year]] = metric[:metric]\n end\n end\n\n metric_hash\n end",
"title": ""
},
{
"docid": "6e95714bb2e134780cf462bc8c32d6f5",
"score": "0.53341866",
"text": "def prep_event(tweet)\n # From the tweet text get date and time\n date = date(tweet.full_text)\n time = time(tweet.full_text)\n {\n place: tweet.place,\n date: date,\n time: time,\n keywords: tweet.full_text,\n username: tweet.username,\n id: tweet.tweet_id\n }\n end",
"title": ""
},
{
"docid": "367815550b1160c2dea1bfa159aac1c1",
"score": "0.5302887",
"text": "def repr_tweet(tweet)\n data = {\n :id => tweet.id,\n :created_at => tweet.created_at,\n :text => tweet.text,\n :user => {\n :id => tweet.user.id,\n :name => tweet.user.name,\n :screen_name => tweet.user.screen_name,\n :utc_offset => tweet.user.utc_offset,\n :created_at => tweet.user.created_at,\n :followers_count => tweet.user.followers_count,\n :friends_count => tweet.user.friends_count\n }\n }\n data[:coordinates] = {\n :coordinates => tweet.geo.coordinates\n } if not tweet.geo.nil?\n data[:place] = {\n :id => tweet.place.id,\n :country_code => tweet.place.country_code\n } if not tweet.place.nil?\n data[:place][:bounding_box] = {\n :coordinates => tweet.place.bounding_box.coordinates\n } if not tweet.place.nil? and not tweet.place.bounding_box.nil?\n data[:retweeted_status] = {\n :id => tweet.retweeted_status.id,\n :created_at => tweet.retweeted_status.created_at,\n :text => tweet.retweeted_status.text,\n :user => {\n :id => tweet.retweeted_status.user.id\n }\n } if not tweet.retweeted_status.nil?\n data[:mentions] = tweet.user_mentions.map do |el|\n {\n :screen_name => el.screen_name,\n :id => el.id\n }\n end if not tweet.user_mentions.nil?\n data[:hashtags] = tweet.hashtags.map {|el| el.text} if not tweet.hashtags.nil?\n return data\nend",
"title": ""
},
{
"docid": "096bf4591b8044c7562bf59ac38cd7cf",
"score": "0.5295675",
"text": "def hash_days_number year\n hash = { 1 => 31, 2 => 28, 3 => 31, 4 => 30, 5 => 31, 6 => 30,\n 7 => 31, 8 => 31, 9 => 30, 10 => 31, 11 => 30, 12 => 31 }\n\n hash[2] = 29 if leap? year\n hash\nend",
"title": ""
},
{
"docid": "d89148d394609d42d07119dd27dd2659",
"score": "0.5281857",
"text": "def yearly_play_chart_data\n self.yearly_play_data.map do |year, times_played|\n {name: year, plays: times_played}\n end\n end",
"title": ""
},
{
"docid": "7078adeaccd7981081964687b2226ea5",
"score": "0.5256162",
"text": "def markov_table(tweets)\n table = {}\n\n tweets.each do |string|\n prefix = [nil] * @prefix_length\n\n string.split.each do |word|\n next if @bad_words.include? word\n\n # Record mentions but don't include in table\n if word.include? '@'\n @mentions << word\n next\n end\n\n this_prefix = prefix.dup\n counts = table.fetch(this_prefix, Hash.new(0))\n counts[word] += 1\n\n table[this_prefix] = counts\n\n prefix.shift\n prefix << word\n end\n\n # End of the tweet, add a terminating nil\n this_prefix = prefix.dup\n counts = table.fetch(this_prefix, Hash.new(0))\n counts[nil] += 1\n table[this_prefix] = counts\n end\n\n # pp table\n table\n end",
"title": ""
},
{
"docid": "ff7ed38f6c763a7d64280cbedc48ec73",
"score": "0.52473277",
"text": "def online_participation_by_year\n year = @online_enrollment.map { |hash| hash.fetch(:timeframe).to_i }\n data = @online_enrollment.map { |hash| hash.fetch(:data) }\n Hash[year.zip(data.map { |num| truncate(num) })]\n end",
"title": ""
},
{
"docid": "837bcf5550b4e680f014c547b5575d70",
"score": "0.5240085",
"text": "def parse_twitter_api_response(tweets)\n tweets = tweets.map do |tweet|\n if tweet.attrs[:retweeted_status] then\n { created_at: tweet.created_at.getlocal.strftime(\"%l:%M%p - %b %e, %Y\"), name: tweet.user.name, body: \"Retweet: \" << CGI.unescapeHTML(tweet.attrs[:retweeted_status][:full_text]), avatar: tweet.user.profile_image_url_https, screen_name: \"@\" + tweet.user.screen_name}\n else\n { created_at: tweet.created_at.getlocal.strftime(\"%l:%M%p - %b %e, %Y\"), name: tweet.user.name, body: CGI.unescapeHTML(tweet.attrs[:full_text]), avatar: tweet.user.profile_image_url_https, screen_name: \"@\" + tweet.user.screen_name }\n end\n end\n\n return tweets\nend",
"title": ""
},
{
"docid": "dced084f68e1f293c4ad74592e16e1da",
"score": "0.5209394",
"text": "def getTweet(tweet,rt)\n\tflds=[]\n\n\trt_original_tweetID=nil\n\tif tweet[\"retweeted_status\"]\n\t\trt_original_tweetID=tweet[\"retweeted_status\"][\"id\"]\n\tend\n\n\ttweetID=tweet[\"id\"]\n\tflds << tweetID\n\tflds << tweet[\"user\"][\"id\"]\n\tif tweet[\"created_at\"]\n\t\tflds << tweet[\"created_at\"]\n\t\tdt=DateTime.parse(tweet[\"created_at\"])\n\t\tflds << dt.strftime(\"%Y%m%d\")\n\t\tflds << dt.strftime(\"%H%M%S\")\n\telse\n\t\tflds << nil\n\t\tflds << nil\n\t\tflds << nil\n\tend\n\tflds << rt\n\tflds << rt_original_tweetID\n\tif $orgText\n\t\tflds << tweet[\"text\"]\n\telse\n\t\tif tweet[\"text\"]\n\t\t\tflds << tweet[\"text\"].gsub(\"\\r\",\"\").gsub(\"\\n\",\"\")\n\t\telse\n\t\t\tflds << nil\n\t\tend\n\tend\n\tif tweet[\"source\"]\n\t\tflds << tweet[\"source\"].gsub(/<a.*?>/,\"\").gsub(/<\\/a.*?>/,\"\")\n\telse\n\t\tflds << nil\n\tend\n\tflds << tweet[\"truncated\"]\n\tflds << tweet[\"in_reply_to_status_id\"]\n\tflds << tweet[\"in_reply_to_user_id\"]\n\tflds << tweet[\"in_reply_to_screen_name\"]\n\tdat=tweet[\"coordinates\"]\n\tif dat\n\t\tflds << dat[0]\n\t\tflds << dat[1]\n\telse\n\t\tflds << nil\n\t\tflds << nil\n\tend\n\tflds << tweet[\"contributors\"]\n\n\t#dat=tweet[\"current_user_retweet\"]\n\t#if dat\n\t#\tflds << dat[\"id\"]\n\t#else\n\t#\tflds << nil\n\t#end\n\n\tflds << tweet[\"avorite_count\"]\n\tflds << tweet[\"favorited\"]\n\tflds << tweet[\"filter_level\"]\n\tflds << tweet[\"lang\"]\n#place\tPlaces\n\tflds << tweet[\"possibly_sensitive\"]\n#scopes\tObject\n\tflds << tweet[\"retweet_count\"]\n\tflds << tweet[\"retweeted\"]\n#\tflds << tweet[\"withheld_copyright\"]\n#withheld_in_countries\tArray of String\n#\tflds << tweet[\"withheld_scope\"]\n\n\n\treturn tweetID,flds\nend",
"title": ""
},
{
"docid": "e7734232d6caae5276118cd407adad18",
"score": "0.5203672",
"text": "def parse_trend_tweets_availible (tweets_availible)\n @tweets = tweets_availible\n @trend_rows = Array.new\n @string_rows = Array.new\n for tweet in @tweets\n @trend_row = Array.new\n @country = tweet[\"country\"]\n @trend_row << @country \n @countrycode = tweet[\"countryCode\"]\n @trend_row << @coun\n @name = tweet[\"name\"]\n @trend_row << @name\n @placetypecodename = tweet[\"placeType\"][\"name\"]\n @trend_row << @placetypecodename\n @placetypecode = tweet[\"placeType\"][\"code\"]\n @trend_row << @placetypecode \n @url = tweet[\"url\"]\n @trend_row << @url\n @woeid = tweet[\"woeid\"]\n @trend_row << @woeid\n @stringrow = @trend_row.join(\"|\")\n @trend_rows << @trend_row \n @string_rows << @stringrow\n end\n @trend_rows\n end",
"title": ""
},
{
"docid": "f59a520c7c66c4c655c6dbf8f61840d1",
"score": "0.51991755",
"text": "def get_data_words_each_week\n \n # Get Current Year\n yearCurrent = Time.now.year\n \n # One entry for each week of the year\n words_per_week = Array.new( 52, 0 )\n \n # Loop through entries and increment totals\n user_entries = Entry.find( :all, :conditions => [\"userid = #{id}\"] )\n \n user_entries.each do |entry|\n if( entry.words.nil? || entry.hours.nil? || entry.minutes.nil? )\n next \n end\n \n if( yearCurrent != entry.starttime.year )\n next\n end\n \n week = entry.starttime.strftime( \"%W\" ).to_i\n puts \"Week: #{week} Time: #{entry.starttime}\"\n \n words_per_week[week] = words_per_week[week] + entry.words\n end\n \n # Assemble Data String\n data_string = \"\"\n \n (0..(words_per_week.length - 1)).each do |i|\n data_string = data_string + words_per_week[i].to_s\n if( i < words_per_week.length - 1 )\n data_string = data_string + \",\"\n end\n end\n \n puts data_string\n return data_string\nend",
"title": ""
},
{
"docid": "0f1a027fe9e9635c4e3cc0c9e2025903",
"score": "0.5188859",
"text": "def initialized_year_hash\n year_in_range = self.startDate.year\n year_hash = {}\n while year_in_range <= self.endDate.year\n year_hash[year_in_range] = BigDecimal(0.0, 10)\n year_in_range += 1\n end\n year_hash\n end",
"title": ""
},
{
"docid": "c22f1331abd0723f48fd879db3f2d3fc",
"score": "0.518218",
"text": "def users_by_day\n\t\thash = Hash.new\n\t\t# SORTING USER_COMMITMENTS BY CREATION DATE TO AN ARRAY\n\t\tsorted_array = self.user_themes.all.sort { |a, b| a.created_at <=> b.created_at }\n\t\t# CREATING A HASH WHERE EACH DATE FROM FIRST UC CONTAINS VALUE OF UCs CREATED\n\t\tsorted_array.each do |each_ut|\n\t\t\tif hash[each_ut.created_at.to_date] == nil\n\t\t\t\thash[each_ut.created_at.to_date] = 0\n\t\t\tend\n\t\t\thash[each_ut.created_at.to_date] += 1\n\t\tend\n\t\tday_count = sorted_array[0].created_at.to_date\n\t\thash[day_count - 1.days] = 0\n\t\t# INCREMENTING WITH PREVIOUS DAY\n\t\twhile (day_count <= Date.today)\n\t\t\tif hash[day_count] != nil\n\t\t\t\thash[day_count] = hash[day_count - 1.days] + hash[day_count]\n\t\t\telse\n\t\t\t\thash[day_count] = hash[day_count - 1.days]\n\t\t\tend\n\t\t\tday_count += 1.days\n\t\tend\n\t\treturn hash\n\tend",
"title": ""
},
{
"docid": "6bbbd1b5256cb6609c35766c1bb45963",
"score": "0.51544625",
"text": "def get_keywords\n tweets = self.get_tweets\n counts = Hash.new(0)\n tweets.each do |tweet|\n tweet.text.downcase.split(/\\s+/).each do |word|\n word.gsub!(/\\p{^Alnum}/,'')\n next if word.size < 1\n counts[word] += 1\n end\n end\n temp_nest_array = (counts.select{ |k, v| v.to_i > 1}).sort_by{ |k, v| -v } # sort by count (descending) on counts of more than one word\n count_hash = Hash.new(0)\n temp_nest_array.each do |k, v|\n count_hash[k] = v\n end\n count_hash\n end",
"title": ""
},
{
"docid": "34f77e54cabd1d42ba55f59fabd3cb32",
"score": "0.5154018",
"text": "def parse_trend_tweets_place (tweets_place)\n @todays_date = get_date\n @tweets = tweets_place\n @trend_rows = Array.new\n @trend_rows_string = Array.new\n @trends = @tweets[0]['trends']\n @as_of = @tweets[0]['as_of']\n @as_of = @as_of.chomp(\"Z\") \n #@as_of = @as_of.gsub(/:/, '-')\n @location = @tweets[0][\"locations\"]\n #@location_name = @location[0][\"name\"]\n @location_woeid = @location[0][\"woeid\"]\n ###dump each record into a csv row\n @trends.each do |trend|\n @tweet_row = Array.new\n @tweet_row << @location_woeid.to_s\n @todays_date = get_date\n @tweet_row << @todays_date.to_s\n @tweet_row << \"1\"\n @tweet_row << @as_of.to_s\n #@tweet_row << @location_name\n @name = trend[\"name\"]\n @url = trend[\"url\"]\n @tweet_row << @name\n @tweet_row << @url\n @trend_rows << @tweet_row\n @stringrow = @tweet_row.join(\"|\")\n @trend_rows_string << @stringrow\n end\n return [ @trend_rows, @trend_rows_string ]\n end",
"title": ""
},
{
"docid": "3de42c33bff8677450f7f06f2c1df243",
"score": "0.5145889",
"text": "def default_tweets\n tweets = [\n { name: \"@xero\", body: sanitize(\"Coffee + Code = Beautiful Accounting #xero #coffee\"), avatar: \"https://pbs.twimg.com/profile_images/490207413933309952/_LiT6IcT_bigger.png\" },\n { name: \"@patnz\", body: sanitize(\"RT @Xero - Coffee + Code = Beautiful Accounting #xero #coffee\"), avatar: \"https://pbs.twimg.com/profile_images/124955173/avatar_bigger.jpg\" }\n ]\nend",
"title": ""
},
{
"docid": "09a4b959c7928dbf2fb91e2200ea70cb",
"score": "0.5143028",
"text": "def facet_by_range(arr)\n interval = Date.current.year - LOWER_BOUND_YEAR\n\n arr.select { |a| a[\"key_as_string\"].to_i <= Date.current.year }[\n 0..interval\n ].\n map do |hsh|\n {\n \"id\" => hsh[\"key_as_string\"],\n \"title\" => hsh[\"key_as_string\"],\n \"count\" => hsh[\"doc_count\"],\n }\n end\n end",
"title": ""
},
{
"docid": "31d0681a4cac48be643cbdc0b1c91b4d",
"score": "0.51408136",
"text": "def date_array(hash)\n array = []\n hash.each do |h|\n temp =[]\n h.each do |key,value|\n if key == \"month\"\n temp << value\n end\n if key == \"day\"\n temp << value\n end\n if key == \"year\"\n temp << value\n end\n end\n array << temp\n end\n return array\n end",
"title": ""
},
{
"docid": "0d688487fcfd755667e06d68dae08d40",
"score": "0.5120087",
"text": "def famous_birthdays # This example is to illustrate what a hash is\n birthdays = {\n 'Ludwig Van Beethoven' => Date.new(1770, 12, 16),\n 'Dave Brubeck' => Date.new(1920, 12, 6),\n 'Buddy Holly' => Date.new(1936, 9, 7),\n 'Keith Richards' => Date.new(1943, 12, 18) \n }\n end",
"title": ""
},
{
"docid": "2ae358f89d57bfa458d3ccb599263e7b",
"score": "0.5110013",
"text": "def collect_words_from_tweets_over_interval(interval)\n word_freq_hash = Hash.new\n word_freq_hash.default = 0\n \n EM.run do\n client = TweetStream::Client.new\n client.sample(language: \"en\") do |status|\n status.text.split.each do |word|\n word_freq_hash[word] += 1 unless @stop_words.include? word.downcase\n end\n end\n\n EM::PeriodicTimer.new(interval * 60) do\n client.stop\n end\n end\n\n return word_freq_hash\n end",
"title": ""
},
{
"docid": "e80362a9e8201a3e1b8d06ca40822d8b",
"score": "0.50918496",
"text": "def extract\n @tweets.each do |tweet|\n sw_filter(tweet.lang)\n .filter(tweet.attrs[:full_text].split.map { |w| w.downcase } )\n .each do |token|\n next unless is_word? token\n @working_space[token] << tweet.user.id\n end\n end\n end",
"title": ""
},
{
"docid": "20126d683e321ac67b24cd02e9687102",
"score": "0.50673753",
"text": "def perform\n tweets = load_tweets\n tweets.each do |t|\n t.hashtags.each do |h|\n Trend.create(hashtags: h.text, created_at: Time.now)\n end\n end\n end",
"title": ""
},
{
"docid": "14ed76b2526f40853600023f59b6318e",
"score": "0.5059078",
"text": "def get_tweet_counts_per_frequency(freq, tweet_name, start_time, end_time)\n case freq\n when \"minute\"\n delta = 60\n when \"hour\"\n delta = 3600\n else\n delta = 86400\n end\n\n t = Hash.new(0)\n if @tweets.key?(tweet_name)\n @tweets[tweet_name].each do |time|\n next if time < start_time || time > end_time\n t[(time - start_time) / delta] += 1\n end\n end\n\n result = []\n (0..((end_time - start_time) / delta)).each do |i|\n result.push(t[i])\n end\n\n result\n end",
"title": ""
},
{
"docid": "fff64209ef08e40f856b2c825baa5e6b",
"score": "0.5047007",
"text": "def birthdays(from_year:, to_year:)\n rows = []\n\n config_hash.characters.each do |chara|\n (from_year..to_year).each do |year|\n date = Date.parse(\"#{year}/#{chara.birthday}\")\n rows << CalendarRow.new(date: date, chara: chara)\n rescue ArgumentError => e\n # NOTE: うるう年以外で2/29をparseしようとするとエラーになるので握りつぶす\n raise unless e.message == \"invalid date\"\n end\n end\n\n rows.sort_by { |row| [row.date, row.chara.name] }\n end",
"title": ""
},
{
"docid": "41f99848a8bebf258f6164bce5eacd03",
"score": "0.5029384",
"text": "def get_tweet_id(day)\n tw = Tweet.new(day)\n tw.search_tweets\n end",
"title": ""
},
{
"docid": "b36487fb06d5a76b9d4aab8ad6217666",
"score": "0.5019566",
"text": "def get_tweets(handle)\n\t\tarray = []\n\n\t\tbegin\n\t\t\t# Pull tweets and arrange as an array for caching and use in the front end\n\t\t\t@@twitter_client.search(\"from:#{handle}\", result_type: \"recent\").take(25).each do |t|\n\n\t\t\t\tcontent = t.text.dup\n\n\t\t\t\t# Linkify the handles by replacing them with links\n\t\t\t\thandles = content.scan(/@([a-z0-9_]+)/i).flatten\n\t\t\t\thandles.each do |h|\n\t\t\t\t\tcontent.gsub!(h, \"<a href='http://twitter.com/#{h}'>#{h}</a>\")\n\t\t\t\tend\n\n\t\t\t\tarray << [t.created_at, content]\n\n\t\t\tend\n\n\t\t# Rate limiting and other errors should be displayed\n\t\trescue Twitter::Error => error\n\t\t\tflash[:error] = error\n\t\tend\n\n\t\t# Return the array of tweets and dates\n\t\tarray\n\tend",
"title": ""
},
{
"docid": "f5ea052ce0f674ff966a92d49347d822",
"score": "0.50101364",
"text": "def get_tweets\n Rails.cache.fetch('stops', :expires_in => 30) {\n results = []\n \n Twitter::Search.new('#gbnyc').from('garrettb').from('jakebellacera').per_page(100).since_date('2010-02-25').fetch().results.each do |result|\n if result.geo.present?\n results << {\n :text => result.text,\n :from_user => result.from_user,\n :created_at => result.created_at,\n :lat => result.geo.coordinates[0],\n :lng => result.geo.coordinates[1]\n }\n end\n end\n \n results\n }\n end",
"title": ""
},
{
"docid": "2329a3d737c3093dcf4611df93dfb073",
"score": "0.49875727",
"text": "def extract_years(dates)\n dates.flat_map{ |date| extract_year(date) }.uniq\n end",
"title": ""
},
{
"docid": "b64a7102e21394d470553cc7095d69dd",
"score": "0.49829766",
"text": "def gen_stats\n object_stats = {}\n object.gen_stats.each do |stat|\n object_stats[stat.as_json['start_year']] = stat.as_json.except('school_id', 'created_at', 'updated_at', 'start_year')\n end\n object_stats\n end",
"title": ""
},
{
"docid": "e37ae23dc83d2d9061af9f8e8e0d41a0",
"score": "0.49674007",
"text": "def get_data_words_every_week\n words_per_day = Array.new( 7, 0 )\n \n # Get current day\n timeNow = Time.now\n time60Days = timeNow - 60 * 24 * 60 * 60\n \n # Loop through entries and increment totals\n user_entries = Entry.find( :all, :conditions => [\"userid = #{id}\"] )\n \n user_entries.each do |entry|\n if( entry.words.nil? || entry.hours.nil? || entry.minutes.nil? )\n next \n end\n \n # Must have occurred in the last 60 days\n if( entry.starttime.time < time60Days )\n next\n end\n \n dayEntry = entry.starttime.wday().to_i\n\n words_per_day[dayEntry] += entry.words\n end\n \n # Assemble Data String\n data_string = \"\"\n \n (0..(words_per_day.length - 1)).each do |i|\n data_string = data_string + words_per_day[i].to_s\n if( i < words_per_day.length - 1 )\n data_string = data_string + \",\"\n end\n end\n \n return data_string\n end",
"title": ""
},
{
"docid": "5422101bc04dd7a2b223d0aabeec62e1",
"score": "0.49653774",
"text": "def build_tweets # rubocop:disable Metrics/MethodLength\n tweet = Tweet.new(@link)\n @tags.each do |tag|\n begin\n tweet.add(tag)\n rescue Tweet::TagTooLong\n @tweets.push tweet\n raise StandardError if \"#{tag} | #{@link}\".length > 140\n tweet = Tweet.new(@link)\n end\n end\n @tweets.push tweet\n end",
"title": ""
},
{
"docid": "cbd233b22953289d6f2721ac26412ff6",
"score": "0.49606347",
"text": "def gather_tweets(trainLine, trainNumber)\n tweets = @client.user_timeline(trainLine, {count: 10})\n array_tweets = Array.new\n\n tweets.each do |tweet|\n if validate_tweet(tweet, trainNumber) && validate_time(tweet)\n array_tweets << tweet.text\n end\n\n end\n array_tweets\n end",
"title": ""
},
{
"docid": "94c94d8c31b8ebf285d2af9cf710bb83",
"score": "0.49554121",
"text": "def list_tweets\n tweets\n end",
"title": ""
},
{
"docid": "9e717e8b0a556035e5a79420289f1312",
"score": "0.49491355",
"text": "def to_term_hash(term_array)\n term_array.inject({ }) { |result_hash, term| result_hash[term.word] = term; result_hash } \n end",
"title": ""
},
{
"docid": "457f3159977a80f23c452ac0d4a6ef68",
"score": "0.49447942",
"text": "def get_data_words_this_week\n words_per_day = Array.new( 7, 0 )\n \n # Get the current day of week\n dateCurrent = DateTime.now\n dayCurrent = dateCurrent.wday().to_i\n \n # Get date at the start of the week\n timeStart = Time.utc( dateCurrent.year, dateCurrent.month, dateCurrent.day )\n timeStart = timeStart - 24 * 60 * 60 * dayCurrent\n \n # Get date at the end of the week\n timeEnd = Time.utc( dateCurrent.year, dateCurrent.month, dateCurrent.day )\n timeEnd = timeEnd + 24 * 60 * 60 * ( 7 - dayCurrent )\n \n # Loop through entries and increment totals\n user_entries = Entry.find( :all, :conditions => [\"userid = #{id}\"] )\n \n user_entries.each do |entry|\n if( entry.words.nil? || entry.hours.nil? || entry.minutes.nil? )\n next \n end\n \n dayEntry = entry.starttime.wday().to_i\n timeEntry = Time.utc( entry.starttime.year, entry.starttime.month, entry.starttime.day, entry.starttime.hour, entry.starttime.min )\n \n if( timeStart.to_i <= timeEntry.to_i && timeEnd.to_i >= timeEntry.to_i )\n words_per_day[dayEntry] += entry.words\n end\n end\n \n # Assemble Data String\n data_string = \"\"\n \n (0..(words_per_day.length - 1)).each do |i|\n data_string = data_string + words_per_day[i].to_s\n if( i < words_per_day.length - 1 )\n data_string = data_string + \",\"\n end\n end\n \n return data_string\n end",
"title": ""
},
{
"docid": "8ab7efe41777f3658f7cabc9c7c7bfbe",
"score": "0.49362072",
"text": "def makeYearList(entries)\n # Find the range of the years\n years = entries.map {|entry| entry.year}\n entriesList = []\n years.max.downto(years.min) { |year|\n yearEntries = matchEntries(entries, \"year\", year)\n next if yearEntries.size == 0\n entriesList << [year, yearEntries]\n }\n entriesList\nend",
"title": ""
},
{
"docid": "3f6468ae8f965492c57ad50c07c127a5",
"score": "0.4927923",
"text": "def index\n @year = params.has_key?(:year) ? params[:year].to_i : 2017\n\n @calendars = (Calendar.where(year_c: @year).order(:date_c).all)\n @hash = Hash.new{ |h, k| h[k] = [] }\n @calendars.each do |s|\n @hash[s.date_c.month] << s\n end\n\n end",
"title": ""
},
{
"docid": "ead33c610efa5e4de4401eab0c4f90c6",
"score": "0.49018642",
"text": "def liked_tweets\n @tweets = self.likes.map { |like| like.tweet }\n end",
"title": ""
},
{
"docid": "3868deb487d7ab152b762b81aa477ccd",
"score": "0.49000987",
"text": "def dates\n\t\t@times = { \n\t\t\t:haiti=>{\n\t\t\t\t:one_week_before=>\tTime.new(2010,01,5),\n\t\t\t\t:event\t\t\t=>\tTime.new(2010,01,12),\n\t\t\t\t:one_week_after\t=>\tTime.new(2010,01,19),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2010,02,12)\n\t\t\t},\n\n\t\t\t:philippines=>{ \n\t\t\t\t:one_week_before=>\tTime.new(2013,11,1),\n\t\t\t\t:event\t\t\t=>\tTime.new(2013,11,8),\n\t\t\t\t:one_week_after\t=>\tTime.new(2013,11,15),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2013,12,8)\n\t\t\t},\n\t\t\t:phil=>{ \n\t\t\t\t:one_week_before=>\tTime.new(2013,11,1),\n\t\t\t\t:event\t\t\t=>\tTime.new(2013,11,8),\n\t\t\t\t:one_week_after\t=>\tTime.new(2013,11,15),\n\t\t\t\t:dw_end\t\t\t=>\tTime.new(2013,12,8)\n\t\t\t}\n\t\t}\n\tend",
"title": ""
},
{
"docid": "d725d1699b039618518799b200d60493",
"score": "0.48950374",
"text": "def get_tweets_from_redis\n\tbegin \n\t\tredis = Redis.new(:host => \"barreleye.redistogo.com\", :port => 9283, :password => \"c67e5bd9e2ce6eda9348ddc07d1859bf\")\n\trescue\n\t\tputs \"Couldnt connect to redis\"\n\tend\n\tall_keys = redis.keys \"*\"\n\t[\"earthquake\",\"harvest1\",\"harvest-packers-falcons\",\"lavsmohan\",\"shishirmk\",\"krishashok\",\"SaketSrivastav\",\"bobsaget\",\"SrBachchan\",\"irteen\",\"warunsl\",\"dens\",\"gartenberg\",\"bhogleharsha\"].each do |uname|\n\t\tall_keys.delete(uname+\"_tweets\")\n\tend\n\n\t#Creating an array of tweet objects\n\ttweets = Array.new\n\tfor key in all_keys\n\t\tkey = \"CNNLive_tweets\"\n\t\tnext if !all_keys.index(\"chosen_\"+key)\n\t\tchosen_key = \"chosen_\"+key\n\t\tlen = redis.llen chosen_key\n\t\tchosen_list = redis.lrange chosen_key,0, len-1\n\n\t\tlen = redis.llen key\n\t\ttweet_list = redis.lrange key,0, len-1\n\t\tputs \"#{key} => #{tweet_list.length}\"\n\t\ttweet_list.each do |t|\n\t\t\ttemp = Tweet.new\n\t \ttemp.username = JSON.parse(t)['user']['screen_name']\n\t \ttemp.language = JSON.parse(t)['user']['lang']\n\t \ttemp.original_tweet = JSON.parse(t)['text']\n\t \ttemp.time = JSON.parse(t)['created_at']\n\t \ttemp.retweet = true if JSON.parse(t)['retweet_count'] != 0\n\t \ttemp.reply = true if JSON.parse(t)['in_reply_to_status_id'] != \"null\"\n\t \ttemp.chosen = true if chosen_list[0].index(temp.original_tweet)\n\t \ttweets << temp\n\t end\n\t break #To do run the code on just one user first\n\tend\nend",
"title": ""
},
{
"docid": "e6f28533e7ffb5669e5da4bddd19f030",
"score": "0.4885786",
"text": "def find_tweets(current_user)\n @screen_name = current_user.authentications[2].to_s\n @another_tweet = self.twitter.user_timeline(@screen_name)\n @tweet = Tweets.new\n @another_tweet.each do |t|\n @tweet.screenname = t.screen_name\n @tweet.text = t.text\n @tweet.created_at = t.created_at\n end\n @tweet.save\n end",
"title": ""
},
{
"docid": "21bfa388cee1ce0d520933ac788ef6bb",
"score": "0.4884559",
"text": "def filter_tweets(screen_names)\n full_timeline(screen_names).each_with_object([]) do |tweet, memo|\n next if tweet.created_at > up_to_time\n memo << tweet if age_of_tweet_in_days(tweet) <= range\n end\n end",
"title": ""
},
{
"docid": "f55ef30f12505e4ba4ff99c9a2bda986",
"score": "0.48788652",
"text": "def this_years_fixtures(fixture_hash)\n current_year = Time.new.year.to_s\n fixture_hash.select {|id, fixture_data| fixture_data[\"event_date\"][0..3] == current_year}\nend",
"title": ""
},
{
"docid": "576853ebe889222dd98a94a36344b57e",
"score": "0.48748037",
"text": "def get_tweet_counts_per_frequency(freq, tweet_name, start_time, end_time)\n \n end",
"title": ""
},
{
"docid": "178c5b1fb34795c2a294ad49ba1136a1",
"score": "0.48746422",
"text": "def index\n @histories = History.where(fandom_id: params[:fandom_id]).order(event_date: :desc)\n \n hash = {}\n @histories.unscope(:order).order(event_date: :asc).each do |history|\n hash[history.event_date.year.to_s.to_sym] = history.event_date.strftime('%F')\n end\n @years_hash = hash.to_a.reverse.to_h\n end",
"title": ""
},
{
"docid": "3a5ee3ebd01736514ddcb6ac78d93c8f",
"score": "0.48581868",
"text": "def todays_auto_tweet_count\n self.twitter_tweets.count\n end",
"title": ""
},
{
"docid": "b416df404e2db7ba07f3808e13b93a49",
"score": "0.48504356",
"text": "def participation_by_year\n year = @pupil_enrollment.map { |hash| hash.fetch(:timeframe).to_i }\n data = @pupil_enrollment.map { |hash| hash.fetch(:data) }\n Hash[year.zip(data.map { |num| truncate(num) })]\n end",
"title": ""
},
{
"docid": "10fb2afa03721da1be44e790d2fc569c",
"score": "0.48488384",
"text": "def print_dates ()\n for date in DATES\n pp \"#{date[1]} Tweets On #{date[0].strftime(\"%Y-%m-%d\")}\"\n end\nend",
"title": ""
},
{
"docid": "b016ca30780107c56402611a681122dd",
"score": "0.48461643",
"text": "def famous_birthdays\n birthdays = {\n 'Ludwig van Beethoven' => Date.new(1770,12,16),\n 'Dave Brubeck' => Date.new(1920,12,6),\n 'Buddy Holly' => Date.new(1936,9,7),\n 'Keith Richards' => Date.new(1943,12,18)\n }\n end",
"title": ""
},
{
"docid": "171bd07a9430ccf616c2fc30afbb8f62",
"score": "0.4845981",
"text": "def tweets\n # cannot write this yet because I can't even test it\n # 1. they keep track of their tweets => []\n # 2. they figure it out\n Tweet.all.select do |tweet| # Tweet instance\n # I am the user asking for my tweets\n # I want to know which tweets are ME (I, my, myself, self)\n tweet.user == self\n # comapre it to the information being held in the tweet\n # specifically, the reference they are holding\n end\n\n # so efficiency => don't think about it\n # refactor, indexes\n end",
"title": ""
},
{
"docid": "20cbebb2a8c9b64d643cb2f4fc058e46",
"score": "0.48459166",
"text": "def years\n use_date = params[:dt] || \"created_at\"\n @age_limit = (params[:years] || \"2\").to_i.years.ago\n date_format = \"'%Y-%m'\"\n @dates = AudioMessage.active\n .where(\"audio_messages.#{use_date} > ?\",@age_limit)\n .group(\"date_format(audio_messages.#{use_date},#{date_format})\")\n .order(\"audio_messages.#{use_date} DESC\")\n .count\n @speakers_by_date = {}\n @dates.keys.each do |date|\n @speakers_by_date[date] =\n generate_speaker_list_with_counts_for_date(date,date_format,use_date)\n end\n # Peek at most recent load date\n @latest_addition_date = AudioMessage.maximum('created_at')\n end",
"title": ""
},
{
"docid": "f2ca27d26e70c7a1f46688e5b4751fa2",
"score": "0.48456365",
"text": "def dt_tm_array_to_hash(arr, tm_detail)\n arr.split(/(\\d+)/)[1..-1].each_slice(2).inject(tm_detail) { |h, i| h[i.last.to_sym] = i.first; h }\n end",
"title": ""
},
{
"docid": "4335d55f8caff50b52c071744609ebf2",
"score": "0.4834066",
"text": "def days_in_year\n return Datet.days_in_year(@t_year)\n end",
"title": ""
},
{
"docid": "44becf00191674e617d4978128482ac8",
"score": "0.48214853",
"text": "def get_attendances_per_event(location_id)\n attendances_per_year_by_loc = ActiveRecord::Base.connection.execute(\"SELECT COUNT(*) as total, extract(year from date) as year FROM events JOIN attendances ON events.id = attendances.event_id WHERE events.location = #{location_id} GROUP BY year ORDER BY year DESC;\")\n attends_by_year = {}\n \n attendances_per_year_by_loc.each do |attends|\n attends_by_year[attends['year']] = attends['total']\n end\n return attends_by_year\n end",
"title": ""
},
{
"docid": "c230e682ccd59867b10e8ed396887cef",
"score": "0.48188862",
"text": "def calendar (holidays, dates)\r\n\t\tif (holidays.length === dates.length)\r\n\t\t\thash = {}\r\n\t\t\t0.upto(holidays.length - 1).each do |index|\r\n\t\t\t\thash[holidays[index]] = dates[index]\r\n\t\t\tend\r\n\r\n\t\t\treturn hash\r\n\t\telse\r\n\t\t\traise \"Array lengths don't match\"\r\n\t\tend\r\n\tend",
"title": ""
},
{
"docid": "30ce5e3281b8e9e362474a6c768625ef",
"score": "0.48174185",
"text": "def create\n \n @tweet = Tweet.new(params[:tweet])\n \n # write stats\n @keywords.each do |word|\n \n if @tweet.text.downcase.include? word then\n \n stat = WordStatistic.where(:word => word, :day => DateTime.now.beginning_of_day..DateTime.now).first\n if stat.nil? then\n new_stat = WordStatistic.new(:word => word, :day => DateTime.now, :freq => 1)\n new_stat.save\n else\n \n stat.freq += 1\n stat.save\n end\n end\n end # keywords\n\n respond_to do |format|\n if @tweet.save\n format.json { render :json => @tweet, :notice => 'Tweet was successfully created.' }\n format.xml { render :xml => @tweet, :status => :created, :location => @tweet }\n else\n format.xml { render :xml => @tweet.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "552ef8ae21a1612b293c1839bda6445d",
"score": "0.48095727",
"text": "def timeline\n timeline = tweets.map { |tweet| tweet }\n all_following.each do |user|\n timeline += user.tweets.map { |tweet| tweet }\n end\n timeline.sort_by!(&:created_at).reverse\n end",
"title": ""
},
{
"docid": "38830b9d536b48cb51b32b5d99314aa9",
"score": "0.48094496",
"text": "def extract_wine_years(html_page)\n years = []\n # Creation of hash for each year, filled with year and url\n html_page.search('#div-all-millesimes > table > tbody > tr').each do |element|\n wine_info = {}\n wine_info[:year] = element.search('.millesime > a').text\n wine_info[:link] = element.search('.millesime > a').attribute('href').value\n years << wine_info\n end\n return years # => array of hashes containing year and url for each year\nend",
"title": ""
},
{
"docid": "2e55a09f99384d05906ba677d5a4c7be",
"score": "0.4805532",
"text": "def parse_tweets\n @tweets.each do |tweet|\n @user[:handle] << tweet[\"user\"][\"screen_name\"]\n unless tweet[\"place\"].nil?\n place = tweet[\"place\"][\"full_name\"]\n else\n place = nil\n end\n\n @user[:features]<<{:type =>\"Feature\",\n :geometry =>{:type=>\"Point\",\n :coordinates =>tweet[\"coordinates\"][\"coordinates\"]},\n :properties =>{:created_at=>tweet[\"created_at\"],\n :text=>tweet[\"text\"],\n :place=>place}}\n end\n end",
"title": ""
},
{
"docid": "f682e31865665e91bb84b90cc76b54b3",
"score": "0.47911966",
"text": "def favorites_by_month \n new_hash = self.favorites.reduce({}) do |favorites_hash, favorite|\n favorites_hash[favorite] = favorite.months_array\n favorites_hash\n end\n end",
"title": ""
},
{
"docid": "5297759a574b7678de4739a2c553f5b6",
"score": "0.47894344",
"text": "def tweets_for state\n\n\t\tsdb = AWS::SimpleDB.new(access_key_id: $aws_access, secret_access_key: $aws_secret)\n\n\t\tdomain = sdb.domains['cspp51050-final']\n\t\tresults = domain.items.where(state: state)\n\n\t\tconvert_sdb_to_objects results\n\t\t\n\tend",
"title": ""
},
{
"docid": "592f15d9a8176304c92b8b6de8839f9c",
"score": "0.47887734",
"text": "def getIncomingTweets\n words = ['Zynga','YouTube','Yahoo','Xbox','Windows','Wikipedia','Twitter','Tumblr','Telecoms','Symbian','Oracle','Spotify','Sony','Smartphones','Skype','Samsung','Reddit','Oracle','Nokia','Nintendo','Acer','Acta','Activision','Blizzard','Adobe','Amazon','Android','AOL','Apple','Asus','Bing','Bitcoin','BitTorrent','BlackBerry','Chatroulette','snapchat','Craigslist','Dell','Digg','ebay','Facebook','Firefox','Flickr','Foursquare','gmail','google','groupon','htc','ibm','Instagram','Intel','iPad','iPadmini','iPhone','ipod','iTunes','Kickstarter','Kindle','KindleFire','Kinect','LinkedIn','Linux','Macworld','Megaupload','Microsoft','Mozilla','Myspace','Congress','Obama','Boehner','EricCantor','Biden','Pelosi','Democrats','Republicans','Cruz','Constitution','Federal','Legislature','Senate','Obamacare', 'Acquisition','AMEX','Amortization','Arbitrage','Bank','Bankrupt','Barter','Bear','Beneficiary','Bond','Broker','Brokerage','Bull','Buying','Buyout','Collateral','Commodity','Credit','Debenture','Debit','Debt','Default','Delinquency','Demand','Depository','Depreciation','Depression','Deregulation','Embezzlement','Federal','Fees','Fiscal','Foreclosure','Lendingrate','Leverage','Liability','Lien','Liquidity','Long-term','Lowrisk','Merger','NYSE','OTC','Recession','Regulation','Securities','Takeover','Underwriter']\n TweetStream::Client.new.on_error do |message|\n puts \"Error: #{message.to_s} \"\n end.track('Zynga','YouTube','Yahoo','Xbox','Windows','Wikipedia','Twitter','Tumblr','Telecoms','Symbian','Oracle','Spotify','Sony','Smartphones','Skype','Samsung','Reddit','Oracle','Nokia','Nintendo','Acer','Acta','Activision','Blizzard','Adobe','Amazon','Android','AOL','Apple','Asus','Bing','Bitcoin','BitTorrent','BlackBerry','Chatroulette','snapchat','Craigslist','Dell','Digg','ebay','Facebook','Firefox','Flickr','Foursquare','gmail','google','groupon','htc','ibm','Instagram','Intel','iPad','iPadmini','iPhone','ipod','iTunes','Kickstarter','Kindle','KindleFire','Kinect','LinkedIn','Linux','Macworld','Megaupload','Microsoft','Mozilla','Myspace','Congress','Obama','Boehner','EricCantor','Biden','Pelosi','Democrats','Republicans','Cruz','Constitution','Federal','Legislature','Senate','Obamacare', 'Acquisition','AMEX','Amortization','Arbitrage','Bank','Bankrupt','Barter','Bear','Beneficiary','Bond','Broker','Brokerage','Bull','Buying','Buyout','Collateral','Commodity','Credit','Debenture','Debit','Debt','Default','Delinquency','Demand','Depository','Depreciation','Depression','Deregulation','Embezzlement','Federal','Fees','Fiscal','Foreclosure','Lendingrate','Leverage','Liability','Lien','Liquidity','Long-term','Lowrisk','Merger','NYSE','OTC','Recession','Regulation','Securities','Takeover','Underwriter') do |status|\n if status.text.language.to_s == \"english\" && !status.retweet?\n if words.any? {|word| status.text.include?(word)}\n prep = @conn.prepare(\"INSERT INTO stream(response) VALUES(?)\")\n prep.execute status.text\n prep.close\n end\n end\n end\n end",
"title": ""
},
{
"docid": "70b3e38b9489af6d7b64c42345d7cc52",
"score": "0.47837028",
"text": "def years() 365 * days end",
"title": ""
},
{
"docid": "2acffffd413dbdb3d757a3c62cf9f72a",
"score": "0.47760662",
"text": "def day_of_year\n count = @t_day\n @@days_in_months.each_index do |key|\n break if key >= @t_month\n val = @@days_in_months[key]\n \n if key == 2 and Datet.gregorian_leap?(@t_year)\n count += 29\n else\n count += val.to_i\n end\n end\n \n return count\n end",
"title": ""
},
{
"docid": "f4bf4a65ecb625976f428803e9c93605",
"score": "0.47752318",
"text": "def day_number_of_the_year day, month, hash \n if month > 1\n for i in 1...month\n day += hash[i]\n end\n end\n day\nend",
"title": ""
},
{
"docid": "0dfa5413171939fc37ab6b7456593a51",
"score": "0.47750884",
"text": "def ticker_analysis_busy_days\n analysis_result = {}\n\n TICKER_SYMBOLS.each do |ticker|\n # Get the data for each ticker symbol\n analysis_result[ticker] = busy_days(ticker)\n end\n\n return analysis_result\n end",
"title": ""
},
{
"docid": "b1090258830e9fe58bc51d50517425db",
"score": "0.47606763",
"text": "def descretize_sensor_data_by_day(sensors)\n data = {}\n sensors.each do |s|\n key = s.created_at.to_date\n data[key] = [] if data[key].nil? \n data[key] << s\n end\n return data\n end",
"title": ""
},
{
"docid": "97754328b676dc352fce98c0fab48566",
"score": "0.47563544",
"text": "def activity_year_fractions_hash(activity)\n year_fractions = {}\n total_activity_days = activity.endDate - activity.startDate # Cannot be zero, by :validDate\n range_start = activity.startDate\n while range_start.year < activity.endDate.year\n range_end = Date.new(range_start.year + 1)\n year_fractions[range_start.year] = ((range_end - range_start) / total_activity_days)\n range_start = range_end\n end\n year_fractions[range_start.year] = ((activity.endDate - range_start) / total_activity_days)\n year_fractions\n end",
"title": ""
},
{
"docid": "df33df9a86cda7a867715cb7cad09812",
"score": "0.47540548",
"text": "def tokenizer_result_row_swimmer_year\n TokenExtractor.new(\n :swimmer_year,\n 36,\n 2\n )\n end",
"title": ""
},
{
"docid": "3834934cce35ff126f83eecfb74b8809",
"score": "0.47390577",
"text": "def hash\n [ticker, company_name, industry_group_number, industry_group_name, fiscal_year_0, fiscal_year_1, fiscal_year_2, company_last_5_year_actual, company_fiscal_year_1_vs_fiscal_year_0, company_fiscal_year_2_vs_fiscal_year_1, company_long_term_growth_mean, company_fiscal_year_1_forward_price_to_earnings, industry_last_5_year_actual, industry_fiscal_year_1_vs_fiscal_year_0, industry_fiscal_year_2_vs_fiscal_year_1, industry_long_term_growth_mean, industry_fiscal_year_1_forward_price_to_earnings, sp500_last_5_year_actual, sp500_fiscal_year_1_vs_fiscal_year_0, sp500_fiscal_year_2_vs_fiscal_year_1, sp500_long_term_growth, sp500_fiscal_year_1_price_to_earnings, company].hash\n end",
"title": ""
},
{
"docid": "c35a3ed3cf41e059496e0637a1885efc",
"score": "0.47265938",
"text": "def record_tweet(tweet_name, time)\n @hash[tweet_name] ||= []\n i = @hash[tweet_name].bsearch_index { |ele| ele >= time } || @hash[tweet_name].size\n @hash[tweet_name].insert(i, time)\n end",
"title": ""
},
{
"docid": "7a53b1bc4de673d426ebf796c8f7bf0d",
"score": "0.47231153",
"text": "def week_of_year(weeks, *extras)\n merge(week: weeks.array_concat(extras))\n end",
"title": ""
},
{
"docid": "6ea269ae0a802833a3d5867aa9d724aa",
"score": "0.47202396",
"text": "def hash\n [day, from, to].hash\n end",
"title": ""
},
{
"docid": "102c13782bdf551c5708b797fcbf5a5e",
"score": "0.47154614",
"text": "def year\n @year = params[:id].to_i\n date_format = \"'%Y'\"\n @speakers = generate_speaker_list_with_counts_for_date(@year,date_format,\"event_date\")\n end",
"title": ""
},
{
"docid": "6011eed9bedb35a7fcd1a45146d9b0a4",
"score": "0.47151688",
"text": "def engagement_data(weather_hash)\r\n weather_hash.keys.map { |key|\r\n data = weather_hash[key]\r\n engagement = Outreacher.determine_engagement(weather: data[:weather], temp: data[:temperature])\r\n {date: key, temperature: data[:temperature], weather: data[:weather], icon: data[:icon], engagement: engagement}\r\n }\r\n end",
"title": ""
},
{
"docid": "435ec528c1685eeca4c199334d4a1818",
"score": "0.47117257",
"text": "def time_entries_for(target_date)\n target_day = Skej::NLP.parse(session, target_date.to_s)\n .strftime('%A')\n .downcase\n .to_sym\n TimeEntry.where(build_query_params).with_day(target_day).map do |entry|\n entry.session = session and entry\n end\n end",
"title": ""
},
{
"docid": "d46725b8d962fd466fb5097558d6d5f0",
"score": "0.47101423",
"text": "def associated_years\n years = \"\"\n \n\t start_date = event_start\n\t start_date = entry_deadline if is_opportunity?\n\t \n years << start_date.year.to_s if !start_date.blank?\n years << ' '\n years << event_finish.year.to_s if !event_finish.blank?\n \n #remove duplicates and trim off spaces\n unique_years = years.strip.split(' ').uniq.sort\n result = unique_years\n if unique_years.length > 1\n result = []\n for y in unique_years[0]..unique_years[1]\n result << y\n end\n end\n result\n #now we have the 2004-2008 case to deal with, we wish to create [2004,2005,...2008]\n \n end",
"title": ""
},
{
"docid": "dfcc98ef5b41edfc46fd01204ed174f9",
"score": "0.47085002",
"text": "def status_tweets\n logger.debug { \"#{__method__} is called twitter_user_id=#{id}\" }\n tweets = []\n tweets = InMemory::StatusTweet.find_by(uid) if InMemory.enabled? && InMemory.cache_alive?(created_at)\n tweets = Efs::StatusTweet.where(uid: uid) if tweets.blank? && Efs::Tweet.cache_alive?(created_at)\n tweets = ::S3::StatusTweet.where(uid: uid) if tweets.blank?\n tweets.map { |tweet| ::TwitterDB::Status.new(uid: uid, screen_name: screen_name, raw_attrs_text: tweet.raw_attrs_text) }\n end",
"title": ""
},
{
"docid": "b9e5f24ac8a4d98b6056ede2ed7877ef",
"score": "0.47049525",
"text": "def week_to_date_map\n week_of_year = Time.new.strftime(\"%V\").to_i\n week_count = week_of_year.modulo(4) + 1\n\n mapping = {}\n for i in 0..3 do\n date = Date.today.beginning_of_week(:monday)\n date += 1 + ((3-date.wday) % 7)\n date += i.week\n mapping[week_count] = date\n week_count += 1\n week_count = 1 if week_count > 4\n end\n\n mapping[0] = 'On Hold'\n mapping[99] = 'Not Yet Set'\n mapping\n end",
"title": ""
},
{
"docid": "28b73f1c8015a560e7b93238db3ce9b7",
"score": "0.47033513",
"text": "def print_timeline(tweets)\n # ADD CODE TO ITERATE THROUGH EACH TWEET AND PRINT ITS TEXT\n tweets.each do |tweet| puts tweet['text'] end\n \n\nend",
"title": ""
},
{
"docid": "b94d89826fa2661ccd3a8cb7509de6d2",
"score": "0.47013938",
"text": "def year_array\n return ['x'] +(@earliest_year..@latest_year).to_a\n end",
"title": ""
},
{
"docid": "020a495c94c5662d517b4446525325d4",
"score": "0.46992472",
"text": "def get_times(hash)\n\ttimes = hash.map { |name, time| time }\nend",
"title": ""
},
{
"docid": "c8be8f08deba0606423f703ac33fec71",
"score": "0.4699132",
"text": "def create_arr_hashes(arr_arrays)\n\thash_keys = arr_arrays.shift.map { |key| key.to_sym }\n\tarr_index = 0\n\tarr_hashes = []\n\tarr_arrays.each do |student|\n\t\t\tstudent_hash = {}\n\t\t\tstudent.each do |value|\n\t\t\t\tstudent_hash[hash_keys[arr_index]] = value\n\t\t\t\tarr_index += 1\n\t\t\t\tend\n\t\t\tstudent_hash[:cohort] = :March\n\t\t\tarr_hashes << student_hash\n\t\t\tarr_index = 0\n\t\t\tend\n\tarr_hashes\nend",
"title": ""
},
{
"docid": "c67a97d335bcfdef834d5dbe9ce61592",
"score": "0.4698106",
"text": "def get_tweet_counts_per_frequency(freq, tweet_name, start_time, end_time)\n s = @hash[tweet_name].bsearch_index { |ele| ele >= start_time }\n arr = (0..(end_time - start_time)/FREQ[freq]).map { 0 }\n return arr if s.nil?\n t = (@hash[tweet_name].bsearch_index { |ele| ele > end_time } || @hash[tweet_name].size) - 1\n return arr if s > t\n @hash[tweet_name][s..t].each do |time|\n tmp = (time - start_time) / FREQ[freq]\n arr[tmp] += 1\n end\n arr\n end",
"title": ""
},
{
"docid": "d558ca81cb6bfc00d25cae01603854dc",
"score": "0.4692333",
"text": "def hash_args\n [@month, @day_of_week] + super\n end",
"title": ""
}
] |
5a2f5288fabc5421d013b0760d3e9deb | I call on the method, say_hello, and give it the string "Richard" | [
{
"docid": "9d8a7849cd87294f6349db145ff480ed",
"score": "0.0",
"text": "def say_hello(name = \"Ruby Programmer\")\n puts \"Hello #{name}!\" \nend",
"title": ""
}
] | [
{
"docid": "8b40998aa991081e06a4faf58ab25750",
"score": "0.8495739",
"text": "def say_hello",
"title": ""
},
{
"docid": "da52d9c31872a16ff60b884227ac1c0d",
"score": "0.8279021",
"text": "def say_hello \n\t\"hello\"\nend",
"title": ""
},
{
"docid": "0be41d4245699a45e6335b1d60825933",
"score": "0.81914306",
"text": "def say_hello\n 'hello'\n end",
"title": ""
},
{
"docid": "0be41d4245699a45e6335b1d60825933",
"score": "0.81914306",
"text": "def say_hello\n 'hello'\n end",
"title": ""
},
{
"docid": "a048ff9558653c445cdd94828eb60a90",
"score": "0.8185373",
"text": "def say_hello\n 'hello'\n end",
"title": ""
},
{
"docid": "6935903d6ac69ae5d538b12e0ea7dbb4",
"score": "0.81345063",
"text": "def say_hello \n \"hello\"\nend",
"title": ""
},
{
"docid": "c83e24f9bd5d1ad9520d845db92e2557",
"score": "0.8085955",
"text": "def say_hello\n \"hello\" \nend",
"title": ""
},
{
"docid": "8918e588fe04f85fd45456458bc823c8",
"score": "0.8031513",
"text": "def say_hello(name)\n \"Hello, \" + name\nend",
"title": ""
},
{
"docid": "b6f7fc32438ee8c43807bfe77cb2bdb6",
"score": "0.8015347",
"text": "def say_hello\n\tputs \"ich bin Benjamin.\"\nend",
"title": ""
},
{
"docid": "fbf446d8f744aa56eeb966467472f222",
"score": "0.8013013",
"text": "def say_hello #method names should be snake case\n puts HELLO_TEXT\n end",
"title": ""
},
{
"docid": "ad6c19b1d016098efcedbc2f5cdff6dd",
"score": "0.7988066",
"text": "def say_hello\n \"hello\"\nend",
"title": ""
},
{
"docid": "ad6c19b1d016098efcedbc2f5cdff6dd",
"score": "0.7988066",
"text": "def say_hello\n \"hello\"\nend",
"title": ""
},
{
"docid": "ad6c19b1d016098efcedbc2f5cdff6dd",
"score": "0.7988066",
"text": "def say_hello\n \"hello\"\nend",
"title": ""
},
{
"docid": "ad6c19b1d016098efcedbc2f5cdff6dd",
"score": "0.7988066",
"text": "def say_hello\n \"hello\"\nend",
"title": ""
},
{
"docid": "ad6c19b1d016098efcedbc2f5cdff6dd",
"score": "0.7988066",
"text": "def say_hello\n \"hello\"\nend",
"title": ""
},
{
"docid": "ad6c19b1d016098efcedbc2f5cdff6dd",
"score": "0.7988066",
"text": "def say_hello\n \"hello\"\nend",
"title": ""
},
{
"docid": "ad6c19b1d016098efcedbc2f5cdff6dd",
"score": "0.7988066",
"text": "def say_hello\n \"hello\"\nend",
"title": ""
},
{
"docid": "5f1488727df390d8cdfd7e1b10bbba79",
"score": "0.7981002",
"text": "def say_hello\n\tname = \"jonathan\"\n\tputs \"hello \" + name + \"!\"\nend",
"title": ""
},
{
"docid": "7230c5243b4e58a6d9fc82c82e9a0464",
"score": "0.79731387",
"text": "def say_hello\n return \"hello\"\n end",
"title": ""
},
{
"docid": "85ee38e9344fb254ef3b562a3d4f89e3",
"score": "0.7952538",
"text": "def say_hello\n \"Hello\"\nend",
"title": ""
},
{
"docid": "82257a5ca5cb496eb0bdfb2d4219cdb9",
"score": "0.7950393",
"text": "def say_hello\n string = \"This is me saying, hello world!\"\n return string\n end",
"title": ""
},
{
"docid": "da2fb12f8c81dc329d48e46f65ea03d0",
"score": "0.79451877",
"text": "def say_hello\n 'hello'\nend",
"title": ""
},
{
"docid": "da2fb12f8c81dc329d48e46f65ea03d0",
"score": "0.79451877",
"text": "def say_hello\n 'hello'\nend",
"title": ""
},
{
"docid": "da2fb12f8c81dc329d48e46f65ea03d0",
"score": "0.79451877",
"text": "def say_hello\n 'hello'\nend",
"title": ""
},
{
"docid": "e6635bc19b0890bce7790c77a4f1ccee",
"score": "0.7939709",
"text": "def say_hello\n 'Hello'\nend",
"title": ""
},
{
"docid": "e6635bc19b0890bce7790c77a4f1ccee",
"score": "0.7939709",
"text": "def say_hello\n 'Hello'\nend",
"title": ""
},
{
"docid": "e6635bc19b0890bce7790c77a4f1ccee",
"score": "0.7939709",
"text": "def say_hello\n 'Hello'\nend",
"title": ""
},
{
"docid": "f299bd32ba6738bb3f8aa505cde4e53c",
"score": "0.7938046",
"text": "def say_hello(phrase)\n puts phrase\nend",
"title": ""
},
{
"docid": "ca792cd8f74bb52336daec154c765f18",
"score": "0.79286313",
"text": "def say_hello(name)\n\tputs \"hello #{name}\"\nend",
"title": ""
},
{
"docid": "a97a881c1d4db2f79cd9f89124f0fcab",
"score": "0.79045963",
"text": "def say_hello_to(name)\n puts \"Hello \" + name\nend",
"title": ""
},
{
"docid": "bfe5643f221c628bc353339bfc38424a",
"score": "0.79030114",
"text": "def say_hello\n puts \"Hello #{@name}\"\n end",
"title": ""
},
{
"docid": "3b8ad0e0d581fcb45466df375a303e74",
"score": "0.7888486",
"text": "def say_hello\n puts \"hello call\"\n end",
"title": ""
},
{
"docid": "386a9bb57636ea56d7e03d83b7a9a58d",
"score": "0.78838164",
"text": "def say_hello(name)\n\tputs \"ich bin #{name}.\"\nend",
"title": ""
},
{
"docid": "e1ccc533aa7f60c8cef26b6c384b2920",
"score": "0.7848363",
"text": "def say_hello(name)\n \"hello #{name}\"\nend",
"title": ""
},
{
"docid": "12ba7969b3ef66f0d0a39606a290f602",
"score": "0.78337204",
"text": "def say_hi\n \"Hi\"\n end",
"title": ""
},
{
"docid": "4a8e6047d48327dd6e308ddff3dcc410",
"score": "0.782972",
"text": "def say_hello(name)\n puts \"Hello \" + name +\"!\"\nend",
"title": ""
},
{
"docid": "c148f3e7c05cf185b7447e2f7292e07d",
"score": "0.7828237",
"text": "def say_hello(name)\nputs \"hello #{name}\"\nend",
"title": ""
},
{
"docid": "645d9dab04f4a9f940ad6df69287533f",
"score": "0.78267795",
"text": "def say_hello\n puts \"#{self.name} says #{self.speak}!\"\n end",
"title": ""
},
{
"docid": "c3d3ab7c546b021c9f1df79f8caf3528",
"score": "0.78200436",
"text": "def say_hi\n \"Hi!\"\n end",
"title": ""
},
{
"docid": "78ed3390c83e8c90a331fea6845a5944",
"score": "0.78121024",
"text": "def say_hello\n first_name = \"Jennifer\"\n puts \"Hi, my name is #{self.name} or #{first_name}\"\n end",
"title": ""
},
{
"docid": "aee3674a6753bd3a70a5c1c3aa4d6b3c",
"score": "0.78004134",
"text": "def say_hello()\n 'hello'\nend",
"title": ""
},
{
"docid": "e0840a1b16d1476ecadbdd1270690d74",
"score": "0.779442",
"text": "def greet\n say_hello + ' ' + say_world\nend",
"title": ""
},
{
"docid": "bfde35890c8aafb9dd4bad323bd65fbb",
"score": "0.7790611",
"text": "def sayhi(name)\n puts (\"Hello \" + name)\nend",
"title": ""
},
{
"docid": "405b57c2f6ca7f48ea75a5393e72ce8f",
"score": "0.77869034",
"text": "def say_hello(name)\nputs \"Hello Kent Beck\"\nend",
"title": ""
},
{
"docid": "63dfbc8650b3ab61f5f0577330d9c7f1",
"score": "0.77866465",
"text": "def say_hello\n puts \"Hi Mike\"\nend",
"title": ""
},
{
"docid": "7d62b97fda03efa56d137412a1e508cf",
"score": "0.77847385",
"text": "def say_hi(name)\n\tputs \"Howdy\" + name\nend",
"title": ""
},
{
"docid": "27ea5ee140a40dcff637ed2cdf97877a",
"score": "0.7784598",
"text": "def say_hello\n\tputs \"ich bin Mike.\"\n\tputs \"ich bin Steven.\"\n\tputs \"ich bin Paul.\"\nend",
"title": ""
},
{
"docid": "01f8b0dfd19a6a47303e495257499591",
"score": "0.7782496",
"text": "def greet\n say_hello + \" \" + say_world\nend",
"title": ""
},
{
"docid": "2dc4cfd5ce94ea36e3bbdcfca1e393b3",
"score": "0.7775965",
"text": "def say_hello(name)\n\tputs \"Hello, #{name}!\"\n\t\nend",
"title": ""
},
{
"docid": "5d5ce46767f42cfe3ea681867491739b",
"score": "0.77726287",
"text": "def say_hello()\n\n\"hello\"\n\nend",
"title": ""
},
{
"docid": "31a87cf2592e180ecea1ea169d773754",
"score": "0.7771785",
"text": "def hello(name)\n # YOUR CODE HERE\n \"Hello, \" + name\nend",
"title": ""
},
{
"docid": "97ab3a24ec807c931dec83cdaf18bca3",
"score": "0.7761869",
"text": "def say_hello\n puts 'hello world'\n end",
"title": ""
},
{
"docid": "a94d895e5f0dd0284834d2b0f5c6a129",
"score": "0.77613264",
"text": "def say_hello(person) # This time we name the method and add a parameter \"person\"\n\tputs \"Hello \" + person + \".\" \nend",
"title": ""
},
{
"docid": "8a452e088d66727f4475faf63062ac39",
"score": "0.77612287",
"text": "def hello(name)\n\treturn 'Hello, ' + name\nend",
"title": ""
},
{
"docid": "792ed0043fc439fd73510cd9ceb476d7",
"score": "0.77601033",
"text": "def say_hello\n me = \"Chris P. Bacon\"\n puts \"hello from #{me}\"\nend",
"title": ""
},
{
"docid": "e8dad2e06af489ad59d1840d402cdc54",
"score": "0.7758844",
"text": "def says_hello \n puts \"Bonjour, first_name !\"\nend",
"title": ""
},
{
"docid": "37d2f5ca8bfcd26b53c10d8aeb4c6332",
"score": "0.7747752",
"text": "def hello(name)\n # YOUR CODE HERE\n \"Hello, \" + name\nend",
"title": ""
},
{
"docid": "37d2f5ca8bfcd26b53c10d8aeb4c6332",
"score": "0.7747752",
"text": "def hello(name)\n # YOUR CODE HERE\n \"Hello, \" + name\nend",
"title": ""
},
{
"docid": "b79ff082c6a3a3126198d17179fac2a2",
"score": "0.77385455",
"text": "def say_hello()\n\tputs (\"Hello\")\nend",
"title": ""
},
{
"docid": "cd00b43718b4cabfed5456c3931fb3dd",
"score": "0.77343065",
"text": "def say_hello(first_name)\n\t\tputs \"Bonjour, \" + first_name\n\tend",
"title": ""
},
{
"docid": "a176b505c21880d94bdfc08f9d774d2b",
"score": "0.7731073",
"text": "def say_hello(name)\n puts \"hello #{name}\"\nend",
"title": ""
},
{
"docid": "26805be3e1b88cae178b08d758c0a439",
"score": "0.7730766",
"text": "def say_hello(message)\n # write code here\n puts message\nend",
"title": ""
},
{
"docid": "36021d9ba9ddeccb91636751996bfd7a",
"score": "0.77252984",
"text": "def hello_method\n\t'Hello'\nend",
"title": ""
},
{
"docid": "86db0e408d9b03a31f4fd0ab8aa10231",
"score": "0.7722188",
"text": "def say_hello(first_name)\n\tputs \"Hello #{first_name}!\"\nend",
"title": ""
},
{
"docid": "f5fecab345b01f684ea9fc2a6c0742cb",
"score": "0.77199334",
"text": "def say\n\t\tputs \"#{@hello} #{@world}!\" \n\tend",
"title": ""
},
{
"docid": "aad6292990d86255a1d644003e15f1fe",
"score": "0.7713891",
"text": "def say_hello(person)\n puts \"hello \" + person + \".\"\nend",
"title": ""
},
{
"docid": "d9d449f92c440505fa7695d66d30bd92",
"score": "0.77131486",
"text": "def say_hello\n return \"hello\"\nend",
"title": ""
},
{
"docid": "d9d449f92c440505fa7695d66d30bd92",
"score": "0.77131486",
"text": "def say_hello\n return \"hello\"\nend",
"title": ""
},
{
"docid": "d9d449f92c440505fa7695d66d30bd92",
"score": "0.77131486",
"text": "def say_hello\n return \"hello\"\nend",
"title": ""
},
{
"docid": "30c141641aec679aa52feb0d4418afae",
"score": "0.7708379",
"text": "def say_hello(name)\n puts \"Why, hello there \" + name + \"!\"\nend",
"title": ""
},
{
"docid": "78a4945ece2804f1478d429aa74c6a5a",
"score": "0.76993734",
"text": "def say_hello\n message = \"hello\"\n p message\nend",
"title": ""
},
{
"docid": "78a4945ece2804f1478d429aa74c6a5a",
"score": "0.76993734",
"text": "def say_hello\n message = \"hello\"\n p message\nend",
"title": ""
},
{
"docid": "c6697689b16f5cd7f97b24e695bd943f",
"score": "0.76943916",
"text": "def hello(name)\r\n\t\"Hello, \" + name\r\nend",
"title": ""
},
{
"docid": "fdb556a71e44708a566da2950989fffb",
"score": "0.76913565",
"text": "def greets_hello(name)\n\treturn \"Hello, \"+ name +\"!\"\nend",
"title": ""
},
{
"docid": "f6595558c07f226721f1df9dc58ff894",
"score": "0.7685374",
"text": "def say_hello_to(name)\n puts \"Hello #{name}\"\nend",
"title": ""
},
{
"docid": "ac590a1870959bbb95ad4922fca324fc",
"score": "0.76831055",
"text": "def say_hello_to(name)\n puts \"Hello There #{name}!\"\nend",
"title": ""
},
{
"docid": "54254cd87a38eae3bc5d4b77efd52b09",
"score": "0.76824605",
"text": "def say_hello\n return 'hello'\nend",
"title": ""
},
{
"docid": "54254cd87a38eae3bc5d4b77efd52b09",
"score": "0.76824605",
"text": "def say_hello\n return 'hello'\nend",
"title": ""
},
{
"docid": "834690c04691f42904137597695edcea",
"score": "0.7680063",
"text": "def hello(name)\r\n\t# YOUR CODE HERE\r\n\treturn \"Hello, \" + name\r\nend",
"title": ""
},
{
"docid": "e2832d0d0700c23e82e0468a699dcca7",
"score": "0.7678632",
"text": "def say_hi(name)\r\n \"Yo long time no see, #{name}!!!\"\r\nend",
"title": ""
},
{
"docid": "e2832d0d0700c23e82e0468a699dcca7",
"score": "0.7678632",
"text": "def say_hi(name)\r\n \"Yo long time no see, #{name}!!!\"\r\nend",
"title": ""
},
{
"docid": "fb9f2a38180e6921dcd286cb5b157a97",
"score": "0.7670006",
"text": "def say_hello(name)\n puts \"Hello, #{name}!\"\n end",
"title": ""
},
{
"docid": "9b666ebef2b3b088fc38a52bf4a354b2",
"score": "0.76683056",
"text": "def sayHelloWithName(name)\n puts \"hello \"+name\nend",
"title": ""
},
{
"docid": "1b5c790977e3af47f3c31feb277dda47",
"score": "0.7664519",
"text": "def say_hi_to(name)\n puts \"Hello #{name}\"\n end",
"title": ""
},
{
"docid": "be11ec9c3a4b6a1ecef33c7791da7106",
"score": "0.7663598",
"text": "def hello(name)\n return \"Hello, \"+ name\nend",
"title": ""
},
{
"docid": "50f283db0ebadf3e4fbd586adf87fa6a",
"score": "0.766313",
"text": "def hello(name)\n return \"Hello, \"+name\nend",
"title": ""
},
{
"docid": "e4893b6c90a957177f97508e7013ee9a",
"score": "0.7656101",
"text": "def hello(name)\n\treturn \"Hello #{name}\"\nend",
"title": ""
},
{
"docid": "6a416df97ea3d1841afefeca8dc99952",
"score": "0.76548976",
"text": "def say_hi\n \"hi\"\nend",
"title": ""
},
{
"docid": "6a416df97ea3d1841afefeca8dc99952",
"score": "0.76548976",
"text": "def say_hi\n \"hi\"\nend",
"title": ""
},
{
"docid": "2241570c368bf5c41e1d4c5b85442168",
"score": "0.76514506",
"text": "def say_hello_to(name)\n puts \"Hello, #{name}\"\nend",
"title": ""
},
{
"docid": "60f99c58090eeb6297b251bdd230223c",
"score": "0.7650955",
"text": "def hello(name)\r\n return 'Hello, ' + name\r\nend",
"title": ""
},
{
"docid": "473f0c79d4648a38d73aa12e9b95a93e",
"score": "0.764852",
"text": "def say_hello(name)\n puts \"Hola #{name}\"\nend",
"title": ""
},
{
"docid": "3094d45eb2eff2f32854db280b8c689f",
"score": "0.76435536",
"text": "def say_hi(name)\n \"Hi, #{name}\"\nend",
"title": ""
},
{
"docid": "1973f37d36fd183a1daf2f669c258092",
"score": "0.7643355",
"text": "def say_hi(name)\n name\nend",
"title": ""
},
{
"docid": "edeb2dbed486f3843c5a31406ce6eccc",
"score": "0.7642793",
"text": "def hello_method\r\n \"Hello \"\r\nend",
"title": ""
},
{
"docid": "9a2fe29b09a581609d3f2b7fda47abeb",
"score": "0.7640559",
"text": "def greeter(name)\r\n return \"Hello \" + name\r\nend",
"title": ""
},
{
"docid": "5ecf6d4898b8b4517d3863f5dc1b1b9d",
"score": "0.76402396",
"text": "def say_hello(name)\n puts \"Hello #{name}\"\nend",
"title": ""
},
{
"docid": "de6a255dbc5e083325010ce2f33b0a58",
"score": "0.76372254",
"text": "def sayhi(name)\n puts (\"Hello #{name}\")\n end",
"title": ""
},
{
"docid": "996e9ffd4b05fbccdeee27372cab484c",
"score": "0.7636709",
"text": "def say_hello(name)\n puts \"Hi #{name}\"\nend",
"title": ""
},
{
"docid": "9348f20397b0821b08f45502ac7c59ec",
"score": "0.7635429",
"text": "def say_hello\r\n\tputs \"HODOR!\"\r\nend",
"title": ""
},
{
"docid": "af00a033e3e21dc176acd4318ff424eb",
"score": "0.7630301",
"text": "def hello(name)\n \"Hello, \"+ name\nend",
"title": ""
}
] |
5d9ca798894382a9ef9cdf7b40c7cf44 | Overwrite Server Initializer to add file_hash | [
{
"docid": "b79213dbd0778fbc113fbd8fcfd75a51",
"score": "0.0",
"text": "def initialize(options)\n super(options)\n @server_files = hash_files\n @routes = {}\n controller_names = read_and_load_controllers\n @controllers = create_controller_hash(controller_names)\n if File.exists?(\"./routes.rb\")\n @routes = eval(File.read(\"./routes.rb\"))\n end\n end",
"title": ""
}
] | [
{
"docid": "a56ff259f63690f6186ec4778a45861a",
"score": "0.70438594",
"text": "def initialize\n @server_files = {}\n end",
"title": ""
},
{
"docid": "948022ab5a7718b070f1d2df1dbb3338",
"score": "0.63575095",
"text": "def file_hash=(value)\n @file_hash = value\n end",
"title": ""
},
{
"docid": "66fcb809cbf8b7e1e7bb33f4c059932e",
"score": "0.618435",
"text": "def public_file_server=(_arg0); end",
"title": ""
},
{
"docid": "b9301d57ca368f72b619e1e230d79e6d",
"score": "0.61043364",
"text": "def initialize(file = DEFAULTS['cf'])\n @everything = YAML.load(ERB.new(IO.read(abs_config_file_path(file))).result)\n raise \"malformed ferret server config\" unless @everything.is_a?(Hash)\n @config = DEFAULTS.merge(@everything[Rails.env] || {})\n if @everything[Rails.env]\n @config['uri'] = socket.nil? ? \"druby://#{host}:#{port}\" : \"drbunix:#{socket}\"\n end\n end",
"title": ""
},
{
"docid": "b9301d57ca368f72b619e1e230d79e6d",
"score": "0.61043364",
"text": "def initialize(file = DEFAULTS['cf'])\n @everything = YAML.load(ERB.new(IO.read(abs_config_file_path(file))).result)\n raise \"malformed ferret server config\" unless @everything.is_a?(Hash)\n @config = DEFAULTS.merge(@everything[Rails.env] || {})\n if @everything[Rails.env]\n @config['uri'] = socket.nil? ? \"druby://#{host}:#{port}\" : \"drbunix:#{socket}\"\n end\n end",
"title": ""
},
{
"docid": "c4cb83eed39527a85ca05ec9a443c964",
"score": "0.6079746",
"text": "def file_server root = nil, opts = {}, &proc\n if root && configurable?\n opts[:cache_control] ||= 'max-age=3600, must-revalidate'\n @file_server = {root: root, opts: opts, proc: proc}\n end\n @file_server\n end",
"title": ""
},
{
"docid": "17ac89acb8492f36ac4c685001da36c1",
"score": "0.60160154",
"text": "def initialize_config_file\n @config = HashWithIndifferentAccess.new\n write_config_file\n end",
"title": ""
},
{
"docid": "858448c997f86f1011a21c749c62ee19",
"score": "0.5987232",
"text": "def initialize(file, hash = nil)\n @file = file\n super(hash)\n end",
"title": ""
},
{
"docid": "82e4ecb0b9b604538b5a969276204cf3",
"score": "0.5906911",
"text": "def initialize_update\n @file = File.new(filename, 'rb+')\n pos = @file.pos = @file.read(POINTER_SIZE).unpack1(UNPACK_METHOD)\n @hash = Marshal.load(@file)\n @file.pos = pos\n end",
"title": ""
},
{
"docid": "da0f1fbfa28fcbf69f4fa8f1912a5473",
"score": "0.5860149",
"text": "def set_file_hash\n self.file_hash = if File.size(file_path) < 6.megabytes\n # File is too small to seek to 5MB, so hash the whole thing\n Digest::MD5.hexdigest(IO.binread(file_path))\n else\n Digest::MD5.hexdigest(File.open(file_path, 'rb') do |f|\n f.seek(5.megabytes) && f.read(1.megabyte)\n end)\n end\n end",
"title": ""
},
{
"docid": "695a77777132697f4127d9a8bf0cd622",
"score": "0.58404845",
"text": "def initialize(file_or_hash, extended = {})\n @options = file_or_hash.kind_of?(Hash) ? file_or_hash : load_file(file_or_hash)\n @options.merge!(extended)\n @options[:pid_file] ||= File.join(ROOT,'updater.pid')\n @options[:host] ||= \"localhost\"\n @logger = @options[:logger] || Logger.new(@options[:log_file] || STDOUT)\n level = Logger::SEV_LABEL.index(@options[:log_level].upcase) if @options[:log_level]\n @logger.level = level || Logger::WARN unless @options[:logger] #only set this if we were not handed a logger\n @logger.debug \"Debugging output enabled\" unless @options[:logger]\n Update.logger = @logger\n end",
"title": ""
},
{
"docid": "0eb05993cca3470785641410b49d8818",
"score": "0.5797694",
"text": "def initialize()\n @redis_ip = redis_ip\n @redis_password = redis_password\n @verbose = verbose\n @file_path = file_path\n @file_type_flag = file_type_flag\n @keystore = keystore\n @skip_first_line = skip_first_line\n end",
"title": ""
},
{
"docid": "b2f7eba514dbef1333a22d3c2657c5f5",
"score": "0.5779649",
"text": "def initialize(file=nil)\n\t\tself.stathash = convert(client.sftp.stat!(client.fs.realpath(file))) if file \n\tend",
"title": ""
},
{
"docid": "a31b1f889092888987b4590f32a79ead",
"score": "0.5743541",
"text": "def initialize cache_file_path, hash_type = Hash, options = {}\n @cache_file_path = cache_file_path\n @hash_type = hash_type\n @empty = options[:empty]\n @initial = options[:initial]\n end",
"title": ""
},
{
"docid": "7a90e999582dc21f74ea241270a82f05",
"score": "0.573812",
"text": "def init_file; end",
"title": ""
},
{
"docid": "7a90e999582dc21f74ea241270a82f05",
"score": "0.573812",
"text": "def init_file; end",
"title": ""
},
{
"docid": "0a8072003e4d2df2513a87a825ed92e6",
"score": "0.57353777",
"text": "def initialize(name:, path:, created_at:, updated_at:, hash:, mime_type:, size:)\n super(\n name: name,\n path: path,\n type: 'file',\n created_at: created_at,\n updated_at: updated_at\n )\n @hash = hash\n @mime_type = mime_type\n @size = size\n end",
"title": ""
},
{
"docid": "fdee44fc2399a66f004e735583f2cca9",
"score": "0.570942",
"text": "def initialize(config_file)\n @server_conf_vec = parse_config(config_file)\n end",
"title": ""
},
{
"docid": "60558dcdfc1eb7b8cf6035b84662bf84",
"score": "0.57086617",
"text": "def initialize\n @digest = Digest::SHA512\n @perform_request_signing = true\n @her_auto_configure = true\n end",
"title": ""
},
{
"docid": "28c951299ba6dcd137fa55e7c62d7c58",
"score": "0.5707464",
"text": "def public_file_server; end",
"title": ""
},
{
"docid": "6193d1fd7983a90cbbb27c6249bac981",
"score": "0.5695132",
"text": "def record_hash(filename, hash)\n # Intentionally left blank.\n end",
"title": ""
},
{
"docid": "9c4b697959ad417616fc071f0a6feead",
"score": "0.56769675",
"text": "def hash\n super +\n @file.hash\n end",
"title": ""
},
{
"docid": "9c4b697959ad417616fc071f0a6feead",
"score": "0.56769675",
"text": "def hash\n super +\n @file.hash\n end",
"title": ""
},
{
"docid": "37b697ae448c31600d6c9997b3c63620",
"score": "0.5606465",
"text": "def hash\n super +\n @authorized_keys.hash +\n @files.hash +\n @host.hash +\n @network_configuration.hash +\n @regenerate_ssh_keys.hash +\n @timezone.hash +\n @users.hash\n end",
"title": ""
},
{
"docid": "f78fbe368b7d7bd408c6d1ea680f42b0",
"score": "0.56004864",
"text": "def file_hashes=(value)\n @file_hashes = value\n end",
"title": ""
},
{
"docid": "6e9b300fa92c15725428f37f693cea34",
"score": "0.5595239",
"text": "def serverInit(metainfo, addr, port)\n end",
"title": ""
},
{
"docid": "78bbcc9356108b1d7f0457ce054c7d9f",
"score": "0.55536854",
"text": "def hash_file\n\t\t\treturn @hash_file ||= Pathname.new(@@config.hash_dir).join(name).to_s\n\t\tend",
"title": ""
},
{
"docid": "3d524d01e46e36bfb1e25545f74d33e0",
"score": "0.5549684",
"text": "def initialize(private_key: nil, private_key_file: nil, server_key: nil, server_key_file: nil)\n @server_key = server_key\n @private_key = private_key\n # Load Service RSA private key\n if private_key_file and (File.file?(private_key_file))\n @private_key = open private_key_file, 'r' do |io|\n io.read\n end\n end\n # Load Server RSA public key\n if server_key_file and (File.file?(server_key_file))\n @server_key = open server_key_file, 'r' do |io|\n io.read\n end\n end\n @crypto = Crypto.new(@private_key, @server_key)\n @api_url = HOST\n @is_ssl_verify = true\n if @server_key\n @public_hash = Crypto.sha512(@server_key)\n end\n end",
"title": ""
},
{
"docid": "2a754bb5ba61feafb1ec8da4cd5dafc3",
"score": "0.5541716",
"text": "def update_file_hash\n self.file_hash_type = \"sha1\"\n new_hash = FileStorage.backend.file_hash(self.locator)\n unless self.file_hash.blank?\n if self.file_hash != new_hash\n raise HashMatchFailure.new(self.file_hash, new_hash)\n end\n end\n self.file_hash = new_hash\n end",
"title": ""
},
{
"docid": "159e859c290782fd4defeeb8f81104c4",
"score": "0.5539213",
"text": "def initialize_server\n\tend",
"title": ""
},
{
"docid": "159e859c290782fd4defeeb8f81104c4",
"score": "0.5539213",
"text": "def initialize_server\n\tend",
"title": ""
},
{
"docid": "7908d727b7ed8d4990a764ffdfdcaa2e",
"score": "0.5526647",
"text": "def initialize\n @config_file_path = config_file_path\n end",
"title": ""
},
{
"docid": "eb2e83b1c2c481393059771c321a6f4b",
"score": "0.5525676",
"text": "def initialize(app_path:, file_name: 'server_config', port:)\n @file_name = file_name\n @app_path = app_path\n @port = port\n end",
"title": ""
},
{
"docid": "3ae60ba98db0ae7281c420e41c3a2e40",
"score": "0.55241597",
"text": "def add_hash_for_file filename, hash\n @client.query \"INSERT INTO #{@config['abc_file_hashes_table']} (filename, hash) VALUES ('#{filename}', '#{hash}')\"\n end",
"title": ""
},
{
"docid": "1cbc102313b6abf06e434ac40abdee1b",
"score": "0.55021536",
"text": "def initialize\n @server = Monsove.config.server\n @username = Monsove.config.username\n @ssh_key = Monsove.config.ssh_key\n end",
"title": ""
},
{
"docid": "8bd56790bdc26f7925518e1882701069",
"score": "0.54999137",
"text": "def files\n config[FILES_KEY] = Utils.hashify(config[FILES_KEY])\n end",
"title": ""
},
{
"docid": "79d0e01cc9cba3dafc1e5553bf2395eb",
"score": "0.54886675",
"text": "def initialize(file_path)\n @file_path = file_path\n @user_data = Array.new\n @invited_users = Array.new\n @response = Hash.new\n end",
"title": ""
},
{
"docid": "562990f5d5f90e673c5eb97842ede8bc",
"score": "0.5473231",
"text": "def set_file_attr\n set_version\n set_timezone\n set_len_and_net\n end",
"title": ""
},
{
"docid": "b7998f8d9cbdda75f8b7296d207db505",
"score": "0.54553056",
"text": "def mount_extra(http_server)\n end",
"title": ""
},
{
"docid": "cb8c8b7103c17f5894b5a57c2dda2346",
"score": "0.545119",
"text": "def initfile\n if (content = @server.request_http(:get, '/initfile')) == \"No initfile defined.\"\n content = nil\n end\n content\n end",
"title": ""
},
{
"docid": "0768057d9af3e5074787e49d02035d95",
"score": "0.5450542",
"text": "def file_hash(file_path)\r\n\r\n @digest.reset\r\n @base_str = nil\r\n @digest.file(file_path).to_s\r\n end",
"title": ""
},
{
"docid": "b801467e660aca245f77691b3d5d4281",
"score": "0.54466236",
"text": "def initialize(file)\n @users = {}\n @hash_val = {}\n @error_code = 0\n @file = file\n end",
"title": ""
},
{
"docid": "21ef17be3ae8725a7ecacf55f4ac7975",
"score": "0.54399574",
"text": "def initialize(options = {})\n @options = options.stringify_keys.reverse_merge(\n 'path' => DEFAULT_PATH, \n 'blocks_count' => DEFAULT_BLOCKS_COUNT)\n initialize_file\n end",
"title": ""
},
{
"docid": "122c6e18a8c89336d31d52f4830a2063",
"score": "0.5422859",
"text": "def initialize(bot)\n super # But before let cinch init the plugin :D\n\n @servers = YAML.load_file(ROOT_DIR + '/conf/ServerSharing.yaml')\n @settings = YAML.load_file(ROOT_DIR + '/conf/ServerSharing.settings.yaml')\n end",
"title": ""
},
{
"docid": "e5ee4c4ed5699f016a81062ed3466da1",
"score": "0.54201186",
"text": "def initialize(options)\n @options = options.dup\n @sha1 = options[:sha1].strip\n dalli_params = { sha1: sha1, request: 'sha1s'}\n unless (@shipped_files = cache.read(dalli_params))\n @shipped_files = model.find(:all,\n conditions: { aix_file_sha1: @sha1})\n # Need to do something with rc\n rc = cache.write(dalli_params, @shipped_files)\n end\n end",
"title": ""
},
{
"docid": "2e474c9591d78cb2b4fe32a7f38cd27d",
"score": "0.5404448",
"text": "def hash\n super +\n @address.hash +\n @gluster_volume.hash +\n @host.hash +\n @mount_options.hash +\n @nfs_retrans.hash +\n @nfs_timeo.hash +\n @nfs_version.hash +\n @password.hash +\n @path.hash +\n @port.hash +\n @portal.hash +\n @target.hash +\n @type.hash +\n @username.hash +\n @vfs_type.hash\n end",
"title": ""
},
{
"docid": "e864b0c158b3fae6d18d12e7b596f687",
"score": "0.5388267",
"text": "def initialize(full_path, hash)\n @hash = hash\n super(full_path)\n end",
"title": ""
},
{
"docid": "64a6f39b03709a71b256719f76980d69",
"score": "0.5376921",
"text": "def initialize(method, filepath)\n if (method.upcase == \"-SHA1\")\n @hashfunc = Digest::SHA1.new\n @hashname = \"SHA1\"\n else\n @hashfunc = Digest::MD5.new\n @hashname = \"MD5\"\n end\n @fullfilename = filepath\n end",
"title": ""
},
{
"docid": "2d1e26ebe7e6e2b56d4aa42aea0f031d",
"score": "0.5369575",
"text": "def initialize(path_or_stream, encryption_key = nil)\n encryption_key = ENV['SECRET_KEYS_ENCRYPTION_KEY'] if encryption_key.nil? || encryption_key.empty?\n update_secret(key: encryption_key)\n path_or_stream = Pathname.new(path_or_stream) if path_or_stream.is_a?(String)\n load_secrets!(path_or_stream)\n # if no salt exists, create one.\n update_secret(salt: SecureRandom.hex(8)) if @salt.nil?\n super(@values)\n end",
"title": ""
},
{
"docid": "ef6c233b64f4e58dcbd3a2849a025374",
"score": "0.5356783",
"text": "def initialize(&block)\n super\n\n @base64 ||= false\n @salt ||= true\n @password_file ||= nil\n\n instance_eval(&block) if block_given?\n end",
"title": ""
},
{
"docid": "a46174e1b857d73099fdc0feb70f644a",
"score": "0.5356519",
"text": "def add_init_file(config)\n if config.init_contents\n contents = ''\n config.init_contents.each do |file|\n if file.respond_to?(:read)\n contents << file.read\n elsif File.extname(file) == '.erb'\n contents << expand_erb(file, config).read\n else\n contents << File.read(file)\n end\n end\n @files[config.init_filename] = StringIO.new(contents)\n end\n end",
"title": ""
},
{
"docid": "2df1efae86ec376c52ac07f8ad03c6c5",
"score": "0.53517556",
"text": "def file_hash(file_id)\n # OpenSSL::Digest::SHA1.new(get_file(file_id)).to_s\n FileStorage.log.info \"Base backend getting file hash for #{file_id}\"\n digest = OpenSSL::Digest::SHA1.new\n callback_to_write_proc(file_id, Proc.new do |to_write|\n digest << to_write\n end)\n digest.to_s\n end",
"title": ""
},
{
"docid": "628f9ea693f0d0e5365663486c9c2c9f",
"score": "0.53468925",
"text": "def setup_client_config(config_hash)\n # Only Volt.config.public is passed from the server (for security reasons)\n @config = wrap_config(public: config_hash)\n end",
"title": ""
},
{
"docid": "25b0ffc546c287a9eea65f2fb7191d15",
"score": "0.5344152",
"text": "def create_update_hash(uuid, file_hash, status)\n {\n uuid:,\n file_hash:,\n status:\n }\n end",
"title": ""
},
{
"docid": "5410d3ee3df0e226ca1381c4188cfd47",
"score": "0.53393626",
"text": "def initialize(hash)\n hash = hash.with_indifferent_access\n super Base64.decode64(hash[:base64])\n\n @original_filename = hash[:filename]\n @content_type = hash[:content_type]\n end",
"title": ""
},
{
"docid": "777fbce91b37c422f735b5f896e6ccdc",
"score": "0.5339159",
"text": "def initialize(hash, client)\n super(hash, client)\n end",
"title": ""
},
{
"docid": "777fbce91b37c422f735b5f896e6ccdc",
"score": "0.53387994",
"text": "def initialize(hash, client)\n super(hash, client)\n end",
"title": ""
},
{
"docid": "575bb02607c721cfae77c9a54ee5e5e1",
"score": "0.53339535",
"text": "def initialize(file_name, stream = T.unsafe(nil), encrypter = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "255a58f6e16ff87463bce5bce0941708",
"score": "0.53297985",
"text": "def initialize(iPassword, iSalt, oFile)\n @Password, @Salt, @File = iPassword, iSalt, oFile\n @Buffer = ''\n end",
"title": ""
},
{
"docid": "0fdf0682115c3153fc505286a91a5296",
"score": "0.5324549",
"text": "def initialize(*params)\n super\n params = params[0]\n\n if params[:filename]\n self.filename = ::File.absolute_path params[:filename]\n stats = ::File.stat self.filename\n %w{mtime ftype size}.each do |w|\n eval \"self.#{w} = stats.#{w}\"\n end\n end\n\n #options!\n gen_md5 if params[:md5sum]\n end",
"title": ""
},
{
"docid": "89b32037ce57cebe458f5c9ea332e2a9",
"score": "0.53239584",
"text": "def init_file=(_arg0); end",
"title": ""
},
{
"docid": "89b32037ce57cebe458f5c9ea332e2a9",
"score": "0.53239584",
"text": "def init_file=(_arg0); end",
"title": ""
},
{
"docid": "708bff1c1931453c25e8bda1445ad4c8",
"score": "0.5320764",
"text": "def initialize(*args)\n\n\t\tif args[0].instance_of?(ActionDispatch::Http::UploadedFile)\n\n\t\t\tfile_params = args[0]\n\n\t\t\tsha1_collection = `camput file --permanode #{file_params.tempfile.path}`\n\t\t\tsha1_array = sha1_collection.split(\"\\n\")\n\n\t\t\t@permanode = sha1_array[2]\n\t\t\t@filecontent = sha1_array[0]\n\n\t\t\tfilename = remove_spaces(file_params.original_filename)\n\t\t\tfile_extension = filename.split('.')[1]\n\t\t\tfiletype = get_filetype(file_extension)\n\n\t\t\tset_attributes(\"filename\", filename)\n\t\t\tset_attributes(\"file_extension\", file_extension)\n\t\t\tset_attributes(\"filetype\", filetype)\n\t\t\tset_attributes(get_sha_from_attr_value('title', 'all_shas'), \"list\", @permanode)\n\t\t\tset_attributes(\"auth\", random_string())\n\t\t\tset_attributes(\"auth\", random_string())\n\t\t\tset_attributes(\"auth\", random_string())\n\t\t\tset_attributes(\"public\", \"true\")\n\t\t\tset_attributes(\"private\", \"true\")\n\n\t\t\tif filetype == \"image\"\n\t\t\t\tget_thumbnail(@permanode)\n\t\t\tend\n\n\t\t\tadd_sha_to_extension_list(@permanode, file_extension)\n\t\t\tadd_sha_to_extension_list(@permanode, filetype)\n\n\t\t\tbegin\n\t\t\t\trandom_string = random_string()\n\t\t\tend while does_attr_value_exist?('download', random_string)\n\n\t\t\tset_attributes(\"download\", random_string)\n\t\t\tset_attributes(\"icon\", \"96x96/#{filetype}.png\")\n\n\t\telsif args[0].instance_of?(Array)\n\n\t\t\targs[0].each do |file_params|\n\n\t\t\t\tsha1_collection = `camput file --permanode #{file_params.tempfile.path}`\n\t\t\t\tsha1_array = sha1_collection.split(\"\\n\")\n\n\t\t\t\t@permanode = sha1_array[2]\n\t\t\t\t@filecontent = sha1_array[0]\n\n\t\t\t\tfilename = remove_spaces(file_params.original_filename)\n\t\t\t\tfile_extension = filename.split('.')[1]\n\t\t\t\tfiletype = get_filetype(file_extension)\n\n\t\t\t\tset_attributes(\"filename\", filename)\n\t\t\t\tset_attributes(\"file_extension\", file_extension)\n\t\t\t\tset_attributes(\"filetype\", filetype)\n\t\t\t\tset_attributes(get_sha_from_attr_value('title', 'all_shas'), \"list\", @permanode)\n\t\t\t\tset_attributes(\"auth\", random_string())\n\t\t\t\tset_attributes(\"auth\", random_string())\n\t\t\t\tset_attributes(\"auth\", random_string())\n\t\t\t\tset_attributes(\"public\", \"true\")\n\t\t\t\tset_attributes(\"private\", \"true\")\n\n\t\t\t\tif filetype == \"image\"\n\t\t\t\t\tget_thumbnail(@permanode)\n\t\t\t\tend\n\n\t\t\t\tadd_sha_to_extension_list(@permanode, file_extension)\n\t\t\t\tadd_sha_to_extension_list(@permanode, filetype)\n\n\t\t\t\tbegin\n\t\t\t\t\trandom_string = random_string()\n\t\t\t\tend while does_attr_value_exist?('download', random_string)\n\n\t\t\t\tset_attributes(\"download\", random_string)\n\t\t\t\tset_attributes(\"icon\", \"96x96/#{filetype}.png\")\n\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "a4db6815fda279b8bf8639af0cfef022",
"score": "0.5318326",
"text": "def hash\n super +\n @address.hash +\n @concurrent.hash +\n @encrypt_options.hash +\n @host.hash +\n @options.hash +\n @order.hash +\n @password.hash +\n @port.hash +\n @type.hash +\n @username.hash\n end",
"title": ""
},
{
"docid": "b2a10b2c3baf42f4cc15cfce28feca1e",
"score": "0.53105724",
"text": "def configure_server; end",
"title": ""
},
{
"docid": "567e4ca2ab6ae757d9399c65a031c08b",
"score": "0.52927244",
"text": "def hash\n super +\n @nfs_server_ip.hash\n end",
"title": ""
},
{
"docid": "3ba79f62e0301a2f78fe8ebde91155fe",
"score": "0.52916384",
"text": "def hash\n super +\n @bytes_read.hash +\n @bytes_written.hash +\n @client_port.hash +\n @host_name.hash\n end",
"title": ""
},
{
"docid": "b0d51ffbebd4e6bc3c96319da6b1f9ae",
"score": "0.5291219",
"text": "def initialize(conf = {})\n @options = conf\n # @ssh_id_path = File.join(ENV['HOME'],'.ssh','id_dsa')\n @ssh_id_path = File.join(ENV['HOME'], '.ssh', 'id_rsa')\n process_options\n end",
"title": ""
},
{
"docid": "5e16a2cba115247d4da3f94ff2beb85f",
"score": "0.52842337",
"text": "def init\n @payload = params # payload from github webhook\n @file_path = params[:path] # the file that we are listening for changes\n @branches= ENV[\"BRANCHES\"].split(\":\") # the branches we listen for changes\n @branch = @payload[\"ref\"].split(\"/\").last # take the branch from payload webhook\n @github_token = ENV[\"GITHUB_TOKEN\"] # github personal token to access repo with role of admin:repo_hook \n @repository = @payload[\"repository\"][\"full_name\"] # the repository where the file is\n @languages = ENV[\"LANGUAGES\"].split(\":\") # all languages to be generated\n @file_type = @file_path.split(\".\").last # get the file type from path\n end",
"title": ""
},
{
"docid": "cb0753df0eee57afc6712f973db5c26a",
"score": "0.52818936",
"text": "def storage_file_host=(_arg0); end",
"title": ""
},
{
"docid": "49bba04779658a6f73239abf61b5f341",
"score": "0.5274968",
"text": "def add_request_hash(properties, fields)\n data = fields.map { |e| properties[e] }\n data << @options[:encryption_key]\n properties['hash_'] = Digest::MD5.hexdigest(data.join(''))\n end",
"title": ""
},
{
"docid": "1c2b29958b7e7b7d7327932917798cfc",
"score": "0.52703893",
"text": "def initialize(public_path, path, request, response, options)\n super(public_path, path, request, response, options)\n @local_path = public_path.gsub(/^#{root[0..-2]}/,\"\")\n if @local_path.length == 0\n @local_path = \"/\"\n end\n @ws_user ||= options[:ws_user]\n if options[:object]\n @file = options[:object]\n elsif @local_path.length <= 1\n @file = ROOT\n else\n #puts \"PUBLIC PATH: #{public_path}, #{@local_path}\"\n end\n end",
"title": ""
},
{
"docid": "70f83345b6b8ece17373a5d2c2f2180f",
"score": "0.5261397",
"text": "def initialize(server)\n super(server)\n end",
"title": ""
},
{
"docid": "4b2790cd8ef8ec696d77a6f556b2b8a6",
"score": "0.5254937",
"text": "def set_file\n \n end",
"title": ""
},
{
"docid": "90268895513634c60014a3932f95b9aa",
"score": "0.5254642",
"text": "def initialize(base = nil)\n @base = (base || ENV['FILE_SECRETS_BASE'] || Dir.pwd)\n end",
"title": ""
},
{
"docid": "6e2419227feddc6da00ab96f8172236b",
"score": "0.52517676",
"text": "def initialize(username, password, req_path, server, port)\n @auth = {username: username, password: password }\n @host = \"https://\" + server + \":\" + port\n @req_path = req_path\n end",
"title": ""
},
{
"docid": "55e01e18b9161efd75df5a7191d562c2",
"score": "0.5251729",
"text": "def init_ssh_config_file( ssh_config_file, ssh_config_init ) \n File.open( ssh_config_file, 'w') { |f| f.write(File.read(ssh_config_init )) } if !File.exist?( ssh_config_file ) && \n ssh_config_init && !ssh_config_init.empty?\n end",
"title": ""
},
{
"docid": "5fb419f37dc996f313c504c40d14f50e",
"score": "0.524908",
"text": "def file_hash\n return @file_hash\n end",
"title": ""
},
{
"docid": "f05102be52d65e7ea7c5da6443c115d3",
"score": "0.5246115",
"text": "def hash\n super +\n @address.hash +\n @host.hash +\n @logical_units.hash +\n @mount_options.hash +\n @nfs_retrans.hash +\n @nfs_timeo.hash +\n @nfs_version.hash +\n @override_luns.hash +\n @password.hash +\n @path.hash +\n @port.hash +\n @portal.hash +\n @target.hash +\n @type.hash +\n @username.hash +\n @vfs_type.hash +\n @volume_group.hash\n end",
"title": ""
},
{
"docid": "16188a06e51321cb0c7b3cc31d34d6d9",
"score": "0.5243559",
"text": "def initialize\n @file = self.class.file_handler.new('hadupils-hiverc')\n end",
"title": ""
},
{
"docid": "3f23fd8df892146ff4183e5d95da36de",
"score": "0.5240442",
"text": "def download_hash\n original_file_hash || mp3_file_hash || {}\n end",
"title": ""
},
{
"docid": "0ee7dd8528d008df87193d2f2b45eb44",
"score": "0.5240115",
"text": "def initialize(config_hash_or_file = {})\n\n if config_hash_or_file.is_a? Hash\n config_hash_or_file.nested_symbolize_keys!\n @username = config_hash_or_file[:username]\n @password = config_hash_or_file[:password]\n @consumer_key = config_hash_or_file[:consumer_key]\n @consumer_secret = config_hash_or_file[:consumer_secret]\n @access_token = config_hash_or_file[:access_token]\n @access_token_secret = config_hash_or_file[:access_token_secret]\n @rest_endpoint = config_hash_or_file.key?(:rest_endpoint) ? config_hash_or_file[:rest_endpoint] : Muddyit.REST_ENDPOINT\n else\n config = YAML.load_file(config_hash_or_file)\n config.nested_symbolize_keys!\n @username = config[:username]\n @password = config[:password]\n @consumer_key = config[:consumer_key]\n @consumer_secret = config[:consumer_secret]\n @access_token = config[:access_token]\n @access_token_secret = config[:access_token_secret]\n @rest_endpoint = config.key?(:rest_endpoint) ? config[:rest_endpoint] : Muddyit.REST_ENDPOINT\n end\n\n if !@consumer_key.nil?\n @auth_type = :oauth\n @consumer = ::OAuth::Consumer.new(@consumer_key, @consumer_secret, {:site=>@rest_endpoint})\n @accesstoken = ::OAuth::AccessToken.new(@consumer, @access_token, @access_token_secret)\n elsif !@username.nil?\n @auth_type = :basic\n end\n end",
"title": ""
},
{
"docid": "3eaf4d1a2149af448769e86b7075815e",
"score": "0.52399266",
"text": "def init\n update_ping\n update_server_info\n update_challenge_number\n end",
"title": ""
},
{
"docid": "5d78c1b5f9c3272c70a05ead5d98ed7e",
"score": "0.52368194",
"text": "def initialize(path, password_hash: nil)\n @path = path\n @mtime = Time.at(0)\n @passwd = Hash.new\n @auth_type = BasicAuth\n @password_hash = password_hash\n\n case @password_hash\n when nil\n # begin\n # require \"string/crypt\"\n # rescue LoadError\n # warn(\"Unable to load string/crypt, proceeding with deprecated use of String#crypt, consider using password_hash: :bcrypt\")\n # end\n @password_hash = :crypt\n when :crypt\n # require \"string/crypt\"\n when :bcrypt\n require \"bcrypt\"\n else\n raise ArgumentError, \"only :crypt and :bcrypt are supported for password_hash keyword argument\"\n end\n\n File.open(@path,\"a\").close unless File.exist?(@path)\n reload\n end",
"title": ""
},
{
"docid": "085661feea7d2f99b129bee1f9ffc3d7",
"score": "0.5230824",
"text": "def generate_server_hash\n VALID_OPTIONS[:server].each_with_object({}) do |(k, v), hsh|\n hsh[v[:alt_name]] = new_resource.send(:\"server_#{k}\")\n end\n end",
"title": ""
},
{
"docid": "8e3e42b86669184020001f012cebe0b0",
"score": "0.5229382",
"text": "def initialize(hash = nil)\n super()\n update(hash) if hash\n expires_after(Session.keepalive)\n created()\n end",
"title": ""
},
{
"docid": "cc095cd07bc9c3fb40b51f67198c9344",
"score": "0.5228924",
"text": "def initialize(hash_or_file = self.class.source)\n case hash_or_file\n when Hash\n self.update hash_or_file\n else\n hash = YAML.load(ERB.new(File.read(hash_or_file)).result).to_hash\n hash = hash[self.class.namespace] if self.class.namespace\n self.update hash\n end\n end",
"title": ""
},
{
"docid": "0d5746c101845ab4b4f6e5767eb66138",
"score": "0.522341",
"text": "def add_header_hash(audio_recording)\n protocol, value = audio_recording.split_file_hash\n headers['Digest'] = \"#{protocol}=#{value}\"\n end",
"title": ""
},
{
"docid": "576f6bf7e6e04894275e21a3f4a36d76",
"score": "0.52187616",
"text": "def add_file(sourcefile = nil)\n fullpath = temppath\n path = File.basename(fullpath)\n\n if sourcefile\n @server.mount(\"/#{path}\", WEBrick::HTTPServlet::FileHandler, sourcefile.path, FileCallback: @file_callback)\n else\n File.open(fullpath, 'w+') { |f| yield f }\n end\n [\"http://#{Socket.gethostname}:#{@port}/#{path}\", fullpath]\n end",
"title": ""
},
{
"docid": "e189f59ac26b1ee8d818c5a725e9f255",
"score": "0.5218117",
"text": "def hash\n super +\n @brick_dir.hash +\n @gluster_volume.hash +\n @server_id.hash +\n @statistics.hash +\n @status.hash\n end",
"title": ""
},
{
"docid": "529b5d625a665268ca2206d89a721a61",
"score": "0.52103764",
"text": "def initialize(path, tmpdir, options)\n begin\n @original_filename = File.basename(path)\n @remote_path = path\n @content_type = 'application/x-octet-stream'\n @options = options\n # generate a unique name\n digest = Digest::SHA1.hexdigest(path + Time.now.to_i.to_s + rand(99999999).to_s)\n file_path = tmpdir + \"/\" + digest\n super file_path, \"w+b\"\n fetch\n self.close\n validate_size\n rescue Exception => ex\n # clean up if something went wrong\n self.close rescue nil\n File.delete(file_path) rescue nil\n raise ex\n end\n end",
"title": ""
},
{
"docid": "eb83fe3f30e872d5914ec25e35930536",
"score": "0.5208924",
"text": "def init_checksum\n if @exp_run_obj.config_checksum\n @checksum = @exp_run_obj.config_checksum\n else\n require \"digest/sha1\"\n long_checksum_string = Dir.glob(@path+\"/*.{json,txt,bin}\").sort.inject(\"\") do |c, f|\n # Calculate checksum for every file and concat them\n c += Digest::SHA1.hexdigest(File.open(f, \"r\").read)\n end\n # \"compress\" the concated checksums by checksumming\n @checksum = Digest::SHA1.hexdigest(long_checksum_string)\n end\n event_log.log \"calculating new checksum over local files: #{@checksum}\"\n @checksum\n end",
"title": ""
},
{
"docid": "45fef1f5ca1c2b37d237ba6c850b1882",
"score": "0.52032477",
"text": "def setup\n super\n\n self.folder_name = datastore['FOLDER_NAME']\n self.share = datastore['SHARE'] || Rex::Text.rand_text_alpha(4 + rand(3))\n self.file_name = datastore['FILE_NAME'] || Rex::Text.rand_text_alpha(4 + rand(3))\n\n t = Time.now.to_i\n self.hi, self.lo = ::Rex::Proto::SMB::Utils.time_unix_to_smb(t)\n\n # The module has an opportunity to set up the file contents in the \"primer callback\"\n if datastore['FILE_CONTENTS']\n File.open(datastore['FILE_CONTENTS'], 'rb') { |f| self.file_contents = f.read }\n else\n self.file_contents = Rex::Text.rand_text_alpha(50 + rand(150))\n end\n end",
"title": ""
},
{
"docid": "e883a9758a08bc15005bae9100d13608",
"score": "0.52030414",
"text": "def initialize(username,password)\n @username = username\n @password = password\n @files = {}\n @@users[username] = password\n end",
"title": ""
},
{
"docid": "d1f36b366ee8ccff0984a285a89a0e98",
"score": "0.5200391",
"text": "def initialize(server, name)\n @name = name\n @server = server\n @host = server.uri\n @uri = \"/#{name.gsub('/','%2F')}\"\n @root = host + uri\n @streamer = Streamer.new\n @bulk_save_cache = []\n @bulk_save_cache_limit = 500 # must be smaller than the uuid count\n end",
"title": ""
},
{
"docid": "45d8090bdaf33a0c8a639a91925cde48",
"score": "0.5199147",
"text": "def initialize \n @Filename = \"client.log\" \n end",
"title": ""
},
{
"docid": "ad6cf7c564265ebbf0d9dbeb66a864da",
"score": "0.5197359",
"text": "def init_new_file(filename, options={})\n # @todo options for chunkSize, alias, contentType, metadata\n @files_id = options[:_id] || BSON::ObjectId.new\n @files.insert([\n { :_id => @files_id,\n :chunkSize => options[:chunk_size] || DEFAULT_CHUNK_SIZE,\n :filename => filename,\n :md5 => Digest::MD5.new.to_s,\n :length => 0,\n :uploadDate => Time.now.utc,\n :contentType => options[:content_type] || DEFAULT_CONTENT_TYPE,\n :aliases => options[:aliases] || [],\n :metadata => options[:metadata] || {}\n }\n ])\n end",
"title": ""
},
{
"docid": "c1a3eac8374b8c89f85d9370545cb12a",
"score": "0.5194228",
"text": "def initialize(path)\n @path = path\n @mtime = Time.at(0)\n @digest = Hash.new\n @mutex = Thread::Mutex::new\n @auth_type = DigestAuth\n File.open(@path,\"a\").close unless File.exist?(@path)\n reload\n end",
"title": ""
},
{
"docid": "3af80e0854901496bab581ba1113d9ce",
"score": "0.518482",
"text": "def initialize(path_or_stream, encryption_key = nil)\n @encryption_key = nil\n @salt = nil\n @format = :json\n\n encryption_key = read_encryption_key(encryption_key)\n update_secret(key: encryption_key)\n path_or_stream = Pathname.new(path_or_stream) if path_or_stream.is_a?(String)\n load_secrets!(path_or_stream)\n\n super(@values)\n end",
"title": ""
},
{
"docid": "a4f9fe891ab43197f5a00ee7c83594f2",
"score": "0.5182625",
"text": "def add_file(file)\n @initial_version.file(file.name, file.mode, &file.content)\n end",
"title": ""
},
{
"docid": "6a70ccca4c647a2126c781fd6c8098e7",
"score": "0.51811045",
"text": "def initialize(file_path, log, verbose=false, mock = false)\n @config_file = file_path\n @parsed_hash = {}\n @verbose = verbose\n @log = log.dup\n @log.level = verbose ? Log4r::DEBUG : Log4r::INFO\n @mock = mock\n @errors_count = 0\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "e24a94b70a1aba69022fe006dc3f036c",
"score": "0.0",
"text": "def set_invention\n @invention = Invention.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60339177",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60135007",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.59219855",
"text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.589884",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.5889191",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.58780754",
"text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n else\n super\n end\n end",
"title": ""
},
{
"docid": "a80b33627067efa06c6204bee0f5890e",
"score": "0.5863248",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.58094144",
"text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end",
"title": ""
},
{
"docid": "33ff963edc7c4c98d1b90e341e7c5d61",
"score": "0.57375425",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.57285565",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.57149214",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.56900954",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.56665677",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.5651118",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.5648135",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.56357735",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.5627078",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.5608873",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5598699",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.5598419",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.5589822",
"text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.55084664",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.5504379",
"text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.5465574",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.5464707",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.54471064",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.54455084",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.5437386",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.54160327",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.5397424",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.5392518",
"text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "a468b256a999961df3957e843fd9bdf4",
"score": "0.5385411",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.53794575",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.5357573",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.53487605",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.5346655",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.53448105",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.5342072",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.5341318",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.53243506",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.53025913",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.5283114",
"text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end",
"title": ""
},
{
"docid": "1e1e48767a7ac23eb33df770784fec61",
"score": "0.5282289",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.52585614",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.52571374",
"text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "fc88422a7a885bac1df28883547362a7",
"score": "0.52483684",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.5244467",
"text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.5236853",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.52330637",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.52300817",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.522413",
"text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52226824",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.521999",
"text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end",
"title": ""
},
{
"docid": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.5215832",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.5213786",
"text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.52100146",
"text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end",
"title": ""
},
{
"docid": "2aba2d3187e01346918a6557230603c7",
"score": "0.52085197",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.5203262",
"text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.5202406",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.520174",
"text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end",
"title": ""
},
{
"docid": "d56f4ec734e3f3bc1ad913b36ff86130",
"score": "0.5201504",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "7fca702f2da4dbdc9b39e5107a2ab87d",
"score": "0.5191404",
"text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end",
"title": ""
},
{
"docid": "063b82c93b47d702ef6bddadb6f0c76e",
"score": "0.5178325",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.51765746",
"text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.5162045",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.5150735",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.5143402",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.51415485",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.51398855",
"text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.51376045",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.51318985",
"text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end",
"title": ""
},
{
"docid": "f2ac709e70364fce188bb24e414340ea",
"score": "0.5115387",
"text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5111866",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.5109771",
"text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.5107364",
"text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend",
"title": ""
},
{
"docid": "f04fd745d027fc758dac7a4ca6440871",
"score": "0.5106081",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.51001656",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.50964546",
"text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end",
"title": ""
},
{
"docid": "076c761e1e84b581a65903c7c253aa62",
"score": "0.5093199",
"text": "def add_callbacks(base); end",
"title": ""
}
] |
56b1325b71f3e135b9c604a04b2f3433 | Send the selected values to model and get the data for the charts | [
{
"docid": "82e05eeb64f26068f3e319dde51446c8",
"score": "0.0",
"text": "def set_options\n\n\t\tchoices = params[:choices_str].split(\"\")\n\t\tchoices.each_with_index do |choice, index|\n\t\t\tif not choice.in?([\"A\",\"B\",\"C\",\"D\"])\n\t\t\t\tchoices[index] = choice.to_i\n\t\t\telse\n\t\t\t\tchoices[index] = choice\n\t\t\tend\n\t\tend\n\n\t\toptions = []\n\t\tchoices.each_with_index do |choice, index|\n\t\t\toptions.push({:choicelevel => choice, :choicenumber => index})\n\t\tend\n\n\t\tdata = Calculator.set_values(choices)\n\n\t\trender json: {data: data}\n\n\tend",
"title": ""
}
] | [
{
"docid": "f6d0a83f11ea745b15624e2e1b3d5574",
"score": "0.61088353",
"text": "def get_chart_data\n chart_params\n end",
"title": ""
},
{
"docid": "2d8f5a4d7cd4bd9d53fd5cab12ed4115",
"score": "0.6062596",
"text": "def index\n \n chart_params\n \n @diaini = params[:auxdata].to_date.beginning_of_day\n @diafim = params[:auxdata].to_date.end_of_day\n \n @mesini = params[:auxdata].to_date.beginning_of_month\n @mesfim = params[:auxdata].to_date.end_of_month\n \n @anoini = params[:auxdata].to_date.beginning_of_year\n @anofim = params[:auxdata].to_date.end_of_year\n \n @sensors = Sensor.where(chave: params[:chave]).order(\"datainclusao\").all\n \n @sensors_dia = @sensors.where(datainclusao: @diaini..@diafim)\n @sensors_mes = @sensors.where(datainclusao: @mesini..@mesfim)\n @sensors_ano = @sensors.where(datainclusao: @anoini..@anofim)\n \n labelsdia = []\n limpezadia = []\n prodgerdia = []\n utilresdia = []\n economidia = []\n \n labelsmes = []\n limpezames = []\n prodgermes = []\n utilresmes = []\n economimes = []\n \n labelsano = []\n limpezaano = []\n prodgerano = []\n utilresano = []\n economiano = []\n \n \n @valor_dia = 0\n \n @sensors_dia.each do |sensor|\n \n if sensor.sensor2 >= 510\n ts0 = (sensor.sensor2 * 0.1667) * (sensor.sensor3 * 0.0246)\n else\n ts0 = (sensor.sensor2 * (-0.1667)) * (sensor.sensor3 * 0.0246)\n end\n \n ts1 = ((sensor.sensor0 * 2.7114) * (sensor.sensor1 * 0.09774) / 1000)\n \n ts2 = 0\n ts3 = 0\n \n @valor_dia += ts1.to_i\n \n labelsdia.push({\n label: sensor.datainclusao.strftime('%T')\n })\n \n limpezadia.push({\n value: ts0.to_i\n })\n \n prodgerdia.push({\n value: ts1.to_i\n })\n \n utilresdia.push({\n value: ts3.to_i\n })\n \n economidia.push({\n value: ts2.to_i\n })\n \n end\n \n @ts0 = 0\n @ts1 = 0\n @ts2 = 0\n @ts3 = 0\n \n @valor_mes = 0\n \n @sensors_mes.each do |sensor|\n \n @auxdia = sensor.datainclusao.day\n \n if @auxdia2 == nil\n @auxdia2 = sensor.datainclusao.day\n end\n \n if @auxdia != @auxdia2\n \n @valor_mes += @ts2\n \n labelsmes.push({\n label: @label\n })\n \n limpezames.push({\n value: @ts0.to_i\n })\n \n prodgermes.push({\n value: @ts1.to_i\n })\n \n utilresmes.push({\n value: @ts3.to_i\n })\n \n economimes.push({\n value: @ts2.to_i\n })\n \n @ts0 = 0\n @ts1 = 0\n @ts2 = 0\n @ts3 = 0\n \n end\n \n if sensor.sensor2 >= 510\n @ts0 = (sensor.sensor2 * 0.1667) * (sensor.sensor3 * 0.0246)\n else\n @ts0 = (sensor.sensor2 * (-0.1667)) * (sensor.sensor3 * 0.0246)\n end\n \n @ts1 = ((sensor.sensor0 * 2.7114) * (sensor.sensor1 * 0.09774) / 1000)\n \n @ts2 = 0\n @ts3 = 0\n \n @label = sensor.datainclusao.strftime('%F')\n \n @auxdia2 = sensor.datainclusao.day\n \n end\n \n if @auxdia == @auxdia2\n \n @valor_mes += @ts2\n \n labelsmes.push({\n label: @label\n })\n \n limpezames.push({\n value: @ts0.to_i\n })\n \n prodgermes.push({\n value: @ts1.to_i\n })\n \n utilresmes.push({\n value: @ts3.to_i\n })\n \n economimes.push({\n value: @ts2.to_i\n })\n \n end\n \n @ts0 = 0\n @ts1 = 0\n @ts2 = 0\n @ts3 = 0\n \n @valor_ano = 0\n \n @sensors_ano.each do |sensor|\n \n @auxmes = sensor.datainclusao.month\n \n if @auxmes2 == nil\n @auxmes2 = sensor.datainclusao.month\n end\n \n if @auxmes != @auxmes2\n \n @valor_ano += @ts2\n \n labelsano.push({\n label: @label\n })\n \n limpezaano.push({\n value: @ts0.to_i\n })\n \n prodgerano.push({\n value: @ts1.to_i\n })\n \n utilresano.push({\n value: @ts3.to_i\n })\n \n economiano.push({\n value: @ts2.to_i\n })\n \n @ts0 = 0\n @ts1 = 0\n @ts2 = 0\n @ts3 = 0\n \n end\n \n if sensor.sensor2 >= 510\n @ts0 = (sensor.sensor2 * 0.1667) * (sensor.sensor3 * 0.0246)\n else\n @ts0 = (sensor.sensor2 * (-0.1667)) * (sensor.sensor3 * 0.0246)\n end\n \n @ts1 = ((sensor.sensor0 * 2.7114) * (sensor.sensor1 * 0.09774) / 1000)\n \n @ts2 = 0\n @ts3 = 0\n \n @label = sensor.datainclusao.month\n \n @auxmes2 = sensor.datainclusao.month\n \n end\n \n if @auxmes == @auxmes2\n \n @valor_ano += @ts2\n \n labelsano.push({\n label: @label\n })\n \n limpezaano.push({\n value: @ts0.to_i\n })\n \n prodgerano.push({\n value: @ts1.to_i\n })\n \n utilresano.push({\n value: @ts3.to_i\n })\n \n economiano.push({\n value: @ts2.to_i\n })\n \n end\n \n \n @chart = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"zoomline\",\n renderAt: \"chartContainer\",\n dataSource: {\n chart: {\n caption: \"Controle de manutenção\",\n subCaption: \"\",\n xAxisname: \"Horas\",\n yAxisName: \"Produção (kW)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"12\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\"\n },\n categories: [{category: [ labelsdia ]}],\n dataset: [\n {\n seriesname: \"Produção\",\n data: [ limpezadia ]\n }\n ]\n }\n })\n \n @chart2 = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"zoomline\",\n renderAt: \"chart2Container\",\n dataSource: {\n chart: {\n caption: \"Produção Geral\",\n subCaption: \"\",\n xAxisname: \"Horas\",\n yAxisName: \"Produção (kW)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"12\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\"\n },\n categories: [{category: [ labelsdia ]}],\n dataset: [\n {\n seriesname: \"Produção\",\n data: [ prodgerdia ]\n }\n ]\n }\n })\n \n @chart3 = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"zoomline\",\n renderAt: \"chart3Container\",\n dataSource: {\n chart: {\n caption: \"Controle de Consumo\",\n subCaption: \"\",\n xAxisname: \"Horas\",\n yAxisName: \"Consumo (kW)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"12\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\"\n },\n categories: [{category: [ labelsdia ]}],\n dataset: [\n {\n seriesname: \"Consumo\",\n data: [ utilresdia ]\n }\n ]\n }\n })\n \n @chart4 = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"zoomline\",\n renderAt: \"chart4Container\",\n dataSource: {\n chart: {\n caption: \"Controle de Econômia\",\n subCaption: \"\",\n xAxisname: \"Horas\",\n yAxisName: \"Econômia (kW)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"12\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\"\n },\n categories: [{category: [ labelsdia ]}],\n dataset: [\n {\n seriesname: \"Econômia\",\n data: [ economidia ]\n }\n ]\n }\n })\n \n @chartmes = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"mscolumn2d\",\n renderAt: \"chartmesContainer\",\n dataSource: {\n chart: {\n caption: \"Controle de manutenção\",\n subCaption: \"\",\n xAxisname: \"Dias\",\n yAxisName: \"Produção (kW/h)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"31\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\",\n numberSuffix: \"W/h\"\n },\n categories: [{category: [ labelsmes ]}],\n dataset: [\n {\n seriesname: \"Produção\",\n data: [ limpezames ]\n }\n ]\n }\n })\n \n @chart2mes = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"mscolumn2d\",\n renderAt: \"chart2mesContainer\",\n dataSource: {\n chart: {\n caption: \"Produção Geral\",\n subCaption: \"\",\n xAxisname: \"Dias\",\n yAxisName: \"Produção (kW/h)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"31\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\",\n numberSuffix: \"W/h\"\n },\n categories: [{category: [ labelsmes ]}],\n dataset: [\n {\n seriesname: \"Produção\",\n data: [ prodgermes ]\n }\n ]\n }\n })\n \n @chart3mes = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"mscolumn2d\",\n renderAt: \"chart3mesContainer\",\n dataSource: {\n chart: {\n caption: \"Controle de Consumo\",\n subCaption: \"\",\n xAxisname: \"Dias\",\n yAxisName: \"Consumo (kW/h)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"31\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\",\n numberSuffix: \"W/h\"\n },\n categories: [{category: [ labelsmes ]}],\n dataset: [\n {\n seriesname: \"Consumo\",\n data: [ prodgermes ]\n }\n ]\n }\n })\n \n @chart4mes = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"mscolumn2d\",\n renderAt: \"chart4mesContainer\",\n dataSource: {\n chart: {\n caption: \"Controle de Econômia\",\n subCaption: \"\",\n xAxisname: \"Dias\",\n yAxisName: \"Econômia (kW/h)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"31\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\",\n numberSuffix: \"W/h\"\n },\n categories: [{category: [ labelsmes ]}],\n dataset: [\n {\n seriesname: \"Econômia\",\n data: [ prodgermes ]\n }\n ]\n }\n })\n \n @chartano = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"mscolumn2d\",\n renderAt: \"chartanoContainer\",\n dataSource: {\n chart: {\n caption: \"Controle de manutenção\",\n subCaption: \"\",\n xAxisname: \"Meses\",\n yAxisName: \"Produção (kW/h)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"12\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\",\n numberSuffix: \"W/h\"\n },\n categories: [{category: [ labelsano ]}],\n dataset: [\n {\n seriesname: \"Produção\",\n data: [ limpezaano ]\n }\n ]\n }\n })\n \n \n @chart2ano = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"mscolumn2d\",\n renderAt: \"chart2anoContainer\",\n dataSource: {\n chart: {\n caption: \"Produção Geral\",\n subCaption: \"\",\n xAxisname: \"Meses\",\n yAxisName: \"Produção (kW/h)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"12\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\",\n numberSuffix: \"W/h\"\n },\n categories: [{category: [ labelsano ]}],\n dataset: [\n {\n seriesname: \"Produção\",\n data: [ prodgerano ]\n }\n ]\n }\n })\n \n \n @chart3ano = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"mscolumn2d\",\n renderAt: \"chart3anoContainer\",\n dataSource: {\n chart: {\n caption: \"Controle de Consumo\",\n subCaption: \"\",\n xAxisname: \"Meses\",\n yAxisName: \"Consumo (kW/h)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"12\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\",\n numberSuffix: \"W/h\"\n },\n categories: [{category: [ labelsano ]}],\n dataset: [\n {\n seriesname: \"Consumo\",\n data: [ utilresano ]\n }\n ]\n }\n })\n \n \n @chart4ano = Fusioncharts::Chart.new({\n width: \"450\",\n height: \"250\",\n type: \"mscolumn2d\",\n renderAt: \"chart4anoContainer\",\n dataSource: {\n chart: {\n caption: \"Controle de Econômia\",\n subCaption: \"\",\n xAxisname: \"Meses\",\n yAxisName: \"Econômia (kW/h)\",\n forceAxisLimits: \"1\",\n numVisibleLabels: \"12\",\n theme: \"fint\",\n exportEnabled: \"1\",\n showValues: \"0\",\n numberSuffix: \"W/h\"\n },\n categories: [{category: [ labelsano ]}],\n dataset: [\n {\n seriesname: \"Econômia\",\n data: [ economiano ]\n }\n ]\n }\n })\n \n end",
"title": ""
},
{
"docid": "824fadee6811b4d851336d97371db67a",
"score": "0.59887743",
"text": "def annotation_values\n render json: @selected_annotation.to_json\n end",
"title": ""
},
{
"docid": "c0f611adf6e919740de3d1c76720f90f",
"score": "0.5947016",
"text": "def show\n @x_values = BoostVibroIndicator.where(total_vibration_indicator_id:@total_vibration_indicator.id, type_axis: 1).last\n @y_values = BoostVibroIndicator.where(total_vibration_indicator_id:@total_vibration_indicator.id, type_axis: 2).last\n @z_values = BoostVibroIndicator.where(total_vibration_indicator_id:@total_vibration_indicator.id, type_axis: 3).last\n end",
"title": ""
},
{
"docid": "ad38aaff7f81c2973f615f9dad83b9a8",
"score": "0.5925989",
"text": "def show\n @chart_data = Sale.pluck(\"uriage_date\",\"uriage_gaku\") \n end",
"title": ""
},
{
"docid": "6911079e470d56472e215a519545896b",
"score": "0.59000194",
"text": "def set_chart_data\n label = ['NO','NO2','CO','SO2','O3','TEMP','AP','HUM']\n data = PrepareDataChart.new\n @chartdata = data.latest(20,label) \n @latest_channels = AqmeshDatum.last.aqmesh_channels\n end",
"title": ""
},
{
"docid": "febfc57490003101d924aedc3e1ad233",
"score": "0.5894658",
"text": "def values\r\n end",
"title": ""
},
{
"docid": "973bf4a218a5eb5594c71a87b4f577d0",
"score": "0.5893079",
"text": "def index\n @data_values = DataValue.all\n end",
"title": ""
},
{
"docid": "aeee48904a18ac3d4505e11be5008f2d",
"score": "0.5724714",
"text": "def values\n end",
"title": ""
},
{
"docid": "aeee48904a18ac3d4505e11be5008f2d",
"score": "0.5724714",
"text": "def values\n end",
"title": ""
},
{
"docid": "0451887d7146fb63674db69aef6f0841",
"score": "0.57130736",
"text": "def chart\n @stocks = Stock.all\n end",
"title": ""
},
{
"docid": "2bc4e66cc77518c6d58202bfb4f266a3",
"score": "0.56847125",
"text": "def values=(value)\n @values = value\n end",
"title": ""
},
{
"docid": "2bc4e66cc77518c6d58202bfb4f266a3",
"score": "0.56847125",
"text": "def values=(value)\n @values = value\n end",
"title": ""
},
{
"docid": "2bc4e66cc77518c6d58202bfb4f266a3",
"score": "0.56847125",
"text": "def values=(value)\n @values = value\n end",
"title": ""
},
{
"docid": "2bc4e66cc77518c6d58202bfb4f266a3",
"score": "0.56847125",
"text": "def values=(value)\n @values = value\n end",
"title": ""
},
{
"docid": "2bc4e66cc77518c6d58202bfb4f266a3",
"score": "0.56847125",
"text": "def values=(value)\n @values = value\n end",
"title": ""
},
{
"docid": "2bc4e66cc77518c6d58202bfb4f266a3",
"score": "0.56847125",
"text": "def values=(value)\n @values = value\n end",
"title": ""
},
{
"docid": "c69b6b1c92918a8b76eadfae70ba6fd9",
"score": "0.56700194",
"text": "def values\n @values\n end",
"title": ""
},
{
"docid": "c69b6b1c92918a8b76eadfae70ba6fd9",
"score": "0.56700194",
"text": "def values\n @values\n end",
"title": ""
},
{
"docid": "6e90c6fbd9ddbae70dfccba6a11957d2",
"score": "0.56328154",
"text": "def chart\n\n end",
"title": ""
},
{
"docid": "2330d9a30d762bf3c93819d6da06c4d3",
"score": "0.56313294",
"text": "def show\n @experiment = Experiment.find(params[:id])\n @temperatures = @experiment.datapoints.where(:dataType => \"temperature\").order(\"id desc\").first(70000)\n @pHs = @experiment.datapoints.where(:dataType => \"pH\").order(\"id desc\").first(70000)\n @agitations = @experiment.datapoints.where(:dataType => \"agitation\").order(\"id desc\").first(70000)\n @dissolvedOxygens = @experiment.datapoints.where(:dataType => \"do\").order(\"id desc\").first(70000)\n gon.temperatureData = [{:values => @temperatures.map{ |d| {:x => (d.time-@experiment.startTime).seconds, :y => d.value} }, :key=> \"Experiment id:#{@experiment.id}\", :color =>'#ff7f0e'}]\n gon.pHData = [{:values => @pHs.map{ |d| {:x => (d.time-@experiment.startTime).seconds, :y => d.value} }, :key=> \"Experiment id:#{@experiment.id}\", :color =>'#ff7f0e'}]\n gon.doData = [{:values => @dissolvedOxygens.map{ |d| {:x => (d.time-@experiment.startTime).seconds, :y => d.value} }, :key=> \"Experiment id:#{@experiment.id}\", :color =>'#ff7f0e'}]\n gon.agitData = [{:values => @agitations.map{ |d| {:x => (d.time-@experiment.startTime).seconds, :y => d.value} }, :key=> \"Experiment id:#{@experiment.id}\", :color =>'#ff7f0e'}]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end",
"title": ""
},
{
"docid": "5fd73d6d7688d6b24993c2f9769d314f",
"score": "0.5625976",
"text": "def choose\n @datum = Datum.find(params[:trial_datum_id])\n \n respond_to do |format|\n format.html { render :layout => false }\n format.json { render json: @datum && @datum.chart_data }\n end\n end",
"title": ""
},
{
"docid": "03bf62b3ecdcbce2bdc093cd02372c10",
"score": "0.5608485",
"text": "def show\n @x_values = BoostVibLInd.where(local_vib_f_indicator_id:@local_vib_f_indicator.id, type_axis: 1).last\n @y_values = BoostVibLInd.where(local_vib_f_indicator_id:@local_vib_f_indicator.id, type_axis: 2).last\n @z_values = BoostVibLInd.where(local_vib_f_indicator_id:@local_vib_f_indicator.id, type_axis: 3).last\n end",
"title": ""
},
{
"docid": "bdebb0f611e9e309a68b3896469544d1",
"score": "0.5602201",
"text": "def show\n @x_values = BoostVibLsInd.where(local_vib_s_indicator_id:@local_vib_s_indicator.id, type_axis: 1).last\n @y_values = BoostVibLsInd.where(local_vib_s_indicator_id:@local_vib_s_indicator.id, type_axis: 2).last\n @z_values = BoostVibLsInd.where(local_vib_s_indicator_id:@local_vib_s_indicator.id, type_axis: 3).last\n end",
"title": ""
},
{
"docid": "549423319dc59b827d03ed9ccad5812c",
"score": "0.55944175",
"text": "def index\n @products = Product.all\n\n @product_price = []\n @product_name = []\n @product_price_s = []\n @product_rate = []\n\n @products.each do |product|\n @product_price_s << (product.price).to_i\n @product_price << [(product.price).to_i]\n @product_rate << (product.rate).to_i\n @product_name << product.name\n end\n \n @min_val = @product_price_s.min\n @max_val = @product_price_s.max\n\n #return render :text => @product_data.inspect\n \n @color=[] \n @product_name.each do |name|\n @color << \"%06x\" % (rand * 0xffffff)\n end\n\n @bar = Gchart.bar(\n :size => '500x300',\n :stacked => false,\n :title => 'Bar chart', \n :data => @product_price_s,\n :bar_colors => :legend,\n :legend => @product_name,\n :axis_with_labels => ['x','y'],\n :axis_labels => [@product_name, @product_price_s.sort],\n )\n\n @bar_horizontal = Gchart.bar(\n #:title => 'Horizontal Bar chart',\n :size => '500x300', \n :stacked => false, \n :data => @product_price_s,\n :legend => @product_name,\n :bar_colors => :legend,\n :axis_with_labels => ['y','x'],\n :axis_labels => [@product_name, @product_price_s.sort],\n :orientation => 'horizontal'\n )\n\n @line = Gchart.line(\n :size => '500x300',\n :title => \"Line Chart\",\n #:axis_with_labels => ['x'],\n :line_colors => :legend,\n :axis_with_labels => ['y','x'],\n :axis_labels => [@product_name, @product_price_s.sort],\n :legend => @product_name,\n :data => @product_price_s.sort\n )\n \n @linexy = Gchart.line(\n :title => \"Line XY chart\",\n :axis_with_labels => ['y','x'],\n :axis_labels => [@product_rate.sort, @product_price_s.sort],\n :data => [@product_price_s, @product_rate], \n :line_colors => \"FF0000,00FF00\"\n )\n\n=begin\n @linexy1 = Gchart.line_xy(\n :size => '200x300',\n :title => \"Line XY Chart\",\n :axis_with_labels => ['y'],\n :line_colors => @color,\n :xAxis_labels => @product_price, :min_value => 0, :max_value => @max_val,\n :legend => @product_name,\n :data => @product_price_s\n ) \n=end\n \n @pie = Gchart.pie(\n :data => @product_price_s,\n :title => 'Pie chart', \n :size => '400x200', \n :labels => @product_name,\n :legend => @product_name\n )\n\n @pie_3d = Gchart.pie_3d(\n :data => @product_price_s,\n :title => 'Pie 3D chart', \n :size => '400x200',\n :labels => @product_name,\n :legend => @product_name\n )\n\n @sparkline = Gchart.sparkline( \n # A sparkline chart has exactly the same parameters as a line chart. The only difference is that the axes lines are not drawn for sparklines by default.\n :title => \"Spark Line chart\",\n :data => @product_price_s, \n :size => '100x200', \n :line_colors => '0077CC'\n )\n\n @venn = Gchart.venn(\n :title => \"Venn chart\",\n :data => @product_price_s,\n )\n \n @scatter = Gchart.scatter(\n :title => \"Scatter chart\",\n :data => @product_price,\n :axis_with_labels => ['x','y'],\n :axis_labels => [@product_name,@product_price_s.sort]\n )\n \n @google_meter = Gchart.meter(\n :title => \"Google Meter chart\",\n :data => @product_price\n #:label => ['Flavor']\n )\n\n end",
"title": ""
},
{
"docid": "46758b7c47dad5b453966020a4fede45",
"score": "0.55691487",
"text": "def index\n @scalevalues = Scalevalue.all\n end",
"title": ""
},
{
"docid": "ddeda89de9f50a8c1ab274d89f5c6ea6",
"score": "0.5556569",
"text": "def parameters_and_values model=self\n if model.is_sbml?\n parameters_and_values_from_sbml model\n elsif model.is_dat?\n parameters_and_values_from_dat model\n else\n {}\n end\n end",
"title": ""
},
{
"docid": "ce297ac9ebd43be7fb5cfe24c490d4d2",
"score": "0.55461115",
"text": "def data\n values.active.map { |value| value.target.value }\n end",
"title": ""
},
{
"docid": "3795250e3b88223957f1af70036f627e",
"score": "0.5544332",
"text": "def get_data_point_values\n # look up the attribute value and find its possible data points for athe autocomplete\n data_point_value=params[:data_point_value]\n if params[:attribute_value_name] != \"\"\n attribute_value=AttributeValue.find_by_name(params[:attribute_value_name])\n if attribute_value != nil \n @data_points = DataPoint.find(:all,:limit=>20,:order=>:value,:conditions=>[\"attribute_value_id = ? AND value LIKE ?\",attribute_value.id,data_point_value +\"%\"])\n render(:template=>\"shared/get_data_point_values\",:layout=>false) \n return\n end\n end\n render(:nothing=>true)\n end",
"title": ""
},
{
"docid": "d03983d38a22e230877d69865a141923",
"score": "0.55380094",
"text": "def show\n @graph.postal = House.where(\"hems_id is ?\", @graph.hems_id).first.postal\n @chart_data = []\n if @graph.main == true\n chart = []\n House.where(\"hems_id is ?\", @graph.hems_id).first.mains.where(timestamp: @graph.start..@graph.end).each{|v|\n chart << [v.timestamp.strftime(\"%Y-%m-%dT%H:%M:%S+09:00:00\"), v.value]\n }\n @chart_data << { :name => \"main\", :data => chart}\n end\n if @graph.solar_generate == true\n chart = []\n House.where(\"hems_id is ?\", @graph.hems_id).first.solar_generates.where(timestamp: @graph.start..@graph.end).each{|v|\n chart << [v.timestamp.strftime(\"%Y-%m-%dT%H:%M:%S+09:00:00\"), v.value]\n }\n @chart_data << { :name => \"solar_generated\", :data => chart}\n end\n if @graph.solar_sold == true\n chart = []\n \n House.where(\"hems_id is ?\", @graph.hems_id).first.solar_sells.where(timestamp: @graph.start..@graph.end).each{|v|\n chart << [v.timestamp.strftime(\"%Y-%m-%dT%H:%M:%S+09:00:00\"), v.value]\n }\n @chart_data << { :name => \"solar_sold\", :data => chart}\n end\n if @graph.battery_charge == true\n chart = []\n \n House.where(\"hems_id is ?\", @graph.hems_id).first.battery_charges.where(timestamp: @graph.start..@graph.end).each{|v|\n chart << [v.timestamp.strftime(\"%Y-%m-%dT%H:%M:%S+09:00:00\"), v.value]\n }\n @chart_data << { :name => \"battery_charge\", :data => chart}\n end\n if @graph.battery_discharge == true\n chart = []\n \n House.where(\"hems_id is ?\", @graph.hems_id).first.battery_discharges.where(timestamp: @graph.start..@graph.end).each{|v|\n chart << [v.timestamp.strftime(\"%Y-%m-%dT%H:%M:%S+09:00:00\"), v.value]\n }\n @chart_data << { :name => \"battery_discharge\", :data => chart}\n end\n if @graph.fuel_cell == true\n chart = []\n \n House.where(\"hems_id is ?\", @graph.hems_id).first.fuel_cells.where(timestamp: @graph.start..@graph.end).each{|v|\n chart << [v.timestamp.strftime(\"%Y-%m-%dT%H:%M:%S+09:00:00\"), v.value]\n }\n @chart_data << { :name => \"fuel_cell\", :data => chart}\n end\n if @graph.gus == true\n chart = []\n \n House.where(\"hems_id is ?\", @graph.hems_id).first.gus.where(timestamp: @graph.start..@graph.end).each{|v|\n chart << [v.timestamp.strftime(\"%Y-%m-%dT%H:%M:%S+09:00:00\"), v.value]\n }\n @chart_data << { :name => \"gus\", :data => chart}\n end\n if @graph.water == true\n chart = []\n \n House.where(\"hems_id is ?\", @graph.hems_id).first.waters.where(timestamp: @graph.start..@graph.end).each{|v|\n chart << [v.timestamp.strftime(\"%Y-%m-%dT%H:%M:%S+09:00:00\"), v.value]\n }\n @chart_data << { :name => \"water\", :data => chart}\n end\n end",
"title": ""
},
{
"docid": "1d51380c0042694706e0a264f7b63505",
"score": "0.55366766",
"text": "def plot_data; end",
"title": ""
},
{
"docid": "03837c9fa571f9edf3aa97b2154b90c3",
"score": "0.5528382",
"text": "def select_input\n @categories = Category.all.collect{|category| [category.name, category.id]}\n @brands = Brand.all.collect {|brand| [brand.name, brand.id]}\n end",
"title": ""
},
{
"docid": "04961ca3c95f7c6053659e7b40b62489",
"score": "0.5527431",
"text": "def get_values\n @set.values\n end",
"title": ""
},
{
"docid": "74ca8f2c432b54407398238b6b9e70d7",
"score": "0.5523929",
"text": "def index\n @graphs = Graph.all\n p Graph.pluck(\"date\")\n p Graph.pluck(\"temp\")\n\n @data = {\n labels: Graph.pluck(\"date\"),\n datasets: [\n {\n label: \"My First dataset\",\n fillColor: \"rgba(151,187,205,0.2)\",\n strokeColor: \"rgba(151,187,205,1)\",\n pointColor: \"rgba(151,187,205,1)\",\n pointStrokeColor: \"# fff\",\n pointHighlightFill: \"# fff\",\n pointHighlightStroke: \"rgba(151,187,205,1)\",\n data: Graph.pluck(\"temp\") \n },\n ]\n\n }\n @options = {\n scaleOverride: true,\n scaleStartValue: 0,\n scaleSteps: 6,\n scaleStepWidth: 5\n }\n end",
"title": ""
},
{
"docid": "e0aa8a3fbff9f2a89cb4b71917283b0f",
"score": "0.5521952",
"text": "def getquicksizervalues\n @quicksizer = QuickSizer.all\n respond_to do |format|\n format.html\n format.csv { send_data @quicksizer.as_csv }\n end\n end",
"title": ""
},
{
"docid": "88582514778e6b1906698616ca8d6d81",
"score": "0.5506792",
"text": "def index\n @values = Value.all\n \n end",
"title": ""
},
{
"docid": "6516b64cbbfebab83d7e1505343f0d51",
"score": "0.5497075",
"text": "def getvalue\n selected_rows\n end",
"title": ""
},
{
"docid": "dab68ab04737dd25fd11b9218a4eab04",
"score": "0.54959124",
"text": "def data\n plot && plot.data\n end",
"title": ""
},
{
"docid": "1529368cee2306bba94ba7f830176d64",
"score": "0.54898113",
"text": "def values\n self\n end",
"title": ""
},
{
"docid": "2d7ef49e595df6d9634d8085f9291901",
"score": "0.5486724",
"text": "def values\n @values\n end",
"title": ""
},
{
"docid": "2d7ef49e595df6d9634d8085f9291901",
"score": "0.54863596",
"text": "def values\n @values\n end",
"title": ""
},
{
"docid": "2d7ef49e595df6d9634d8085f9291901",
"score": "0.54863596",
"text": "def values\n @values\n end",
"title": ""
},
{
"docid": "13252d52b8cf87bc91f0e7c241ce29c7",
"score": "0.5478775",
"text": "def engine_data \n if params[:engine_model]\n @power = Engine.where(:id => params[:engine_model]).first.power_rating\n respond_to do |format|\n format.js { render :layout => false, :locals => {:power => @power} } \n end\n end\n end",
"title": ""
},
{
"docid": "4462a5eed922e06abb9a209cc3b8d04e",
"score": "0.54721653",
"text": "def values\n @values\n end",
"title": ""
},
{
"docid": "5a51224955973c56479c244016c1a2c1",
"score": "0.54499394",
"text": "def data_for_combo_chart\n [{\n name: 'Aproximácia',\n data: logistic_data.xrange.step(0.1).map do |x|\n [x, function.apply(x)]\n end}, {\n name: 'Výkony',\n data: performances.map do |p|\n [p.years_f, p.body]\n end}]\n end",
"title": ""
},
{
"docid": "c30e0950ed3f312cdd036f8f31e005f5",
"score": "0.54487044",
"text": "def index\n @selections = Selection.all\n end",
"title": ""
},
{
"docid": "a5bd9ee2e4b4e94d1eb7e84745c10615",
"score": "0.5448108",
"text": "def chart\n end",
"title": ""
},
{
"docid": "82791a4e1767f44c055c962d1a253e26",
"score": "0.5441464",
"text": "def show\n @values = @sensor.values\n end",
"title": ""
},
{
"docid": "c46f2b9a7d9266bb11f03dd3ab9de6c6",
"score": "0.54309076",
"text": "def index\n @maker_options = Maker.all.inject(Array.new) {|a, m| a << [m.name, m.id]; a}\n @engine_options = Engine.all.inject(Array.new) {|a, e| a << [e.name, e.id]; a}\n @meter_options = Meter.all.inject(Array.new) {|a, m| a << [m.name, m.id]; a}\n\n if params[:bike_id] && params[:year] && params[:meter_id]\n @price = Price.where([\"bike_id = ? AND year = ? AND meter_id = ?\", params[:bike_id], params[:year], params[:meter_id]]).first\n @price.average = 0 if @price.average.nil?\n end\n\n\n respond_to do |format|\n format.html\n format.js\n end\n end",
"title": ""
},
{
"docid": "ce3a73bbb585cf2b12abd02f2c835214",
"score": "0.54266316",
"text": "def select\n # Si le retour du formulaire, faire la requete \"show\" appropriee\n if request.post?\n fin = readDate(params['fin']) if params['fin']\n depart = readDate(params['depart']) if params['depart']\n dateRange = depart.to_formatted_s(:db)+':'+fin.to_formatted_s(:db)\n redirect_to(\"/graphiques/show/#{params['indic']}/#{dateRange}\")\n else\n # Sinon afficher le formulaire pour choisir le graphique\n # Les defaults pour la date\n @fin = Date.today\n @depart = @fin - 14\n end\n end",
"title": ""
},
{
"docid": "c73251a1c4fb6ab49f4ead448e4de242",
"score": "0.5420381",
"text": "def select_dictionaries_for_label_mapping\n base_dics, order, order_direction = Dictionary.get_showables current_user\n @grid_dictionaries = get_dictionaries_grid_view base_dics\n\n respond_to do |format|\n format.html { render layout: false }\n end\n end",
"title": ""
},
{
"docid": "443efe542113ccf58bd9d1f2f26222e1",
"score": "0.54197973",
"text": "def index\n @values = current_plan.values\n end",
"title": ""
},
{
"docid": "492b18f6b8b34e4205c11531ea9005a5",
"score": "0.5417962",
"text": "def chart_data(params)\n time_fraction = params[:fraction] * 60\n seconds = 0\n points = Point.where(:trip_id => self.trip_id).order('timestamp asc')\n labels = []\n data = []\n series = []\n\n return nil if points.length == 0\n \n fuel = []\n fuel_temp = []\n speed = []\n speed_temp = []\n rpm = []\n rpm_temp = []\n\n start_timestamp = points.first.timestamp.to_i\n\n points.each do |p|\n diff = p.timestamp.to_i - start_timestamp\n\n if diff >= time_fraction\n labels.push(Time.at(seconds).utc.strftime(\"%H:%M\"))\n start_timestamp = p.timestamp.to_i\n\n (fuel_temp.length == 0) ? fuel.push(0) : fuel.push(sprintf(\"%.2f\", (fuel_temp.reduce(:+)) / fuel_temp.length))\n (speed_temp.length == 0) ? speed.push(0) : speed.push(sprintf(\"%.2f\", (speed_temp.reduce(:+)) / speed_temp.length))\n (rpm_temp.length == 0) ? rpm.push(0) : rpm.push(sprintf(\"%.2f\", (rpm_temp.reduce(:+)) / rpm_temp.length))\n \n fuel_temp = []\n speed_temp = []\n rpm_temp = []\n\n seconds = seconds + time_fraction\n end\n\n if p.fuel_economy >= 0\n fuel_temp.push(p.fuel_economy * TripStat::KML_TO_MPG)\n end\n if p.vehicle_speed >= 0\n speed_temp.push(p.vehicle_speed * TripStat::KM_TO_MPH)\n end\n if p.rpm >= 0\n rpm_temp.push(p.rpm)\n end\n end\n\n if params[:fuel] == true\n data.push(fuel)\n series.push('Fuel [mpg]')\n end\n\n if params[:speed] == true\n data.push(speed)\n series.push('Speed [mph]')\n end\n\n if params[:rpm] == true\n data.push(rpm)\n series.push('RPM [rpm]')\n end\n\n return {\n :labels => labels,\n :data => data,\n :series => series\n }\n end",
"title": ""
},
{
"docid": "105bca23c2a4b9c37b56ea9885e9ebf8",
"score": "0.53852326",
"text": "def index\n @values = Value.all\n end",
"title": ""
},
{
"docid": "e79814efbae24a93cc12d882a9d535bf",
"score": "0.53766716",
"text": "def values\n @demographic_data.values.to_json\n end",
"title": ""
},
{
"docid": "1095b169d4228e9b0887c82ebe080953",
"score": "0.5376449",
"text": "def index\n\t\tif params[:limit] == nil\n @indicator_values = IndicatorValue.limit(default_limit)\n\t\telse\n\t\tcid = params[:cid]\n\t\tiid = params[:iid]\n\t\tlimit = params[:limit]\n\t\tyear = params[:yid]\n\t\tputs \"special\"\n\t\t@indicator_values = IndicatorValue.select_multiple(cid, iid, year, limit)\n\t\tend\n end",
"title": ""
},
{
"docid": "13dffc1f52f019899d3e5fef7a832b4c",
"score": "0.5368621",
"text": "def for_model_set\n @equipment_models = EquipmentModel.find(params[:ids])\n @start_date = start_date\n @end_date = end_date\n @data_tables = models_subreport(params[:ids],@start_date,@end_date, @equipment_models)\n end",
"title": ""
},
{
"docid": "cf545c1821119bca61287854fb4192e9",
"score": "0.53642875",
"text": "def chart=(v); end",
"title": ""
},
{
"docid": "81598873e1e59791c750360d36e41b42",
"score": "0.53572416",
"text": "def initialise_var\n @debut_periode = 1946\n @fin_periode = 2003\n @dataset_choisi = \"\"\n @datasets2 = Dataset.find(:all)\n @datasets = ActiveRecord::Base.connection.select_all(\n \"Select data_set_full_name, id from datasets order by id\")\n \n # la liste des datasets disponibles pour le select html\n @dat = Array.new()\n @dat[0] = ['Please choose a dataset', '0']\n i= 1 \n for @d in @datasets\n option = Array.new()\n option[0] = @d['data_set_full_name']\n option[1] = @d['id']\n @dat[i] = option\n i += 1\n end\n end",
"title": ""
},
{
"docid": "9d2b5606f5e2c2841c6f6ca5620acb8d",
"score": "0.53521913",
"text": "def index\n if choice_hash = get_selected_status_core\n clean_choice_hash = {}\n @view_mode = choice_hash[:view_mode]\n\n choice_hash.each do |key, value|\n clean_choice_hash[key] = value if !value.nil? && value != \"\" && key != :view_mode\n end\n @selected_data = Core.where(clean_choice_hash)\n else # choice_hash is nil\n @selected_data = Core.all\n end\n\n # @cores = @selected_data.filter(filtering_params(params)).limit(20)\n # @cores_limited = @selected_data.limit(20)\n @selected_data = @selected_data.order(updated_at: :desc)\n @cores = @selected_data.filter(filtering_params(params)).paginate(:page => params[:page], :per_page => 20)\n @cores_count = Core.count\n @selected_core_count = @selected_data.count\n\n cores_csv = @selected_data.order(:sfdc_id)\n respond_to do |format|\n format.html\n format.csv { render text: cores_csv.to_csv }\n end\n\n # Checkbox - Deprecated!\n # batch_status\n end",
"title": ""
},
{
"docid": "753bd8d610789a7d0939dbda47b7c6c9",
"score": "0.5341937",
"text": "def selections; end",
"title": ""
},
{
"docid": "04e70ce14dbfe1386659821c389ecf10",
"score": "0.5341072",
"text": "def create\n if session[:user_id].nil?\n redirect_to root_path and return\n end\n\n xaxis_all = params[:xaxis].split(\",\")\n\n # 棒グラフ\n if params[:chart_cat] == 'bar'\n\n check_on = params[:check_on].keys\n check_no = Array.new()\n check_on.each do |check|\n check_no.push(check.gsub('no','').to_i)\n end \n\n case params[:radios_bar]\n \n # 商談・査定・試乗\n when 'chart_3s' then\n fseries1_all = params[:fseries1].split(\",\")\n fseries2_all = params[:fseries2].split(\",\")\n fseries3_all = params[:fseries3].split(\",\")\n xaxis = Array.new()\n fseries1 = Array.new()\n fseries2 = Array.new()\n fseries3 = Array.new()\n check_no.each do |no|\n xaxis.push(xaxis_all[no])\n fseries1.push(fseries1_all[no])\n fseries2.push(fseries2_all[no])\n fseries3.push(fseries3_all[no])\n end\n @chart = LazyHighCharts::HighChart.new(\"graph\") do |f|\n f.title(:text => \"商談・査定・試乗 件数\")\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => xaxis)\n f.series(:name => \"商談\", :yAxis => 0, :data => fseries1.map(&:to_i), :dataLabels => {enabled:true}, :dataLabels => {enabled:true})\n f.series(:name => \"査定\", :yAxis => 0, :data => fseries2.map(&:to_i), :dataLabels => {enabled:true}, :dataLabels => {enabled:true})\n f.series(:name => \"試乗\", :yAxis => 0, :data => fseries3.map(&:to_i), :dataLabels => {enabled:true}, :dataLabels => {enabled:true}) \n f.yAxis [\n {:title => {:text => \"件数\", :margin => 5} },\n ]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:defaultSeriesType=>\"column\", :height => 560, :width => 1170)\n end\n # 新車車 受注・登録台数/計画進度\n when 'chart_newcar' then\n fseries1_all = params[:fseries_pl_newcar].split(\",\")\n fseries2_all = params[:fseries_newcar].split(\",\")\n fseries3_all = params[:fseries_percentage_newcar].split(\",\")\n fseries4_all = params[:fseries_registration].split(\",\")\n fseries5_all = params[:fseries_percentage_registration].split(\",\")\n xaxis = Array.new()\n fseries1 = Array.new()\n fseries2 = Array.new()\n fseries3 = Array.new()\n fseries4 = Array.new()\n fseries5 = Array.new()\n check_no.each do |no|\n xaxis.push(xaxis_all[no])\n fseries1.push(fseries1_all[no])\n fseries2.push(fseries2_all[no])\n fseries3.push(fseries3_all[no])\n fseries4.push(fseries4_all[no])\n fseries5.push(fseries5_all[no])\n end\n #受注進度の平均\n t=0.0\n fseries3.each do |i|\n t+=i.to_f\n end\n avg_newcar = t/fseries3.size\n #登録進度の平均\n t=0.0\n fseries5.each do |i|\n t+=i.to_f\n end\n avg_registration = t/fseries5.size\n @chart = LazyHighCharts::HighChart.new(\"graph\") do |f|\n f.title(:text => \"新車 受注・登録台数、計画進度\")\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => xaxis)\n f.series(:name => \"計画\", :yAxis => 0, :data => fseries1.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"受注\", :yAxis => 0, :data => fseries2.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"登録\", :yAxis => 0, :data => fseries4.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"受注進度\", :yAxis => 1, :data => fseries3.map(&:to_f), :dataLabels => {enabled:true}, :type => \"line\")\n f.series(:name => \"登録進度\", :yAxis => 1, :data => fseries5.map(&:to_f), :dataLabels => {enabled:true}, :type => \"line\")\n# f.options[:yAxis] = [{ title: { text: '台数' }}, { title: { text: '進度%'}, opposite: true}]\n f.options[:yAxis] = [{ title: { text: '台数' }}, { title: { text: '進度%'}, opposite: true, \n plotLines: [{color: 'red', dashStyle: 'ShortDash', label: {text: '受注進度', align: 'right', style: {color: 'red', fontWeight: 'bold'}}, value: avg_newcar, width: 1, id: 'plotline_newcar'}, \n {id: 'plotline_registration',color: 'blue', dashStyle: 'ShortDash',label: {text: '登録進度', align: 'right', style: {color: 'blue', fontWeight: 'bold'}}, value: avg_registration, width: 1}] }]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:height => '560', :width => 1170)\n end\n # 中古車 受注・登録台数/計画進度\n when 'chart_usedcar' then\n fseries1_all = params[:fseries_pl_usedcar].split(\",\")\n fseries2_all = params[:fseries_usedcar].split(\",\")\n fseries3_all = params[:fseries_percentage_usedcar].split(\",\")\n xaxis = Array.new()\n fseries1 = Array.new()\n fseries2 = Array.new()\n fseries3 = Array.new()\n check_no.each do |no|\n xaxis.push(xaxis_all[no])\n fseries1.push(fseries1_all[no])\n fseries2.push(fseries2_all[no])\n fseries3.push(fseries3_all[no])\n end\n #受注進度の平均\n t=0.0\n fseries3.each do |i|\n t+=i.to_f\n end\n avg_usedcar = t/fseries3.size\n @chart = LazyHighCharts::HighChart.new(\"graph\") do |f|\n f.title(:text => \"中古車 受注登録台数、受注進度\")\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => xaxis)\n f.series(:name => \"計画\", :yAxis => 0, :data => fseries1.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"受注\", :yAxis => 0, :data => fseries2.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"受注進度\", :yAxis => 1, :data => fseries3.map(&:to_f), :dataLabels => {enabled:true}, :type => \"line\")\n f.options[:yAxis] = [{ title: { text: '台数' }}, { title: { text: '進度%'}, opposite: true,\n plotLines: [{color: 'red', dashStyle: 'ShortDash', label: {text: '', align: 'right', style: {color: 'red', fontWeight: 'bold'}}, value: avg_usedcar, width: 1, id: 'plotline_usedcar'}]}]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:height => '560', :width => 1170)\n end\n # 【初回1ヶ月点検】実施台数\n when 'chart_onemonth' then\n fseries1_all = params[:fseries_pl_onemonth].split(\",\")\n fseries2_all = params[:fseries_onemonth].split(\",\")\n xaxis = Array.new()\n fseries1 = Array.new()\n fseries2 = Array.new()\n check_no.each do |no|\n xaxis.push(xaxis_all[no])\n fseries1.push(fseries1_all[no])\n fseries2.push(fseries2_all[no])\n end\n @chart = LazyHighCharts::HighChart.new(\"graph\") do |f|\n f.title(:text => \"初回1ヶ月点検 実施台数\")\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => xaxis)\n f.series(:name => \"対象\", :yAxis => 0, :data => fseries1.map(&:to_i), :dataLabels => {enabled:true})\n f.series(:name => \"実施\", :yAxis => 0, :data => fseries2.map(&:to_i), :dataLabels => {enabled:true})\n f.yAxis [\n {:title => {:text => \"台数\", :margin => 5} },\n ]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:defaultSeriesType=>\"column\", :height => 560, :width => 1170)\n end\n # 【初回6ヶ月点検】実施台数\n when 'chart_sixmonth' then\n fseries1_all = params[:fseries_pl_sixmonth].split(\",\")\n fseries2_all = params[:fseries_sixmonth].split(\",\")\n xaxis = Array.new()\n fseries1 = Array.new()\n fseries2 = Array.new()\n check_no.each do |no|\n xaxis.push(xaxis_all[no])\n fseries1.push(fseries1_all[no])\n fseries2.push(fseries2_all[no])\n end\n @chart = LazyHighCharts::HighChart.new(\"graph\") do |f|\n f.title(:text => \"初回6ヶ月点検 実施台数\")\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => xaxis)\n f.series(:name => \"対象\", :yAxis => 0, :data => fseries1.map(&:to_i), :dataLabels => {enabled:true})\n f.series(:name => \"実施\", :yAxis => 0, :data => fseries2.map(&:to_i), :dataLabels => {enabled:true})\n f.yAxis [\n {:title => {:text => \"台数\", :margin => 5} },\n ]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:defaultSeriesType=>\"column\", :height => 560, :width => 1170)\n end\n # 【12ヶ月・24ヶ月点検】実施台数/実施率\n when 'chart_years' then\n fseries1_all = params[:fseries_pl_years].split(\",\")\n fseries2_all = params[:fseries_years].split(\",\")\n fseries3_all = params[:fseries_years_not].split(\",\")\n fseries4_all = params[:fseries_percentage_all_years].split(\",\")\n xaxis = Array.new()\n fseries1 = Array.new()\n fseries2 = Array.new()\n fseries3 = Array.new()\n fseries4 = Array.new()\n check_no.each do |no|\n xaxis.push(xaxis_all[no])\n fseries1.push(fseries1_all[no])\n fseries2.push(fseries2_all[no])\n fseries3.push(fseries3_all[no])\n fseries4.push(fseries4_all[no])\n end\n #実施率の平均\n t=0.0\n fseries4.each do |i|\n t+=i.to_f\n end\n avg_year = t/fseries4.size\n @chart = LazyHighCharts::HighChart.new(\"graph\") do |f|\n f.title(:text => \"12ヶ月・24ヶ月点検 実施台数、実施率\")\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => xaxis)\n f.series(:name => \"対象\", :yAxis => 0, :data => fseries1.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"実施\", :yAxis => 0, :data => fseries2.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"対象外実施\", :yAxis => 0, :data => fseries3.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"実施率\", :yAxis => 1, :data => fseries4.map(&:to_f), :dataLabels => {enabled:true}, :type => \"line\")\n f.options[:yAxis] = [{ title: { text: '台数' }}, { title: { text: '実施率%'}, opposite: true,\n plotLines: [{color: 'red', dashStyle: 'ShortDash', label: {text: '', align: 'right', style: {color: 'red', fontWeight: 'bold'}}, value: avg_year, width: 1, id: 'plotline_year'}]}]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:height => '560', :width => 1170)\n end\n # 【車検】実施台数/実施率\n when 'chart_inspection' then\n fseries1_all = params[:fseries_pl_inspection].split(\",\")\n fseries2_all = params[:fseries_inspection].split(\",\")\n fseries3_all = params[:fseries_inspection_not].split(\",\")\n fseries4_all = params[:fseries_percentage_all_inspection].split(\",\")\n xaxis = Array.new()\n fseries1 = Array.new()\n fseries2 = Array.new()\n fseries3 = Array.new()\n fseries4 = Array.new()\n check_no.each do |no|\n xaxis.push(xaxis_all[no])\n fseries1.push(fseries1_all[no])\n fseries2.push(fseries2_all[no])\n fseries3.push(fseries3_all[no])\n fseries4.push(fseries4_all[no])\n end\n #実施率の平均\n t=0.0\n fseries4.each do |i|\n t+=i.to_f\n end\n avg_inspection = t/fseries4.size\n @chart = LazyHighCharts::HighChart.new(\"graph\") do |f|\n f.title(:text => \"【車検】実施台数、実施率\")\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => xaxis)\n f.series(:name => \"対象\", :yAxis => 0, :data => fseries1.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"実施\", :yAxis => 0, :data => fseries2.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"対象外実施\", :yAxis => 0, :data => fseries3.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"実施率\", :yAxis => 1, :data => fseries4.map(&:to_f), :dataLabels => {enabled:true}, :type => \"line\")\n f.options[:yAxis] = [{ title: { text: '台数' }}, { title: { text: '実施率%'}, opposite: true,\n plotLines: [{color: 'red', dashStyle: 'ShortDash', label: {text: '', align: 'right', style: {color: 'red', fontWeight: 'bold'}}, value: avg_inspection, width: 1, id: 'plotline_inspection'}]}]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:height => '560', :width => 1170)\n end\n # 【任意保険】件数/継続率\n when 'chart_insurance' then\n fseries1_all = params[:fseries_insurance_new].split(\",\")\n fseries2_all = params[:fseries_pl_insurance].split(\",\")\n fseries3_all = params[:fseries_insurance_renew].split(\",\")\n fseries4_all = params[:fseries_percentage_insurance_renew].split(\",\")\n xaxis = Array.new()\n fseries1 = Array.new()\n fseries2 = Array.new()\n fseries3 = Array.new()\n fseries4 = Array.new()\n check_no.each do |no|\n xaxis.push(xaxis_all[no])\n fseries1.push(fseries1_all[no])\n fseries2.push(fseries2_all[no])\n fseries3.push(fseries3_all[no])\n fseries4.push(fseries4_all[no])\n end\n #継続率の平均\n t=0.0\n fseries4.each do |i|\n t+=i.to_f\n end\n avg_insurance = t/fseries4.size\n @chart = LazyHighCharts::HighChart.new(\"graph\") do |f|\n f.title(:text => \"任意保険 件数、継続率\")\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => xaxis)\n f.series(:name => \"新規\", :yAxis => 0, :data => fseries1.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"継続対象\", :yAxis => 0, :data => fseries2.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"継続\", :yAxis => 0, :data => fseries3.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"継続率\", :yAxis => 1, :data => fseries4.map(&:to_f), :dataLabels => {enabled:true}, :type => \"line\")\n f.options[:yAxis] = [{ title: { text: '件数' }}, { title: { text: '継続率%'}, opposite: true,\n plotLines: [{color: 'red', dashStyle: 'ShortDash', label: {text: '', align: 'right', style: {color: 'red', fontWeight: 'bold'}}, value: avg_insurance, width: 1, id: 'plotline_insurance'}]}]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:height => '560', :width => 1170)\n end\n # 【新車】台数、売上額・粗利\n when 'chart_profit_of_newcar' then\n fseries1_all = params[:fseries_number_of_newcar].split(\",\")\n fseries2_all = params[:fseries_profit_of_newcar].split(\",\")\n fseries3_all = params[:fseries_sales_of_newcar].split(\",\")\n xaxis = Array.new()\n fseries1 = Array.new()\n fseries2 = Array.new()\n fseries3 = Array.new()\n check_no.each do |no|\n xaxis.push(xaxis_all[no])\n fseries1.push(fseries1_all[no])\n fseries2.push(fseries2_all[no])\n fseries3.push(fseries3_all[no])\n end\n @chart = LazyHighCharts::HighChart.new(\"graph\") do |f|\n f.title(:text => \"新車 売上台数、売上額・粗利額\")\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => xaxis)\n f.series(:name => \"売上額\", :yAxis => 0, :data => fseries3.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"粗利額\", :yAxis => 0, :data => fseries2.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"台数\", :yAxis => 0, :data => fseries1.map(&:to_i), :dataLabels => {enabled:true}, :type => \"line\", :yAxis => 1)\n f.options[:yAxis] = [{ title: { text: '金額' }}, { title: { text: '台数'}, opposite: true}]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:height => '560', :width => 1170)\n end\n # 【中古車】台数/粗利\n when 'chart_profit_of_usedcar' then\n fseries1_all = params[:fseries_number_of_usedcar].split(\",\")\n fseries2_all = params[:fseries_profit_of_usedcar].split(\",\")\n fseries3_all = params[:fseries_sales_of_usedcar].split(\",\")\n xaxis = Array.new()\n fseries1 = Array.new()\n fseries2 = Array.new()\n fseries3 = Array.new()\n check_no.each do |no|\n xaxis.push(xaxis_all[no])\n fseries1.push(fseries1_all[no])\n fseries2.push(fseries2_all[no])\n fseries3.push(fseries3_all[no])\n end\n @chart = LazyHighCharts::HighChart.new(\"graph\") do |f|\n f.title(:text => \"中古車 売上台数、売上額・粗利額\")\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => xaxis)\n f.series(:name => \"売上額\", :yAxis => 0, :data => fseries3.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"粗利額\", :yAxis => 0, :data => fseries2.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"台数\", :yAxis => 0, :data => fseries1.map(&:to_i), :dataLabels => {enabled:true}, :type => \"line\", :yAxis => 1)\n f.options[:yAxis] = [{ title: { text: '金額' }}, { title: { text: '台数'}, opposite: true}]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:height => '560', :width => 1170)\n end\n # 【サービス】台数/粗利\n when 'chart_profit_of_service' then\n fseries1_all = params[:fseries_number_of_service].split(\",\")\n fseries2_all = params[:fseries_profit_of_service].split(\",\")\n fseries3_all = params[:fseries_sales_of_service].split(\",\")\n xaxis = Array.new()\n fseries1 = Array.new()\n fseries2 = Array.new()\n fseries3 = Array.new()\n check_no.each do |no|\n xaxis.push(xaxis_all[no])\n fseries1.push(fseries1_all[no])\n fseries2.push(fseries2_all[no])\n fseries3.push(fseries3_all[no])\n end\n @chart = LazyHighCharts::HighChart.new(\"graph\") do |f|\n f.title(:text => \"サービス 入庫台数、売上額・粗利額\")\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => xaxis)\n f.series(:name => \"売上額\", :yAxis => 0, :data => fseries3.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"粗利額\", :yAxis => 0, :data => fseries2.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"台数\", :yAxis => 0, :data => fseries1.map(&:to_i), :dataLabels => {enabled:true}, :type => \"line\", :yAxis => 1)\n f.options[:yAxis] = [{ title: { text: '金額' }}, { title: { text: '台数'}, opposite: true}]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:height => '560', :width => 1170)\n end\n # 【総粗利】金額\n when 'chart_profit_of_all' then\n fseries1_all = params[:fseries_profit_of_all].split(\",\")\n fseries2_all = params[:fseries_sales_of_all].split(\",\")\n fseries3_all = params[:fseries_percentage_profit_of_all].split(\",\")\n xaxis = Array.new()\n fseries1 = Array.new()\n fseries2 = Array.new()\n fseries3 = Array.new()\n check_no.each do |no|\n xaxis.push(xaxis_all[no])\n fseries1.push(fseries1_all[no])\n fseries2.push(fseries2_all[no])\n fseries3.push(fseries3_all[no])\n end\n #利益率の平均\n t=0.0\n fseries3.each do |i|\n t+=i.to_f\n end\n avg_profit = t/fseries3.size\n @chart = LazyHighCharts::HighChart.new(\"graph\") do |f|\n f.title(:text => \"総売上額・粗利額、総利益率\")\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => xaxis)\n f.series(:name => \"売上額\", :yAxis => 0, :data => fseries2.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"粗利額\", :yAxis => 0, :data => fseries1.map(&:to_i), :dataLabels => {enabled:true}, :type => \"column\")\n f.series(:name => \"利益率\", :yAxis => 1, :data => fseries3.map(&:to_f), :dataLabels => {enabled:true}, :type => \"line\")\n f.options[:yAxis] = [{ title: { text: '金額(千円)' }}, { title: { text: '利益率%'}, opposite: true,\n plotLines: [{color: 'red', dashStyle: 'ShortDash', label: {text: '', align: 'right', style: {color: 'red', fontWeight: 'bold'}}, value: avg_profit, width: 1, id: 'plotline_profit'}]}]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:height => '560', :width => 1170)\n end\n else\n logger.debug(\"else\")\n end\n end\n\n # 折れ線グラフ\n if params[:chart_cat] == 'line'\n\n categories_all = params[:categories].split(\",\")\n categories = Array.new()\n i = 0\n categories_all.each do |cat|\n categories.push(categories_all[i])\n i += 1\n end\n\n case params[:radios_line]\n # 【顧客】契約台数推移\n when 'customer' then\n # 対象データ存在チェック\n if params[:check_on_customer].nil? \n redirect_to charts_path, :notice => \"1件以上データを選択してください。\"\n return\n end\n\n check_on = params[:check_on_customer].keys\n check_no = Array.new()\n check_on.each do |check|\n check_no.push(check.gsub('no','').to_i)\n end \n data_all = params[:fseries_customer_all].split(\"#\")\n data = Array.new()\n xaxis = Array.new()\n check_no.each do |no|\n data.push(data_all[no].split(\",\"))\n xaxis.push(xaxis_all[no])\n end\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(text: '管理内台数')\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => categories)\n num = 0\n while num < xaxis.length do\n f.series(:name => xaxis[num], :data => data[num].map(&:to_i), :dataLabels => {enabled:true})\n num += 1\n end\n f.yAxis [{:title => {:text => \"台数\", :margin => 5} },]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:height => '560', :width => 1170)\n end\n\n # 【新車】受注台数推移\n when 'percentage_newcar' then\n # 対象データ存在チェック\n if params[:check_on_percentage_newcar].nil? \n redirect_to charts_path, :notice => \"1件以上データを選択してください。\"\n return\n end\n\n check_on = params[:check_on_percentage_newcar].keys\n check_no = Array.new()\n check_on.each do |check|\n check_no.push(check.gsub('no','').to_i)\n end \n data_all = params[:fseries_percentage_newcar_all].split(\"#\")\n data = Array.new()\n xaxis = Array.new()\n check_no.each do |no|\n data.push(data_all[no].split(\",\"))\n xaxis.push(xaxis_all[no])\n end\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(text: '新車 受注台数')\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => categories)\n num = 0\n while num < xaxis.length do\n f.series(:name => xaxis[num], :data => data[num].map(&:to_f), :dataLabels => {enabled:true}, :type => \"column\")\n num += 1\n end\n f.yAxis [{:title => {:text => \"受注台数\", :margin => 5} },]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:height => '560', :width => 1170)\n end\n\n # 【新車】登録台数\n when 'percentage_registration' then\n # 対象データ存在チェック\n if params[:check_on_percentage_registration].nil? \n redirect_to charts_path, :notice => \"1件以上データを選択してください。\"\n return\n end\n\n check_on = params[:check_on_percentage_registration].keys\n check_no = Array.new()\n check_on.each do |check|\n check_no.push(check.gsub('no','').to_i)\n end \n data_all = params[:fseries_percentage_registration_all].split(\"#\")\n data = Array.new()\n xaxis = Array.new()\n check_no.each do |no|\n data.push(data_all[no].split(\",\"))\n xaxis.push(xaxis_all[no])\n end\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(text: '新車 登録台数')\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => categories)\n num = 0\n while num < xaxis.length do\n f.series(:name => xaxis[num], :data => data[num].map(&:to_f), :dataLabels => {enabled:true}, :type => \"column\")\n num += 1\n end\n f.yAxis [{:title => {:text => \"登録台数\", :margin => 5} },]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:height => '560', :width => 1170)\n end\n\n # 【中古車】受注台数\n when 'percentage_usedcar' then\n # 対象データ存在チェック\n if params[:check_on_percentage_usedcar].nil? \n redirect_to charts_path, :notice => \"1件以上データを選択してください。\"\n return\n end\n\n check_on = params[:check_on_percentage_usedcar].keys\n check_no = Array.new()\n check_on.each do |check|\n check_no.push(check.gsub('no','').to_i)\n end \n data_all = params[:fseries_percentage_usedcar_all].split(\"#\")\n data = Array.new()\n xaxis = Array.new()\n check_no.each do |no|\n data.push(data_all[no].split(\",\"))\n xaxis.push(xaxis_all[no])\n end\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(text: '中古車 受注台数')\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => categories)\n num = 0\n while num < xaxis.length do\n f.series(:name => xaxis[num], :data => data[num].map(&:to_f), :dataLabels => {enabled:true})\n num += 1\n end\n f.yAxis [{:title => {:text => \"受注台数\", :margin => 5} },]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:height => '560', :width => 1170)\n end\n\n # 【12点検・24点検】実施率推移\n when 'percentage_years' then\n # 対象データ存在チェック\n if params[:check_on_percentage_years].nil? \n redirect_to charts_path, :notice => \"1件以上データを選択してください。\"\n return\n end\n\n check_on = params[:check_on_percentage_years].keys\n check_no = Array.new()\n check_on.each do |check|\n check_no.push(check.gsub('no','').to_i)\n end \n data_all = params[:fseries_percentage_years_all].split(\"#\")\n data = Array.new()\n xaxis = Array.new()\n check_no.each do |no|\n data.push(data_all[no].split(\",\"))\n xaxis.push(xaxis_all[no])\n end\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(text: '12点検・24点検 実施率')\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => categories)\n num = 0\n while num < xaxis.length do\n f.series(:name => xaxis[num], :data => data[num].map(&:to_f), :dataLabels => {enabled:true})\n num += 1\n end\n f.yAxis [{:title => {:text => \"実施率%\", :margin => 5} },]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:height => '560', :width => 1170)\n end\n\n # 【車検】実施率推移\n when 'percentage_inspection' then\n # 対象データ存在チェック\n if params[:check_on_percentage_inspection].nil? \n redirect_to charts_path, :notice => \"1件以上データを選択してください。\"\n return\n end\n\n check_on = params[:check_on_percentage_inspection].keys\n check_no = Array.new()\n check_on.each do |check|\n check_no.push(check.gsub('no','').to_i)\n end \n data_all = params[:fseries_percentage_inspection_all].split(\"#\")\n data = Array.new()\n xaxis = Array.new()\n check_no.each do |no|\n data.push(data_all[no].split(\",\"))\n xaxis.push(xaxis_all[no])\n end\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(text: '車検 実施率')\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => categories)\n num = 0\n while num < xaxis.length do\n f.series(:name => xaxis[num], :data => data[num].map(&:to_f), :dataLabels => {enabled:true})\n num += 1\n end\n f.yAxis [{:title => {:text => \"実施率%\", :margin => 5} },]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:height => '560', :width => 1170)\n end\n\n # 【任意保険】新規件数\n when 'percentage_insurance_renew' then\n # 対象データ存在チェック\n if params[:check_on_percentage_insurance_renew].nil? \n redirect_to charts_path, :notice => \"1件以上データを選択してください。\"\n return\n end\n\n check_on = params[:check_on_percentage_insurance_renew].keys\n check_no = Array.new()\n check_on.each do |check|\n check_no.push(check.gsub('no','').to_i)\n end \n data_all = params[:fseries_percentage_insurance_renew_all].split(\"#\")\n data = Array.new()\n xaxis = Array.new()\n check_no.each do |no|\n data.push(data_all[no].split(\",\"))\n xaxis.push(xaxis_all[no])\n end\n @chart = LazyHighCharts::HighChart.new('graph') do |f|\n f.title(text: '任意保険 新規件数')\n f.subtitle(text: params[:subtitle])\n f.xAxis(:categories => categories)\n num = 0\n while num < xaxis.length do\n f.series(:name => xaxis[num], :data => data[num].map(&:to_f), :dataLabels => {enabled:true})\n num += 1\n end\n f.yAxis [{:title => {:text => \"新規件数\", :margin => 5} },]\n f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)\n f.chart(:height => '560', :width => 1170)\n end\n\n else\n logger.debug(\"else\")\n end\n end\n\n end",
"title": ""
},
{
"docid": "510b1114649d788e08aa8d4461f56b8f",
"score": "0.53409207",
"text": "def selectbox_collection_items\n @vehicle_devices = VehicleDevice.all\n @lines = Line.all\n end",
"title": ""
},
{
"docid": "c71a8be944fb89ab77a17fd4c16f7193",
"score": "0.53266394",
"text": "def update_values\n end",
"title": ""
},
{
"docid": "c71a8be944fb89ab77a17fd4c16f7193",
"score": "0.53266394",
"text": "def update_values\n end",
"title": ""
},
{
"docid": "c71a8be944fb89ab77a17fd4c16f7193",
"score": "0.53266394",
"text": "def update_values\n end",
"title": ""
},
{
"docid": "c71a8be944fb89ab77a17fd4c16f7193",
"score": "0.53266394",
"text": "def update_values\n end",
"title": ""
},
{
"docid": "c71a8be944fb89ab77a17fd4c16f7193",
"score": "0.53266394",
"text": "def update_values\n end",
"title": ""
},
{
"docid": "4fe83c11c1653415e0e376d1e9092c55",
"score": "0.5317037",
"text": "def index\n @rice1s = Rice1.all\n @size = {\n height: '220',\n width: '220'\n }\n @data = {\n labels: [\"#{Rice1.first.month} / #{Rice1.first.year}\", \"#{Rice1.second.month} / #{Rice1.second.year}\", \"#{Rice1.third.month} / #{Rice1.third.year}\"],\n datasets: [\n {\n label: \"sdfgdfs\",\n fillColor: \"rgba(220,220,20,0.2)\",\n strokeColor: \"RoyalBlue\",\n pointColor: \"LightSeaGreen\",\n pointStrokeColor: \"LightSeaGreen\",\n pointHighlightFill: \"LightSeaGreen\",\n pointHighlightStroke: \"LightSeaGreen\",\n data: [Rice1.first.price, Rice1.second.price, Rice1.third.price]\n },\n ]\n }.to_json\n @maturity = {\n labels: [\"#{Rice1.first.month} / #{Rice1.first.year}\", \"#{Rice1.second.month} / #{Rice1.second.year}\", \"#{Rice1.third.month} / #{Rice1.third.year}\"],\n datasets: [\n {\n label: \"sdfgdfs\",\n fillColor: \"rgba(220,220,20,0.2)\",\n strokeColor: \"RoyalBlue\",\n pointColor: \"LightSeaGreen\",\n pointStrokeColor: \"LightSeaGreen\",\n pointHighlightFill: \"LightSeaGreen\",\n pointHighlightStroke: \"LightSeaGreen\",\n data: [Rice1.first.maturity, Rice1.second.maturity, Rice1.third.maturity]\n },\n ]\n }.to_json \n end",
"title": ""
},
{
"docid": "e6288edeb585fcc52ea9435b2e91c7d0",
"score": "0.53112966",
"text": "def chart_chooser\n assert_privileges('utilization')\n unless params[:task_id] # Only do this first time thru\n @sb[:options][:chart_date] = params[:miq_date_1] if params[:miq_date_1]\n @sb[:options][:chart_date] = params[:miq_date_2] if params[:miq_date_2]\n @sb[:options][:days] = params[:details_days] if params[:details_days]\n @sb[:options][:days] = params[:report_days] if params[:report_days]\n @sb[:options][:days] = params[:summ_days] if params[:summ_days]\n @sb[:options][:tz] = params[:details_tz] if params[:details_tz]\n @sb[:options][:tz] = params[:report_tz] if params[:report_tz]\n @sb[:options][:tz] = params[:summ_tz] if params[:summ_tz]\n @sb[:options][:tag] = params[:details_tag] == \"<None>\" ? nil : params[:details_tag] if params[:details_tag]\n @sb[:options][:tag] = params[:report_tag] == \"<None>\" ? nil : params[:report_tag] if params[:report_tag]\n @sb[:options][:tag] = params[:summ_tag] == \"<None>\" ? nil : params[:summ_tag] if params[:summ_tag]\n @sb[:options][:index] = params[:chart_idx] == \"clear\" ? nil : params[:chart_idx] if params[:chart_idx]\n if params.key?(:details_time_profile) || params.key?(:report_time_profile) || params.key?(:summ_time_profile)\n @sb[:options][:time_profile] = params[:details_time_profile].blank? ? nil : params[:details_time_profile].to_i if params.key?(:details_time_profile)\n @sb[:options][:time_profile] = params[:report_time_profile].blank? ? nil : params[:report_time_profile].to_i if params.key?(:report_time_profile)\n @sb[:options][:time_profile] = params[:summ_time_profile].blank? ? nil : params[:summ_time_profile].to_i if params.key?(:summ_time_profile)\n tp = TimeProfile.find(@sb[:options][:time_profile]) if @sb[:options][:time_profile].present?\n @sb[:options][:time_profile_tz] = @sb[:options][:time_profile].blank? ? nil : tp.tz\n @sb[:options][:time_profile_days] = @sb[:options][:time_profile].blank? ? nil : tp.days\n end\n end\n if x_node != \"\"\n get_node_info(x_node, \"n\")\n perf_util_daily_gen_data(\"n\")\n end\n @right_cell_text ||= _(\"Utilization Summary\")\n replace_right_cell(@nodetype) unless @waiting # Draw right side if task is done\n end",
"title": ""
},
{
"docid": "94e0a1ec9db064c1e63051f077337b45",
"score": "0.53036094",
"text": "def chart=(v) DataTypeValidator.validate \"Series.chart\", Chart, v; @chart = v; end",
"title": ""
},
{
"docid": "a8c2bd942027365769e02fdee8889c3a",
"score": "0.52970743",
"text": "def get_prices_for_select_from_bar\n @prices = []\n unless params[:id].blank?\n bar = Bar.find(params[:id])\n @prices = bar.prices\n end\n render :partial => \"shared/prices\"\n end",
"title": ""
},
{
"docid": "3790fcbc7cc10f338a79da3203aab35e",
"score": "0.52916425",
"text": "def index\n @scales_scalevalues = ScalesScalevalue.all\n end",
"title": ""
},
{
"docid": "eb3b026c7a3a9d80cfa5d8562b212465",
"score": "0.52915",
"text": "def get_selects_info\n @nuage_versions = NuageVersion.all\n @ha_models = HaModel.all\n @verticals = Vertical.all\n @qty_ranges = QtyRange.all\n @revenues = Revenue.all\n @regions = Region.all\n @cmss = CloudManagementSystem.all\n end",
"title": ""
},
{
"docid": "e5c33e6cd3e286377ac250e523e34461",
"score": "0.5290929",
"text": "def getPicklistValues\n\t\t\n\t\t\t\t\treturn @picklistValues\n\t\t\t\n\t\t\t\tend",
"title": ""
},
{
"docid": "64d77aade8c034ffe7ba0a95b78c9b2c",
"score": "0.5279898",
"text": "def graph3\n @booksbyyear = GraphFormSql::ChartGem.getdata(\"select count(*) c,year from books b left join authors a on a.id=b.author_id group by year order by year\" )\n @topauthors = GraphFormSql::ChartGem.getdata(\"select count(*) c ,author_id,fio from books b left join authors a on a.id=b.author_id group by b.author_id order by c desc limit 10\")\n @authoravarge = GraphFormSql::ChartGem.getdata(\"select avg(a.c) c ,a.author_id,a.fio from\n ( select count(*) c ,author_id ,fio , year from books b left join authors a on a.id=b.author_id group by b.author_id,year ) a group by a.author_id\")\n @booksbyauthor = GraphFormSql::ChartGem.getdata(\"select count(*) c ,author_id,fio from books b left join authors a on a.id=b.author_id group by b.author_id\")\n\n end",
"title": ""
},
{
"docid": "da9e3ad94ebceb8fdbb37d13ea4496d5",
"score": "0.52755135",
"text": "def obtainDataValues(indic)\n \n # Retrieve the measures for this date range\n mesures = Mesure.\n joins('as m inner join journees as j on m.journee_id = j.id').\n select('date, temps, valeur').\n where(\"indicateur = :indic and date >= :minDate and date <= :endDate\", \n {:indic => indic, :minDate => @minDate.to_formatted_s(:db), :endDate => @maxDate.to_formatted_s(:db)})\n \n # If no data, then no valeurs and no graph\n return if mesures.empty?\n \n # Creer la liste des valeurs.\n # 'x' est le temps en seconde, 'y' est la valeur mesuree.\n mesures.each do |m|\n x = m.temps.to_i\n y = m.valeur\n @xyPairs << [x, y]\n end\n @xyPairs.sort! { | x, y | x[0] <=> y[0] }\n end",
"title": ""
},
{
"docid": "0ffee01175c1d5a79a1cbc4ce467a88a",
"score": "0.527095",
"text": "def index\n\n @line_chart_jans = LineChart.where(:month_name => \"January\")\n @line_chart_febs = LineChart.where(:month_name => \"February\")\n @line_chart_mars = LineChart.where(:month_name => \"March\")\n @line_chart_aprs = LineChart.where(:month_name => \"April\")\n @line_chart_mays = LineChart.where(:month_name => \"May\")\n @line_chart_juns = LineChart.where(:month_name => \"June\")\n @line_chart_juls = LineChart.where(:month_name => \"July\")\n @line_chart_augs = LineChart.where(:month_name => \"August\")\n @line_chart_seps = LineChart.where(:month_name => \"September\")\n @line_chart_octs = LineChart.where(:month_name => \"October\")\n @line_chart_novs = LineChart.where(:month_name => \"November\")\n @line_chart_decs = LineChart.where(:month_name => \"December\")\n\n\n end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
},
{
"docid": "69768ace328ed4e595fbcb17d9035356",
"score": "0.5270395",
"text": "def values; end",
"title": ""
}
] |
fb5bb511b47ed3f9aad531700569eae8 | will have its ID validates :price_paid, :numericality => true | [
{
"docid": "98ff6102ebfae2b21e94dc69ebcddbae",
"score": "0.0",
"text": "def user_id_session\n return :no_such_item\n end",
"title": ""
}
] | [
{
"docid": "b8861faba340bac0f30436c5ece21e15",
"score": "0.65261173",
"text": "def save_paid\r\n self.paid = calc_paid\r\n self.save\r\n end",
"title": ""
},
{
"docid": "fd4c7f3535492d89669835e8f401b038",
"score": "0.6260754",
"text": "def save!\n if self.price_id.blank?\n return false unless validates_required_attr\n new_save(\"addprice\")\n else\n new_save(\"changeprice\")\n end\n end",
"title": ""
},
{
"docid": "8b9b7db23394e43d39ce57a4e7da68c4",
"score": "0.6197361",
"text": "def paid?\n id % 2 == 0\n end",
"title": ""
},
{
"docid": "835319dc798411198661223c62f3e1ba",
"score": "0.6194789",
"text": "def check_paid\n self.paid_amount = 0\n self.paid = false\n payments.each do |payment|\n self.paid_amount += payment.amount\n end\n\n if self.paid_amount - self.gross_amount >= 0\n self.paid = true\n end\n end",
"title": ""
},
{
"docid": "d7c81d4062a64ad0bb9d0dcd8e71bcda",
"score": "0.6150454",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "d7c81d4062a64ad0bb9d0dcd8e71bcda",
"score": "0.6150454",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "d7c81d4062a64ad0bb9d0dcd8e71bcda",
"score": "0.6150454",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "d7c81d4062a64ad0bb9d0dcd8e71bcda",
"score": "0.6150454",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "662f786d525f8eb19aa7773d66d8bd38",
"score": "0.612731",
"text": "def get_amount_paid\n if paid? then price\n else amount_paid\n end\n end",
"title": ""
},
{
"docid": "087987e51875913dfb084c4c24b4b34e",
"score": "0.6117866",
"text": "def validate_price\n @price / @frontend_price * 100.0 >= 99.0\n end",
"title": ""
},
{
"docid": "53dcb101673c0272fd37844e522b1a06",
"score": "0.6107666",
"text": "def paid_enough?\n errors.add(:paid,'You don\\'t paid enough') unless self.product.value <= self.total_paid\n end",
"title": ""
},
{
"docid": "621d706694e8d7c4fd953ed20c984d43",
"score": "0.604457",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "621d706694e8d7c4fd953ed20c984d43",
"score": "0.604457",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "621d706694e8d7c4fd953ed20c984d43",
"score": "0.604457",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "621d706694e8d7c4fd953ed20c984d43",
"score": "0.604457",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "621d706694e8d7c4fd953ed20c984d43",
"score": "0.604457",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "621d706694e8d7c4fd953ed20c984d43",
"score": "0.604457",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "621d706694e8d7c4fd953ed20c984d43",
"score": "0.604457",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "621d706694e8d7c4fd953ed20c984d43",
"score": "0.604457",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "621d706694e8d7c4fd953ed20c984d43",
"score": "0.604457",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "621d706694e8d7c4fd953ed20c984d43",
"score": "0.604457",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "621d706694e8d7c4fd953ed20c984d43",
"score": "0.604457",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "621d706694e8d7c4fd953ed20c984d43",
"score": "0.604457",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "621d706694e8d7c4fd953ed20c984d43",
"score": "0.604457",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "4520ee35697cc0f3a2a228bad88251b2",
"score": "0.5995923",
"text": "def validate_amount\n amount = sale.total_amount\n sales_id = sale.id\n sale_penalty = sale.penalty\n total_payment = 0\n total_amount_sale = amount + sale_penalty\n payments_query = Payment.where(sale_id: sales_id)\n payments_query.each do |payment|\n total_payment += payment.amount\n end\n if total_payment == total_amount_sale\n sale.customer.update(state: \"sinDeuda\")\n sale.pago!\n else\n unless sale.customer.state == \"conDeuda\"\n sale.customer.update(state: \"conDeuda\")\n end\n end\n end",
"title": ""
},
{
"docid": "411c94308761bdea2a6158b87d1db9df",
"score": "0.598296",
"text": "def get_amount_paid\n paid? ? price : (amount_paid || 0.to_d)\n end",
"title": ""
},
{
"docid": "5f91f92f4622ec555be8c5e7df416991",
"score": "0.5966395",
"text": "def price_id_useful?()\n return false\n end",
"title": ""
},
{
"docid": "d72a0dd2799d449a1fa2e0df63e472bc",
"score": "0.5950389",
"text": "def set_paid!\n if set_paid\n self.save\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "66fcd9d44519be8568ea60822506b87c",
"score": "0.5935902",
"text": "def set_i_price\n @i_price = IPrice.find(params[:id])\n end",
"title": ""
},
{
"docid": "0b980381dc3b37a538bc41fae3bde52a",
"score": "0.592052",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "0b980381dc3b37a538bc41fae3bde52a",
"score": "0.592052",
"text": "def set_price\n @price = Price.find(params[:id])\n end",
"title": ""
},
{
"docid": "109a465a8989b12080c83a1e1a1a4319",
"score": "0.5887812",
"text": "def set_pricing\n @pricing = Pricing.find(params[:id])\n end",
"title": ""
},
{
"docid": "109a465a8989b12080c83a1e1a1a4319",
"score": "0.5887812",
"text": "def set_pricing\n @pricing = Pricing.find(params[:id])\n end",
"title": ""
},
{
"docid": "a73d874be041729c55a6bbd53fe09f04",
"score": "0.5881312",
"text": "def set_price_rule\n @price_rule = PriceRule.find(params[:id])\n end",
"title": ""
},
{
"docid": "a73d874be041729c55a6bbd53fe09f04",
"score": "0.5881312",
"text": "def set_price_rule\n @price_rule = PriceRule.find(params[:id])\n end",
"title": ""
},
{
"docid": "a73d874be041729c55a6bbd53fe09f04",
"score": "0.5881312",
"text": "def set_price_rule\n @price_rule = PriceRule.find(params[:id])\n end",
"title": ""
},
{
"docid": "779063ff8d6928113cdca5f89ef29f0f",
"score": "0.5872952",
"text": "def permit_price_params\n params.require(:permit_price).permit(:price, :permit_id)\n end",
"title": ""
},
{
"docid": "bfc7e0159a91df0e4eee78c1dcb92771",
"score": "0.5869032",
"text": "def set_permit_price\n @permit_price = PermitPrice.find(params[:id])\n end",
"title": ""
},
{
"docid": "8fb7c7ce1637d2d4e32fb6a96b7ba1d2",
"score": "0.5867046",
"text": "def valid_products_number()\n \n end",
"title": ""
},
{
"docid": "b480189cf733814c4100549d0442f8c3",
"score": "0.5864419",
"text": "def set_create_price\n @create_price = CreatePrice.find(params[:id])\n end",
"title": ""
},
{
"docid": "073bc6e881d5b3b65f34c2ac46694f74",
"score": "0.5839765",
"text": "def set_amounts\n super\n self.check_paid\n paid_amount_will_change!\n nil\n end",
"title": ""
},
{
"docid": "011a5b16144fee2f644fbe2bb082f17d",
"score": "0.5828073",
"text": "def update\n params[:quoted_price][:oil_price] = 1 unless params[:quoted_price][:oil_price].strip.match(/^\\d+$/)\n @quoted_price = QuotedPrice.find(params[:id])\n respond_to do |format|\n if @quoted_price.update_attributes(params[:quoted_price])\n flash[:success] = \"恭喜,报价表修改完成\"\n format.html { redirect_to admin_quoted_prices_path }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"title": ""
},
{
"docid": "acaf8210e31799df42e582dc13248603",
"score": "0.5825105",
"text": "def paid\n self.update(cost: 0)\n \n end",
"title": ""
},
{
"docid": "0db35eaab86dcf6c68846071f10731d6",
"score": "0.58240616",
"text": "def update_product_price\n\n \tif @old_price != unitprice && @old_price != 0\n \t\t#price = ProductPrices.new (product_id: id, old_price: @old_price, new_price: unitprice, user_id: current_user.id)\n \t\tprice = ProductPrices.new\n \t\tprice.product_id = id\n \t\tprice.old_price = @old_price\n \t\tprice.new_price = unitprice\n \t\t#price.user_id = current_user.id\n \t\tprice.save\n \tend\n end",
"title": ""
},
{
"docid": "07e89330c2a17524ecef76a6d60a770c",
"score": "0.5806984",
"text": "def price\n return if params[:id].nil?\n @price = product.prices.find(params[:id])\n end",
"title": ""
},
{
"docid": "275cca0e65723f16f307fa90bdf23fc7",
"score": "0.58025426",
"text": "def hpp_selling_price\n errors.add(:selling_price, \"should be greater than hpp or not empty\") if selling_price == nil || selling_price.present? && hpp.to_f > selling_price.to_f && selling_price!=0\n end",
"title": ""
},
{
"docid": "0f75608b529ae4239803b5a9787ec058",
"score": "0.58019894",
"text": "def set_crypto_price\n @crypto_price = CryptoPrice.find(params[:id])\n end",
"title": ""
},
{
"docid": "1cf8717fcddddccafa6bbc7a73137217",
"score": "0.5798544",
"text": "def set_paid\n if not draft and (unpaid_amount > 0 and not paid)\n payments << Payment.new(date: Date.current, amount: unpaid_amount)\n check_paid\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "ed8ffa26dbcc3344649e7ffc161dd891",
"score": "0.57860684",
"text": "def set_price_earning\n @price_earning = PriceEarning.find(params[:id])\n end",
"title": ""
},
{
"docid": "6536912015f83ffdc16288f369264c0a",
"score": "0.5776546",
"text": "def pay(amount)\n return false unless active?\n self.total_payed = amount.to_s.gsub(/[^\\d]/,\"\").to_i + total_payed.to_i\n self.save\n end",
"title": ""
},
{
"docid": "b4704aaba8989f0c43749a6665a0bf43",
"score": "0.5768519",
"text": "def paid!\n self.state = STATES.key(:paid).to_i\n self.save!\n end",
"title": ""
},
{
"docid": "aff4b13f0825acb1205af467d9ace997",
"score": "0.5766445",
"text": "def set_item_price\n @item_price = ItemPrice.find(params[:id])\n end",
"title": ""
},
{
"docid": "a11d37638c78b4be1ea5f100fbd52f6f",
"score": "0.57598794",
"text": "def update_paid\n self.check_paid\n # Use update_columns to skip more callbacks\n self.update_columns(paid: self.paid, paid_amount: self.paid_amount)\n end",
"title": ""
},
{
"docid": "7b8e34f4b6eaeab22a9b2c7fe896d9c5",
"score": "0.5752749",
"text": "def validate_payment\n payment = @current_user.ordered_payments.find(params[:id]) rescue nil\n !payment.blank?\n end",
"title": ""
},
{
"docid": "178620379c0350a6f5b648d8613ae1c5",
"score": "0.5743545",
"text": "def check_price_instance_var; end",
"title": ""
},
{
"docid": "10c228df95494c38a6d4c204aaa81f88",
"score": "0.5732488",
"text": "def set_itemPrice\r\n @itemPrice = ItemPrice.find(params[:id])\r\n end",
"title": ""
},
{
"docid": "d571a5904be2a4d2c898bcea95ed8cff",
"score": "0.5727373",
"text": "def set_service_price\n @service_price = ServicePrice.find(params[:id])\n end",
"title": ""
},
{
"docid": "8c3bdfba363a6474ade57511c074ddfa",
"score": "0.5707545",
"text": "def verify_paid\n @paid = true\n end",
"title": ""
},
{
"docid": "b13d3861c248337ffe76045cd986b538",
"score": "0.5704122",
"text": "def id=(value)\n oldID = @id\n @id = value\n @pp = [@pp,self.totalpp].min if oldID>0\n end",
"title": ""
},
{
"docid": "84b44659340b7cc4d62776e93a1baf67",
"score": "0.57039475",
"text": "def paid\n if params[:event_user][:paid_total].present? && params[:event_user][:paid_total].to_f\n paid_total_cents = params[:event_user][:paid_total].to_f * 100.0 - @event_user.paid_total_cents\n if paid_total_cents < 0\n paid_total_cents = nil\n if params[:event_user][:paid_total].to_f < 0\n @error_message = \"Enter a positive number.\"\n else\n paid_total_cents = params[:event_user][:paid_total].to_f * 100.0 - @event_user.paid_total_cents\n end\n elsif (!@event.fundraiser? && (params[:event_user][:paid_total].to_f * 100.0) > @event.split_amount_cents)\n @error_message = \"Enter an amount less than the required event amount.\"\n end\n else\n paid_total_cents = nil\n end\n\n if !@error_message\n if params[:event_user][:paid_total].to_f > 0\n if paid_total_cents < 0\n @event_user.unpay_cash_payments!\n @event_user.reload\n payment = @event_user.create_payment(amount_cents: params[:event_user][:paid_total].to_f * 100.0)\n else\n payment = @event_user.create_payment(amount_cents: paid_total_cents)\n end\n\n @event_user.pay!(payment)\n @event_user.update_attributes(accepted_invite: true)\n else params[:event_user][:paid_total].to_f == 0\n @event_user.unpay_cash_payments!\n @event_user.set_to_zero!\n end\n end\n\n respond_to do |format|\n format.js\n format.html { redirect_to admin_event_path(@event) }\n end\n end",
"title": ""
},
{
"docid": "ffc8fe607548fee7e6276af741e03fa7",
"score": "0.5682627",
"text": "def set_product_price\n @product_price = ProductPrice.find(params[:id])\n end",
"title": ""
},
{
"docid": "54083859b6c820e44e9807b0cb73b7f4",
"score": "0.5678626",
"text": "def validate\n price_cents <= 0 ? raise(InvalidProductPriceCents) : true\n end",
"title": ""
},
{
"docid": "1a66be4dab9224ecd2823b828773bfe1",
"score": "0.56769",
"text": "def validate_amount\n raise InvalidAmount unless @price.amount.is_a? Numeric\n end",
"title": ""
},
{
"docid": "2319a98d671bf25cc25d8cd8bf521392",
"score": "0.56643003",
"text": "def set_primary_fee\n @primary_fee = PrimaryFee.find(params[:id])\n end",
"title": ""
},
{
"docid": "2b702e04b5196bf117cbc68d717c4aa8",
"score": "0.5654104",
"text": "def set_modelprice\n @modelprice = Modelprice.find(params[:id])\n end",
"title": ""
},
{
"docid": "8be566ffc855d0729c2dad2e49793000",
"score": "0.5652054",
"text": "def create\n inv_params = invoice_params.merge(:total_amount => (invoice_params[\"amount\"].to_d/\n Conversion.find_by_sql([\"SELECT * FROM conversions where conversions.currency_id = ? and \n conversions.date <= ? order by conversions.date asc\", invoice_params[\"currency_id\"], \n Date.new(invoice_params[\"date(1i)\"].to_i,invoice_params[\"date(2i)\"].to_i,invoice_params[\"date(3i)\"].to_i)])[0][\"conversion_rate\"]).round(2))\n\n @invoice = Invoice.new(inv_params)\n @pricing = Pricing.find_by_sql([\"SELECT * FROM pricings where pricings.client_id = ? \n and pricings.DATETIME <= ? order by pricings.DATETIME desc\", @invoice.client_id, @invoice.date ]) \n if @pricing[0].PaymentDelay != nil and invoice_params[\"ddate(1i)\"].to_i == Date.new(2000,1,1).year and \n invoice_params[\"ddate(2i)\"].to_i == Date.new(2000,1,1).month and invoice_params[\"ddate(3i)\"].to_i == Date.new(2000,1,1).day\n @invoice.write_attribute(:ddate, @invoice.date+@pricing[0].PaymentDelay)\n end\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to action: \"index\" }\n #format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n #format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "661ace37418187c4b7b12e29cc32818d",
"score": "0.5649824",
"text": "def paid?\n payments_total >= calculate_total_amount\n end",
"title": ""
},
{
"docid": "102139145633ffe02ce27b0501f1155a",
"score": "0.56469",
"text": "def set_spare_price\n @spare_price = SparePrice.find(params[:id])\n end",
"title": ""
},
{
"docid": "66e83cef8443196c984db1626f34f541",
"score": "0.5645009",
"text": "def set_competitor_price\n @competitor_price = CompetitorPrice.find(params[:id])\n end",
"title": ""
},
{
"docid": "66e83cef8443196c984db1626f34f541",
"score": "0.5645009",
"text": "def set_competitor_price\n @competitor_price = CompetitorPrice.find(params[:id])\n end",
"title": ""
},
{
"docid": "78d2bfe18e9bc8e0938caf32f00108c0",
"score": "0.562738",
"text": "def set_currencyprice\n @currencyprice = Currencyprice.find(params[:id])\n end",
"title": ""
},
{
"docid": "27ea25c78df4d6c8fd4b22f58d1f4c90",
"score": "0.56235045",
"text": "def set_Paid(value)\n set_input(\"Paid\", value)\n end",
"title": ""
},
{
"docid": "8878b4cd2c95123feba91a28b8b3fae1",
"score": "0.5622355",
"text": "def make_purchase_by_id(selected_game_id) \n game = Game.find_by(id: selected_game_id)\n if self.balance - game.price >= 0\n Purchase.create(:game => game, :user => self)# :price => game.price\n self.balance -= game.price\n puts \"Purchase Complete!\" #1\n puts \"Your balance is now #{self.balance}.\"\n else\n return \"Insufficient Funds.\"#2\n end\n end",
"title": ""
},
{
"docid": "72fe2f32cedd27c26e77b36f2c574116",
"score": "0.5608819",
"text": "def price\n raise NotImplementedError, 'Redefine this method in your billing model.'\n end",
"title": ""
},
{
"docid": "353ece910ce06e9e67331f9ad51249d9",
"score": "0.56072307",
"text": "def create\n if price_params[:salon_id].to_i == current_user.control.to_i or current_user.control.to_i == 0\n @price = Price.new(price_params)\n respond_to do |format|\n if @price.save\n update_services(@price)\n format.html { redirect_to :back, notice: '<b>' + @price.service.name + '</b> was successfully created.'}\n format.json { render :show, status: :created, location: @price }\n else\n format.html { render :back }\n format.json { render json: @price.errors, status: :unprocessable_entity }\n end\n end\n else\n flash[:alert] = t(\"no_right_to_do_that\")\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "ed54500c7e23a7a7818db9bb6947abe4",
"score": "0.56066555",
"text": "def set_invoice_payment_status\n\n invoice_cost = invoice.total_cost\n paid_amount = invoice.paid_amount\n\n if paid_amount >= invoice_cost\n invoice.paid!\n else\n invoice.partially_paid!\n end\n\n end",
"title": ""
},
{
"docid": "fa819fd0ecadcc28e38dfbe5b467ce19",
"score": "0.5604735",
"text": "def is_paid?\n false\n end",
"title": ""
},
{
"docid": "1120fee49953b5324abb42ecf0ceb7b9",
"score": "0.56013674",
"text": "def check_product\n product.company_id = invoice.company_id\n product.updated_by = invoice.user_id\n product.created_by ||= invoice.user_id\n product.net_price ||= price_per_unit\n product.iva_aliquot ||= self.iva_aliquot\n product.measurement_unit ||= measurement_unit\n product.active = false unless product.persisted? || product.tipo != \"Servicio\"\n\n begin\n iva_percentage = Float(Afip::ALIC_IVA.map{|k,v| v if k == iva_aliquot}.compact[0])\n rescue => error\n iva_percentage = 0\n end\n product.price ||= price_per_unit * (1 + iva_percentage)\n product.save unless product.persisted?\n end",
"title": ""
},
{
"docid": "23461ad33c1e156b801807facca262ac",
"score": "0.5600257",
"text": "def set_price_record\n @price_record = PriceRecord.find(params[:id])\n end",
"title": ""
},
{
"docid": "568825b172bc2ca86b62ef39aab7ea05",
"score": "0.55994695",
"text": "def pay\n\t\tself.update paid_amount: self.amount, payed: true\n\tend",
"title": ""
},
{
"docid": "fd30b91dea1da7501ee4de010ce98e66",
"score": "0.5596614",
"text": "def update\n price = @purchase.price-params[:price].to_i\n if(price<0)\n price = 0\n end\n respond_to do |format|\n if @purchase.update(price: price)\n format.html { redirect_to @purchase, notice: 'Purchase was successfully updated.' }\n format.json { render :show, status: :ok, location: @purchase }\n else\n format.html { render :edit }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n @user = User.find(@purchase.user_id)\n @money_amount = User.sum_purchases_of_user_by_email(@user.email)\n @user.update(money_amount: @money_amount)\n end",
"title": ""
},
{
"docid": "eea715daf014536bc8baad8d7470ff81",
"score": "0.55912244",
"text": "def create\n @payment = Payment.new(params[:payment])\n @invoice = Invoice.find(params[:invoice_id])\n @payment.invoice_id = params[:invoice_id]\n if (@payment.amount).to_d == @invoice.amount_left_to_pay then\n @invoice.maksettu = true\n else\n if (@invoice.payments.sum(:amount)).to_d + @payment.amount == (@invoice.summa).to_d\n @invoice.maksettu = true\n elsif @invoice.payments.sum(:amount).to_d + @payment.amount.to_d > @invoice.summa.to_d\n flash[:alert] = 'MAKSOIT LIIKAA! HÄHÄHÄHÄÄ! RAHASI MENIVÄT LIMBOON!'\n @invoice.maksettu = true\n end\n\n end\n\n respond_to do |format|\n if @payment.save && @invoice.save\n format.html { redirect_to invoice_payments_url(@invoice), notice: 'Payment was successfully created.' }\n format.json { render json: @payment, status: :created, location: @payment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b3f5d3bb755ee77600031999d7b22c1e",
"score": "0.5590112",
"text": "def price_params\n params.require(:price).permit(:price, :salon_id, :service_id)\n end",
"title": ""
},
{
"docid": "c6c294b7605f4e9331a5ad0b52b9f8b1",
"score": "0.5583591",
"text": "def set_price_update\n @price_update = PriceUpdate.find(params[:id])\n end",
"title": ""
},
{
"docid": "fe7ab848f1769311b3a1d2fd25810904",
"score": "0.5578612",
"text": "def pay\n @expense = Expense.find(params[:expense_id])\n \n if (@expense.update_attributes(:paid => true))\n return render :json=> {:success => true, :message => \"expense paid successfully\"}\n else\n return render :json=> {:success => false, :message => \"expense paid unsuccessfully\"}\n end\n end",
"title": ""
},
{
"docid": "17adabb6e7e14087f3826851c8483c8a",
"score": "0.55710495",
"text": "def valid_price?(price)\r\n Security::StringChecker.is_numeric?(price) && price.to_i > 0\r\n end",
"title": ""
},
{
"docid": "a7317cf4f03dc62181d12247d79f5670",
"score": "0.55705625",
"text": "def mark_paid!\n Invoice.transaction do\n if update_product?\n reservation.update_attribute(:amount_paid, reservation.price)\n end\n update_attribute(:is_paid, true)\n end\n end",
"title": ""
},
{
"docid": "4028aa331fa5083944df91a8c0ddbc15",
"score": "0.55671954",
"text": "def test_validate_presence_of_payid\n payer = Payer.new(:payer => \"Payer without Payid\")\n assert_equal(false, payer.save, \"Payer ID can't be blank!\")\n end",
"title": ""
},
{
"docid": "522a9981ba112d56f5941f6d3b30747f",
"score": "0.55658513",
"text": "def markpaid(amount)\n pay = Donation.last(:amount => amount)\n pay.paid = true\n pay.save\nend",
"title": ""
},
{
"docid": "522a9981ba112d56f5941f6d3b30747f",
"score": "0.55658513",
"text": "def markpaid(amount)\n pay = Donation.last(:amount => amount)\n pay.paid = true\n pay.save\nend",
"title": ""
},
{
"docid": "83cb286c801d3e04949265d5c1e5f3ee",
"score": "0.55612534",
"text": "def order_paid? order_id\n order = Spree::Order.find_by_number(order_id)\n return order.paid?\n end",
"title": ""
},
{
"docid": "28cd8dc4593e1aba4ea1097ca2539b84",
"score": "0.5559789",
"text": "def create_price\n Stripe::Price.create(\n product: @product, \n unit_amount: @money, \n currency: \"TRY\"\n )\n end",
"title": ""
},
{
"docid": "f9626c72425916b7dbe1e6269ebf4887",
"score": "0.5548329",
"text": "def pricing_name_id\n self.pricing_name_id.try :id\n end",
"title": ""
},
{
"docid": "6e2d769dc4f7066e24c1baefeb9837ae",
"score": "0.55465984",
"text": "def recount_paid_upto payment_id\n payment = Payment.find(payment_id)\n new_date = self.paid_upto.to_time + ((payment.amount.to_f / self.plan.price_per_day).floor + 1).days\n self.update_attribute(:paid_upto, new_date)\n rescue\n false\n end",
"title": ""
},
{
"docid": "85522c41a3ae9b613b7431e3065ae9eb",
"score": "0.5545564",
"text": "def paid?\n \ttrue\n end",
"title": ""
},
{
"docid": "84c1c290f2541bc5e074deec62db9fb4",
"score": "0.5537265",
"text": "def is_paid=(value)\n @is_paid = value\n end",
"title": ""
},
{
"docid": "32984765357e1ae50af8ae936705c651",
"score": "0.55322474",
"text": "def invoice_valid?(invoice)\n invoice && invoice.send(\"#{@@payment_class_name.underscore}_id\").blank? && invoice.paid_at.blank?\n end",
"title": ""
},
{
"docid": "7ccc6dcf0496fb2ac635651a17aad874",
"score": "0.55301917",
"text": "def validate_price\n\n\t\t\t# Not basic step => no validation\n\t\t\tif !self.confirmation_step?\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\t# If condition has some meaning\n\t\t\tif self.delivery_map_zone && self.delivery_map_zone.order_below_min_price != true && !self.min_price.nil?\n\t\t\t\t\t\n\t\t\t\t# Compare basic and minimal price\n\t\t\t\tif self.basic_price.to_i < self.min_price.to_i && self.override_min_price != true\n\t\t\t\t\terrors.add(:override_min_price, I18n.t(\"activerecord.errors.models.#{RicEshop.order_model.model_name.i18n_key}.attributes.override_min_price.blank\"))\n\t\t\t\tend\n\n\t\t\tend\n\n\t\tend",
"title": ""
},
{
"docid": "85d8b0fd5d8e0aba961eee10975b151e",
"score": "0.55243385",
"text": "def set_pricing_item\n @pricing_item = PricingItem.find(params[:id])\n end",
"title": ""
},
{
"docid": "1ddaf06c78a9490ddf94e38875dd7d5d",
"score": "0.55222565",
"text": "def set_stripe_id\n price = Stripe::Price.create({\n unit_amount: amount,\n currency: \"usd\",\n product: \"prod_EP0UOHa0sNeorA\",\n # product: 'prod_Kyu7StID0XtS7W'\n\n })\n self.stripe_id = price.id\n end",
"title": ""
},
{
"docid": "9938febf99d5ffec98e79afa378479de",
"score": "0.55184793",
"text": "def paid\n @order = Order.last\n #@order = Order.find(params[:id])\n #@order.update_attribute(:status, 'Order Paid')\n @order.update_attribute(:status, 'Paid with PayPal')\n end",
"title": ""
}
] |
51d0c5e6714e0b105db9bd3d8e2813d5 | Pair Product? Define a boolean method, pair_product?, that accepts two arguments: an array of integers and a target_product (an integer). The method returns a boolean indicating whether any pair of elements in the array multiplied together equals that product. You cannot multiply an element by itself. An element on its own is not a product. | [
{
"docid": "c9b97f14ec3b016d450ea2406450c13d",
"score": "0.84679914",
"text": "def pair_product?(arr, target_product)\n arr.combination(2).map {|pair| pair.reduce(:*)}.include?(target_product)\n\nend",
"title": ""
}
] | [
{
"docid": "56247bc00e51dcf2b85ba6598132401f",
"score": "0.8806622",
"text": "def pair_product?(arr, target_product)\n\nend",
"title": ""
},
{
"docid": "1a109ccba6a3daacf5080b91ecb4ecb8",
"score": "0.88057125",
"text": "def pair_product?(arr, target_product)\n arr.map do |num|\n num.map do |item|\n return true if num * item == target_product\n false\n end\n end\nend",
"title": ""
},
{
"docid": "253d605a461c169a39c7c6cc93446846",
"score": "0.8802725",
"text": "def pair_product?(arr, target)\r\n\r\nend",
"title": ""
},
{
"docid": "e24ae5058ae61a2e49cae55f92c6d58e",
"score": "0.87389976",
"text": "def pair_product?(arr, target_product)\n arr.each_with_index do |el1, idx1|\n arr.each_with_index do |el2, idx2|\n next if idx1 == idx2\n return true if el1 * el2 == target_product\n end\n end\n\n false\nend",
"title": ""
},
{
"docid": "1fe213d307848d3baec136e7c87d327a",
"score": "0.8714091",
"text": "def pair_product?(arr, target_product)\n# => 1 line with map reduce\n#\tarr.combination(2).map{|pair| pair.reduce(:*)}.include?target_product\n\tls = []\n\ti = 0\n\twhile i < arr.length\n\t\tj = i + 1\n\t\t\twhile arr.length > j\n\t\t\t\tls << arr[i] * arr[j]\n\t\t\t\tj += 1\n\t\t\tend\n\t\ti += 1\n\tend\n\treturn ls.include?(target_product)\nend",
"title": ""
},
{
"docid": "878388841cdb204f0816ff5cd1b83f3b",
"score": "0.85640675",
"text": "def pair_product?(arr, target_product)\n \n i = 0\n while i < arr.length - 1\n j = i + 1\n while j < arr.length\n if arr[i] * arr[j] == target_product\n return true \n end\n j += 1\n end \n i += 1\n end\n \n false\n \n arr.combination(2).any? {|a,b| a*b == target_product}\n # !!combo.detect {|a,b| a*b == target_product}\nend",
"title": ""
},
{
"docid": "dbe58caa90d20dbbd116686f1b3d7db0",
"score": "0.8560212",
"text": "def pair_product?(arr, target_product)\n\n idx1 = 0\n while idx1 < arr.length\n idx2 = idx1 + 1\n while idx2 < arr.length\n if arr[idx1] * arr[idx2] == target_product\n return true\n end\n idx2 += 1\n end\n idx1 += 1\n end\n\n return false\n\nend",
"title": ""
},
{
"docid": "2a79c8e559bbbc418528bb97cfe8ab28",
"score": "0.8474164",
"text": "def pair_product?(arr, target_product)\n i = 0\n\n while i < arr.length\n j = i + 1\n while j < arr.length\n if arr[i] * arr[j] == target_product\n return true\n end\n j += 1\n end\n i += 1\n end\n\n false\nend",
"title": ""
},
{
"docid": "218dccf31dccabbf9363edc156609e7c",
"score": "0.8453648",
"text": "def pair_product?(arr, target_product)\n prods = []\n\n i = 0\n while i < arr.length\n j = i + 1\n while j < arr.length\n prods << arr[i] * arr[j] unless prods.include?(arr[i] * arr[j])\n j += 1\n end\n i +=1\n end\n prods.include?(target_product)\nend",
"title": ""
},
{
"docid": "03f4774aa30d046d8d42352a4b922deb",
"score": "0.83871007",
"text": "def pair_product?(arr, target_product)\n\n i = 0\n while i < arr.length\n\n j = i+1\n while j < arr.length\n\n if arr[i]*arr[j] == target_product\n return true\n else\n return false\n end\n\n j += 1\n end\n\n i += 1\n end\nend",
"title": ""
},
{
"docid": "2e49fb13ed64529c745a0dbfb6c1aafe",
"score": "0.83455706",
"text": "def pair_product?(arr, target_product)\n # Nested loop\n arr.each_with_index do |el1, idx1|\n arr.each_with_index do |el2, idx2| \n if idx2 > idx1\n if el1 * el2 == target_product\n return true\n # else # will return false the first time, every time. (unless the first pair is the correct one)\n # return false\n end\n end\n end\n end\n return false\nend",
"title": ""
},
{
"docid": "76e383a808d36286ea9cb6d4be701148",
"score": "0.8312475",
"text": "def pair_product(arr, product)\n (0...arr.length).each do |idx1|\n (idx1+1...arr.length).each do |idx2|\n return true if arr[idx1] * arr[idx2] == product\n end\n end\n false\nend",
"title": ""
},
{
"docid": "0c0f18741d7c1fe178573d7e6c756f86",
"score": "0.82872605",
"text": "def pair_product?(arr, target_product)\n\n\t# iterate through the array\n\t\tarr.each_index do |index|\n\n\t# exclude current index\n\t\t\tindex_out = arr[0...index] + arr[index+1..-1]\n\n\t# for each index, check if target_product / element exists in array\n\t return true if index_out.include?(target_product/arr[index])\n\n\t\tend\n\tfalse\nend",
"title": ""
},
{
"docid": "8bab63457eb3e7f6caa64d601f6fed47",
"score": "0.81879514",
"text": "def pair_product(arr, target)\n arr.each.with_index do |num1, idx1|\n arr.each.with_index do |num2, idx2|\n if idx2 > idx1\n if num1 * num2 == target\n return true\n end\n end\n end\n end\n return false\nend",
"title": ""
},
{
"docid": "72b3da205e7d1da781b8b4901fb3b80c",
"score": "0.81788164",
"text": "def pair_product(array, product)\n array.combination(2).to_a.any? { |pair| pair.inject(:*) == product }\nend",
"title": ""
},
{
"docid": "89d7906c9c797b2bb587069070903d32",
"score": "0.81172085",
"text": "def pair_product(arr, product)\n (0...arr.length).each do |i|\n (i...arr.length).each do |j|\n return true if j > i && arr[i] * arr[j] == product \n end\n end\n false\nend",
"title": ""
},
{
"docid": "1a67bb5b61e08c1f16ce83fecc0844b8",
"score": "0.81018895",
"text": "def pair_product(arr, target)\n i = 0\n while i < arr.length\n j = 0\n while j < arr.length\n if j > i\n if arr[i] * arr[j] == target\n return true\n end\n end\n j += 1\n end\n i += 1\n end\n return false\nend",
"title": ""
},
{
"docid": "4a483551dfa5a7b8c524cd52a1aea2c7",
"score": "0.8051201",
"text": "def pair_product(array, product)\n (0...array.length).each do |i|\n (i+1...array.length).each do |j|\n if array[i] * array[j] == product\n return true\n end\n end\n end\n false\nend",
"title": ""
},
{
"docid": "d3228c583401bec8fa59642fb076b17b",
"score": "0.8047593",
"text": "def pair_product(array, product)\n array.each_with_index do |el_1, ind_1|\n array.each_with_index do |el_2, ind_2|\n return true if (ind_2 > ind_1) && (el_1 * el_2 == product)\n end\n end\n false\nend",
"title": ""
},
{
"docid": "2d1678e75aece82825b600d582fa16e7",
"score": "0.8001545",
"text": "def pair_product(array, product)\n array.each_with_index do |num1, ind1|\n array.each_with_index do |num2, ind2|\n if ind1 < ind2\n return true if num1 * num2 == product\n end\n end\n end\n return false\nend",
"title": ""
},
{
"docid": "6226c988b99602ec4c909d14f7a1e524",
"score": "0.79671484",
"text": "def pair_product(arr, product)\n (0...arr.length-1).each do |start_i|\n (start_i+1...arr.length).each do |end_i|\n if arr[start_i] * arr[end_i] == product\n return true\n end \n end \n end \n false\nend",
"title": ""
},
{
"docid": "91706421275857ac4ba509317361728a",
"score": "0.7964795",
"text": "def pair_product(arr, prod)\n arr.each_with_index do |num_1, idx_1|\n (idx_1 + 1...arr.length).each do |idx_2|\n num_2 = arr[idx_2]\n return true if num_1 * num_2 == prod\n end\n end\n false\nend",
"title": ""
},
{
"docid": "d899db08e84b19f8346efc459bcc7d07",
"score": "0.7956049",
"text": "def pair_product(numbers, product)\n numbers.each_with_index do |ele_1, idx1|\n numbers.each_with_index do |ele_2, idx2|\n if idx2 > idx1\n return true if ele_1 * ele_2 == product\n end\n end\n end\n false\nend",
"title": ""
},
{
"docid": "a143f03dccef027ae876c9d11322d394",
"score": "0.7935816",
"text": "def pair_product(numbers, product)\n (0...numbers.length - 1).each do |i|\n (i+1...numbers.length).each do |j|\n return true if numbers[i] * numbers[j] == product\n end\n end\n\n false\nend",
"title": ""
},
{
"docid": "e27f1962f018904bba07530e722956ee",
"score": "0.790164",
"text": "def pair_product(arr, prod)\n\n (0...arr.length).any? do |i|\n (i+1...arr.length).any? { |j| arr[i] * arr[j] == prod }\n end\n\nend",
"title": ""
},
{
"docid": "b04b0883793cb6c19fbb0808147e527e",
"score": "0.7888329",
"text": "def pair_product(array, product)\n array.each_with_index do |elem1, idx1|\n array.each_with_index do |elem2, idx2|\n if (elem1 * elem2 == product) && (idx1 < idx2)\n return true \n end \n end\n end\n\n false\nend",
"title": ""
},
{
"docid": "0d9e3b9fa1ed568e94fa3b20e7db6c0b",
"score": "0.7872912",
"text": "def pair_product(num_arr, product)\n num_arr.each_with_index do |num_1, idx_1|\n num_arr.each_with_index do |num_2, idx_2| \n return true if num_1 * num_2 == product && idx_2 > idx_1\n end \n end\n false\nend",
"title": ""
},
{
"docid": "996514b7c971455d872602a0e8596960",
"score": "0.78682864",
"text": "def pair_product?(arr, target_product)\r\n\r\n i = 0\r\n while i < arr.length - 1\r\n\r\n subarray = arr[i + 1...arr.length]\r\n\r\n return true if subarray.include?(target_product/arr[i])\r\n\r\n i += 1\r\n end\r\n\r\n false\r\nend",
"title": ""
},
{
"docid": "26643fbb4a6ebec510c6d0508a2277f4",
"score": "0.7863903",
"text": "def pair_product(arr, product)\n arr.each_with_index do |num1, i1|\n arr.each_with_index do |num2, i2|\n if i2 > i1 && num1 * num2 == product\n return true\n end\n end\n end\n false\nend",
"title": ""
},
{
"docid": "d15ade16516aa447ddbe8410341b3b80",
"score": "0.7835865",
"text": "def pair_product(nums_array, pro)\n (0...nums_array.length).each do |idx_1|\n (idx_1+1...nums_array.length).each do |idx_2|\n if nums_array[idx_1] * nums_array[idx_2] == pro\n return true\n end\n end\n end\n false\nend",
"title": ""
},
{
"docid": "494e35018e6161eaf4190c9039389294",
"score": "0.78131324",
"text": "def pair_product(nums, product)\n nums.each_with_index do |num1, idx1|\n nums.each_with_index do |num2, idx2|\n if idx2 > idx1\n return true if num1 * num2 == product\n end\n end\n end\n false\nend",
"title": ""
},
{
"docid": "4f87e94419e2553ff626cdc4b9a25d06",
"score": "0.7797271",
"text": "def pair_product?(arr, target_product)\n\n i = 0\n while i < arr.length - 1\n\n subarray = arr[i + 1...arr.length]\n\n return true if subarray.include?(target_product/arr[i])\n\n i += 1\n end\n\n false\nend",
"title": ""
},
{
"docid": "0b3ee172162c084acda79bdd50a75f0b",
"score": "0.77961415",
"text": "def pair_product(numbers, product)\n numbers.each_with_index do |n1,idx1|\n numbers.each_with_index do |n2,idx2|\n if idx2 > idx1\n n1 * n2 == product ? ( return true ) : ()\n end\n end\n end\n false\nend",
"title": ""
},
{
"docid": "056886e94351ff218af5d95979c88233",
"score": "0.7754523",
"text": "def pair_product(arr, num)\n (0...arr.length - 1).each do |i|\n (i + 1...arr.length).each do |j|\n return true if arr[i] * arr[j] == num\n end\n end\n return false\n\nend",
"title": ""
},
{
"docid": "38d322158693ae2c0749e7a122348f15",
"score": "0.7743127",
"text": "def pair_product?(arr, target_product)\n # consider reading out all els from index[0] to index[-2] of the array given since we need to make a pair with each that we consider to read\n # iterate thru it making a forward-subarray each time\n # check if any of the subarray gives us a boolean 'true'\n # elsewise return 'false'\n i = 0\n while i < arr.length - 1 # index [-2]\n sub_arr = arr[i+1..-1] # exclude el and look forward, previous els not considered\n return true if sub_arr.include?(target_product/arr[i]) # gives a boolean 'true'\n i += 1\n end\n\n false\nend",
"title": ""
},
{
"docid": "b04f4d961bd1aeed4a193de21766980c",
"score": "0.7739955",
"text": "def pair_product?(arr, target_product)\n i = 0 \n j = 0 \n a = arr.pop\n #puts a \n loop do \n return false if i == arr.length \n return true if a * arr[i] == target_product\n i = i + 1 \n #puts arr\n end \n #loop do \n # return false if i == arr.length \n \n # a = arr[i]\n # i = i + 1 \n # arr2 \n # loop do \n \n # return true if a * arr2[j] == target_product\n # j = j+ 1\n # end \n #end\nend",
"title": ""
},
{
"docid": "d670f0e9fd0624f2a09b948913026889",
"score": "0.7730627",
"text": "def pair_product(numbers, product)\n numbers.each_with_index do |num_1, idx_1|\n numbers.each_with_index do |num_2, idx_2|\n if idx_2 > idx_1 && (num_1 * num_2) == product\n return true\n end\n end\n end\n false\nend",
"title": ""
},
{
"docid": "fa8e2b9acf24f0a9f685616f6194b438",
"score": "0.77044225",
"text": "def pair_product(array, num)\n array.each_index do |i1|\n array.each_index do |i2|\n if i2 > i1 && array[i1] * array[i2] == num\n return true\n end\n end\n end\n false\nend",
"title": ""
},
{
"docid": "1076dffdaa90beede7c3c1aa250d3c40",
"score": "0.76245487",
"text": "def pair_product(arr, num)\n # debugger\n (0..arr.length-2).each do |i|\n (i+1..arr.length-1).each do |el|\n return true if arr[i] * arr[el] == num\n end\n end\n return false\nend",
"title": ""
},
{
"docid": "e3330a3b624b733915c7b078b8db4601",
"score": "0.75666904",
"text": "def pair_product(arr, prod)\n arr.each_with_index do |i , idx1|\n arr.each_with_index do |j , idx2|\n if i * j == prod && idx1 < idx2\n return true\n end\n end\n\n end\n false\nend",
"title": ""
},
{
"docid": "0d04526965e194ffcbdab9d77a0488e6",
"score": "0.75414985",
"text": "def pair_product(arr, num)\n arr.each_with_index do |num1, idx1|\n arr.each_with_index do |num2, idx2|\n if idx2 > idx1 && num1 * num2 == num\n return true\n end\n end\n end\n return false\nend",
"title": ""
},
{
"docid": "cc0bbdbd930556981fdb8269e0833251",
"score": "0.74845517",
"text": "def pair_product(arr, target)\n good_pairs = []\n arr.each.with_index do |num1, idx1|\n arr.each.with_index do |num2, idx2|\n if idx2 > idx1 && num1 * num2 == target\n good_pairs << [num1, num2]\n end\n end\n end\n return good_pairs\nend",
"title": ""
},
{
"docid": "af6403401daec8514194cb4d38e7beef",
"score": "0.7479967",
"text": "def pair_product?(arr, num)\n\n counter = 1\n arr.each_with_index do |num1, idx1| \n arr.each_with_index do |num2, idx2|\n if idx1 > idx2\n return true if num1 * num2 == num\n end\n end\n end\n false\nend",
"title": ""
},
{
"docid": "e2fab30eeb5323e5ab87c6a38539a56a",
"score": "0.74443084",
"text": "def pair_product(arr, num)\n arr.each.with_index do |num1, idx1|\n arr.each.with_index do |num2, idx2|\n return true if num1 * num2 == num && idx1 < idx2\n end\n end\n false\nend",
"title": ""
},
{
"docid": "f75b64428903dc8e213f67ed96329b80",
"score": "0.7432724",
"text": "def pair_product(nums, pr)\r\n eq = false\r\n nums.each_index do |i|\r\n nums.each_index do |j|\r\n if j > i && nums[i]*nums[j] == pr\r\n eq = true\r\n end \r\n end\r\n end\r\n eq\r\nend",
"title": ""
},
{
"docid": "59a2acc9d018f9aacb804f887cdea05a",
"score": "0.7356588",
"text": "def pair_product(arr, target)\n product_arr = []\n arr.each.with_index do |el1, i1|\n arr.each.with_index do |el2, i2|\n if i1 < i2\n if el1 * el2 == target\n product_arr << [i1, i2]\n end\n end\n end\n end\n return product_arr\nend",
"title": ""
},
{
"docid": "c2187acb72354cd19b5a548cd21dfab4",
"score": "0.7220937",
"text": "def pair_product(arr, target)\n pairs = []\n i = 0\n while i < arr.length\n j = 0\n while j < arr.length\n if j > i\n if arr[i] * arr[j] == target\n pairs << [i, j]\n end\n end\n j += 1\n end\n i += 1\n end\n return pairs\nend",
"title": ""
},
{
"docid": "28a4670e0aa75013f0147d18fb41065d",
"score": "0.70792145",
"text": "def pair_product(arr, num)\n\n arr.each.with_index do |n, i| \n arr.each.with_index do |x, j|\n return true if j > i && n * x == num\n end\n end\n false\nend",
"title": ""
},
{
"docid": "46777ede24dd3a17776a850c07bfb661",
"score": "0.69325405",
"text": "def pair_product(numbers, product)\n #new_arr = []\n (0...numbers.length).each do |i|\n (i+1...numbers.length).each do |j|\n #new_arr << str[i..j]\n return true if numbers[i]*numbers[j] == product\n end\n end\n false\nend",
"title": ""
},
{
"docid": "fe9343e192ce782ae285cdf1a557ea23",
"score": "0.6843597",
"text": "def prod(array, product)\r\n result = []\r\n array.each { |val| array.each { |val2| result.push(val, val2) if val * val2 == product } }\r\n result.uniq\r\nend",
"title": ""
},
{
"docid": "2ff48e7df9d7eb4a069c841fea382c10",
"score": "0.67133445",
"text": "def pair_product(arr,product)\n hash=Hash.new(false)\n arr.each do |ele|\n return true if hash[ele]==true\n hash[product/ele]=true\n end\n false\nend",
"title": ""
},
{
"docid": "78a6749958ad884aeeff4ab94db9d310",
"score": "0.6662508",
"text": "def check_product?(array, n)\n # ADD YOUR CODE HERE\n return false unless array.combination(3).any?{|group| group.inject(:*)==n}\n true\nend",
"title": ""
},
{
"docid": "00f6888fe0c01999d12931c9086e97d9",
"score": "0.6657441",
"text": "def check_product?(array, n)\n if array.length<3\n return false\n end\n for i in 0..array.length-3 do\n for j in i..array.length-2 do\n for k in j..array.length-1 do\n if (array[i]*array[j]*array[k])==n\n return true\n end\n end\n end\n end\n return false\nend",
"title": ""
},
{
"docid": "53a564fa8ab26d18ee09cd275db48e67",
"score": "0.6300926",
"text": "def check_if_exist(arr)\n return arr.count(0) > 1 ||\n arr.product(arr)\n .map { |x, y| x == 2 * y && x != 0 }\n .any?\nend",
"title": ""
},
{
"docid": "3c08f210fa9a4ec18c6d473f32f0c670",
"score": "0.62181014",
"text": "def okay_two_sum?(arr, target)\n arr.sort!\n pairs = arr.combination(2).to_a\n pairs.any? {|pair| pair.sum == target}\nend",
"title": ""
},
{
"docid": "a3139094d6108c670a33b4c193f3e2b6",
"score": "0.61543417",
"text": "def multiply_all_pairs(arr_1, arr_2)\n arr_1.product(arr_2).map { |num1, num2| num1 * num2 }.sort\nend",
"title": ""
},
{
"docid": "68e9bccefe643a1e883a47b0c48a721a",
"score": "0.6143131",
"text": "def pair_sum?(array, target)\n return false if array.include?(target / 2.0) &&\n array.count(target / 2.0) == 1\n\n pairs = (0...array.length).zip(array)\n hash = Hash[pairs]\n\n array.any? { |el| hash.has_value?(target - el) }\nend",
"title": ""
},
{
"docid": "8e105002cbf4776ee21941f49fb7ab62",
"score": "0.6131801",
"text": "def multiply_all_pairs(array_1, array_2)\n array_1.product(array_2).map { |num1, num2| num1 * num2 }.sort\nend",
"title": ""
},
{
"docid": "d6b0efe30f5f6865853bc2988ce3dd02",
"score": "0.6100372",
"text": "def check_size_product(a, b)\n return false if (a[0].length != b.length)\n return true\nend",
"title": ""
},
{
"docid": "72be506e9869eb833be83d9716697dcb",
"score": "0.6087421",
"text": "def productify(array)\nend",
"title": ""
},
{
"docid": "408aa5ebc9080e60d6a554152f94d08c",
"score": "0.60794836",
"text": "def two_sum?(arr,target_sum)\r\n arr.combination(2).any? { |pair| pair.sum == target_sum }\r\nend",
"title": ""
},
{
"docid": "31026957572b832af1177db05b07015e",
"score": "0.6072801",
"text": "def product(array)\n # TODO: Calculate the product of an array of numbers.\n # You should use of Enumerable#reduce\nend",
"title": ""
},
{
"docid": "ec00e14034c5a9b3d8fa4f9073b050b6",
"score": "0.60686696",
"text": "def multiply_all_pairs(array1, array2)\n array1.product(array2).map { |x, y| x * y}.sort\nend",
"title": ""
},
{
"docid": "03f48f4ac6859a1e1b4176ed3f34cb01",
"score": "0.605393",
"text": "def bad_two_sum?(arr, target_sum)\n target = false\n arr.combination(2) do |pair|\n target = true if pair.sum == target_sum\n end\n target\nend",
"title": ""
},
{
"docid": "d1807866892dfeb5c78ed7493c5fdf5a",
"score": "0.6050495",
"text": "def multiply_all_pairs(arr1, arr2)\n p arr1.product(arr2).map {|x, y| x * y}.sort\nend",
"title": ""
},
{
"docid": "257b90e583bb315e270ee1d68d6ee5d9",
"score": "0.6030818",
"text": "def triplet?(a, b, c)\r\n\tif a * a == b * b + c * c\r\n\t\ttrue\r\n\telse\r\n\t\tfalse\r\n\tend\r\nend",
"title": ""
},
{
"docid": "0d8fe05baa35dfb818cc864e0523256a",
"score": "0.6029111",
"text": "def productify(arr)\nend",
"title": ""
},
{
"docid": "c7d46882a85154ce842c2b5dbb9cc3b1",
"score": "0.60200745",
"text": "def productify(array)\n\nend",
"title": ""
},
{
"docid": "c7d46882a85154ce842c2b5dbb9cc3b1",
"score": "0.60200745",
"text": "def productify(array)\n\nend",
"title": ""
},
{
"docid": "7149f634488a61d8c070dcabfcc57980",
"score": "0.5988357",
"text": "def adjacentElementsProduct(inputArray) inputArray.each_cons(2).map { |a,b| a*b }.max end",
"title": ""
},
{
"docid": "3af9222aeb8ed543f079b6d155494278",
"score": "0.5982511",
"text": "def product?(str)\n !! product(str)\n end",
"title": ""
},
{
"docid": "4203561d44d3f0a07fd4600d607936f0",
"score": "0.59735286",
"text": "def multiply_all_pairs(arr1, arr2)\n arr1.product(arr2).map { |prod| prod.inject(:*) }.sort\nend",
"title": ""
},
{
"docid": "d252c8033b6825ad36083c571b30339f",
"score": "0.59703773",
"text": "def multiply_all_pairs(array1, array2)\n array1.product(array2).map { |elem| elem.inject(:*) }.sort\nend",
"title": ""
},
{
"docid": "c37db1cf22fc35e80ff814ddbb0f446a",
"score": "0.5962407",
"text": "def multiply_all_pairs(array1, array2)\n array1.product(array2).map { |n1, n2| n1 * n2 }.sort\nend",
"title": ""
},
{
"docid": "34607f6c4ca5f1ff4d38241feb3266a0",
"score": "0.59554714",
"text": "def okay_two_sum?(arr, target)\n \nend",
"title": ""
},
{
"docid": "5a0c3abc9cfc7205e547fdaf8225ed50",
"score": "0.5954462",
"text": "def pair_sum?(arr, target)\n hash = Hash.new\n arr.each { |el| hash[el] = target - el }\n hash.each do |key, val|\n return true if hash.key?(val) && key != val\n end\n false\nend",
"title": ""
},
{
"docid": "eb2839107fea2a5c36d5be710feed5c0",
"score": "0.59517443",
"text": "def multiply_all_pairs(arr1,arr2)\n arr1.product(arr2).map {|value| value.reduce(:*)}.sort!\nend",
"title": ""
},
{
"docid": "00a92eb6e2337ceb51fd8e785e42c431",
"score": "0.59508425",
"text": "def pair?(p)\n p.is_a?(Array) && p.length >= 2\n end",
"title": ""
},
{
"docid": "82fd21e49cd1fcebdec6e990c06f3d9f",
"score": "0.594669",
"text": "def multiply_all_pairs(array_1, array_2)\n array_1.product(array_2).map { |subarray| subarray[0] * subarray[1] }.sort\nend",
"title": ""
},
{
"docid": "a32c115c72ad3834a470da2408e20808",
"score": "0.59460956",
"text": "def pair_target(array, target)\r\n\r\n\r\nend",
"title": ""
},
{
"docid": "51da441ab0da16bcebc2e0807f709c87",
"score": "0.59453547",
"text": "def multiply_all_pairs(arr, arr1)\n counter = 0\n counter1 = 0\n array_of_products = []\n\n loop do\n if counter1 == arr1.size\n counter += 1\n counter1 = 0\n end\n break if counter == arr.size\n\n array_of_products << (arr[counter] * arr1[counter1])\n counter1 += 1\n end\n array_of_products.sort\nend",
"title": ""
},
{
"docid": "32b326d8d5856a84ae8403492dfa2379",
"score": "0.59292775",
"text": "def okay_two_sum?(arr, target)\n\nend",
"title": ""
},
{
"docid": "9c1ad5bbf8a790c6a767c2ffb05e32d1",
"score": "0.5905642",
"text": "def multiply_all_pairs(arr1, arr2)\n pairs_arr = arr1.product(arr2)\n products = pairs_arr.map do |pairs|\n pairs[0] * pairs[1]\n end\n products.sort\nend",
"title": ""
},
{
"docid": "080773df5286f82b05fcdd021286a033",
"score": "0.5903126",
"text": "def multiply_all_pairs(array1, array2)\n # array1.product(array2).map {|sub_arr| sub_arr.inject(:*)}.sort\n array1.product(array2).map {|a, b| a * b }.sort\n\nend",
"title": ""
},
{
"docid": "879b4fe65c0886511b41707a30577b6f",
"score": "0.59029746",
"text": "def product(p1, p2 = nil)\n result = nil\n # If we have two parameters, both numeric\n if ((p1.is_a? Numeric) && (p2.is_a? Numeric))\n result = p1 * p2\n # If we just one parameter and it is an array\n elsif (Calculator.is_numeric_array?(p1) && p2.nil?)\n # Start with the identity\n result = @@MULT_IDENT\n # And multiply each element by the current product\n p1.each { |numVal| result *= numVal }\n end\n result\n end",
"title": ""
},
{
"docid": "b5ef7d8c3188b5b776fff892a5831898",
"score": "0.5896358",
"text": "def multiply_all_pairs(arr_1, arr_2)\n arr_1.product(arr_2).map { |sub_array| sub_array.reduce(1, :*) }.sort\nend",
"title": ""
},
{
"docid": "3cc0ec21a5eda01e3fe749b09cce2678",
"score": "0.58935034",
"text": "def multiply_all_pairs(arr1, arr2)\n arr1.product(arr2).map {|arr| arr.reduce(:*) }.sort\nend",
"title": ""
},
{
"docid": "d00d5f0b947e6a3d21f3f9ca49a04ae4",
"score": "0.5889909",
"text": "def multiply_all_pairs(arr1, arr2)\n arr1.product(arr2).map { |arr| arr.inject(:*) }.sort\nend",
"title": ""
},
{
"docid": "7a5092f7e48d2f14fdfb6558aace9477",
"score": "0.5886597",
"text": "def multiply_pairs(arr1, arr2)\n pairs_arr = arr1.product(arr2)\n pairs_arr.map { |pair| pair.reduce(:*) }.sort\nend",
"title": ""
},
{
"docid": "c1a1443564563900f078f3610291eaf3",
"score": "0.5882833",
"text": "def multiply_all_pairs2(arr1, arr2)\n arr1.product(arr2).map { |num1, num2| num1 * num2 }.sort\nend",
"title": ""
},
{
"docid": "22e9f128d18e5b4b800545985bfe7189",
"score": "0.58768296",
"text": "def others_prod(arr)\n\nend",
"title": ""
},
{
"docid": "8cfad348233e4ec8741b1c922f1a8586",
"score": "0.5876599",
"text": "def multiply_all_pairs(arr1, arr2)\n arr1.product(arr2).map {|arr| arr.inject(:*) }.sort\nend",
"title": ""
},
{
"docid": "4b2919ebb3dc1868cbc64f0064ca8b0e",
"score": "0.5870097",
"text": "def multiply_all_pairs(arr1, arr2)\n product = 1\n product_arr = []\n nested_arr = arr1.product(arr2)\n nested_arr.each do |arr|\n arr.each do |number|\n product *= number\n end\n product_arr.push(product)\n product = 1\n end\n product_arr.sort!\nend",
"title": ""
},
{
"docid": "9202684a3ef7ceae0e9e6442ea6396be",
"score": "0.5842624",
"text": "def multiply_all_pairs(arr1, arr2)\n arr1.product(arr2).map { |pairs| pairs.inject(:*) }.sort\nend",
"title": ""
},
{
"docid": "dd8b117260631f9b10008cc87b20496f",
"score": "0.5832175",
"text": "def two_sum?(arr, target_sum)\n\n\nend",
"title": ""
},
{
"docid": "16fc749be8bc0d863b3662370cb0ac7b",
"score": "0.58266765",
"text": "def pair_sum?(array, target)\n frequencies = Hash.new\n\n array.each do |num|\n missing = target - num\n return true if frequencies[missing]\n frequencies[num] = true\n end\n\n false\nend",
"title": ""
},
{
"docid": "0e2653ba466f22d0e84693f0bf0dc08c",
"score": "0.58262795",
"text": "def multiply_all_pairs(array1, array2)\n combos = array1.product(array2)\n combos.map do |subarray|\n subarray.reduce(:*)\n end.sort\nend",
"title": ""
},
{
"docid": "010b6d429e629c967dec8286af0e18e2",
"score": "0.58181953",
"text": "def pair_sum?(arr, target)\n differences = Hash.new\n arr.each do |num|\n p \"#{target - num} <= num | #{differences} <= differences\"\n return true if differences[target - num]\n differences[num] = true\n end\n\n false\nend",
"title": ""
},
{
"docid": "8957c28ed5e4427f78d38159470eb93d",
"score": "0.58179444",
"text": "def multiply_all_pairs(array_a, array_b)\n products = []\n array_a.each do |element_a|\n array_b.each do |element_b|\n products << element_a * element_b\n end\n end\n products.sort\nend",
"title": ""
},
{
"docid": "ad30f7aeb7a9b7d05ad46f5738b9f334",
"score": "0.5815407",
"text": "def others_prod(arr)\n if arr.length < 2\n raise IndexError, 'Getting the product of numbers at other indices requires at least 2 numbers'\n end\n\n products_of_all_ints_except_at_index = []\n\n # for each integer, we find the product of all the integers\n # before it, storing the total product so far each time\n product_so_far = 1\n i = 0\n while i < arr.length\n products_of_all_ints_except_at_index[i] = product_so_far\n product_so_far *= arr[i]\n i += 1\n end\n\n # for each integer, we find the product of all the integers\n # after it. since each index in products already has the\n # product of all the integers before it, now we're storing\n # the total product of all other integers\n product_so_far = 1\n i = arr.length - 1\n while i >= 0\n products_of_all_ints_except_at_index[i] *= product_so_far\n product_so_far *= arr[i]\n i -= 1\n end\n\n return products_of_all_ints_except_at_index\nend",
"title": ""
}
] |
a7a817661c0faa5c863dfc7d8fa829b2 | Returns the string representation of the object | [
{
"docid": "a408df9f3be79d7c20500741a990725c",
"score": "0.0",
"text": "def to_s\n to_hash.to_s\n end",
"title": ""
}
] | [
{
"docid": "e0c61d22481a9b8a23b7a0620c2b5f87",
"score": "0.90105623",
"text": "def to_s\n @object.to_s\n end",
"title": ""
},
{
"docid": "fc45164ab937a7dc1e465646a36f565c",
"score": "0.89507985",
"text": "def to_s\n object.to_s\n end",
"title": ""
},
{
"docid": "c3e5b5f046c9433d172fdf8a83c4251b",
"score": "0.84716886",
"text": "def serialize(object)\n object.to_s\n end",
"title": ""
},
{
"docid": "75c468ae7aac18e1f6817fa278aa2fc3",
"score": "0.8339234",
"text": "def to_s\n self.inspect\n end",
"title": ""
},
{
"docid": "5fa0fdf4f6bdf14d3aa202170b260fbb",
"score": "0.83367085",
"text": "def to_s\n @string || @object.to_s('F')\n end",
"title": ""
},
{
"docid": "5fa0fdf4f6bdf14d3aa202170b260fbb",
"score": "0.83367085",
"text": "def to_s\n @string || @object.to_s('F')\n end",
"title": ""
},
{
"docid": "9de4b58d246a11e5383cd14d25999c96",
"score": "0.8331301",
"text": "def to_s\n \"#<#{self.class.name}:#{object_id} #{info}>\"\n end",
"title": ""
},
{
"docid": "ef8347d4b67512b6014671c191895785",
"score": "0.8253641",
"text": "def to_s\n \"#<#{self.class.name}:#{object_id}> @names=#{names}>\"\n end",
"title": ""
},
{
"docid": "38ec5a20748ef547b11556822b9e697d",
"score": "0.8144842",
"text": "def to_s\n self.inspect\n end",
"title": ""
},
{
"docid": "e35e99c2bcba3b4b490d2f3a53176b03",
"score": "0.81436175",
"text": "def to_s\n toString()\n end",
"title": ""
},
{
"docid": "cc0e97fb4b19160f868e2e44bde26d84",
"score": "0.81352323",
"text": "def to_s\r\n dump\r\n end",
"title": ""
},
{
"docid": "43c77b14298648b096d94635f07e6782",
"score": "0.8125576",
"text": "def to_s\n inspect\n end",
"title": ""
},
{
"docid": "1faac082597bd45aca189b09902be90f",
"score": "0.8092433",
"text": "def to_s\n toString\n end",
"title": ""
},
{
"docid": "86129319a2a6447f6fe874d37b39c363",
"score": "0.808521",
"text": "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"title": ""
},
{
"docid": "3d1f10c3d1123d425b0cacfd0f3e48f3",
"score": "0.8072519",
"text": "def to_s\n\t\t\t@string\n\t\tend",
"title": ""
},
{
"docid": "71cbe7f31efd7ed1ad9b686acf4f3b56",
"score": "0.80385107",
"text": "def to_s\n stringify\n end",
"title": ""
},
{
"docid": "3c8dafeb3bbc740b175545d45e167d02",
"score": "0.80297846",
"text": "def to_s\n to_h.to_s\n end",
"title": ""
},
{
"docid": "adfe0d463793f76edc0508608484c743",
"score": "0.80050814",
"text": "def to_s\n @string\n end",
"title": ""
},
{
"docid": "adfe0d463793f76edc0508608484c743",
"score": "0.80050814",
"text": "def to_s\n @string\n end",
"title": ""
},
{
"docid": "adfe0d463793f76edc0508608484c743",
"score": "0.80050814",
"text": "def to_s\n @string\n end",
"title": ""
},
{
"docid": "adfe0d463793f76edc0508608484c743",
"score": "0.80050814",
"text": "def to_s\n @string\n end",
"title": ""
},
{
"docid": "97d9c57822555c523dce3148048d7b1c",
"score": "0.79616946",
"text": "def to_s\n @string\n end",
"title": ""
},
{
"docid": "97d9c57822555c523dce3148048d7b1c",
"score": "0.79616946",
"text": "def to_s\n @string\n end",
"title": ""
},
{
"docid": "97d9c57822555c523dce3148048d7b1c",
"score": "0.79616946",
"text": "def to_s\n @string\n end",
"title": ""
},
{
"docid": "97d9c57822555c523dce3148048d7b1c",
"score": "0.79616946",
"text": "def to_s\n @string\n end",
"title": ""
},
{
"docid": "7505c4f2ba56ad590ef5fdb10aedef3a",
"score": "0.7953433",
"text": "def inspect\n serialize.to_s\n end",
"title": ""
},
{
"docid": "a359b877abd28b7abf7f8c678ea8577d",
"score": "0.79434973",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "5d15a288f94eb3b75eaeac36ce19d48f",
"score": "0.7918579",
"text": "def to_s\n @string ||= Builder::ToString.new(self).string\n end",
"title": ""
},
{
"docid": "e9c7394b1a677651a30121fc2bed7989",
"score": "0.7907501",
"text": "def to_s\n self\n end",
"title": ""
},
{
"docid": "9d437a721c55b92a48f9776e5349abe3",
"score": "0.78843534",
"text": "def to_s()\n serialize.to_s()\n end",
"title": ""
},
{
"docid": "9d437a721c55b92a48f9776e5349abe3",
"score": "0.78843534",
"text": "def to_s()\n serialize.to_s()\n end",
"title": ""
},
{
"docid": "290b6ae2641b7b0e6514651e95a3f86e",
"score": "0.78833294",
"text": "def to_s\n string\n end",
"title": ""
},
{
"docid": "49bb934e4aa5abfc5ac38d66d28872e2",
"score": "0.7882269",
"text": "def to_s\n inspect\n end",
"title": ""
},
{
"docid": "49bb934e4aa5abfc5ac38d66d28872e2",
"score": "0.7882269",
"text": "def to_s\n inspect\n end",
"title": ""
},
{
"docid": "4f7585f66ffa450a9070d4f17e5a3bbd",
"score": "0.7874536",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "4f7585f66ffa450a9070d4f17e5a3bbd",
"score": "0.7874536",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "4f7585f66ffa450a9070d4f17e5a3bbd",
"score": "0.7874536",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "4f7585f66ffa450a9070d4f17e5a3bbd",
"score": "0.7874536",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "4f7585f66ffa450a9070d4f17e5a3bbd",
"score": "0.7874536",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "4f7585f66ffa450a9070d4f17e5a3bbd",
"score": "0.7874536",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "4f7585f66ffa450a9070d4f17e5a3bbd",
"score": "0.7874536",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "364217bde731c34cfd5336c47ea54c11",
"score": "0.7865495",
"text": "def inspect\n self.to_s\n end",
"title": ""
},
{
"docid": "364217bde731c34cfd5336c47ea54c11",
"score": "0.7865495",
"text": "def inspect\n self.to_s\n end",
"title": ""
},
{
"docid": "f8c58eb15f6f14b88f4cfe3ef5f9b5c2",
"score": "0.786448",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "f8c58eb15f6f14b88f4cfe3ef5f9b5c2",
"score": "0.786448",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "2b31b8ea95895fe618445791f766ecad",
"score": "0.78499025",
"text": "def to_s\n end",
"title": ""
},
{
"docid": "2b31b8ea95895fe618445791f766ecad",
"score": "0.78499025",
"text": "def to_s\n end",
"title": ""
},
{
"docid": "2b31b8ea95895fe618445791f766ecad",
"score": "0.78499025",
"text": "def to_s\n end",
"title": ""
},
{
"docid": "2b31b8ea95895fe618445791f766ecad",
"score": "0.78499025",
"text": "def to_s\n end",
"title": ""
},
{
"docid": "8c3811a97a91cfceb8d9e71fefac2a00",
"score": "0.780679",
"text": "def inspect\n to_s.inspect\n end",
"title": ""
},
{
"docid": "4145618248ebb2dc28500b337e37de91",
"score": "0.7784133",
"text": "def inspect()\n serialize.to_s()\n end",
"title": ""
},
{
"docid": "4145618248ebb2dc28500b337e37de91",
"score": "0.7784133",
"text": "def inspect()\n serialize.to_s()\n end",
"title": ""
},
{
"docid": "bd2701ba73fda21d69100b2ec24cead2",
"score": "0.7766622",
"text": "def inspect\n return self.to_s\n end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
},
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.77602875",
"text": "def to_s; end",
"title": ""
}
] |
c159403ea09610a0f47a7dbf9958b7f8 | validate fields that should be in hash for any item object in SearchWorks Solr | [
{
"docid": "046c7afc999639a0449815095db0c425",
"score": "0.0",
"text": "def validate_item(config)\n result = validate_gdor_fields(config)\n result << \"#{druid} missing collection\\n\" unless field_present?(:collection)\n\n Array(self[:collection]).each do |collection_druid|\n result << \"#{druid} missing collection_with_title (or collection #{collection_druid} is missing title)\\n\" unless field_present?(:collection_with_title, Regexp.new(\"#{collection_druid}-\\\\|-.+\"))\n end\n result << \"#{druid} missing file_id(s)\\n\" unless field_present?(:file_id)\n result\n end",
"title": ""
}
] | [
{
"docid": "389e834b29dbfcc1fd3d0769453f041b",
"score": "0.616786",
"text": "def check_item_fields\n # Process each field for this item\n @fields.each do |field, options| \n # If manadatory make sure it exists and a value have been defined \n rc = true \n rc = check_mandatory(field) if (options.has_key?('mandatory') and options['mandatory'] == 'Y')\n \n # Check if this field contains child items, if so add to hash \n @child_item_fields[field] = options['child_items'] if (options.has_key?('child_items') and \n !options['child_items'].blank?)\n\n # Some child items are sorted by a field specified in the form definition \n # file (e.g. groups), others such as questions are sorted by a fixed \n # sort order field (i.e. sort_order)\n if (rc == true and options.has_key?('sort_field') and options['sort_field'] == 'Y')\n @child_item_sort_order_fields = @data[field] \n elsif (@child_item_sort_order_fields.kind_of?(Hash) and \n options.has_key?('sort_by') and !options['sort_by'].blank?)\n @child_item_sort_order_fields[field] = options['sort_by'] \n end\n \n # Get the method to use when checking for duplicate codes \n @unique_code_check = options['unique_code_check'] if (options.has_key?('unique_code_check') and \n !options['unique_code_check'].blank?)\n \n # Create an instance variable for the field and set to nil\n instance_variable_set(\"@#{field}\", nil)\n \n # If the field exists then we set the instance variable for that field.\n # For example we define 'code' as a field, here we extract the value for\n # code and assign it to @code which is the instance variable for code.\n if (rc == true and !@data.blank?() and @data.has_key?(field) and !@data[field].blank?)\n instance_variable_set(\"@#{field}\", @data[field])\n logger.info \"*** @#{field}:: #{@data[field]}\"\n # Check if a method has been defined for this field, if so call it now\n if (options.has_key?('field_method') and !options['field_method'].blank? and\n self.respond_to?(options['field_method']))\n # Call the function\n self.send(options['field_method'])\n end \n end \n end\n end",
"title": ""
},
{
"docid": "842b2e858ce3036281e06de480b1c0ef",
"score": "0.6112783",
"text": "def valid_attributes\n { \"guid\" => \"xxxxx\",\n \"title\" => \"xxxxx\",\n \"content_raw\" => \"xxxxx\",\n \"content_hash\" => \"MyString\",\n \"user_id\" => \"1\"}\n end",
"title": ""
},
{
"docid": "8011fc75c86ef3fddd26acf1e113b67b",
"score": "0.6050269",
"text": "def valid_attributes\n {\"title\" => \"test chore\",\n \"user_id\" => 1,\n \"email_id\" => 1,\n \"choretype_id\" => 1,\n \"context_id\" => 1,\n \"project_id\" => 1\n }\n end",
"title": ""
},
{
"docid": "7ce319299b0024a77363b48c5b859861",
"score": "0.5894126",
"text": "def validate_option_fields!(fields)\n fields.uniq!\n #check to make sure all fields exist\n #TODO Write check code for multi-table... ignoring this for now\n missing_fields = []\n fields.each do |f|\n missing_fields << f.to_s unless column_names().include?(f.to_s) or f.to_s.include?(\".\")\n end\n raise ArgumentError, \"Missing fields: #{missing_fields.sort.join(\",\")} in acts_as_tsearch definition for \n table #{table_name}\" if missing_fields.size > 0\n end",
"title": ""
},
{
"docid": "a6e04a8d84359b7ffcf35ee3d611e142",
"score": "0.58771306",
"text": "def validate_keys jdoc\n special_keys = %w{_id _rev _deleted _attachments}\n jdoc.each do |k,v|\n if k[0] == \"_\"\n raise BoothError.new(500, \"doc_validation\", \"bad special field '#{k}'\") unless special_keys.include?(k)\n end\n end\n end",
"title": ""
},
{
"docid": "1a9b47f6a644ed50e0d69428a4bcf1c2",
"score": "0.5863952",
"text": "def test_failure_for_bad_fields\n assert_raise ArgumentError do\n BlogEntry.acts_as_tsearch :fields => \"ztitle\"\n end\n\n assert_raise ArgumentError do\n BlogEntry.acts_as_tsearch :fields => [:ztitle, :zdescription]\n end\n \n assert_raise ArgumentError do\n BlogEntry.acts_as_tsearch :vectors => {\n :auto_update_index => false,\n :fields => { \n \"a\" => {:columns => [:title]},\n \"b\" => {:columns => [:zdescription]}\n }\n }\n end\n end",
"title": ""
},
{
"docid": "513af9e331346360cb329113405cf9e8",
"score": "0.58514893",
"text": "def valid_attributes\n {\"title\" => \"test title\",\n \"context_id\" => 1,\n \"user_id\" => 1\n }\n end",
"title": ""
},
{
"docid": "dbc1d26a43d89449ec787094fd32e6a5",
"score": "0.58408374",
"text": "def hashable_field(item)\n return false unless item.is_a?(Hash)\n field = Hashable::Field.new(item)\n field if field.hashable?\n end",
"title": ""
},
{
"docid": "7c43d3ae7f133437b2cefa71cbabcf9e",
"score": "0.5831007",
"text": "def validate_allowed_fields(file:, ident:, hash:, allowed_fields:, **_opts)\n unless hash\n feedback(\n path: file.filename,\n annotation_level: 'failure',\n message: \"#{ident}: Element is empty or nil\"\n )\n\n return\n end\n\n hash.keys&.each do |key|\n unless allowed_fields.include?(key)\n feedback(\n path: file.filename,\n annotation_level: 'failure',\n message: \"#{ident}: Key '#{key}' not in the allowed fields [#{allowed_fields.join(', ')}]\"\n )\n end\n end\n end",
"title": ""
},
{
"docid": "6533e629a16d191dc40f76ce8107ed77",
"score": "0.5817426",
"text": "def validate_hash(the_input, the_array)\n nil_values(the_input)\n incorrect_keys(the_input, the_array)\n end",
"title": ""
},
{
"docid": "039a2e6d03696a85828803137f5f2b30",
"score": "0.5789039",
"text": "def valid_attributes\n\t\t{ :order_id => @order.id, :store_item_id => @store_item.id, :count => 1 }\n\tend",
"title": ""
},
{
"docid": "434f8bb604d67ffac6cade38d47d8be2",
"score": "0.5766558",
"text": "def valid_attributes\n {\n :buyer_id => 1,\n :seller_id => 1,\n :item_id => 1,\n :state => 1\n }\n end",
"title": ""
},
{
"docid": "c159a19c2da863ef1db4936e5a5f8217",
"score": "0.5754464",
"text": "def validate_fields\n @importer.commits.map do |commit|\n SubsetFieldValidator.call(\n @importer.schema.allowed_headers, commit.keys\n )\n end.compact\n end",
"title": ""
},
{
"docid": "67b5f86c1a64cc064b6fba82daa33148",
"score": "0.5716158",
"text": "def validate_item\n validate @intname => Symbol,\n @id => Integer,\n @name => String,\n @pocket => Symbol,\n @price => Integer,\n @description => String,\n @fling_power => Integer\n raise \"Cannot have an ID of 0 or lower for new Item object\" if @id < 1\n end",
"title": ""
},
{
"docid": "b0b7091a4087053cf74ec53d9db8d3a9",
"score": "0.5710013",
"text": "def validate_hash_keys(record, hash, attribute_name, expected_keys)\n validate_type(record, hash, attribute_name, Hash)\n\n if hash.is_a? Hash\n expected_keys.each do |key|\n if not hash.keys.include? key\n record.errors[:base] << \"#{attribute_name} attribute must contain the key #{key}\"\n end\n end\n end\n\n\n end",
"title": ""
},
{
"docid": "cd3f62fbdd5e9fa0211c879ec1f3aa92",
"score": "0.5706685",
"text": "def test_solr_response\n items = Item.all\n assert_nil items.solr_response\n items.to_a\n assert_kind_of Hash, items.solr_response\n end",
"title": ""
},
{
"docid": "5ecd2113da593917bd0cf73103b1bc50",
"score": "0.57042545",
"text": "def validate hash\n hash.each do |key, value|\n send(key).should == value\n end\n end",
"title": ""
},
{
"docid": "7dcc52adfd073b08d9a8796cbebe3bc0",
"score": "0.5664078",
"text": "def valid_attributes\n { \n :title => \"aaa\",\n :content => \"123456\"\n }\n end",
"title": ""
},
{
"docid": "584ab24d4a1fab50660037d92aca2e3e",
"score": "0.5600218",
"text": "def valid_params\n {:address => 'Queen St', :invoice_date => '2013-04-15', :due_on_date => '2013-05-15', :invoice_number => 876, :terms => '30 days', :po_number => '7654', :pre_payment => false, :currency => 'gbp', :vat_rate => 20, :invoice_items_attributes => [{:payment_profile_id => payment_profiles(:payment_profiles_002).id, :name => 'item name', :quantity => 1, :vat => true, :amount => 100.00}] }\n end",
"title": ""
},
{
"docid": "efa160972af065c3f4a48075e385a562",
"score": "0.5579679",
"text": "def validate_hash_inputs(data_hash)\n data_hash = data_hash.stringify_keys\n all_keys_in_params = data_hash.keys.all? do |k|\n @params.key?(k)\n end\n raise error_unidentified_params(data_hash.keys) unless all_keys_in_params\n\n @params.each do |key, _|\n validate_param(key, data_hash[key])\n end\n end",
"title": ""
},
{
"docid": "bb6125a4cb4c4b2354525a8232a9d7c6",
"score": "0.5559602",
"text": "def valid_attributes\n { body: \"blah\",\n title: 'Something' }\n end",
"title": ""
},
{
"docid": "0c32a4a90c7d4ef03de30639337c3c10",
"score": "0.55569685",
"text": "def prepare_item_hash(item_hash)\n item_hash[\"unique_user\"] = !!item_hash[\"unique_user\"] #boolean\n code = item_hash[\"range_unique_code\"]\n item_hash[\"range_unique_code\"] = code ? code.length : 0\nend",
"title": ""
},
{
"docid": "fb814832c5d2366bfc0b22ae1e42fc3b",
"score": "0.5556409",
"text": "def valid_attributes\n {:name => \"Joe's\", :zip => \"12345\"}\n end",
"title": ""
},
{
"docid": "ec18cb8c4e1380c1c52ab6dbf7bc6d43",
"score": "0.55562466",
"text": "def _validate_attributes(fields = nil)\n invalid_fields = {}\n @cache.each(:attributes => fields) do |f,value,index|\n @form.set_current_index(index)\n invalid = Invalid.evaluate(@form,@form.fields[f],value)\n if !invalid.empty?\n invalid_fields[f] ||= []\n invalid_fields[f][index.to_i] = invalid\n end\n end\n invalid_fields\n end",
"title": ""
},
{
"docid": "f4112c6cea0b0e3a3f1d045f4e373b37",
"score": "0.55550534",
"text": "def validate_arguments(workitem, required_keys)\n fields = workitem.fields\n required_keys.each do |key|\n raise ArgumentError, \"Missing required argument #{key}\" unless fields[key]\n end\n end",
"title": ""
},
{
"docid": "612ea2db4a00b98824300fc4b1d10621",
"score": "0.55528873",
"text": "def check_extra_fields(args_hash, known_fields)\n extra_fields = args_hash.keys - known_fields - IGNORED_HASH_KEYS\n unless extra_fields.empty?\n raise AdsCommon::Errors::UnexpectedParametersError.new(extra_fields)\n end\n end",
"title": ""
},
{
"docid": "0c007fc7d8832c8bb53962aa8e25d838",
"score": "0.5550203",
"text": "def validate_items(entered_items)\n wrong_items = entered_items.keys - BASE_ITEM_PRICES.keys\n raise \"Item(s) #{wrong_items} are invalid. Please try again.\" unless wrong_items.empty?\nend",
"title": ""
},
{
"docid": "b6ef5b9b69292d08d81d72ad9e31f260",
"score": "0.55460316",
"text": "def valid_attributes\n { \"about_me\" => \"MyString\", \"user_id\" => 1}\n end",
"title": ""
},
{
"docid": "f6d8ed39ec70b8b075d489ed42285b99",
"score": "0.55342966",
"text": "def sanitize_fields; end",
"title": ""
},
{
"docid": "0c68302d3f1139c3e96c42b2cfd093a6",
"score": "0.5521079",
"text": "def validate_keys(*valid_keys); end",
"title": ""
},
{
"docid": "0c68302d3f1139c3e96c42b2cfd093a6",
"score": "0.5520129",
"text": "def validate_keys(*valid_keys); end",
"title": ""
},
{
"docid": "3b043d8d0e2ffd5225a277e97aaf4fc1",
"score": "0.55174375",
"text": "def valid_attributes\n { \"organization_id\" => \"1\", \"user_id\" => \"2\" }\n end",
"title": ""
},
{
"docid": "ad94b051b064bed00cc99a6ea12fb591",
"score": "0.5513284",
"text": "def valid_attributes\n { name: \"the Venue\", postal_code: \"75003\", address_1: \"125, rue de Rivoli\", city: \"Paris\", country: \"FR\" }\n end",
"title": ""
},
{
"docid": "0d0ec66802a48ea98c7f709a506ca339",
"score": "0.5511324",
"text": "def test_salesforce_parsing\n assert_equal ({\n :Id=>\"SALESFORCE_ID_1234\",\n :Field1=>\"value1\",\n :Field2=>\"value2\",\n :deep_field=>\"value3\",\n :deep_field2=>\"value4\",\n :Timestamp => Date.new(2013,3,1)}), TestedModel.parse_salesforce_fields(@salesforce_fields)\n end",
"title": ""
},
{
"docid": "11305f8f77d22f59e2ee72f1a5b3018c",
"score": "0.5508369",
"text": "def check_schema_items(items_schema)\n _check_type(:items, items_schema, Hash, Array)\n if items_schema.is_a?(Hash)\n begin\n validate(items_schema)\n rescue Error => ex\n raise_path_less_error \"Items schema is not valid: #{ex.message}\"\n end\n else # Is an array\n errors = {}\n items_schema.each_with_index do |item_schema, index|\n begin\n validate(item_schema)\n rescue Error => ex\n errors[index] = ex.message\n end\n end\n unless errors.empty?\n msg = errors.map do |index, msg|\n \"item schema ##{index} is not valid (#{msg})\"\n end.to_sentence.capitalize\n raise_path_less_error msg\n end\n end\n end",
"title": ""
},
{
"docid": "f9ef8b1bfbcdb56aa1479cb4a4d383ce",
"score": "0.5497784",
"text": "def valid_attributes\n {\n :title => \"title\",\n :url => \"url\",\n :cover => \"cover\",\n :user_id => @user.id \n }\n end",
"title": ""
},
{
"docid": "10beddc2e530b1a1c4b55c55cf54b4f9",
"score": "0.54862213",
"text": "def validate_hash(hash, errors, opts)\n # set current field\n current_field = nil\n # validate the keys and values\n hash.each do |k, value|\n key = k.to_sym\n # validate the current hash key using broad hash key validation\n errors << \"Hash key encountered that is broadly invalid.\" unless valid_hash_key?(key)\n\n # validate that the hash key is supported as an operator or dataset field\n\n # if they key is an operator validate the dataset supports the operator for the current field\n #\n # if the key is a field of the dataset then we need to validate that the _value_ conforms to the dataset\n # specific validation rules for that field\n #\n # if they key is neither an operator nor a field we raise an ArgumentError\n #\n # Then make a recursive call to validate on the value so that it and its elements are validated\n # later I might be able to optimize this by only making the recursive call for Sets and Hashes\n #\n if dataset.has_operator? key\n dataset.validate_operator_conforms key, current_field, errors\n opts[:parent_operator] = key\n elsif dataset.has_field? key\n current_field = key\n dataset.validate_type_conforms value, current_field, errors\n dataset.validate_value_conforms value, current_field, errors\n opts[:parent_field] = current_field\n else\n errors << \"Encountered hash key that is neither an operator nor a property of the dataset\"\n end\n recursive_validate value, errors, opts\n end\n errors\n end",
"title": ""
},
{
"docid": "713ff033161c6430eb49a296ccb1642d",
"score": "0.54701096",
"text": "def fill_hashlike_from_marc r, hashlike\n @solrfieldspecs.each do |sfs|\n if sfs.arity == 1\n hashlike.add(sfs.solrField,sfs.marc_values(r, hashlike))\n else \n vals = sfs.marc_values(r, hashlike)\n (0..(sfs.arity - 1)).each do |i|\n hashlike.add(sfs.solrField[i], vals[i])\n end\n end\n end\n end",
"title": ""
},
{
"docid": "c2b93f727d897d580c24393ccc912e32",
"score": "0.54681474",
"text": "def check_key_valid; end",
"title": ""
},
{
"docid": "002549164d99fd6009d24ed72e954052",
"score": "0.5466491",
"text": "def validate params\n errors = {}\n #[:id_0, :name_0].each{|key| params[key] = (params[key] || \"\").strip }\n #errors[:id_0] = \"ID field: \" + params[:id_0]\nend",
"title": ""
},
{
"docid": "9df94857af897e5211ab34099b6e4782",
"score": "0.54637575",
"text": "def validate_additional_field_keys(additional_fields)\n additional_fields.each do |key, value|\n if CORE_FIELD_NAMES.include?(key.to_s)\n raise UriService::InvalidAdditionalFieldKeyError, \"Cannot supply the key \\\"#{key.to_s}\\\" as an additional field because it is a reserved key.\"\n end\n unless key.to_s =~ ALPHANUMERIC_UNDERSCORE_KEY_REGEX\n raise UriService::InvalidAdditionalFieldKeyError, \"Invalid key (can only include lower case letters, numbers or underscores, but cannot start with an underscore): \" + key\n end\n end\n end",
"title": ""
},
{
"docid": "a4486c9e87aea59d7e6c6653f8505a88",
"score": "0.5461438",
"text": "def validate(select_hash_key = nil, values_hash_to_validate)\n NiceHash.validate([self, select_hash_key], values_hash_to_validate, only_patterns: false)\n end",
"title": ""
},
{
"docid": "16e3847f313f871be45d22d6157ee7d5",
"score": "0.5439772",
"text": "def normalize_fields(items)\n @fields_from_config ||= {}\n items.map do |item|\n # at this moment, item is a hash or a symbol\n if is_field_config?(item)\n item = normalize_field(item)\n @fields_from_config[item[:name].to_sym] = item\n item #.reject{ |k,v| k == :name } # do we really need to remove the :name key?\n elsif item.is_a?(Hash)\n item = item.dup # we don't want to modify original hash\n item[:items].is_a?(Array) ? item.merge(:items => normalize_fields(item[:items])) : item\n else\n item\n end\n end\n end",
"title": ""
},
{
"docid": "2078d75007384e36d2ca1666a73790e7",
"score": "0.5437542",
"text": "def validate_item(source_item)\n valid_for = []\n text = source_item.get_text.to_string\n $validation_terms.each do |entity_type, terms|\n # Check if item text includes $validation_terms\n valid_for << entity_type if terms.any? { |term| text.include? term }\n end\n valid_for\nend",
"title": ""
},
{
"docid": "5612fb6cc203dc65f8e73c6323362111",
"score": "0.5437321",
"text": "def hash\n [ref, schema, additional_items, additional_properties, all_of, any_of, default, definitions, dependencies, description, enum, example, exclusive_maximum, exclusive_minimum, external_docs, format, id, items, max_items, max_length, max_properties, maximum, min_items, min_length, min_properties, minimum, multiple_of, _not, one_of, pattern, pattern_properties, properties, required, title, type, unique_items].hash\n end",
"title": ""
},
{
"docid": "62dbfb2eb6c39d5130a48e67fc1fe569",
"score": "0.54265445",
"text": "def check_section_data_validity(section_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(Name Code Description),\n 'properties' => {\n 'Name' => { 'type' => 'string' },\n 'Code' => { 'type' => 'string' },\n 'Description' =>\n {\n 'type' => 'object',\n 'properties' =>\n {\n 'Content' => 'string',\n 'Type' => 'string'\n }\n }\n }\n }\n JSON::Validator.validate!(schema, section_data, validate_schema: true)\nend",
"title": ""
},
{
"docid": "d17374d9a8f9faf25bba452f776b6b7b",
"score": "0.5421341",
"text": "def validate_uniqueItems(current_schema, data, fragments)\n if data.is_a?(Array)\n d = data.clone\n dupes = d.uniq!\n if dupes\n message = \"The property '#{build_fragment(fragments)}' contained duplicated array values\"\n raise ValidationError.new(message, fragments, current_schema)\n end\n end\n end",
"title": ""
},
{
"docid": "2ad49a1fbc902c24a00d0dec2df2b395",
"score": "0.5411607",
"text": "def check(fields)\n missing_fields = @spec.keys.difference(fields.keys)\n\n if missing_fields.any?\n missing_fields.each do |field|\n raise \"wrong number of args\" unless @spec[field].eql?(Type::Any)\n end\n end\n\n mismatching_fields = fields.keys.difference(@spec.keys)\n\n raise \"key does not exist\" if mismatching_fields.any?\n\n fields.each do |(field, value)|\n raise \"wrong data type\" unless value.is_a?(@spec[field]) || @spec[field].eql?(Type::Any)\n end\n\n true\n end",
"title": ""
},
{
"docid": "ee3d1acec0a1211cd6582b406663b9ec",
"score": "0.5406212",
"text": "def scrub_fields(fields)\n clean_fields = nil\n if(fields.is_a?(Hash))\n clean_fields = ActiveSupport::OrderedHash.new\n fields.each_pair do |k,v|\n clean_fields[k.to_s] = v.nil? ? {} : v\n end\n else\n clean_fields = fields.map(&:to_s)\n end\n if(clean_fields.is_a?(Hash))\n raise TypeError.new 'Hash values must be of Hash type or nil' if fields.values.detect{|v| !v.is_a?(Hash)}\n end\n clean_fields\n end",
"title": ""
},
{
"docid": "72283a0d3de607cc0ff2dbe4d80e658e",
"score": "0.54031634",
"text": "def validate_item(item)\n rlt = false\n\n handle = item[:handle]\n item = Item.find_by_handle(handle)\n if item.nil?\n # item not exists, valid\n rlt = true\n else\n # duplicated item\n logger.warn \"validate_item: duplicated item[#{handle}]\"\n end\n\n rlt\n end",
"title": ""
},
{
"docid": "8a5ee30c04c07f151a84e185e1c82cd8",
"score": "0.53926915",
"text": "def validate_meta_datum!(meta_datum)\n [:value, :match].each do |key_name|\n if meta_datum[key_name] and not meta_datum[key_name].is_a?(String)\n raise \"#{key_name.capitalize} must be a string!\"\n end\n end\n end",
"title": ""
},
{
"docid": "d35fec1d5262e62b5b81963869d987f9",
"score": "0.5392089",
"text": "def validate_fields(args)\n raise Error, I18n.t('errors.price_not_float') unless number?(@price)\n\n return true if %w[code name price].all? { |s| args.key? s }\n return true if %i[code name price].all? { |s| args.key? s }\n\n raise Error, I18n.t('errors.product_invalid', args: args)\n end",
"title": ""
},
{
"docid": "ca429e12849b0445f531622fa7bdcc4b",
"score": "0.539048",
"text": "def _handle_custom_fields(request_data, item_type, item) \n if item_type != \"test_case\" \\\n && item_type != \"test_plan\" \\\n && item_type != \"assignment\" \\\n && item_type != \"result\" \\\n && item_type != \"device\"\n return false, \"_handle_custom_fields: invalid item_type parameter '#{item_type}'\"\n end\n success = false\n message = \"\" \n if request_data['custom_fields'].is_a?(Hash) \\\n && !request_data['custom_fields'].empty?\n incorrect_fields = request_data['custom_fields'].map {|k,v| (v.is_a?(Hash) && !v.empty?) ? nil : k.to_s}.compact\n if incorrect_fields.count > 0\n return false, \"One or more passed custom_fields were not of the correct type or empty\"\n end \n # create custom field(s) if necessary\n request_data['custom_fields'].each do |key, value|\n if value.key?('name') && value.key?('type')\n type = value['type']\n if type == \"string\" \\\n || type == \"drop_down\" \\\n || type == \"check_box\" \\\n || type == \"radio_button\" \\\n || type == \"number\" \\\n || type == \"link\"\n custom_fields = CustomField.where(:item_type => item_type,\n :field_name => value['name'],\n :field_type => type,\n :active => true) \n if custom_fields == []\n \n custom_field = CustomField.new(:item_type => item_type,\n :field_name => value['name'],\n :field_type => type) \n custom_field = custom_field.save\n # Only create results if object creation is successful\n if !custom_field \n return false, \"_set_custom_fields: error creating new custom field '#{value['name']}' for '#{item_type}' with type '#{type}'\"\n end\n end\n else\n return false, \"_set_custom_fields: invalid field_type parameter '#{type}'\"\n end \n else\n return false, \"Custom field '\" + key + \"' does not contain both a name and type child element.\" \n end\n end\n custom_fields = CustomField.where(:item_type => item_type,\n :active => true) \n # set custom field for item\n if custom_fields.count > 0\n request_data['custom_fields'].each do |key, value|\n # verify that the custom field has a name and value\n if value.key?('name') && value.key?('value')\n # if the custom field passed with the request exists then add it to the result\n custom_field = custom_fields.map {|x| x.field_name == value['name'] ? x : nil}.compact\n if custom_field.count > 0\n # If a custom item entry for the current field doesn't exist, add it,\n # otherwise just set it\n custom_item = item.custom_items.where(:custom_field_id => custom_field.first.id).first\n if custom_item == nil\n item.custom_items.build(:custom_field_id => custom_field.first.id,\n :value => value['value'])\n else\n custom_item.value = value['value']\n custom_item.save\n end\n success = true\n else\n message = 'Custom field ' + value['name'] + ' does not exist'\n success = false\n end \n else\n message = \"Custom field \" + key + \" does not contain a name and value child element.\" \n success = false\n end\n end \n end\n else\n message = \"Passed custom field list was empty or invalid.\"\n end\n return success, message\n end",
"title": ""
},
{
"docid": "2eba910762f6df0bc2db4bc10e6bc677",
"score": "0.53898907",
"text": "def validate_index(item, index)\n unless valid_index?(item, index)\n raise \"Missing digest field #{index.capitalize}\"\n end\n end",
"title": ""
},
{
"docid": "87a7c09985689649b72afc6504d432e5",
"score": "0.5385981",
"text": "def validate!(value)\n raise \"Invalid format\" unless value.instance_of?(Hash)\n end",
"title": ""
},
{
"docid": "ded00d6920ac67f8f2a9c456102cd878",
"score": "0.5384779",
"text": "def validate_items(current_schema, data, fragments)\n if data.is_a?(Array)\n if current_schema.schema['items'].is_a?(Hash)\n data.each_with_index do |item,i|\n schema = JSON::Schema.new(current_schema.schema['items'],current_schema.uri)\n fragments << i.to_s\n validate_schema(schema,item,fragments)\n fragments.pop\n end\n elsif current_schema.schema['items'].is_a?(Array)\n current_schema.schema['items'].each_with_index do |item_schema,i|\n schema = JSON::Schema.new(item_schema,current_schema.uri)\n fragments << i.to_s\n validate_schema(schema,data[i],fragments)\n fragments.pop\n end\n end\n end\n end",
"title": ""
},
{
"docid": "8663aae35b256ead46ad5d1b80daca1f",
"score": "0.5378872",
"text": "def comparing_doc_to_solr_resp_hash?(expected_item)\n actual.is_a?(RSpecSolr::SolrResponseHash) && !expected_item.is_a?(RSpecSolr::SolrResponseHash)\n end",
"title": ""
},
{
"docid": "93e4b59bcee86332a31210f317808511",
"score": "0.53788435",
"text": "def valid_attributes\n {:name => \"Tryal name\",\n :content => \"stupid content\"}\n end",
"title": ""
},
{
"docid": "2beb0fb9daabd9a3f42df078d1c126a1",
"score": "0.5375707",
"text": "def validate_item( x )\n raise InternalError.new( \"#{self.class}.validate_item() not implemented!\" )\n end",
"title": ""
},
{
"docid": "74c0b3a354f3f8cde36e333b74af2f5b",
"score": "0.53745276",
"text": "def verify_schema_hash\r\n Schema.schema_hash_i.should be_instance_of(Hash)\r\n %w{person org}.each{|e| Schema.schema_hash.keys.should include(e)}\r\n end",
"title": ""
},
{
"docid": "ce0e8acaa99f7e255bb4639c48230546",
"score": "0.5373064",
"text": "def validate_attr_in_obj(key, hash)\n raise \"#{key} not stored in #{hash}\" until hash.key?(key)\n end",
"title": ""
},
{
"docid": "d60562effec87c6acf84d2f702fe459a",
"score": "0.53725964",
"text": "def validate_hash\n valid_hash?.tap { |valid| yield(*split_hash) if valid }\n end",
"title": ""
},
{
"docid": "c38f0d341912abe8e7b9c995b29fd16d",
"score": "0.53662086",
"text": "def valid_attributes\n {:title => 'home page', :content => 'hello world'}\n end",
"title": ""
},
{
"docid": "31ba5f210cf758c6cdd98c0d5a768662",
"score": "0.53628993",
"text": "def valid_attributes\n { \"hostname\" => \"MyString\" }\n end",
"title": ""
},
{
"docid": "8443d5d171cfda6feb0a2fb3f674185b",
"score": "0.5360921",
"text": "def initialize(hash_info)\n if hash_info[:set] != nil and hash_info[:set] =~ Shop_Core::ITEM_REGEXP\n @item_type = item_type_from_char($1)\n @item_id = $2.to_i\n @max_quantity = $3 != nil ? $4.to_i : -1\n else\n @item_type = hash_info[:type]\n @item_id = hash_info[:id]\n @max_quantity = hash_info[:quantity] || hash_info[:max] || -1\n end\n @repl_rate = hash_info[:repl_rate] ? (hash_info[:repl_rate] / 100.0) : 1.0\n @price = hash_info[:price].nil? ? item.price : hash_info[:price]\n @sell_locked = hash_info[:sell_locked].nil? ? false : hash_info[:sell_locked]\n @deny_sales = hash_info[:no_sales].nil? ? false : hash_info[:no_sales]\n @required_sw = hash_info[:switch]\n @required_var = hash_info[:variable]\n @required_var_value = hash_info[:variable_val] || 1\n @required_noitem = hash_info[:if_not_item]\n @custom_currency = hash_info[:currency]\n end",
"title": ""
},
{
"docid": "7c7ad4591c09f3dfb469d7e6d5627a5d",
"score": "0.5348369",
"text": "def fields_names_uniquenss\n sections.each do |_k, v|\n if v['fields']\n if v['fields'].values.map { |i| i.values.first }.uniq.size != v['fields'].values.map { |i| i.values.first }.size\n errors.add(:duplicated_field_name, 'duplicated for the same seciton')\n end\n end\n end\n end",
"title": ""
},
{
"docid": "346402f4dd6b8ca890edb0f18203d4e5",
"score": "0.5348129",
"text": "def validate_hash( value )\n\n # Make sure it's a hash in the first place.\n\n unless value.is_a? Hash\n report( :not_hash )\n return\n end\n\n # Enforce hash limits.\n\n return unless validate_count( value )\n\n # Now validate hash keys and values. If we detect problems, don't bother with the rest.\n\n value.all?{ |k, v| validate_key( k ) && validate_value( v ) }\n end",
"title": ""
},
{
"docid": "378d4728ef6d5e88fa030979cf754c40",
"score": "0.5341995",
"text": "def valid_hash?(h); end",
"title": ""
},
{
"docid": "a69b6bee652cd9df2814237899098c62",
"score": "0.5341138",
"text": "def validate_properties(record_v)\n\t\tif record_v.nil?\n\t\t\trecord_v.errors[:base] << \"nil object is not valid.\"\n\t\telsif record_v.properties.nil?\n\t\t\trecord_v.errors[:base] << \"properties cannot be nil.\"\n\t\telsif not record_v.properties.is_a? Hash\n\t\t\t\trecord_v.errors[:base] << \"properties only should be a Hash.\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "ecc38ba6f8858b3cf648f79f1469e3b1",
"score": "0.53388435",
"text": "def sanitize_fields=(_arg0); end",
"title": ""
},
{
"docid": "d5df8448adfa675e6d25aeb23d7a5e34",
"score": "0.533306",
"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": "0a71cf8c5d08c46be8ab6dcaa2e76437",
"score": "0.5329992",
"text": "def validate_order_fields(order_data)\n missing_fields = []\n order_data.each do |key, value|\n validate_order_fields(value) if value.is_a?(Hash)\n value.each { |item| validate_order_fields(item) } if value.is_a?(Array)\n\n missing_fields.push(key) if value.nil?\n end\n\n err_msg = \"One or more fields with important information about the #{missing_fields.join(', ')} were missing\"\n raise ParsingError, err_msg if missing_fields.count.positive?\n end",
"title": ""
},
{
"docid": "ebf344a5288352cd02100cab93ae00ec",
"score": "0.5322313",
"text": "def check_key_value_hash(item)\n return (item.kind_of?(Hash) && item.include?(:key) &&\n item.include?(:value) && (item.keys.size == 2))\n end",
"title": ""
},
{
"docid": "7e8ad04b470eaaa412c82cdecf210ea1",
"score": "0.53207904",
"text": "def test_key_bad_params_hash\n assert_raise TypeError do\n Sketchup.active_model.options[0].key? Hash.new\n end\n end",
"title": ""
},
{
"docid": "cf75d3720d8cc4c6a60f0923db8e10bb",
"score": "0.5320387",
"text": "def hexists(key, field); end",
"title": ""
},
{
"docid": "cf75d3720d8cc4c6a60f0923db8e10bb",
"score": "0.5320387",
"text": "def hexists(key, field); end",
"title": ""
},
{
"docid": "824c7b8e720b3ee085b544c1ae070d14",
"score": "0.5317095",
"text": "def validate_fields(file:, ident:, hash:, required_fields:, allowed_fields:, **opts)\n unless hash\n feedback(\n path: file.filename,\n annotation_level: 'failure',\n message: 'Element is empty or nil'\n )\n\n return\n end\n\n validate_required_fields(\n file: file,\n ident: ident,\n hash: hash,\n required_fields: required_fields,\n **opts\n )\n validate_allowed_fields(\n file: file,\n ident: ident,\n hash: hash,\n allowed_fields: allowed_fields,\n **opts\n )\n end",
"title": ""
},
{
"docid": "712aaf3abf5ade1747eaf01dc1e85a65",
"score": "0.5311528",
"text": "def validate!(props)\n\n end",
"title": ""
},
{
"docid": "c6f6d918e18c384217b431e8dc3db528",
"score": "0.5306346",
"text": "def valid_attributes\n { :description => 'MyDescription', :title => 'Title', :status_id => @status.id, :user_id => @user.id }\n end",
"title": ""
},
{
"docid": "847f31fdf236e38c424d1380849acb05",
"score": "0.5296579",
"text": "def hash_is_not_nil\n self.errors.add :base, 'Hash cannot be nil. It can be empty or filled with some values.' if self.additionalOptions.nil?\n end",
"title": ""
},
{
"docid": "05a78639918808da658799168cfe914b",
"score": "0.5294959",
"text": "def valid_attributes\n { \"githubadd\" => \"http://www.google.com\" }\n end",
"title": ""
},
{
"docid": "63cfea9c2a63d0ae449ab2a34ad6fb5e",
"score": "0.5294561",
"text": "def check_section_property_data_validity(section_property_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(Name Code Description),\n 'properties' => {\n 'EnrollmentStyle' => { 'type' => 'integer' },\n 'EnrollmentQuantity' => { 'type' => 'integer' },\n 'AutoEnroll' => { 'type' => 'boolean' },\n 'RandomizeEnrollments' => { 'type' => 'boolean' }\n }\n }\n JSON::Validator.validate!(schema, section_property_data, validate_schema: true)\nend",
"title": ""
},
{
"docid": "16d51f685f308c555bcc912933ac0dda",
"score": "0.52907777",
"text": "def validate_data(data)\n raise 'Data not valid' unless data&.is_a?(Hash)\n\n data\n end",
"title": ""
},
{
"docid": "7322b58b571a42b7f892cfd833af4a75",
"score": "0.5287153",
"text": "def hash\n [id, name, version, date_created, schema, current, validation_fields, validation_limits, item_validation_fields, item_validation_limits, self_uri].hash\n end",
"title": ""
},
{
"docid": "df17998877d004de499ebb703f3a99c8",
"score": "0.5281351",
"text": "def key_fields; end",
"title": ""
},
{
"docid": "df17998877d004de499ebb703f3a99c8",
"score": "0.5281351",
"text": "def key_fields; end",
"title": ""
},
{
"docid": "c9ced873adda88361f47b8fb47e8549f",
"score": "0.5279664",
"text": "def validate_required_fields(file:, ident:, hash:, required_fields:, **_opts)\n unless hash\n feedback(\n path: file.filename,\n annotation_level: 'failure',\n message: \"#{ident}: Element is empty or nil\"\n )\n\n return\n end\n\n required_fields.each do |key|\n next unless hash[key].nil?\n\n feedback(\n path: file.filename,\n annotation_level: 'failure',\n message: \"#{ident}: Missing required element '#{key}'\"\n )\n end\n end",
"title": ""
},
{
"docid": "a1cdfe9ee2e6972b70cbcda7235944d3",
"score": "0.5263124",
"text": "def valid_attributes\n {\n :product_id => Factory.create(:product).id,\n :store_id => Factory.create(:store).id,\n :quantity => 1\n }\n end",
"title": ""
},
{
"docid": "3cb81dcfee4fccd0d6bdf24af62947bd",
"score": "0.52604246",
"text": "def valid_hstore?\n return true if empty? || self == \"''\"\n # This is what comes from the database\n dbl_quotes_re = /\"([^\"]+)\"=>\"([^\"]+)\"/\n # TODO\n # This is what comes from the plugin\n # this is a big problem, 'cause regexes does not know how to count...\n # how should i very values quoted with two single quotes? using .+ sux.\n sngl_quotes_re = /'(.+)'=>'(.+)'/\n self.match(dbl_quotes_re) || self.match(sngl_quotes_re)\n end",
"title": ""
},
{
"docid": "daa6b001b7d06994b8b0ac230e8e8a58",
"score": "0.52584785",
"text": "def schema_validate(schema)\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "7483d2990e13f10c78612169da6ba23a",
"score": "0.5254125",
"text": "def validate\n super\n check_property :field, String\n end",
"title": ""
},
{
"docid": "33cc05dc7d2e4bd44018ea59210f4939",
"score": "0.5247978",
"text": "def valid_attributes\n # check basic correctnes of input hash\n ATTRIBUTES.each { |attr| return false unless @post_data.keys.include? attr }\n # check \"data\" attribute to contain 2 elements, as stated in task description\n data = @post_data[\"data\"]\n return false unless data.is_a?(Array) && data.size == INPUT_OBJECTS_COUNT\n # check \"data\" array to contain valid data\n data.each do |h|\n next if valid_data_hash? h\n return false\n end\n # input data is valid enough to process it\n true\n end",
"title": ""
},
{
"docid": "5932a2ccdb151d0c3ca2122343fe8162",
"score": "0.5247378",
"text": "def check_updated_user_data_validity(user_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(OrgDefinedId FirstName MiddleName\n LastName ExternalEmail UserName\n Activation),\n 'properties' => {\n 'OrgDefinedId' => { 'type' => %w(string null) },\n 'FirstName' => { 'type' => 'string' },\n 'MiddleName' => { 'type' => %w(string null) },\n 'LastName' => { 'type' => 'string' },\n 'ExternalEmail' => { 'type' => %w(string null) },\n 'UserName' => { 'type' => 'string' },\n 'Activation' => {\n 'required' => ['IsActive'],\n 'properties' => {\n 'IsActive' => {\n 'type' => 'boolean'\n }\n }\n }\n }\n }\n JSON::Validator.validate!(schema, user_data, validate_schema: true)\nend",
"title": ""
},
{
"docid": "5187bc938309f845ad126d7d11a89e4b",
"score": "0.5243902",
"text": "def check_update_demographics_field(demographics_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(Name Description),\n 'properties' => {\n 'Name' => { 'type' => 'string' },\n 'Description' => { 'type' => 'string' }\n }\n }\n JSON::Validator.validate!(schema, demographics_data, validate_schema: true)\nend",
"title": ""
},
{
"docid": "7647e8d36cb00d911af16b407b592421",
"score": "0.52396727",
"text": "def validate_key!\n end",
"title": ""
},
{
"docid": "cdab3afc2c10fc126d0b932b9da44294",
"score": "0.523692",
"text": "def validate(entry); end",
"title": ""
},
{
"docid": "f99d6e8892f3a88aff4129b24f870555",
"score": "0.5232497",
"text": "def test_add_hash\n data = {\n :id=>1,\n :name=>'matt'\n }\n assert RSolr::Message.add(data).to_s =~ /<field name=\"name\">matt<\\/field>/\n assert RSolr::Message.add(data).to_s =~ /<field name=\"id\">1<\\/field>/\n end",
"title": ""
},
{
"docid": "65bc0e5d4013d4ab340c75e8cd6f9458",
"score": "0.52276057",
"text": "def validate_arguments(args_hash, fields_list, type_ns = nil)\n check_extra_fields(args_hash, array_from_named_list(fields_list))\n add_order_key(args_hash, fields_list)\n fields_list.each do |field|\n key = field[:name]\n item = args_hash[key]\n check_required_argument_present(item, field)\n unless item.nil?\n original_name = field[:original_name]\n if original_name\n key = handle_name_override(args_hash, key, original_name)\n end\n\n item_type = get_full_type_signature(field[:type])\n item_ns = field[:ns] || type_ns\n key = handle_namespace_override(args_hash, key, item_ns) if item_ns\n\n # Separate validation for choice types as we need to inject nodes into\n # the tree. Validate as usual if not a choice type.\n unless validate_choice_argument(item, args_hash, key, item_type)\n validate_arg(item, args_hash, key, item_type)\n end\n end\n end\n return args_hash\n end",
"title": ""
},
{
"docid": "c90c01043fd12ce6aff85c817a01f6f5",
"score": "0.5227077",
"text": "def invalid_items\n return @invalid_items if @invalid_items\n\n items = @input.select { |k, v| validate_invalid?(k, v) if all_items.include?(k) }\n case @called_method\n when :entry_tran, :re_exec_tran, :change_tran\n unless (1..9_999_999).include?(@input[:amount].to_i + @input[:tax].to_i)\n items[:amount] = @input[:amount] if @input[:amount]\n items[:tax] = @input[:tax] if @input[:tax]\n end\n when :entry_tran_btc\n unless (1..300_000).include?(@input[:amount].to_i + @input[:tax].to_i)\n items[:amount] = @input[:amount] if @input[:amount]\n items[:tax] = @input[:tax] if @input[:tax]\n end\n end\n @invalid_items = items\n end",
"title": ""
},
{
"docid": "7b7f674fc2820a781fbe53332f25d5e1",
"score": "0.5226339",
"text": "def test_has_key_bad_params_hash\n assert_raise TypeError do\n Sketchup.active_model.options[0].has_key? Hash.new\n end\n end",
"title": ""
},
{
"docid": "3a59124a22272b2a589d3fc70d506f85",
"score": "0.5223091",
"text": "def check_unique(item)\n item.valid?\n end",
"title": ""
}
] |
7cf5b42f6991df24e6c56fb5f170d5e6 | render errors with json saying status unauth | [
{
"docid": "1fce00188b1a3c8bf2c768c2aa0b005c",
"score": "0.80611974",
"text": "def render_unauthorized(message)\n errors = { errors: [detail: message ] }\n render json: errors, status: :unauthorized\n end",
"title": ""
}
] | [
{
"docid": "5a01daa2c0e632f4589dcdfaf8231062",
"score": "0.8300477",
"text": "def render_failed_auth_response\n render status: 401,\n json: json_response(:fail, data: {user: \"Valid email and token must be present.\"})\n end",
"title": ""
},
{
"docid": "59c4ab280b881ab88cb089f0f3c59c26",
"score": "0.825102",
"text": "def invalid_authentication\n #render json: {errors: ['Invalid Request']}, status: :unauthorized\n error!('Invalid Request', :unauthorized)\n end",
"title": ""
},
{
"docid": "973e2357c543e7f426265c53dcd90957",
"score": "0.82338303",
"text": "def render_failed_auth_response\n render status: 401,\n json: json_response(:fail, data: {user: \"Valid username and token must be present.\"})\n end",
"title": ""
},
{
"docid": "0792439d9eb1b36516dad6a4cfaca011",
"score": "0.82188433",
"text": "def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: t('unauthorized')}, status: 401 # Authentication timeout\n end",
"title": ""
},
{
"docid": "0792439d9eb1b36516dad6a4cfaca011",
"score": "0.82188433",
"text": "def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: t('unauthorized')}, status: 401 # Authentication timeout\n end",
"title": ""
},
{
"docid": "0792439d9eb1b36516dad6a4cfaca011",
"score": "0.82188433",
"text": "def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: t('unauthorized')}, status: 401 # Authentication timeout\n end",
"title": ""
},
{
"docid": "53a6f2b6af06a2d0987bbcbc067e4f92",
"score": "0.8207971",
"text": "def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: t('unauthorized')}, status: 401 # Authentication timeout\n end",
"title": ""
},
{
"docid": "a9640aea620964500f8235ad038c749a",
"score": "0.8191617",
"text": "def render_invalid_user\n render json: { error: \"Invalid API token\" }, status: :unauthorized\n end",
"title": ""
},
{
"docid": "4bd89245c05b0b88bac8abe9be930e57",
"score": "0.81433934",
"text": "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end",
"title": ""
},
{
"docid": "8bb7f4233bbf62d7c59b1a6c3f2938c0",
"score": "0.8129787",
"text": "def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: 'unauthorized'}, status: 401 # Authentication timeout\n end",
"title": ""
},
{
"docid": "db052f361c6514af899066cf78bac500",
"score": "0.8076757",
"text": "def render_unauthorized(message)\n errors = {errors: [detail: message]}\n render json: errors, status: :unauthorized\n end",
"title": ""
},
{
"docid": "2c2de7702b19c3a2582a498fc186e966",
"score": "0.8075791",
"text": "def render_unathorized(message)\n errors = { errors: [ { detail: message } ] }\n render json: errors, status: :unauthorized\n end",
"title": ""
},
{
"docid": "6a15fb3d165929cf03ae1d745ba4cd2f",
"score": "0.80561715",
"text": "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end",
"title": ""
},
{
"docid": "3b280760f110f1e7772c38fc20b025dc",
"score": "0.80458426",
"text": "def auth_error(e)\n json_response({ message: e.message }, :unprocessable_entity)\n end",
"title": ""
},
{
"docid": "51e1577a5b382567c09a8fb58fb8aa15",
"score": "0.80384797",
"text": "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end",
"title": ""
},
{
"docid": "51e1577a5b382567c09a8fb58fb8aa15",
"score": "0.80384797",
"text": "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end",
"title": ""
},
{
"docid": "51e1577a5b382567c09a8fb58fb8aa15",
"score": "0.80384797",
"text": "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end",
"title": ""
},
{
"docid": "51e1577a5b382567c09a8fb58fb8aa15",
"score": "0.80384797",
"text": "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end",
"title": ""
},
{
"docid": "51e1577a5b382567c09a8fb58fb8aa15",
"score": "0.80384797",
"text": "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end",
"title": ""
},
{
"docid": "0f4f579c24ae4bc50294884b56d48d00",
"score": "0.80292743",
"text": "def invalid_authentication\n render json: {errors: {code: 401, message: \"You need to sign in\"}}, status: :unauthorized\n end",
"title": ""
},
{
"docid": "d025e323c9d82859794c99140cc2b109",
"score": "0.802644",
"text": "def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: 'unauthorized'}, status: 401 # Authentication timeout\n end",
"title": ""
},
{
"docid": "94429d1ad94ffd79b3eba7bf52edc6b1",
"score": "0.8014954",
"text": "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"title": ""
},
{
"docid": "94429d1ad94ffd79b3eba7bf52edc6b1",
"score": "0.8014954",
"text": "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"title": ""
},
{
"docid": "94429d1ad94ffd79b3eba7bf52edc6b1",
"score": "0.8014954",
"text": "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"title": ""
},
{
"docid": "94429d1ad94ffd79b3eba7bf52edc6b1",
"score": "0.8014954",
"text": "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"title": ""
},
{
"docid": "94429d1ad94ffd79b3eba7bf52edc6b1",
"score": "0.8014954",
"text": "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"title": ""
},
{
"docid": "94429d1ad94ffd79b3eba7bf52edc6b1",
"score": "0.8014954",
"text": "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"title": ""
},
{
"docid": "94429d1ad94ffd79b3eba7bf52edc6b1",
"score": "0.8014954",
"text": "def access_denied\n render :json => %Q~{\"errors\": [\"Please login to consume the REST API\"]}~, :status => 401\n end",
"title": ""
},
{
"docid": "45ba5bc652dcd393b4ca8e22d273c921",
"score": "0.80145305",
"text": "def invalid_authentication\n render json: {error: 'Invalid request'}, status: :unauthorized\n end",
"title": ""
},
{
"docid": "4b1e364b3edeb73409eccd87059d45be",
"score": "0.8012707",
"text": "def failure\n render :json => {:success => false, :errors => {:reason => \"Login failed. Try again\"}}, :status => 401\n end",
"title": ""
},
{
"docid": "629f7817e4cdd260c59bf27c3ff050fc",
"score": "0.80120003",
"text": "def invalid_authentication\n render json: { error: 'Invalid Request' }, status: :unauthorized\n end",
"title": ""
},
{
"docid": "629f7817e4cdd260c59bf27c3ff050fc",
"score": "0.80120003",
"text": "def invalid_authentication\n render json: { error: 'Invalid Request' }, status: :unauthorized\n end",
"title": ""
},
{
"docid": "629f7817e4cdd260c59bf27c3ff050fc",
"score": "0.80120003",
"text": "def invalid_authentication\n render json: { error: 'Invalid Request' }, status: :unauthorized\n end",
"title": ""
},
{
"docid": "629f7817e4cdd260c59bf27c3ff050fc",
"score": "0.80120003",
"text": "def invalid_authentication\n render json: { error: 'Invalid Request' }, status: :unauthorized\n end",
"title": ""
},
{
"docid": "0425d654a0586ff0538e2c38140ab2c4",
"score": "0.79935575",
"text": "def render_unauthenticated_errors(exception)\n render json: {\n message: 'UnAuthenticated.',\n details: exception.error_codes\n }, status: 401\n end",
"title": ""
},
{
"docid": "8c739c3defdcab82466e670d502b575d",
"score": "0.7993271",
"text": "def invalid_authentication\n render json: { error: 'Invalid request' }, status: 403\n end",
"title": ""
},
{
"docid": "7d7ae6af1f33be9a960c061d2f8273ea",
"score": "0.79849494",
"text": "def render_401\n errors = JsonApiServer.errors(\n status: 401,\n title: I18n.t('json_api_server.render_401.title'),\n detail: I18n.t('json_api_server.render_401.detail')\n )\n render json: errors.to_json, status: 401\n end",
"title": ""
},
{
"docid": "dbe07b4df955890ce33e7b906ba92fbd",
"score": "0.797688",
"text": "def invalid_authentication\n render json: { error: 'Not Authenticated' }, status: :unauthorized\n end",
"title": ""
},
{
"docid": "e3ca2c33b4021c645865ec6c8f41f6f2",
"score": "0.7976278",
"text": "def invalid_authentication\n render json: { error: 'Unauthorized' }, status: :unauthorized\n end",
"title": ""
},
{
"docid": "9f469f240aa61cf06cae7180dfe0d406",
"score": "0.79496545",
"text": "def render_errors(errors)\n render json: errors, status: :bad_request\n end",
"title": ""
},
{
"docid": "f1f41b81c48c69316c6a2a51c38a9f00",
"score": "0.79446334",
"text": "def invalid_authentication\n render json: {message: 'Invalid Request'}, status: :unauthorized\n end",
"title": ""
},
{
"docid": "1486d5f4c55c4f33294d994e945efe68",
"score": "0.79408294",
"text": "def render_unauthorized(message)\n errors = {errors: [detail: message]}\n render json: errors, status: :unauthorized\n end",
"title": ""
},
{
"docid": "80bfc860f49c9adff99a610deb239e38",
"score": "0.7931825",
"text": "def authentication_error\n # User's token is either invalid or not in the right format\n render 'api/v1/shared/failure', locals: { errors: [{ user: ['is unauthorized'] }] }, status: :unauthorized # Authentication timeout\n end",
"title": ""
},
{
"docid": "a9dceb0b80820bef2a9de4c82241c7a1",
"score": "0.7929952",
"text": "def render_error(status, msg)\n render json: {errors: [msg]}, status: status\n end",
"title": ""
},
{
"docid": "2fa3bfca3a2545afaf4ad45b85de9951",
"score": "0.7925398",
"text": "def render_unauthorized(message)\n\t\terrors = {errors: [{detail: message}]}\n\t\trender json: errors, status: :unauthorized\n\tend",
"title": ""
},
{
"docid": "23593a88600a9a04b10ce7bbde76f213",
"score": "0.79094654",
"text": "def render_unauthorized(message)\n errors = { errors: [ { detail: message } ] }\n render json: errors, status: :unauthorized\n end",
"title": ""
},
{
"docid": "da4293ab26cce0c191e2c82f0eb7943e",
"score": "0.7900034",
"text": "def json_error_response\n # status must be assigned, ||= will often return 200\n self.status = 401\n self.content_type = \"application/json\"\n # have to include format_json here because custom error app\n # doesn't seem to call render json: as normal\n # so pretty param is ignored\n self.response_body = format_json(\n { errors: [{ status: status, detail: i18n_message }] },\n {} # options hash normally handled by render block\n )\n end",
"title": ""
},
{
"docid": "1c96fca1783e53abe278983a193c828a",
"score": "0.7864738",
"text": "def invalid_authentication\n Log.error(\"invalid_authentication\")\n render json: {error: 'Invalid authentication'}, status: :unauthorized\n end",
"title": ""
},
{
"docid": "fa5469b73c1ad143ddf9473f3eac573e",
"score": "0.7787307",
"text": "def not_authorized\n render json: {\n error: 'Email or password are invalid',\n status: :unauthorized\n }, status: :unauthorized\n end",
"title": ""
},
{
"docid": "97578d2e732b225e6073992cfe759597",
"score": "0.77676976",
"text": "def authenticate_error\n render json: { error: t('devise.failure.unauthenticated') }, status: 401\n end",
"title": ""
},
{
"docid": "141d321351d936f2d52b68c2bb1b583d",
"score": "0.7754356",
"text": "def render_error message, status\n error = {\n error: {\n message: message\n }\n }\n render json: error, status: status\n end",
"title": ""
},
{
"docid": "412c3a28020626e3b86e6c827d9fd861",
"score": "0.77161145",
"text": "def not_auth(status = :unauthorized)\n render json: {\n result: 'Error',\n message: 'Unauthorized Access',\n status: 'Unauthorized'\n }, status: status\n end",
"title": ""
},
{
"docid": "a8d7586607fe5315ee82d22e3a4ccd80",
"score": "0.770747",
"text": "def unauthorized\n render json: {error: 'Unauthorized'}, status: 401\n end",
"title": ""
},
{
"docid": "0c544db560369138ac98fe66182b2829",
"score": "0.7703734",
"text": "def failure\n return render json: {:message => \"Login Failed\" }, :status => :bad_request\n end",
"title": ""
},
{
"docid": "eefec0533e8851e89eb2cacac83fb6a7",
"score": "0.76674753",
"text": "def catch_errors\n # example\n yield\n rescue UnauthenticatedError => e\n json = { errors: [ { status: '401', title: e.message } ] }\n render json: json, status: :unauthorized\n rescue => e\n json = { errors: [ { status: '400', title: e.message } ] }\n render json: json, status: :bad_request\n end",
"title": ""
},
{
"docid": "ef144f69273980fb72fd25a866c0e73c",
"score": "0.76497453",
"text": "def render_unauthorized_errors(exception)\n render json: {\n message: 'Unauthorized.',\n details: exception.error_codes\n }, status: 403\n end",
"title": ""
},
{
"docid": "57638959f0c751e7668a69f9492fa311",
"score": "0.7635864",
"text": "def render_error_json(msg = '', status = :internal_server_error, data = nil, links = nil)\n render json: {\n status: 'error',\n code: ApplicationHelper.code_status[status],\n msg: msg,\n data: data,\n links: links\n }, status: status\n end",
"title": ""
},
{
"docid": "8d8efc8ad52ed33d915f856f5761c103",
"score": "0.7615112",
"text": "def render_failed_driver_auth_response\n render status: 401,\n json: json_response(:fail, data: {user: \"User is not a driver.\"})\n end",
"title": ""
},
{
"docid": "b3ca658b99d58a63c176348d60ba1299",
"score": "0.7589241",
"text": "def render_error(err)\n json_response({ message: err }, :unprocessable_entity)\n end",
"title": ""
},
{
"docid": "94ddd5871c5eb9a786a2048e4b65db86",
"score": "0.7588683",
"text": "def unauthorized(message)\n render json: {\n errors: message,\n status: :unauthorized\n }, status: 401\n end",
"title": ""
},
{
"docid": "7ac75c2d6db0ae5790f4598640687c2d",
"score": "0.75813216",
"text": "def failure\n render json: {error: 'Token is invalid.', messages: params},:status => :unauthorized\n end",
"title": ""
},
{
"docid": "7230edea5a486c4af3c7fbb217b6bfe7",
"score": "0.7580973",
"text": "def invalid_login_attempt\n \n set_flash_message(:alert, :invalid)\n data = {:code => \"NOK\"}\n render json: data \n # render json: flash[:alert], status: 401\n end",
"title": ""
},
{
"docid": "c2a8720d3754c1a4f600b05a008ec094",
"score": "0.7565837",
"text": "def invalid_login_attempt\n set_flash_message(:error, :invalid)\n render json: flash[:error], status: 401\n end",
"title": ""
},
{
"docid": "f06863baf48fdbc1e2b4a79bdcdbdd22",
"score": "0.7546191",
"text": "def invalid_token\n render json: {\n error: \"Invalid Authenticition Token\",\n status: 400\n }, :status => 403\n end",
"title": ""
},
{
"docid": "81735e6479047438a3eedfd8c22dbe2d",
"score": "0.7534982",
"text": "def error_message(errors, status)\n render json: { errors: errors }, status: status\n end",
"title": ""
},
{
"docid": "dfc680a40d22e26bcb39a353d3eb07f9",
"score": "0.75333524",
"text": "def render_fail_json(msg = '', status = :unauthorized, data = nil, links = nil)\n render json: {\n status: 'fail',\n code: ApplicationHelper.code_status[status],\n msg: msg,\n data: data,\n links: links\n }, status: status\n end",
"title": ""
},
{
"docid": "ce84a0bce771e024335b83ee0301426c",
"score": "0.74814767",
"text": "def unauthorized_render_options(error: nil)\n { json: { status_code: 401, error: \"Unauthorized (invalid token)\" } }\n end",
"title": ""
},
{
"docid": "3e0e88eb032389c50379f340f68bde35",
"score": "0.7441402",
"text": "def invalid_authentication\n render_error 'Authentication failure', 'unauthorized', 401\n end",
"title": ""
},
{
"docid": "95f1f62a91f034caa1def4a8e59b9653",
"score": "0.74133015",
"text": "def unauthorized\n render_json error: 'Access Not Authorized', status: :forbidden\n end",
"title": ""
},
{
"docid": "708192b7f042f5ca98d1cd8a000eb0a6",
"score": "0.7405872",
"text": "def error(status, code, message)\n render :json => {:response_type => \"ERROR\", :response_code => code, :message => message}.to_json, :status => status\n end",
"title": ""
},
{
"docid": "07b35fa6cad8a7df40c21031dc0ee5ad",
"score": "0.7381192",
"text": "def render_error_messages(errors, status = :unprocessable_entity)\n render(json: { errors: errors }, status: status)\n end",
"title": ""
},
{
"docid": "b9b8bda0f1054bf231d62e1ea2ac2b23",
"score": "0.7349461",
"text": "def json_render_errors(errors)\n json_fail errors\n end",
"title": ""
},
{
"docid": "1df8122b53e4cf0c13b9f9232e2bcfdd",
"score": "0.73476726",
"text": "def render_bad_request(error)\n json_response({ error: { message: error.message } }, :bad_request)\n end",
"title": ""
},
{
"docid": "95d179538352a7298c4b21f942e0f848",
"score": "0.7345787",
"text": "def unauthorized\n render :json => \"You are not authorized for access.\", :status => :unauthorized\n end",
"title": ""
},
{
"docid": "7afdf85bee5886499dc4f1573b39b63c",
"score": "0.73389727",
"text": "def render_unauthorized(payload = { errors: { unauthorized: [\"You are not authorized perform this action.\"] } })\n render json: payload, status: 401\n end",
"title": ""
},
{
"docid": "cfae2c7157d2e484c81709e4336021d1",
"score": "0.733448",
"text": "def fail_response(errors, status)\n respond_to do |format|\n # we should avoid \"any(:js, :json)\" if we want to get\n # responses with content-type 'application/json'\n # from the server and no 'text/javascript' or whatever else\n # that can cause problems while handle response\n # because in case of 'text/javascript'\n # response we will get stringify version of json response\n format.json { error_message(errors, status) }\n format.html do\n flash[:danger_notice] = errors.first\n redirect_to root_url\n end\n end\n end",
"title": ""
},
{
"docid": "79606c3c9d541d52e7edb5686001ef9b",
"score": "0.73266417",
"text": "def unauthorized\n render \"errors/401\", :status => 401\n\tend",
"title": ""
},
{
"docid": "f8cc6a62fe05190bfe431bc66b8a0bc6",
"score": "0.7324693",
"text": "def unauthorized_response\n respond_to do |format|\n format.json { render json: {error: 'admin_required'}, status: :unauthorized }\n format.any { head :unauthorized }\n end\n end",
"title": ""
},
{
"docid": "93b6177d63fb764bea768a2b80e8c2ba",
"score": "0.73241544",
"text": "def invalid_login_attempt\n respond_to do |format|\n if request.xhr?\n format.json { render json: \"Error with your login or password\", status: 401 }\n else\n format.html { redirect_to :back, alert: 'Error with your login or password'}\n end\n end\n end",
"title": ""
},
{
"docid": "64ee135eee05e1763f7ebc6e82fcde33",
"score": "0.7309343",
"text": "def response_for_unable_to_authenticate(env)\n handle_head(env) do\n body = { 'errors' => { 'mauth' => ['Could not determine request authenticity'] } }\n [500, { 'Content-Type' => 'application/json' }, [JSON.pretty_generate(body)]]\n end\n end",
"title": ""
},
{
"docid": "05418fd6bd02355c8178bc55d0e969d3",
"score": "0.72814935",
"text": "def render_unauthorized\n logger.debug \" *** UNAUTHORIZED REQUEST: '#{request.env['HTTP_AUTHORIZATION']}' ***\"\n self.headers['WWW-Authenticate'] = 'Token realm=\"Application\"'\n render json: {error: \"Bad credentials\"}, status: 401\n end",
"title": ""
},
{
"docid": "4ca4dcff4eec7016496b443576841595",
"score": "0.72787184",
"text": "def respond_with_bad_request(errors)\n render :status => :bad_request, :json => {\n :message => errors.full_messages.join(', ') }\n end",
"title": ""
},
{
"docid": "006b194146d08d832655b8c43b683815",
"score": "0.72716045",
"text": "def render_error(type = nil)\n if type == \"empty\"\n render json: { error: \"No results were found! Please try again with another keyword.\" }, status: 422\n elsif type == \"missing_params\"\n render json: { error: \"Query missing. Please try again with a query string.\" }\n else\n render json: { error: \"Access denied: your API key is invalid. Please enter a valid API key to continue.\" }, status: 401\n end\n end",
"title": ""
},
{
"docid": "6e4bff3f77d2ce9cb32a91881a6aa77e",
"score": "0.7269209",
"text": "def unauthenticated\n { :json => {success: false, \n error: \"You must authenticate in order to make this request.\",\n status: \"401\"}, \n :status => \"401\" }\n end",
"title": ""
},
{
"docid": "2c46095ba842a009c075fc5bf5f596af",
"score": "0.7260791",
"text": "def unauthenticated\n render_json status: :unauthorized\n end",
"title": ""
},
{
"docid": "c3025cc48047debd3765cd9ffff46b61",
"score": "0.7255491",
"text": "def bad_request\n render :json => {:success=>false, :error_code=> 400, :error_msg=>\"Bad Request\"}\n end",
"title": ""
},
{
"docid": "0f6613772121511a8dec179add75cba7",
"score": "0.7225981",
"text": "def render_error(msg, status)\n render_403\n end",
"title": ""
},
{
"docid": "daa873835e15346dad63e96dc37523fd",
"score": "0.7214163",
"text": "def unauthenticated_response(errors)\n # default to a blank realm, I suppose\n realm = @options[:realm] || ''\n response_headers = {\"WWW-Authenticate\" => %Q(OAuth realm=\"#{realm}\"), 'Content-Type' => 'application/json'}\n\n body = {'errors' => errors}\n error_message = begin\n error_values = errors.values.inject([], &:+)\n if error_values.size <= 1\n error_values.first\n else\n # sentencify with periods \n error_values.map { |v| v =~ /\\.\\s*\\z/ ? v : v + '.' }.join(' ')\n end\n end\n body['error_message'] = error_message if error_message\n\n [401, response_headers, [JSON.pretty_generate(body)]]\n end",
"title": ""
},
{
"docid": "2de77f973ea66f096884a8e3d4352319",
"score": "0.7193635",
"text": "def display_errors\n return super unless format == :json\n\n errors, status = resource_errors\n\n controller.render problem: errors, status: status\n end",
"title": ""
},
{
"docid": "6287545476568d23c22ac4e3c976805e",
"score": "0.7181383",
"text": "def error_response(exception)\n render json: { message: exception.message }, status: :bad_request\n end",
"title": ""
},
{
"docid": "30567889485583e4e70c7bd17fd1a9fb",
"score": "0.71751636",
"text": "def response_for(status, exception)\n render json: {\n errors: [exception.message],\n }, status: status\n end",
"title": ""
},
{
"docid": "fdfe839b59bf07d8cfc33e3928f6057e",
"score": "0.7159831",
"text": "def render_access_denied\r\n RenderError.new('422')\r\n end",
"title": ""
},
{
"docid": "d669f71253d8a2c800ce87d208c07734",
"score": "0.7156941",
"text": "def access_denied\n error = error_response_method($e12)\n render :json => error\n end",
"title": ""
},
{
"docid": "834d605706cd7195c3872a323008f09f",
"score": "0.7156751",
"text": "def unauthorized_request(e)\n render json: { message: e.message }, status: :unauthorized\n end",
"title": ""
},
{
"docid": "834d605706cd7195c3872a323008f09f",
"score": "0.7156751",
"text": "def unauthorized_request(e)\n render json: { message: e.message }, status: :unauthorized\n end",
"title": ""
},
{
"docid": "938669b138e7558f8f7ab4d16df6c7d4",
"score": "0.7141055",
"text": "def unauthorized_request(err)\n json_response({ message: err.message }, :unauthorized)\n end",
"title": ""
},
{
"docid": "02705dabeffe55517012a4bc5535f68e",
"score": "0.71302557",
"text": "def error(message, status = 422)\n render text: message, status: status\n end",
"title": ""
},
{
"docid": "9995db57465704dbbb68f741ba2ab81c",
"score": "0.7120509",
"text": "def authenticate_user!\n return if current_user\n render json: json_message(errors: 'Acceso denegado. Por favor ingresa.'), status: 401\n end",
"title": ""
},
{
"docid": "0eb2020643eccaea74250ce28faaeee7",
"score": "0.71155083",
"text": "def unauthorized\n\n render_error( :unauthorized )\n\n end",
"title": ""
},
{
"docid": "15db54ab349bf42f6e1616fe0dee85b3",
"score": "0.7112215",
"text": "def four_zero_one(error)\n json_response(error.message, :unauthorized)\n end",
"title": ""
}
] |
3768bb2296f298736f42d5a56d74c6e0 | List all account permission List all account permission | [
{
"docid": "48f7c46b634271a0ca411133a7dfaf82",
"score": "0.0",
"text": "def get_all_account_permission_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AccountApi.get_all_account_permission_using_get ...'\n end\n # resource path\n local_var_path = '/nucleus/v1/account_permission'\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 => 'PageAccountPermissionVO')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountApi#get_all_account_permission_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
}
] | [
{
"docid": "81934c9ec4557f94348fe9c079f2d4bd",
"score": "0.7732833",
"text": "def index\n @admin_account_permissions = Admin::AccountPermission.account_group_find(params).paginate(page: params[:page])\n end",
"title": ""
},
{
"docid": "13987b98ba0a50b45574199c26f3c480",
"score": "0.7619058",
"text": "def show\n @admin_account_permissions = @admin_permission.account_permissions\n end",
"title": ""
},
{
"docid": "a0c2c4ad1527f43890875fbfdb0c208c",
"score": "0.74654657",
"text": "def list_permissions(options={}) path = \"/api/v2/definitions/permissions\"\n get(path, options, AvaTax::VERSION) end",
"title": ""
},
{
"docid": "41a635d34c678469322b9d2d193c7a7b",
"score": "0.74236983",
"text": "def index\n\t\t@permissions = Permission.all\n\tend",
"title": ""
},
{
"docid": "f3f8d504f671e618fedf70a8c4842871",
"score": "0.7367881",
"text": "def index\n @admin_permissions = Admin::Permission.all\n end",
"title": ""
},
{
"docid": "b26bfa57247539fcdbf1d148cfe9a3dc",
"score": "0.73094803",
"text": "def show\r\n @permissions = Permission.all\r\n end",
"title": ""
},
{
"docid": "131b10ed7db7fad396bb236714ccc89e",
"score": "0.7271811",
"text": "def index\n @permissions = Permission.all\n end",
"title": ""
},
{
"docid": "8a7cf325fc5e210e10d33ed9548c8684",
"score": "0.7269985",
"text": "def list\n @content_columns = Permission.content_columns\n @permission_pages, @permissions = paginate :permission, :order => 'id', :per_page => 15\n end",
"title": ""
},
{
"docid": "28a18e55a062582cca3ebf5c3e550b20",
"score": "0.72355837",
"text": "def list\n @permission_pages, @permissions = paginate :static_permission, :per_page => 20\n end",
"title": ""
},
{
"docid": "82c5e8ecd99d6dab22c3f77718239383",
"score": "0.7174909",
"text": "def permissions\n api.get(:permissions)\n end",
"title": ""
},
{
"docid": "42a8187e6f0ec3104ad68844beeef1a2",
"score": "0.715964",
"text": "def list()\n @client.team_app_permission.list()\n end",
"title": ""
},
{
"docid": "6db2d16f2f954562bafce0311c0f4915",
"score": "0.7152855",
"text": "def index\n @admin_user_permissions = UserPermission.all\n end",
"title": ""
},
{
"docid": "5f26ac659824ac09ce6eaa8ddf959444",
"score": "0.7143956",
"text": "def index\n @permissions = Permission.all\n\n @permissions = filter_by_pagination(relation: @permissions)\n end",
"title": ""
},
{
"docid": "4156c4818de1ebd5b92d2e94f2d5cbed",
"score": "0.7107766",
"text": "def index\n @user_permissions = UserPermission.all\n end",
"title": ""
},
{
"docid": "1fcb101327de09a4a4794ebe4dc1e247",
"score": "0.7043731",
"text": "def index\n @admin_permissions = admin_permissions.all\n end",
"title": ""
},
{
"docid": "77e82402739d854a49967918cacdaf8b",
"score": "0.6955487",
"text": "def permissions\n response = request(:get, '/permissions.json')\n response.collect { |perm| perm['permission'] }\n end",
"title": ""
},
{
"docid": "77e82402739d854a49967918cacdaf8b",
"score": "0.6955487",
"text": "def permissions\n response = request(:get, '/permissions.json')\n response.collect { |perm| perm['permission'] }\n end",
"title": ""
},
{
"docid": "32a702d6a60f0dbb628b785293e7413c",
"score": "0.69493914",
"text": "def index\n @admin_group_permissions = Admin::GroupPermission.all\n end",
"title": ""
},
{
"docid": "8838be4b1b2c4a4e592fef0535aea417",
"score": "0.6929145",
"text": "def index\n @permissions = Permission.all.paginate(page: params[:page], per_page: 15).order('id DESC')\n end",
"title": ""
},
{
"docid": "07906f57636cfe71b8760b232abb5e62",
"score": "0.69085383",
"text": "def index\n @permission_roles = PermissionRole.all\n end",
"title": ""
},
{
"docid": "d725e242ec2e90492c55df2a90b523ad",
"score": "0.6898519",
"text": "def index\n @admin_permissions = Admin::Permission.find_mine(params).paginate(page: params[:page])\n end",
"title": ""
},
{
"docid": "16932df8a9d51fd12d97ad8053bd7773",
"score": "0.6877123",
"text": "def index\n @merchant_account_permission_details = MerchantAccountPermissionDetail.all\n end",
"title": ""
},
{
"docid": "54488534fee839b4ef5e51811d9c20e5",
"score": "0.6868669",
"text": "def get_api_permissions(account_href)\n @permissions[account_href] || []\n end",
"title": ""
},
{
"docid": "def8e853f92dea6635bed03a87370f63",
"score": "0.6815609",
"text": "def index\n @edit_permissions = EditPermission.all\n end",
"title": ""
},
{
"docid": "11eac1fd4c6c59f91536e8095ccd429a",
"score": "0.6815438",
"text": "def all_permissions\n return permissions unless role\n permissions + role.permissions\n end",
"title": ""
},
{
"docid": "09f5f47671ca86256c6c2bde8086a8a1",
"score": "0.6813072",
"text": "def index\n @cdg_permissions = CdgPermission.all\n end",
"title": ""
},
{
"docid": "e936f2558928bcdb1ef1cca5d1c68f74",
"score": "0.6812555",
"text": "def show\n find_permissions\n @role_permission_ids = @core_role.role_permissions.map(&:permission_id)\n end",
"title": ""
},
{
"docid": "ae3f0401db896de305a820f275e1aec7",
"score": "0.6801583",
"text": "def index\n @level_permissions = LevelPermission.all\n end",
"title": ""
},
{
"docid": "cbe4f7fe4fac13425e7124c7c329ba3f",
"score": "0.6775767",
"text": "def show\n @user = User.find(params[:id])\n @all_permissions = Permission.all\n @unique_permissions = Permission.pluck(:name).uniq!\n end",
"title": ""
},
{
"docid": "9060c79fcba9af87a98ca3e7e17e13e3",
"score": "0.6772689",
"text": "def index\n @folderpermissions = Folderpermission.all\n end",
"title": ""
},
{
"docid": "4611a2872f1456225c20ff95c9c216ca",
"score": "0.6747701",
"text": "def index\n @permission_details = PermissionDetail.all\n end",
"title": ""
},
{
"docid": "40ee1e95b2ef1c8625ad72f66cbcee01",
"score": "0.6735595",
"text": "def index\n\t\t#@data = {name: '权限', path: '/managers/permissions'}\n\t\t@permissions = Permission.page(params[:page]).per(params[:rows])\n\t\trespond_with({rows: @permissions, total: @permissions.total_count}) \n\tend",
"title": ""
},
{
"docid": "2a76bcb861f8f9f1572671875aa72f50",
"score": "0.6716495",
"text": "def all_permissions\n (self.permissions + group_permissions + role_permissions).flatten\n end",
"title": ""
},
{
"docid": "33847174a70a66565f65b688e6dd4dbc",
"score": "0.670094",
"text": "def index\n @permissions = Permission.all\n authorize @permissions\n\n render json: @permissions\n end",
"title": ""
},
{
"docid": "5dd7357bd264deac29a88ceb2a6b4b3a",
"score": "0.6636536",
"text": "def list_perm_groups\n GLOBAL_CONFIG[:data][:permissions]\n end",
"title": ""
},
{
"docid": "5dd7357bd264deac29a88ceb2a6b4b3a",
"score": "0.6636536",
"text": "def list_perm_groups\n GLOBAL_CONFIG[:data][:permissions]\n end",
"title": ""
},
{
"docid": "87ea40589740444360eb95a3e6f3e478",
"score": "0.6619657",
"text": "def account_permission(account)\n group_members.joins(:account).where(account: account).first.group_member_permission\n end",
"title": ""
},
{
"docid": "2d0662c206edb70ac8fb26d4d21ee6f5",
"score": "0.6618626",
"text": "def index\n @user_permissions = current_rulemaking.user_permissions.includes(:user).order(\"users.name\").page(params[:page]).per_page(20)\n end",
"title": ""
},
{
"docid": "40fcff520da8f8aa030931b554cf3830",
"score": "0.65895504",
"text": "def permissions\n end",
"title": ""
},
{
"docid": "7fd9325e8173c2c1de7b24fb9f3d682a",
"score": "0.65813094",
"text": "def index\n @roles_permissions = RolesPermission.all\n end",
"title": ""
},
{
"docid": "a48dbe58b1009308eac498a63fa955f2",
"score": "0.65744233",
"text": "def permissions\n User.do_find_permissions :session_id => kb_session_id\n end",
"title": ""
},
{
"docid": "36ce2730c662e4807f14aede53a03e8a",
"score": "0.6568138",
"text": "def object_list\n [self, BasePermissionObject.general_permission_scope]\n end",
"title": ""
},
{
"docid": "7824f1ad75bc3babd89cf05f137f3287",
"score": "0.65580666",
"text": "def index\n @merchant_permissions = MerchantPermission.all\n end",
"title": ""
},
{
"docid": "18644a5f897136140a58197f312f6ee2",
"score": "0.6523909",
"text": "def index\n @permissionviews = Permissionview.all\n end",
"title": ""
},
{
"docid": "36b684463325c999b3743038b34b6200",
"score": "0.6519018",
"text": "def index\n @permissions = Permission.paginate(:page => params[:page], :per_page => 10).order('updated_at DESC')\n end",
"title": ""
},
{
"docid": "facec5fa1224d8fe50bd3ea9eca7ea94",
"score": "0.6516577",
"text": "def print_permissions\n self.permissions.each do |perm|\n puts sprintf(\"%s: \\t %s\",perm.name,perm.description)\n end\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512784",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512494",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512494",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512494",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512494",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512494",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512494",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512494",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512494",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512494",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512494",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512494",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512494",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512494",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512494",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512275",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512275",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "40b42d47bb858c11460670250019dcaa",
"score": "0.6512275",
"text": "def permissions\n @permissions\n end",
"title": ""
},
{
"docid": "f2173a81eab021b020d991ba8a62f5c8",
"score": "0.64757824",
"text": "def acl_entries\n user_acl_entries\n end",
"title": ""
},
{
"docid": "7812267a29576fb8f94eded6827fa08f",
"score": "0.64625555",
"text": "def permissions(opts = {})\n find_collection(\"permissions\", opts)\n end",
"title": ""
},
{
"docid": "9e6e53ac8dd4b64d001b7063df5d7a28",
"score": "0.64568985",
"text": "def permissions\n data.xpath(\"c:permission\", NS::COMBINED).map do |permit|\n principal = nil\n permissions = []\n direct = false\n permit.children.each do |child|\n next unless child.namespace && child.namespace.href == NS::CMIS_CORE\n\n case child.name\n when \"principal\"\n child.children.map do |n|\n next unless n.namespace && n.namespace.href == NS::CMIS_CORE\n\n if n.name == \"principalId\" && principal.nil?\n principal = convert_principal(n.text)\n end\n end\n when \"permission\"\n permissions << child.text\n when \"direct\"\n direct = AtomicType::Boolean.xml_to_bool(child.text)\n end\n end\n AclEntry.new(principal, permissions, direct)\n end\n end",
"title": ""
},
{
"docid": "6538e5b60c8b9af42a831692d470bfcf",
"score": "0.64548427",
"text": "def index\n @admin_permissions = Permission.paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_permissions }\n end\n end",
"title": ""
},
{
"docid": "0753b3a83871a4e1a39f5814ce9d4cb0",
"score": "0.6439347",
"text": "def attribute_permissions\n @pundit_attribute_lists\n end",
"title": ""
},
{
"docid": "f87748c15c29afc0f05801d8030255e8",
"score": "0.64344156",
"text": "def list_permissions\n hash = Dictionary.new\n users = Array.new\n users = accepts_who_with_role( [ :read, :each, :write ] )\n users.each do |user|\n hash[user.login.to_sym] = user.has_what_roles_on( self )\n end#do\n hash = hash.order_by {|key,value| value.length }\n hash = hash.reverse\n hash\n \n end",
"title": ""
},
{
"docid": "e9677b10b77c58b7c94341b36cd2052f",
"score": "0.6429066",
"text": "def list_permissions\n hash = Dictionary.new\n users = Array.new\n users = accepts_who_with_role( [ :read, :execute, :write ] )\n users.each do |user|\n hash[user.login.to_sym] = user.has_what_roles_on( self )\n end#do\n hash = hash.order_by {|key,value| value.length }\n hash = hash.reverse\n hash\n end",
"title": ""
},
{
"docid": "3aed9bd4448e1b5e8bbd1f35a07962e7",
"score": "0.6424996",
"text": "def list\n if current_user\n accounts = current_user.accounts\n render json: { accounts: accounts }, status: :ok\n else\n render json: { error: I18n.t('request.forbidden') }, status: :forbidden\n end\n end",
"title": ""
},
{
"docid": "84cf32136bf40ce197e34ed684ebd99e",
"score": "0.6414188",
"text": "def index\n @mg_permissions = MgPermission.all.paginate(page: params[:page], per_page: 5)\n end",
"title": ""
},
{
"docid": "bef0f53afe3a17a9ed9139f85c9cfdda",
"score": "0.6412885",
"text": "def permissions\n authorize @member\n @roles = Role.all\n end",
"title": ""
},
{
"docid": "44ce73db89c10ccfbc1ef2db579505c4",
"score": "0.6410609",
"text": "def permissions\n @permissions = (@item.id == 1) ?\n CustomizableAdmin::Settings::Permission.\n where(\"#{CustomizableAdmin::Settings::Permission.table_name}.id=1\") :\n CustomizableAdmin::Settings::Permission.\n where(\"#{CustomizableAdmin::Settings::Permission.table_name}.id!=1\")\n end",
"title": ""
},
{
"docid": "6cf18be4f2609af4cb55ce5755c0f240",
"score": "0.6402104",
"text": "def all_permissions\n list = []\n list << permissions_roles.collect { |p| p.permission }\n list << permissions_users.collect { |p| p.permission }\n return list.flatten\n end",
"title": ""
},
{
"docid": "105d2f24827ead157d226c84bc1b4d20",
"score": "0.63915205",
"text": "def permissions\n Permission.scoped(:joins => {:grants => {:role => {:privileges => :user}}}, :conditions => ['shell_users.User_ID = ?',id])\n end",
"title": ""
},
{
"docid": "14dd912c9d038df5931520ac83314490",
"score": "0.6372136",
"text": "def all_chanperms\n Ricer4::Chanperm.where(:user_id => self.id)\n end",
"title": ""
},
{
"docid": "73787edfeae9327d75acc35954760e72",
"score": "0.635873",
"text": "def listacls\n \n end",
"title": ""
},
{
"docid": "95bbfdf8f0299a081715d6a83d01ac2a",
"score": "0.6353841",
"text": "def permissions\n Array.wrap(self[:permissions]).collect(&:to_sym)\n end",
"title": ""
},
{
"docid": "db05a182f84c923a39cd458003c1fe67",
"score": "0.6345526",
"text": "def index\n @mg_roles_permissions = MgRolesPermission.all.paginate(page: params[:page], per_page: 5)\n end",
"title": ""
},
{
"docid": "13712a71ab222f3efb9fa8d020a1474b",
"score": "0.633624",
"text": "def permissions\n info['permissions']\n end",
"title": ""
},
{
"docid": "e2a6e2ad686ee122bc2d647e55f5bfad",
"score": "0.63347936",
"text": "def index\n @role = Role.friendly.find(params[:role_id])\n @role_permissions = RolePermission.where('role_id','=',@role)\n @permissions=Permission.all\n\n @role_permission = RolePermission.new\n end",
"title": ""
},
{
"docid": "89cb1849101eaf5614248e8c9b6f3080",
"score": "0.6332376",
"text": "def permissions; end",
"title": ""
},
{
"docid": "79780ecdb57ce0591e1e9bb765da267e",
"score": "0.6331508",
"text": "def get_account_permissions(account_uid, opts = {})\n # checks if all required parameters are set\n \n raise ArgumentError, 'Missing required parameter \"account_uid\"' if account_uid.nil?\n \n\n op = NovacastSDK::Client::Operation.new '/accounts/{account_uid}/permissions', :GET\n\n # path parameters\n path_params = {}\n path_params['account_uid'] = account_uid\n op.params = path_params\n\n # header parameters\n header_params = {}\n op.headers = header_params\n\n # query parameters\n query_params = {}\n query_params['resources[]'] = opts[:resources] if opts[:resources]\n op.query = query_params\n\n # http body (model)\n \n\n \n\n resp = call_api op\n\n \n NovacastSDK::IdentityV1::Models::RoleResourcePermissionsList.from_json resp.body\n \n end",
"title": ""
},
{
"docid": "d9d82a6668bea8c322f54074f6fdc83b",
"score": "0.6304905",
"text": "def permissions\n @all_admins = User.where(user_type: 'admin')\n @all_organizers = User.where(user_type: 'organizer')\n @all_mentors = User.where(user_type: 'mentor')\n end",
"title": ""
},
{
"docid": "8e0602f11e4fc5c329bc44db352a2620",
"score": "0.6298594",
"text": "def get_permissions\n if @role.type_role==\"system\"\n\t\t\t@permissions = Permission.find(:all, :order => 'name ASC')\n\t else\n @permissions = Permission.type_of(@role.type_role)\n end\n end",
"title": ""
},
{
"docid": "63c938ae662e8c50dfc4d705195b4ea6",
"score": "0.62908",
"text": "def index\n @permissions = Permission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @permissions }\n end\n end",
"title": ""
},
{
"docid": "288d243ee2316d19ba4cd00335bd9375",
"score": "0.6288106",
"text": "def permissions_pretty_list\n ppl = []\n self.user_scope_permissions.each do |psp|\n ppl << psp.datatype\n end\n ppl\n end",
"title": ""
},
{
"docid": "2d3a064659bb9869ca1b9399f3312247",
"score": "0.62842065",
"text": "def index\n @game_level_permissions = GameLevelPermission.all\n end",
"title": ""
},
{
"docid": "5c2d57113b3ca281f5004c84f22179d9",
"score": "0.6279802",
"text": "def permissions\n map(&:permissions).flatten.uniq\n end",
"title": ""
},
{
"docid": "33219db3fea3ef77670af9e713ad54a3",
"score": "0.6268841",
"text": "def index\n @user_permission_groups = UserPermissionGroup.all\n end",
"title": ""
},
{
"docid": "0303111579c262abbad2a818c6da33c8",
"score": "0.62442195",
"text": "def index\n @permission_group_items = PermissionGroupItem.all\n end",
"title": ""
},
{
"docid": "6da7db5bb21eae69d164d3c28cd8f42a",
"score": "0.6239842",
"text": "def index\n @q = SearchParams.new(params[:search_params] || {})\n @permissions = Permission.default_where(@q.attributes(self)).page(params[:page]).per(10)\n end",
"title": ""
},
{
"docid": "b828cd81fd95a4ebebcea600215dd308",
"score": "0.623863",
"text": "def get_all_account_permission_using_get(opts = {})\n data, _status_code, _headers = get_all_account_permission_using_get_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "b828cd81fd95a4ebebcea600215dd308",
"score": "0.623863",
"text": "def get_all_account_permission_using_get(opts = {})\n data, _status_code, _headers = get_all_account_permission_using_get_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "4cfb8c2291f708954cd273892da0e1dc",
"score": "0.62365633",
"text": "def permissions(role_id, action)\n Permission.where(:role_id => role_id,\n :resource_type => @resource_type_name, :action => action).order(\n 'resource_type,role_id,sequence').all\n end",
"title": ""
},
{
"docid": "017259efad65cdec82fb13742d0a8a16",
"score": "0.6234657",
"text": "def find_all_resources_for_account(account = _get_nil_account, authorizer)\n debug \"find_all_resources_for_account: #{account.inspect}\"\n res = OMF::SFA::Resource::OResource.all(:account => account)\n res.map do |r|\n begin\n authorizer.can_view_resource?(r)\n r\n rescue InsufficientPrivilegesException\n nil\n end\n end.compact\n end",
"title": ""
},
{
"docid": "864ce89a4119ea0f3cb43b3c2056addf",
"score": "0.62306577",
"text": "def permissions\n\t\t\t@permissions ||= fb_app.permissions.flatten.join(',')\n\t\tend",
"title": ""
},
{
"docid": "a492845fd67022be6e2b7a3f5908f0ac",
"score": "0.6213887",
"text": "def grand_all_permissions \n # copy permissions \n Permissions::TYPES.each do |permission_type|\n #eval \"self.#{permission_type} = true\" \n self[permission_type] = true\n end\n \n #self.create_client = true\n #self.read_client = true\n #self.update_client = true\n #self.delete_client = true\n \n #self.create_opportunity = account.create_opportunities\n #self.read_opportunity = account.read_opportunities\n #self.update_opportunity = account.create_opportunities\n #self.delete_opportunity = account.create_opportunities\n self.access_account = true\n begin\n self.save!\n \n # add to all catalogs\n self.account.catalogs.each do |catalog|\n catalog_user = catalog.add_account_user self\n end\n rescue\n end\n\n end",
"title": ""
},
{
"docid": "3226f8d030d90983fd6b8f78c34f47b3",
"score": "0.62117755",
"text": "def index\n @permissions = Permission.all\n\n render json: @permissions\n end",
"title": ""
}
] |
af630984682f1a0b5a68e6092af0d102 | Update properties of this object | [
{
"docid": "55fd5a78c781c46939e44848ef093fdf",
"score": "0.0",
"text": "def update!(**args)\n @access = args[:access] if args.key?(:access)\n @binding_explanations = args[:binding_explanations] if args.key?(:binding_explanations)\n @full_resource_name = args[:full_resource_name] if args.key?(:full_resource_name)\n @policy = args[:policy] if args.key?(:policy)\n @relevance = args[:relevance] if args.key?(:relevance)\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": ""
}
] |
1280d0698675a4c2bc1e6856913837dd | GET /rss_tests/1 GET /rss_tests/1.json | [
{
"docid": "57f888f0e9d3f1ebe299635a2e260bec",
"score": "0.757505",
"text": "def show\n @rss_test = RssTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rss_test }\n end\n end",
"title": ""
}
] | [
{
"docid": "1396743edd57caac463f3c2257aaa62e",
"score": "0.7896816",
"text": "def index\n @rss_tests = RssTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rss_tests }\n end\n end",
"title": ""
},
{
"docid": "8bb41f2e8739160bebe3ead6f608feac",
"score": "0.7116316",
"text": "def new\n @rss_test = RssTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rss_test }\n end\n end",
"title": ""
},
{
"docid": "b841b08e8c7604c1b4b5921d8746bd28",
"score": "0.66155404",
"text": "def show\n @rss = Rss.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rss }\n end\n end",
"title": ""
},
{
"docid": "f6f8de9dd2bc121a1e39b6778a236c9c",
"score": "0.64690983",
"text": "def test_rss\n get :georss\n assert_rss_success\n\n get :georss, :display_name => users(:normal_user).display_name\n assert_rss_success\n end",
"title": ""
},
{
"docid": "f6f8de9dd2bc121a1e39b6778a236c9c",
"score": "0.64690983",
"text": "def test_rss\n get :georss\n assert_rss_success\n\n get :georss, :display_name => users(:normal_user).display_name\n assert_rss_success\n end",
"title": ""
},
{
"docid": "1d87e20294019408d0ca441d5db51a5d",
"score": "0.64603764",
"text": "def show\n @rss_item = RssItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rss_item }\n end\n end",
"title": ""
},
{
"docid": "4384c4556642b7651d64100fd39bb3ed",
"score": "0.63708436",
"text": "def show\n @rssfeed = Rssfeed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rssfeed }\n end\n end",
"title": ""
},
{
"docid": "b5692f9f5d3d9a92be3e266b4bdfccf8",
"score": "0.63417125",
"text": "def show\n @feed = Feed.find(params[:id])\n @rss = SimpleRSS.parse open(@feed.url)\n @rss_items = (@rss.items.sort_by { |k| k[:pubDate] }).reverse\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n rescue\n redirect_to feeds_url\n end",
"title": ""
},
{
"docid": "84ce9fd1892aa3d690f280266a89803a",
"score": "0.6281373",
"text": "def new\n @rss = Rss.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rss }\n end\n end",
"title": ""
},
{
"docid": "84057360870df7d3c23f8256e7291fb0",
"score": "0.6186774",
"text": "def get_test\n @test = Test.where(url: params[:url]).select(\"url, ttfb, ttfp, speed_index, is_passed, max_ttfb, max_tti, max_ttfp, max_speed_index, created_at\").last.as_json(:except => :id)\n end",
"title": ""
},
{
"docid": "321eda729cf2a084bb6136e0236a737b",
"score": "0.6172054",
"text": "def index\n @tests = Test.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tests }\n end\n end",
"title": ""
},
{
"docid": "6b077e420c7752f617d70603ab04934f",
"score": "0.6168088",
"text": "def index\n @rss_items = RssItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rss_items }\n end\n end",
"title": ""
},
{
"docid": "3d5f6d84a90e957cb21a5a2478990937",
"score": "0.61496276",
"text": "def test_reading_single_post\n Glue::RSS.stubs(:get).returns(@rss)\n actual = Glue::RSS.new('jordan').feed(1,1)['rss']['channel'][\"item\"]\n assert_equal @title, actual[\"title\"]\n assert_match @body, actual[\"description\"]\n assert_equal @lurl, actual[\"link\"]\n assert_equal @guid, actual[\"guid\"]\n assert_equal @author, actual[\"dc:creator\"]\n end",
"title": ""
},
{
"docid": "d319e1e35450bb5130bece409749d2ea",
"score": "0.61446947",
"text": "def all\n location_id = params[:id]\n location_id ||= \"1\"\n url= \"http://localhost:8080\"\n r = RestClient::Resource.new url\n # TODO Uncomment when implemented\n create_feed(location_id) unless feed_exists?(location_id)\n res = r[\"exist/atom/content/4302Collection/\"+location_id].get\n #res = r[\"exist/atom/content/4302Collection/root-trends\"].get\n render :xml => res\n end",
"title": ""
},
{
"docid": "403008d093eb4cfa5bbe4ddb8d15c4ee",
"score": "0.6144593",
"text": "def test_rss\n user = create(:user)\n\n # First with the public feed\n get :georss, :params => { :format => :rss }\n check_trace_feed Trace.visible_to_all\n\n # Restrict traces to those with a given tag\n get :georss, :params => { :tag => \"London\", :format => :rss }\n check_trace_feed Trace.tagged(\"London\").visible_to_all\n\n # Restrict traces to those for a given user\n get :georss, :params => { :display_name => user.display_name, :format => :rss }\n check_trace_feed user.traces.visible_to_all\n\n # Restrict traces to those for a given user with a tiven tag\n get :georss, :params => { :display_name => user.display_name, :tag => \"Birmingham\", :format => :rss }\n check_trace_feed user.traces.tagged(\"Birmingham\").visible_to_all\n end",
"title": ""
},
{
"docid": "5f7cf316a79ff345a4a750d27039a266",
"score": "0.61417913",
"text": "def show\n @rss_links = RssLink.select(\"id, title\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end",
"title": ""
},
{
"docid": "65931c56f2d0a38bc309c21d998756e2",
"score": "0.6133721",
"text": "def new\n @rss_item = RssItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rss_item }\n end\n end",
"title": ""
},
{
"docid": "881fc56bbc9f3a8485bd025f2619fce5",
"score": "0.6132244",
"text": "def get_alert_summary \n get(\"/alerts.json/summary\")\nend",
"title": ""
},
{
"docid": "2b9a8be7e3fd5cb0a49d876c1a8ee88e",
"score": "0.61309004",
"text": "def index\n @selector_url_tests = SelectorUrlTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @selector_url_tests }\n end\n end",
"title": ""
},
{
"docid": "89c63c37e00660b0be4969b2fb434593",
"score": "0.60968333",
"text": "def new\n @rss_url = RssUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rss_url }\n end\n end",
"title": ""
},
{
"docid": "ba48d9d6f0e8c851fe1b2827699ff2fd",
"score": "0.6090019",
"text": "def latest_test\n response = @http.get(\"test/latest/\")\n msg response, Logger::DEBUG\n return response\n end",
"title": ""
},
{
"docid": "c2ab16c5536fcbee3ea0d5c2711c23d9",
"score": "0.6068731",
"text": "def new\n @rssfeed = Rssfeed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rssfeed }\n end\n end",
"title": ""
},
{
"docid": "c5944dcb290340b97b324ceca875a723",
"score": "0.60677385",
"text": "def index\n require 'nokogiri'\n require 'open-uri'\n #require \"http\"\n\n doc = Nokogiri::XML(open(\"http://sports.yahoo.com/top/rss.xml\"))\n\n @newsfeeds = doc.xpath('//item').map do |i|\n {'title' => i.xpath('title').inner_text,\n 'link' => i.xpath('link').inner_text,\n 'description' => i.xpath('description').inner_text\n }\n\n end\n # @newsfeeds = Newsfeed.all\n\n# Newsfeed.add(@newsfeeds)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @newsfeeds }\n end\n p @newsfeeds\n end",
"title": ""
},
{
"docid": "fa7357119991609b9dc0aaf811975370",
"score": "0.6060148",
"text": "def test \n self.class.get(\"/v1/test\") \n end",
"title": ""
},
{
"docid": "46522c15de04f45aa1bf856598d24f94",
"score": "0.6056978",
"text": "def index\n @rss_feeds = RssFeed.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rss_feeds }\n end\n end",
"title": ""
},
{
"docid": "fefe5aeb5bd2dc5872a584fa7857e88a",
"score": "0.60497814",
"text": "def index\n @testjsons = Testjson.all\n end",
"title": ""
},
{
"docid": "1c3631d633fccbbfdb690fa9f1026d2c",
"score": "0.60139537",
"text": "def show\n @rest_test = RestTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rest_test }\n end\n end",
"title": ""
},
{
"docid": "1a494b867d6bc3dae0f7bc77c66782e5",
"score": "0.6012147",
"text": "def get_new_dev_stories\n base_url = \"http://localhost:3000/\"\n time = Time.now.utc-2.minutes\n path = \"/api/v1/feeds/stories?updated_at=#{time.strftime(\"%FT%T\")+\"%2B00%3A00\"}&per=50\"\n\n conn = Faraday.new(url: base_url) do |faraday|\n faraday.headers[:Accept] = 'application/json'\n faraday.headers[:Authorization] = \"Token token=903890bfe6f5dcbb231e472c0ee33ed7, company_key=61047dce-b69a-4de1-986e-e6db9d46ef97\"\n faraday.request :url_encoded\n faraday.response :logger\n faraday.adapter :net_http\n end\n\n response = conn.get(path)\n JSON.parse(response.body)\n end",
"title": ""
},
{
"docid": "c1a04b206ce80cc293cbb3a858b25281",
"score": "0.6000191",
"text": "def index\n @inspections = Inspection.published.order(\"date DESC\").limit(3)\n if params[:layar]\n\t @rssinspections = Inspection.published.order(\"date DESC\")\n\telse\n\t\t@rssinspections = Inspection.published.order(\"date DESC\").limit(10)\n\tend\n @search = Inspection.published.search(params[:search])\n feed = Feedjira::Feed.fetch_and_parse(\"http://www.food.gov.uk/news-updates/news-rss\", :timeout => 10)\n @entries = feed.entries rescue nil\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inspections }\n format.rss do\n \tresponse.headers[\"Content-Type\"] = \"application/rss+xml; charset=utf-8\"\n end\n end\n end",
"title": ""
},
{
"docid": "94566450489f04769ba12dd17d08f879",
"score": "0.60000914",
"text": "def index\n @rss_item_scores = RssItemScore.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rss_item_scores }\n end\n end",
"title": ""
},
{
"docid": "0fb652b7546ff88eb5b180adef99634e",
"score": "0.59965783",
"text": "def index\n @rss_links = RssLink.select(\"id, home_url, title, url, description, category_id\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rss_links }\n end\n end",
"title": ""
},
{
"docid": "3309efc53a820557c1e3b9e4311ecfa3",
"score": "0.59599626",
"text": "def test \n self.class.get(\"/v1/test\") \n end",
"title": ""
},
{
"docid": "c2e7a2c92e0a499e412bb5947464a8fb",
"score": "0.5956046",
"text": "def index\n @sources = Source.all\n\n #display feed items in order of when they were published\n @feeditems = FeedItem.find( :all, :order => \"created_at DESC\" , :limit => 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sources }\n end\n end",
"title": ""
},
{
"docid": "5c0665ec0065d8075a58ad610934ec7b",
"score": "0.59548265",
"text": "def index\n @rss_feeders = RssFeeder.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @rss_feeders.to_xml }\n end\n end",
"title": ""
},
{
"docid": "3ae6b508e97740f5e8be4dd853e35912",
"score": "0.59516925",
"text": "def fetch_rss_request show\n req = Typhoeus::Request.new search_url(show)\n req.on_complete do |response|\n if response.code == 200\n @result_set << [ show, rss_items(response.body) ]\n else\n @errors[show] = response.body\n end\n end\n\n req\n end",
"title": ""
},
{
"docid": "049734410cf8f6af194e94cc7be2750e",
"score": "0.59508294",
"text": "def destroy\n @rss_test = RssTest.find(params[:id])\n @rss_test.destroy\n\n respond_to do |format|\n format.html { redirect_to rss_tests_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b3d510a24aa62a476241e4f58d6b786d",
"score": "0.59423167",
"text": "def index\n feed_urls = Feed.all.collect(&:feed_url)\n @feeds = fetch_all_feeds(feed_urls)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feeds }\n end\n end",
"title": ""
},
{
"docid": "0aca2a4327094de73a933c9fe6343f3c",
"score": "0.5927018",
"text": "def create\n @rss_test = RssTest.new(params[:rss_test])\n @rss_test.user = current_user\n begin\n feed = Feedzirra::Feed.fetch_and_parse(@rss_test.url)\n @rss_test.title = feed.title\n @rss_test.author = feed.author \n rescue\n \"no description\"\n end\n respond_to do |format|\n if @rss_test.save\n format.html { redirect_to @rss_test, notice: 'Rss test was successfully created.' }\n format.json { render json: @rss_test, status: :created, location: @rss_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rss_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cbeab35eb390af4f33f854e2bf8f05e7",
"score": "0.59248316",
"text": "def index\n @feeds = Feed.order(:title).page(params[:page]).per(5)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feeds }\n end\n end",
"title": ""
},
{
"docid": "df3e1482ab883a3a4df1c09f9e0142c1",
"score": "0.59015715",
"text": "def index\n @testimonies = Testimony.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testimonies }\n end\n end",
"title": ""
},
{
"docid": "01bf205ec2ef3cadbbb12f816eb20f04",
"score": "0.5896802",
"text": "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tests }\n end\n end",
"title": ""
},
{
"docid": "5da842126ec18b1bd273fafd7897e3de",
"score": "0.5896438",
"text": "def index\n @feeds = Feed.all\n\n render json: @feeds\n end",
"title": ""
},
{
"docid": "530283aac9380511db3184e98f484848",
"score": "0.58924085",
"text": "def index\n @testings = Testing.all\n render json: {success: true, testings: @testings}\n end",
"title": ""
},
{
"docid": "1cb3086563af4148e8c83343d0cf25c6",
"score": "0.58891326",
"text": "def top_stories\n get('/topstories.json')\n end",
"title": ""
},
{
"docid": "90f6073a74099712100bbf8c7b5e5c40",
"score": "0.5886935",
"text": "def show\n @tests = Tests.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @tests.to_xml }\n end\n end",
"title": ""
},
{
"docid": "b208b256cf6d56871368caa016aa140f",
"score": "0.58752996",
"text": "def index\n @rssurls = Rssurl.all\n end",
"title": ""
},
{
"docid": "b3e7313c4112d813e076195526770c7f",
"score": "0.5874574",
"text": "def feed\n GET base_url \"/feed\"\n end",
"title": ""
},
{
"docid": "e1b267c23ad1b4a9f5c62a96415878ce",
"score": "0.587271",
"text": "def index\n @rss_urls = RssUrl.all\n end",
"title": ""
},
{
"docid": "4ad44ee999894aac09f12c3541107733",
"score": "0.5864504",
"text": "def feed\n # if we have finished then there are more pages of results to be retrieved from the feed\n items = session[:finished_feeding] ? nil : get_tint_feed(session[:next_page])\n\n respond_to do |format|\n format.json { render json: items }\n end\n end",
"title": ""
},
{
"docid": "c9c573546b5e89396ea4ff8deed83a3d",
"score": "0.5861628",
"text": "def show\n @status_test = StatusTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_test }\n end\n end",
"title": ""
},
{
"docid": "69195bf945b8005763328fc1d408b052",
"score": "0.58587104",
"text": "def index\n render json: mergeNewsFeed\n #render json: offlineTest\n end",
"title": ""
},
{
"docid": "bb3cc782129b3bc7964b07ec7a6dbafe",
"score": "0.58576983",
"text": "def index\n @newsfeed = Newsfeed.new\n @newsfeeds = Newsfeed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @news }\n end\n end",
"title": ""
},
{
"docid": "ddb6ad80e60d8763a80925d484259c79",
"score": "0.5854546",
"text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_result }\n end\n end",
"title": ""
},
{
"docid": "9c0cafba8df35a02d402de217d6cdde4",
"score": "0.5850339",
"text": "def show\n @blog_rss = BlogRss.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @blog_rss }\n end\n end",
"title": ""
},
{
"docid": "b7ce6ff105c1e027dced99cc86164d7c",
"score": "0.58497345",
"text": "def index\n @rss_feeds = RssFeed.all \n @entries = RssFeedParser.new().fetch_entries(@rss_feeds.collect(&:feed_url))\n end",
"title": ""
},
{
"docid": "ee559f4b257ca84278386c718af1ca4b",
"score": "0.5847386",
"text": "def index\n @rss_targets = RssTarget.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rss_targets }\n end\n end",
"title": ""
},
{
"docid": "bd67c33dae7238c9f87c70986871552b",
"score": "0.5845213",
"text": "def index\n @feeds = Feed.order('title ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feeds }\n end\n end",
"title": ""
},
{
"docid": "a3f27df40735c07210ccebc70c7e0c6c",
"score": "0.5842771",
"text": "def index\n @feeds = Feed.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feeds }\n end\n end",
"title": ""
},
{
"docid": "9d06343c09bd34f9cfbd57750832f57f",
"score": "0.58411425",
"text": "def index\n @personal_tests = PersonalTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @personal_tests }\n end\n end",
"title": ""
},
{
"docid": "61e68aa24dde0f91124d5832d355c587",
"score": "0.58255386",
"text": "def index\n @specimen_tests = SpecimenTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @specimen_tests }\n end\n end",
"title": ""
},
{
"docid": "e70ab686d6a2c7d678452966e67ce6d7",
"score": "0.5823961",
"text": "def show\n @test = Test.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test }\n end\n end",
"title": ""
},
{
"docid": "e70ab686d6a2c7d678452966e67ce6d7",
"score": "0.5823961",
"text": "def show\n @test = Test.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test }\n end\n end",
"title": ""
},
{
"docid": "dd9894340d4cf16757baca74371f9f43",
"score": "0.5822522",
"text": "def test\n get(\"/help/test.json\")\n end",
"title": ""
},
{
"docid": "dd9894340d4cf16757baca74371f9f43",
"score": "0.5822522",
"text": "def test\n get(\"/help/test.json\")\n end",
"title": ""
},
{
"docid": "b14dc98fc1cc6206f1c8ff9d6b316366",
"score": "0.5822238",
"text": "def handle_test(url)\n test_entries = current_bundle.entries_for(:test, :hidden => :include)\n content_type = :json\n ret = test_entries.map do |entry|\n { :name => entry.filename.gsub(/^tests\\//,''), :url => \"#{entry.url}?#{entry.timestamp}\" }\n end\n return ret.to_json\n end",
"title": ""
},
{
"docid": "5bd05a137fb97f1470931947a0468175",
"score": "0.5817974",
"text": "def index\n @playlist_test_cases = PlaylistTestCase.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @playlist_test_cases }\n end\n end",
"title": ""
},
{
"docid": "9a025e2cae853a7a5739a893e7ff2421",
"score": "0.5811987",
"text": "def test\n @articles = []\n @types = []\n @preferences = current_user.preferences.all\n @preferences.each do |pref|\n @types << pref.category.name\n end\n num = 0\n # get three new articles\n @types.each do |type|\n response = Unirest.get(\n \"https://content.guardianapis.com/#{type}?&api-key=#{ENV[\"API_KEY\"]}\"\n )\n link = response.body[\"response\"][\"results\"][num][\"apiUrl\"]\n @articles << link\n end\n check = current_user.histories.all\n blank = []\n check.each do |url|\n blank << url.api_url\n end\n @articles.each do |story|\n\n end\n # link = History.new(\n # status: \"unread\",\n # user_id: current_user.id,\n # api_url: story,\n # )\n # link.save\n # render json: \"success!\"\n end",
"title": ""
},
{
"docid": "30a12f33263a3444214657f9b1986ea8",
"score": "0.5807413",
"text": "def test \n self.class.get(\"http://api.foursquare.com/v1/test.json\") \n end",
"title": ""
},
{
"docid": "b3d2e23483caf54ba72d42b7376a9185",
"score": "0.58033365",
"text": "def latest\n location_id = params[:id]\n puts \"My Location ID is %s\" % [location_id]\n\n trends_xml = index(location_id)\n url= \"http://localhost:8080\"\n r = RestClient::Resource.new url\n # TODO Uncomment when implemented\n puts \"Feed exists? %s\" % (feed_exists?(location_id)).to_s\n create_feed(location_id) unless feed_exists?(location_id)\n res = r[\"exist/atom/edit/4302Collection/\"+location_id].post trends_xml, :content_type => \"application/atom+xml\"\n #res = r[\"exist/atom/edit/4302Collection/root-trends\"].post trends_xml, :content_type => \"application/atom+xml\"\n render :xml => res\n end",
"title": ""
},
{
"docid": "a01a3941d48cdac9ab4cc14f27873672",
"score": "0.5793452",
"text": "def get_news\n response = RestClient.get(\"https://api.iextrading.com/1.0/stock/#{self.ticker}/news/last/5\")\n JSON.parse(response.body)\n end",
"title": ""
},
{
"docid": "5ba490d9970f5db94c59554cad203863",
"score": "0.5792211",
"text": "def test_feed_user_not_found\n get :feed, :params => { :format => \"atom\", :display_name => \"Some random user\" }\n assert_response :not_found\n end",
"title": ""
},
{
"docid": "566a6fa2e67d4fce15ff8c3c3da7d9a7",
"score": "0.5788972",
"text": "def show\n @testurl = Testurl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @testurl }\n end\n end",
"title": ""
},
{
"docid": "8e8ef53b8a2e1cae5cbc449a84dd6322",
"score": "0.57888776",
"text": "def show\n @testspec = Testspec.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @testspec }\n end\n end",
"title": ""
},
{
"docid": "81f4f8454541c31a26b58dcaa64e474b",
"score": "0.5782526",
"text": "def index\n @blog_rsses = BlogRss.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @blog_rsses }\n end\n end",
"title": ""
},
{
"docid": "102d0d2427226ac83b5873e5c6af7708",
"score": "0.577989",
"text": "def show\n @rss_item_score = RssItemScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rss_item_score }\n end\n end",
"title": ""
},
{
"docid": "1e40d13e1082215c0cd99f540d3f4291",
"score": "0.57767475",
"text": "def new\n @rss_link = RssLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rss_link }\n end\n end",
"title": ""
},
{
"docid": "f46dba93d0b281e30120d70ef92898c7",
"score": "0.5771239",
"text": "def show\n @story_test = StoryTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story_test }\n end\n end",
"title": ""
},
{
"docid": "8ed524df4b9cd89c1852057c65393f70",
"score": "0.57709676",
"text": "def fetch_rss_feed\n RSS::Parser.parse( @rss_url )\n end",
"title": ""
},
{
"docid": "5da16b2c91298b65822f602999d1754d",
"score": "0.5761609",
"text": "def new_stories\n get('/newstories.json')\n end",
"title": ""
},
{
"docid": "fd8d4ead6f8d5d564a1cf72990f0c0c4",
"score": "0.5753059",
"text": "def test1\n get(:test1, 1)\n end",
"title": ""
},
{
"docid": "fdc82fadfe25f85e4dce912cd1ca0724",
"score": "0.5750019",
"text": "def get_reddit_feed\n\trequest = HTTPI::Request.new\n\trequest.url = \"http://www.reddit.com/.json\"\n\tHTTPI.get(request).body\nend",
"title": ""
},
{
"docid": "fdc82fadfe25f85e4dce912cd1ca0724",
"score": "0.5750019",
"text": "def get_reddit_feed\n\trequest = HTTPI::Request.new\n\trequest.url = \"http://www.reddit.com/.json\"\n\tHTTPI.get(request).body\nend",
"title": ""
},
{
"docid": "d089aa349e3bea0753b55075bd00178a",
"score": "0.5745866",
"text": "def index\n @rssreaders = Rssreader.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rssreaders }\n end\n end",
"title": ""
},
{
"docid": "e2ceda7d4a986ecfb5b6e3a48403ac09",
"score": "0.57455194",
"text": "def rss\n @answers = Answer.find :all, :order => 'answers.created_at DESC', :limit => 20\n\n respond_to do |format|\n format.xml\n end\n end",
"title": ""
},
{
"docid": "9ec16fdf4fd1fdb16a80b6953928bcd7",
"score": "0.5741868",
"text": "def test_feed\n changeset = create(:changeset, :num_changes => 1)\n create(:changeset_tag, :changeset => changeset)\n create(:changeset_tag, :changeset => changeset, :k => \"website\", :v => \"http://example.com/\")\n closed_changeset = create(:changeset, :closed, :num_changes => 1)\n _empty_changeset = create(:changeset, :num_changes => 0)\n\n get :feed, :params => { :format => :atom }\n assert_response :success\n assert_template \"list\"\n assert_equal \"application/atom+xml\", response.content_type\n\n check_feed_result([changeset, closed_changeset])\n end",
"title": ""
},
{
"docid": "5e7781dc0c0f29877a47174eeead595b",
"score": "0.57396793",
"text": "def show\n @test_item = TestItem.find(params[:id])\n\n respond_to do |format|\n format.html { render layout: false } # show.html.erb\n format.json { render json: @test_item }\n end\n end",
"title": ""
},
{
"docid": "cc5c49b3a750f6bc4421c5394dbc2bb7",
"score": "0.5737227",
"text": "def show\n @testresult = Testresult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @testresult }\n end\n end",
"title": ""
},
{
"docid": "cd9def212b4c56a68ec7992e02c4f271",
"score": "0.57338417",
"text": "def index\n @feeds = Feed.all\n render json: @feeds\n end",
"title": ""
},
{
"docid": "090c09aa049f2752fb2076eab3e9c947",
"score": "0.57335865",
"text": "def show\n @test_description = TestDescription.find(params[:id])\n @test_run = TestRun.find_all_by_test_description_id(@test_description.id).last\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: { test_description: @test_description, test_run: @test_run } }\n end\n end",
"title": ""
},
{
"docid": "757b0083881e20ecc536aab9fc1f4783",
"score": "0.5731012",
"text": "def index\n @testies = Testy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @testies }\n end\n end",
"title": ""
},
{
"docid": "81ff179836cf4ff442b0d75415b8d865",
"score": "0.57291824",
"text": "def get_from_mashable\n response = RestClient.get(\"http://mashable.com/stories.json\")\n parsed_response = JSON.load(response)\n parsed_response[\"new\"].map do |mashable|\n story = { title: mashable[\"title\"]}\n\n story\n end\nend",
"title": ""
},
{
"docid": "3b4c92919b54ed10f3de355432d26f58",
"score": "0.572583",
"text": "def get_all_testmonial\n @testmonials = Testmonial.order(\"created_at desc\")\n\n render json: @testmonials\n end",
"title": ""
},
{
"docid": "0952a447e041ee746e1b8f19dd98b3f8",
"score": "0.5724351",
"text": "def index\n \t@rss = Space.find(:all, :order => 'created_at DESC')\n @spaces = @rss.paginate(:page => params[:page], :per_page => 9)\n #p = Space.where([\"created_at <= :end_date\", {:end_date => \"2012-05-28 00:00:00 UTC\" }])\n @pickup = @rss.shuffle().slice(0,3)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spaces }\n format.rss\n end\n end",
"title": ""
},
{
"docid": "65c356b6d5fc8793cbf793fa3031ce07",
"score": "0.57072866",
"text": "def show\n @rss_feed = RssFeed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rss_feed }\n end\n end",
"title": ""
},
{
"docid": "df1c67cfbf750b511d0386819eeaff82",
"score": "0.5707106",
"text": "def index\n @lab_tests = @test_subject.lab_tests\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lab_tests }\n end\n end",
"title": ""
},
{
"docid": "e7bb6ab152a4cff0f5f0b2f3e7d2f702",
"score": "0.57009315",
"text": "def show_demo\n @twitter_feed = TwitterFeed.first\n client = @twitter_feed.client\n @tweets = client.home_timeline\n respond_to do |format|\n format.html\n format.json { render :layout => false ,\n :json => @tweets.to_json }\n end\n end",
"title": ""
},
{
"docid": "b530cce3a24a5e06fb2323e497b42109",
"score": "0.5699153",
"text": "def index\n @lab_tests = @test_subject.lab_tests\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @lab_tests }\n end\n end",
"title": ""
},
{
"docid": "fae79d34c8484b120e5a0efb70c914fe",
"score": "0.5689702",
"text": "def show\n @smoke_test = SmokeTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @smoke_test }\n format.xml { render :xml => @smoke_test }\n end\n end",
"title": ""
},
{
"docid": "7df4877e219193883922911c73cbef7c",
"score": "0.56835663",
"text": "def get_feed\n HTTParty.get(FeedBaseURL + \"#{@code.downcase}_e.xml\")\n end",
"title": ""
},
{
"docid": "2e42744f0bfe4f661737d5aad0bbc2f7",
"score": "0.5683115",
"text": "def index\n @shot_shelfs = []\n (1..5).each do |page|\n res = open(\"http://api.dribbble.com/shots/popular?page=#{page}\")\n code, message = res.status # res.status => [\"200\", \"OK\"]\n\n if code == '200'\n result = ActiveSupport::JSON.decode res.read\n @shot_shelfs << result[\"shots\"]\n else\n puts \"#{code} #{message}\"\n end\n end\n\n render \"index.xml.js\"\n end",
"title": ""
}
] |
7d6c198dabf21bff00e752670cb1fa10 | Return boolean indicated if thread pool is running. If at least one worker thread isn't terminated, the pool is still considered running | [
{
"docid": "d9f7322818a2555c01f510b7acf7ade5",
"score": "0.7433077",
"text": "def running?\n !terminate && (@timeout.nil? || (!@timeout_thread.nil? && @timeout_thread.status)) &&\n @job_runners.all? { |r| r.running? }\n end",
"title": ""
}
] | [
{
"docid": "4fdbfd91528acd24d9cf463b615680da",
"score": "0.8230854",
"text": "def started?\n @thread_pool&.running?\n end",
"title": ""
},
{
"docid": "4fdbfd91528acd24d9cf463b615680da",
"score": "0.8230854",
"text": "def started?\n @thread_pool&.running?\n end",
"title": ""
},
{
"docid": "921e9b74d8059a5fe24bbf2c53af343b",
"score": "0.7943527",
"text": "def alive?\n @mutex.lock\n begin\n !@threadpool.empty? and @threadpool.all?(&:alive?)\n ensure\n @mutex.unlock rescue nil\n end\n end",
"title": ""
},
{
"docid": "6aa3e7273ada2a4d2a26ad30b4a617bf",
"score": "0.79185534",
"text": "def has_workers?\n @mutex.synchronize do\n return false if @closed\n\n if @pid != Process.pid && @workers.list.empty?\n @pid = Process.pid\n @workers = ThreadGroup.new\n spawn_workers\n end\n\n !@closed && @workers.list.any?\n end\n end",
"title": ""
},
{
"docid": "4b32505c42e3cf7030ae3be8a4567b97",
"score": "0.79155",
"text": "def still_running?\n @threads.any?{|e| e && e.respond_to?(:alive?) && e.alive? }\n end",
"title": ""
},
{
"docid": "bd5e26ac99840061fb6755a77d5d2a17",
"score": "0.78918374",
"text": "def running?\n @running || running_threads.size > 0\n end",
"title": ""
},
{
"docid": "72641817666b4465fe695b5fea2a3e66",
"score": "0.7684448",
"text": "def running?\n res = nil\n @thread_lock.synchronize{\n res = (!@thread.nil? && (@thread.status != false))\n }\n res\n end",
"title": ""
},
{
"docid": "2168892c2b659b364c78c00610b9f68e",
"score": "0.76088923",
"text": "def running?\n @thread&.alive?\n end",
"title": ""
},
{
"docid": "4a2f13359982dd1905acb0994c9640c8",
"score": "0.76058835",
"text": "def on_threadpool?\n tp = @mutex.synchronize { @threadpool.dup }\n tp and tp.respond_to?(:include?) and tp.include?(Thread.current)\n end",
"title": ""
},
{
"docid": "e7fba6b321a4c803e633c39e76a43e18",
"score": "0.7602177",
"text": "def running?\n !!@worker and @worker.ok?\n end",
"title": ""
},
{
"docid": "e55a358c69bd0d635c7a1993f7f2eb1b",
"score": "0.75944316",
"text": "def workers_running?\n @workers.any? { |worker| worker.running? }\n end",
"title": ""
},
{
"docid": "dcc247c790eabd95e9be1b61176b8f19",
"score": "0.7569951",
"text": "def running?\n @thread&.alive?\n end",
"title": ""
},
{
"docid": "dcc247c790eabd95e9be1b61176b8f19",
"score": "0.7569951",
"text": "def running?\n @thread&.alive?\n end",
"title": ""
},
{
"docid": "dcc247c790eabd95e9be1b61176b8f19",
"score": "0.7569951",
"text": "def running?\n @thread&.alive?\n end",
"title": ""
},
{
"docid": "44d6a7ad627aa7d8f84d75a51185377d",
"score": "0.7568933",
"text": "def on_threadpool?\n tp = nil\n\n @mutex.synchronize do\n return false unless @threadpool # you can't dup nil\n tp = @threadpool.dup\n end\n\n tp.respond_to?(:include?) and tp.include?(Thread.current)\n end",
"title": ""
},
{
"docid": "fab7dbefb0a3129b81b40e24967ee057",
"score": "0.7557643",
"text": "def running?\n @thread && @thread.alive? ? true : false\n end",
"title": ""
},
{
"docid": "d80fd4c58e116cff894394267b2e9907",
"score": "0.7540822",
"text": "def running?\n @run_thread && @run_thread.alive?\n end",
"title": ""
},
{
"docid": "dd9155400b39a145c39e4bb3776b8d5b",
"score": "0.7532109",
"text": "def running?\n @executor.running?\n end",
"title": ""
},
{
"docid": "534687d487291472e6047381c54a4086",
"score": "0.7490819",
"text": "def running?\n\t\treturn self.executor&.running?\n\tend",
"title": ""
},
{
"docid": "c374695443bc07f06c1509e259c52bd4",
"score": "0.73931813",
"text": "def running?\n if @worker_pid\n begin\n Process.kill 0, @worker_pid\n true\n rescue Errno::ESRCH\n false\n end\n else\n false\n end\n end",
"title": ""
},
{
"docid": "e1a95871276782f10b3ff6d6718dd0ce",
"score": "0.73460853",
"text": "def running?\n !@thread.nil?\n end",
"title": ""
},
{
"docid": "d74a8e2baa06318a1fd55864f07f96a3",
"score": "0.7313917",
"text": "def running?\n !@thread.nil?\n end",
"title": ""
},
{
"docid": "a99677f1d57f1630477e440eaa919be7",
"score": "0.7309061",
"text": "def keep_worker_running?\n @log.debug('Keep Worker Running check ')\n if parent_process_dead?\n @log.info('Think parent process is dead')\n false\n else\n true\n end\n end",
"title": ""
},
{
"docid": "0de91496c9b1b328f51d87b9e842601c",
"score": "0.7300795",
"text": "def alive?\n @threads.select!(&:alive?)\n !@threads.empty?\n end",
"title": ""
},
{
"docid": "c410c3c20d7c9bd7158ad32fe8275507",
"score": "0.7271874",
"text": "def working?\n enabled? ? @thread.alive? : false\n end",
"title": ""
},
{
"docid": "c410c3c20d7c9bd7158ad32fe8275507",
"score": "0.7271874",
"text": "def working?\n enabled? ? @thread.alive? : false\n end",
"title": ""
},
{
"docid": "e0ec959a8f72261dba475b873fd76906",
"score": "0.72631896",
"text": "def workers?\n @workers.any?\n end",
"title": ""
},
{
"docid": "d09b529a6c97239258ade61ef5252027",
"score": "0.7255508",
"text": "def worker_running?\n if fresh_worker.running?\n unless running?\n self.update_attributes!(:running => true)\n end\n true\n else\n if running?\n self.update_attributes!(:pid => nil, :running => false)\n end\n false\n end\n end",
"title": ""
},
{
"docid": "ff7b80551d4e9654ddca0350cdb6711a",
"score": "0.7252948",
"text": "def still_running?\n #puts \"\\t\\t#{@thread.inspect}.nil?\"\n not @thread.nil?\n end",
"title": ""
},
{
"docid": "2dc5ae9eca8e490b540db99f1ace1f4c",
"score": "0.72370154",
"text": "def alive?\n fail ProcessNotRunning unless running?\n thread.alive?\n end",
"title": ""
},
{
"docid": "25e5303c68755cfdaa1f674a66a49b11",
"score": "0.72283864",
"text": "def worker?\n @is_forked\n end",
"title": ""
},
{
"docid": "58076f736a2e217048176b3014096eac",
"score": "0.7199286",
"text": "def worker_running?\n if fresh_worker.running?\n unless running?\n self.update_attributes!(running: true)\n end\n true\n else\n if running?\n self.update_attributes!(pid: nil, running: false)\n end\n false\n end\n end",
"title": ""
},
{
"docid": "c9ee39da4743e1da678537eccb4be536",
"score": "0.7197511",
"text": "def running?\n !exhausted?\n end",
"title": ""
},
{
"docid": "6ad584bac2a75bf0bef5656a5c002745",
"score": "0.71953154",
"text": "def running?\n !@process_status.nil?\n end",
"title": ""
},
{
"docid": "3a71957fe6a720d0dd65437ce633af6c",
"score": "0.71948916",
"text": "def running?\n @server_thread&.alive?\n end",
"title": ""
},
{
"docid": "637e84dd6625fbfa5f1e5315e5daca38",
"score": "0.7183231",
"text": "def still_running?\n @pids.any?{|e| e }\n end",
"title": ""
},
{
"docid": "1bdae8731ccc98a149bf04a432d8aca5",
"score": "0.7151479",
"text": "def shutdown?\n !@pool.running?\n end",
"title": ""
},
{
"docid": "5a9d21d35c0eed1a202e88dcc2a7e31c",
"score": "0.714735",
"text": "def running?\n\t\t\treturn @jobs && !@jobs.empty?\n\t\tend",
"title": ""
},
{
"docid": "db9425662b8b5dde0f49115e70ab6943",
"score": "0.7117901",
"text": "def running?\n @server&.thread&.alive?\n end",
"title": ""
},
{
"docid": "ac18143ca32746e5f46f6bbeb892dea6",
"score": "0.71167445",
"text": "def all_workers_terminated?\n @closed_workers_count >= @workers_count\n end",
"title": ""
},
{
"docid": "e4d1b8c8bd9c7af42533fcf2cf1f0951",
"score": "0.7109667",
"text": "def any_waiting_threads?\n waiting_threads_count >= 1\n end",
"title": ""
},
{
"docid": "67b30465ea149c1dffe529223f428a06",
"score": "0.70973194",
"text": "def running?\n return started? && !completed?\n end",
"title": ""
},
{
"docid": "ff9582d324f03b91b6710e95e0a39e47",
"score": "0.70916057",
"text": "def check_thread_pool\n temp = []\n thread_pool.each do |th|\n case th.status\n when 'run'\n temp << th\n when 'sleep'\n performing = th.thread_variable_get(:performing)\n if performing\n th.thread_variable_set(:should_exit, true)\n else\n temp << th\n end\n end\n end\n self.thread_pool = temp\n n = num_thread - thread_pool.size\n if n > 0\n n.times { create_thread }\n elsif n < 0\n n = -n\n thread_pool.take(n).each do |th|\n th.thread_variable_set(:should_exit, true)\n end\n self.thread_pool = thread_pool.drop(n)\n end\n nil\n end",
"title": ""
},
{
"docid": "1b2520f9669ad7354ca28b2d39b7805e",
"score": "0.7080679",
"text": "def workers?\n @workers.any?\n end",
"title": ""
},
{
"docid": "b35383633cbaff2674e0349929134536",
"score": "0.7080408",
"text": "def stopped?\n master? ? @workers.empty? && @tcp_server_threads.empty? && @tcp_servers.empty? : @tcp_server_threads.empty?\n end",
"title": ""
},
{
"docid": "92807e30571bb3f16bcb27f3719468f5",
"score": "0.7065801",
"text": "def running?\n started? && !stopped?\n end",
"title": ""
},
{
"docid": "85f846b4306169dc0e1c99fd812be717",
"score": "0.704114",
"text": "def running?\n # TODO This should check to see if a process is running or not.\n return true\n end",
"title": ""
},
{
"docid": "133add3c4f376bd9cac270a7a6812a30",
"score": "0.7034236",
"text": "def running?\n @proc.nil? ? false : !@proc.has_exited\n end",
"title": ""
},
{
"docid": "9d0dadf114cf027251fed675fe6d0efe",
"score": "0.702127",
"text": "def started?\n @current_worker_thread != nil\n end",
"title": ""
},
{
"docid": "c54eb6f0f9df6391c26fa9bb9175ea3e",
"score": "0.7015488",
"text": "def running?\n @alive\n end",
"title": ""
},
{
"docid": "13e05f610432b013f093be983f5a4f7e",
"score": "0.7004147",
"text": "def running?\n acts_as_task_task_queue && acts_as_task_task_queue.running? && state == 'running'\n end",
"title": ""
},
{
"docid": "13e05f610432b013f093be983f5a4f7e",
"score": "0.7004147",
"text": "def running?\n acts_as_task_task_queue && acts_as_task_task_queue.running? && state == 'running'\n end",
"title": ""
},
{
"docid": "95dd55d992d78dffb810eb7d54055d25",
"score": "0.6984369",
"text": "def running?\n\t\t\t\t@running.any?\n\t\t\tend",
"title": ""
},
{
"docid": "24af2300757c89b3b19603cde02e6451",
"score": "0.6976872",
"text": "def ready_for_more_threads?\n @job_threads.count(&:alive?) < concurrency_limit\n end",
"title": ""
},
{
"docid": "2056bf1912efb683e5c7a221be612595",
"score": "0.69761586",
"text": "def alive?\n @_cleanthread_thread && @_cleanthread_thread.alive?\n end",
"title": ""
},
{
"docid": "646da064aa58bec18b826bd13cad2e6f",
"score": "0.6963062",
"text": "def running?\n @lock.synchronize { @start_time != nil } && !done?\n end",
"title": ""
},
{
"docid": "24c84da823fd2071b5e7284ec6dcd525",
"score": "0.69590825",
"text": "def working?\n @worker.status\n end",
"title": ""
},
{
"docid": "ac7fbdf0b416505663624566894913ec",
"score": "0.6958326",
"text": "def executing?\n @wait_thread&.status ? true : false\n end",
"title": ""
},
{
"docid": "8f4cc36702530087196354582100a4ae",
"score": "0.6954051",
"text": "def running?\n @count > 0\n end",
"title": ""
},
{
"docid": "6aee9107c670a550f0c941618450e2c5",
"score": "0.69538605",
"text": "def process_running?\n begin\n return false if !@wait_thr\n Process.getpgid( @wait_thr.pid() )\n return true\n rescue Errno::ESRCH\n return false\n end\n end",
"title": ""
},
{
"docid": "34170c2f5aa8a16f25ecba3976cc439b",
"score": "0.69494855",
"text": "def busy?\n @queue.num_waiting < @workers.length\n end",
"title": ""
},
{
"docid": "6207783066ef5a048f6402d2af893843",
"score": "0.6943867",
"text": "def running_process?\n !pids.empty?\n end",
"title": ""
},
{
"docid": "cbbf197e7a1428836fa24101c019954b",
"score": "0.69379246",
"text": "def should_protect?\n worker_threads.each do |thread|\n return true if thread.currently_working?\n end\n return false\n end",
"title": ""
},
{
"docid": "381914c50a0b22dca8410825dd54cee2",
"score": "0.69246846",
"text": "def running?\n @pid && @status.nil?\n end",
"title": ""
},
{
"docid": "c253ec8d94b82fa476ff28cac7eac68f",
"score": "0.6921369",
"text": "def running?()\n return @running\n end",
"title": ""
},
{
"docid": "eeb113fa2a7c88ce322b0c3ad2cf16ba",
"score": "0.69199604",
"text": "def running?\n return true if pid\n end",
"title": ""
},
{
"docid": "100e55dca9be640e870e3ba173ff4159",
"score": "0.691793",
"text": "def any_container_running?\n groups = [self] + descendants\n\n DB::Containers.get.each do |ct|\n return true if ct.pool == pool && groups.include?(self) && ct.running?\n end\n\n false\n end",
"title": ""
},
{
"docid": "f81faa9ac7ec7cfedf984d2b86e97f74",
"score": "0.6915308",
"text": "def alive?\n return @thread.alive? if @thread\n return false\n end",
"title": ""
},
{
"docid": "087ae17cf901eb99b76160a6a9ed665b",
"score": "0.691019",
"text": "def start_worker_thread?\n !environment.forking? or environment.app_server == :thin\n end",
"title": ""
},
{
"docid": "6a65bb2a21390f6835e0398933e76137",
"score": "0.6901453",
"text": "def running?\n self.listener_thread and self.listener_thread.alive?\n end",
"title": ""
},
{
"docid": "618796b8b3f2e8feff25e39110e3da26",
"score": "0.6900689",
"text": "def master_process?\n @workers\n end",
"title": ""
},
{
"docid": "57da49710503526a234f187e8f576bc2",
"score": "0.68875074",
"text": "def running?\n\t\t\t@running.size > 0\n\t\tend",
"title": ""
},
{
"docid": "76e9f7e37d2bd0f488f5e562f32925bb",
"score": "0.688691",
"text": "def started?\n\t\treturn @main_thread && @main_thread.alive?\n\tend",
"title": ""
},
{
"docid": "76e9f7e37d2bd0f488f5e562f32925bb",
"score": "0.688691",
"text": "def started?\n\t\treturn @main_thread && @main_thread.alive?\n\tend",
"title": ""
},
{
"docid": "6628527674ea5374ee0b15e64bb660eb",
"score": "0.68862295",
"text": "def running?\n true\n end",
"title": ""
},
{
"docid": "de0a6e7817c1f0f1723b45f6727e76d8",
"score": "0.6880803",
"text": "def started?\n logger.debug(\"checking if started... list size is #{ worker_threads }\")\n @total_threads == worker_threads && @workers.list.all? { |w| w[:status] }\n end",
"title": ""
},
{
"docid": "8b3b80cec289fa589b8bf77401f3ae34",
"score": "0.68777144",
"text": "def active?\n @thread&.alive?\n end",
"title": ""
},
{
"docid": "d2b324f0ac38751cf6f6b13517fd7df0",
"score": "0.6873205",
"text": "def running?\n return @running\n end",
"title": ""
},
{
"docid": "d2b324f0ac38751cf6f6b13517fd7df0",
"score": "0.6873205",
"text": "def running?\n return @running\n end",
"title": ""
},
{
"docid": "d2b324f0ac38751cf6f6b13517fd7df0",
"score": "0.6873205",
"text": "def running?\n return @running\n end",
"title": ""
},
{
"docid": "d2b324f0ac38751cf6f6b13517fd7df0",
"score": "0.6873205",
"text": "def running?\n return @running\n end",
"title": ""
},
{
"docid": "eba587651d0bc647e43dfd1d65fd4e44",
"score": "0.68731296",
"text": "def running_threads\n @pool_lock.synchronize do \n @threads.select{|t| t.alive? } \n end \n end",
"title": ""
},
{
"docid": "605c624f3d326f6f3ca9c6ed320c9f3b",
"score": "0.68721783",
"text": "def running?\n true # FIXME\n end",
"title": ""
},
{
"docid": "17e7541193851121ca7500bc9519c692",
"score": "0.68668807",
"text": "def running?\n !pid.nil?\n end",
"title": ""
},
{
"docid": "17e7541193851121ca7500bc9519c692",
"score": "0.68668807",
"text": "def running?\n !pid.nil?\n end",
"title": ""
},
{
"docid": "b2ada5411a7691a1abfb7b44fb8933b7",
"score": "0.68658733",
"text": "def in_parallel?\n active_futures.length > 1\n end",
"title": ""
},
{
"docid": "7d0370b99f65a7f716fda1dd8042eec0",
"score": "0.6863246",
"text": "def running?\n return true if @status == :running\n\n return false\n end",
"title": ""
},
{
"docid": "96ccaba6d5059b2e5ff129f9248caa38",
"score": "0.68606716",
"text": "def running?\n not @pid.nil?\n end",
"title": ""
},
{
"docid": "f51896c5ff31281e909cdd87c96d02b6",
"score": "0.68591857",
"text": "def working?()\n\t\t\t\treturn ( @status == :worker_thread_status_working )\n\t\t\tend",
"title": ""
},
{
"docid": "b53d921e6460cbadea154b7922276565",
"score": "0.6856433",
"text": "def running?\n @event_thread.alive?\n end",
"title": ""
},
{
"docid": "4a6fbaf85aa32078f0881f0fd67fdd41",
"score": "0.6854805",
"text": "def running?\n pid && !status\n end",
"title": ""
},
{
"docid": "dc63ab407a1cd876424051b9eff8ae29",
"score": "0.6836957",
"text": "def running?\n true\n end",
"title": ""
},
{
"docid": "dc63ab407a1cd876424051b9eff8ae29",
"score": "0.6836957",
"text": "def running?\n true\n end",
"title": ""
},
{
"docid": "b201529e37fc2f2881476e0c16067c44",
"score": "0.68316925",
"text": "def is_running?\n !RLPS.processes.select { |p| p == self }.empty?\n end",
"title": ""
},
{
"docid": "6d8a219e66fcf039002648faa273d7c2",
"score": "0.6821492",
"text": "def worker?\r\n false\r\n end",
"title": ""
},
{
"docid": "c854eb3579346c4db04ee1bf4e637693",
"score": "0.6819365",
"text": "def running?\n !@counter.closed?\n end",
"title": ""
},
{
"docid": "7b966f223193e3e1a225e0d6db7668b9",
"score": "0.6814814",
"text": "def running?\n return false if( @status )\n \n result = `ps -o pid,stat -p #{@pid} | grep #{@pid}`.chomp\n if( result && result.length > 0 )\n stat = result.strip.split(/\\s+/)[1]\n if stat=~/Z/\n wait()\n return false\n else\n return true\n end\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "3771a407161f4bb0c1e52b87ab63f6eb",
"score": "0.6812585",
"text": "def worker?\r\n @working_on != nil\r\n end",
"title": ""
},
{
"docid": "91dcd7a337963805ca8feb3e59b147eb",
"score": "0.6812388",
"text": "def running?\n state == RUNNING\n end",
"title": ""
},
{
"docid": "91dcd7a337963805ca8feb3e59b147eb",
"score": "0.6812388",
"text": "def running?\n state == RUNNING\n end",
"title": ""
}
] |
c6721f3bd58494c955ed57bd1b0ea77b | publish sends messages to a BigQuery table immediately | [
{
"docid": "5192d6077e0c1fe7b03f2c3a005d7b9a",
"score": "0.740809",
"text": "def publish(messages)\n begin\n return if messages.nil? || messages.empty?\n\n table = get_table_name\n @logger.info(\"Publishing #{messages.length} messages to #{table}\")\n\n create_table_if_not_exists table\n\n failed_rows = @bq_client.append(@dataset, table, messages, @ignore_unknown_values, @skip_invalid_rows)\n write_to_errors_file(failed_rows, table) unless failed_rows.empty?\n rescue StandardError => e\n @logger.error 'Error uploading data.', :exception => e\n\n write_to_errors_file(messages, table)\n end\n end",
"title": ""
}
] | [
{
"docid": "4ca1122ff9fc2bb4b8348b43526366bb",
"score": "0.6490805",
"text": "def pubsub_create_bigquery_subscription project_id:, topic_id:, subscription_id:, bigquery_table_id:\n pubsub = Google::Cloud::Pubsub.new project_id: project_id\n topic = pubsub.topic topic_id\n subscription = topic.subscribe subscription_id,\n bigquery_config: {\n table: bigquery_table_id,\n write_metadata: true\n }\n puts \"BigQuery subscription created: #{subscription_id}.\"\n puts \"Table for subscription is: #{bigquery_table_id}\"\nend",
"title": ""
},
{
"docid": "dd391fd35a15625c61b44d37d1b19e84",
"score": "0.617388",
"text": "def publish\n result = BackgroundJobResult.create\n EventFactory.create(druid: params[:id], event_type: 'publish_request_received', data: { background_job_result_id: result.id })\n PublishJob.set(queue: publish_queue).perform_later(druid: params[:id], background_job_result: result, workflow: params[:workflow])\n head :created, location: result\n end",
"title": ""
},
{
"docid": "dcc2dba6edf64f9eba79a81b485952da",
"score": "0.6167736",
"text": "def publish(topic_key, payload)\n assert_table\n\n result = @table.filter(\n :topic => topic_key.class == Hash ? r.literal(topic_key) : topic_key\n ).update(\n :payload => payload,\n :updated_on => r.now,\n ).run(@conn)\n\n # If the topic doesn't exist yet, insert a new document. Note:\n # it's possible someone else could have inserted it in the\n # meantime and this would create a duplicate. That's a risk we\n # take here. The consequence is that duplicated messages may\n # be sent to the consumer.\n if result['replaced'].zero?\n @table.insert(\n :topic => topic_key,\n :payload => payload,\n :updated_on => r.now,\n ).run(@conn)\n end\n end",
"title": ""
},
{
"docid": "67ed3e4dd5d569cda4154bf7c36d765e",
"score": "0.61671793",
"text": "def test_publish1()\n topic = \"_Publish1_\"\n conn = Scalaroid::PubSub.new()\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n conn.publish(@testTime.to_s + topic + i.to_s, $_TEST_DATA[i])\n end\n\n conn.close_connection()\n end",
"title": ""
},
{
"docid": "95cbf443dec105e95ffd8136323dbfd0",
"score": "0.61261445",
"text": "def redis_publish(channel: \"tables\", **message)\n redis.publish(\"#{Rails.env}/#{channel}\", message.to_json)\nend",
"title": ""
},
{
"docid": "c2edcadb83dde317d87325eb33bc5e6a",
"score": "0.6076458",
"text": "def publishing_activity\n loop do\n @queue.flush { |data| @publisher.post data } if @queue.count >= Config.get[:min_buffer_size]\n sleep Config.get[:publish_interval_ms] / 1000\n end\n end",
"title": ""
},
{
"docid": "732ed748031f8e036a7a4dcf19da17d9",
"score": "0.6044145",
"text": "def stream_record_to_bigquery(table_id, row_data)\n table = @dataset.table table_id\n response = table.insert row_data\n if response.success?\n puts \"Inserted rows successfully\"\n else\n puts \"Failed to insert #{response.error_rows.count} rows\"\n end\n end",
"title": ""
},
{
"docid": "d30a47a48930eee1e7efbe1ba32ceb25",
"score": "0.60408306",
"text": "def write_subscription(query, events); end",
"title": ""
},
{
"docid": "1364d7a84611a5ed147dba33489ad754",
"score": "0.6035758",
"text": "def publish(message)\n log log_name, :publish, message\n\n @broker.publish :results, message.to_json\n end",
"title": ""
},
{
"docid": "0f8cd8e591c7f3a0c27096e897517a8f",
"score": "0.6032996",
"text": "def publish(message)\n @queue.publish(message.to_json, presistent: true)\n end",
"title": ""
},
{
"docid": "b6460198238745097f687bc5bcb991b0",
"score": "0.6023977",
"text": "def test_publish2()\n topic = \"_Publish2\"\n conn = Scalaroid::PubSub.new()\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n conn.publish(@testTime.to_s + topic, $_TEST_DATA[i])\n end\n\n conn.close_connection()\n end",
"title": ""
},
{
"docid": "f57c57c37d7b11f8572ba750a360649a",
"score": "0.5986842",
"text": "def publish!\n self.dequeue\n self.scheduled_at = Time.now.utc\n self.save\n Resque.enqueue(SendTweet, self.id)\n end",
"title": ""
},
{
"docid": "2e42a85bbe744be56af394728a7558e4",
"score": "0.5953895",
"text": "def send_query_message(query_message)\n send_to_db(query_message)\n end",
"title": ""
},
{
"docid": "b3ef4c7f5ae7301ac87f602db8dd1f18",
"score": "0.5870308",
"text": "def publish_batch(messages)\n keys = messages.map { |m| m[:key] }\n payloads = messages.map { |m| m[:payload] }\n\n test_consume_batch(MyBatchConsumer, payloads, keys: keys, call_original: true)\n end",
"title": ""
},
{
"docid": "f17b01f27b7b890e01f7dfc04ceaf11b",
"score": "0.5869959",
"text": "def flush\n @topic.publish do |t|\n @messages.each do |(data, attributes)|\n t.publish data, attributes\n end\n end\n end",
"title": ""
},
{
"docid": "a9a6cb8f9503396f6154005f8370b7ba",
"score": "0.58617043",
"text": "def publish\n end",
"title": ""
},
{
"docid": "a9a6cb8f9503396f6154005f8370b7ba",
"score": "0.58617043",
"text": "def publish\n end",
"title": ""
},
{
"docid": "a9a6cb8f9503396f6154005f8370b7ba",
"score": "0.58617043",
"text": "def publish\n end",
"title": ""
},
{
"docid": "a9a6cb8f9503396f6154005f8370b7ba",
"score": "0.58617043",
"text": "def publish\n end",
"title": ""
},
{
"docid": "a9a6cb8f9503396f6154005f8370b7ba",
"score": "0.58617043",
"text": "def publish\n end",
"title": ""
},
{
"docid": "54aedeab7bb94cdda6bffa43a3a6a032",
"score": "0.5852041",
"text": "def publish\n set_publish_state(Event::PUBLISHED_STATE)\n end",
"title": ""
},
{
"docid": "f358494db1543a8905d6442b7410292b",
"score": "0.5830165",
"text": "def publish!\n publish\n save!\n end",
"title": ""
},
{
"docid": "a4fb2436d196d0caa705f34a9e4161ed",
"score": "0.58104146",
"text": "def publish( message )\n @client.set( @name, message )\n end",
"title": ""
},
{
"docid": "87824b4b65d17367835854410034e8f6",
"score": "0.57985497",
"text": "def publish( message )\n @client.set( @name, message ) # do not expire the message\n end",
"title": ""
},
{
"docid": "5581554da577f4ef39c9df4186344674",
"score": "0.57678324",
"text": "def queue_message(message, message_type)\n queue_name = Rails.configuration.environment.fetch('queue_name')\n logger.debug \"Patient API publishing to queue: #{queue_name}...\"\n Aws::Sqs::Publisher.publish(message, request.uuid, queue_name)\n true\n end",
"title": ""
},
{
"docid": "5574294d0fdc14396aaf4557d8efae07",
"score": "0.5759093",
"text": "def publish(topic, message)\n unless @topic_hash[topic] == nil\n @topic_hash[topic].each do |arr|\n host = arr[0]\n port = arr[1]\n transport = Thrift::BufferedTransport.new(Thrift::Socket.new(host, port))\n \tprotocol = Thrift::BinaryProtocol.new(transport)\n \tclient = Concord::PubSub::PubSubConsumer::Client.new(protocol)\n \ttransport.open()\n \tclient.receive topic,message\n \ttransport.close()\n puts \"publish to #{arr}\"\n end\n else\n puts \"No subscribers for #{topic}\"\n end\n end",
"title": ""
},
{
"docid": "1dd94be5308ce27efaa6d08bccf89154",
"score": "0.57589126",
"text": "def publish!\n publish\n save!\n end",
"title": ""
},
{
"docid": "e79834bf81fa574206d790fd98982c7a",
"score": "0.5750423",
"text": "def publish(event:, context:)\n begin\n iot = Aws::IoT::Client.new(region: 'ap-northeast-1')\n\n endpoint = \"https://#{iot.describe_endpoint.endpoint_address}\"\n puts \"Publish on #{endpoint}\"\n\n client = Aws::IoTDataPlane::Client.new({\n region: 'ap-northeast-1',\n endpoint: endpoint\n })\n\n # 'event' may contains multiple records\n event['Records'].each do |record|\n puts \"message: #{record['body']}\"\n\n payload = {\n message: record['body']\n }.to_json\n\n resp = client.publish({\n topic: ENV['TOPIC'],\n qos: 0,\n payload: payload\n })\n end\n\n {}\n rescue StandardError => e\n puts e.message\n puts e.backtrace.inspect\n {}\n end\nend",
"title": ""
},
{
"docid": "179eecc14f14bc1c4fb3c3c4313472a5",
"score": "0.5749066",
"text": "def publish(name, data={})\n trigger(name, data)\n end",
"title": ""
},
{
"docid": "213a70fa365f747b905cfe4d466537db",
"score": "0.57488877",
"text": "def publish!\n update_column(:published_at, Time.current)\n end",
"title": ""
},
{
"docid": "80346f3faf6b6f817f692982b807d05e",
"score": "0.5736787",
"text": "def pushData(table_name, data, url = RJMetrics::Client::API_BASE)\n @client.pushData(table_name, data, url)\n end",
"title": ""
},
{
"docid": "d8d6f4a38646f5f9ad1f00c2eea87ded",
"score": "0.5724033",
"text": "def publish(queue_name,job)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "83fd33c76e7869e943eaf40558713c64",
"score": "0.5681239",
"text": "def publish; pubsub.publish(self); end",
"title": ""
},
{
"docid": "17476869d04e82be96bc87edf1118d3a",
"score": "0.5675918",
"text": "def publish_messages(messages)\n Queue.publish_batch(self, messages)\n end",
"title": ""
},
{
"docid": "e7a4aced8b0c9a54d0423504cfdea4e9",
"score": "0.5672586",
"text": "def publish( message )\n @topic.publish( message )\n end",
"title": ""
},
{
"docid": "c04ac1b895eacdd99facc9fc4c04c116",
"score": "0.5665787",
"text": "def publish\n\t\t\tAggregator.message_publish( self )\n\t\tend",
"title": ""
},
{
"docid": "9053159ec6e3d345f52e8d7b40173983",
"score": "0.5660858",
"text": "def publish(topic, content)\n # note: do NOT encode the content, this is not decoded on the erlang side!\n # (only strings are allowed anyway)\n # content = @conn.class.encode_value(content)\n result = @conn.call(:publish, [topic, content])\n @conn.class.process_result_publish(result)\n end",
"title": ""
},
{
"docid": "909d20ba458f8035c1181c30da422650",
"score": "0.5659239",
"text": "def process\n Rails.logger.info(\"publish: #{payload}\")\n publish\n end",
"title": ""
},
{
"docid": "9e6688185ed98e225766b670584c1cff",
"score": "0.56454426",
"text": "def publish\n set_publish(true)\n end",
"title": ""
},
{
"docid": "9df9aca89f5a0be886a3121532f57b67",
"score": "0.5635066",
"text": "def republish\n # This variable is needed to avoid triggering a double publish when republishing\n @republishing = true\n add_to_publisher_queue(publish_message('republish'))\n end",
"title": ""
},
{
"docid": "b164d7c701fcfe919d67ada60986fb71",
"score": "0.562691",
"text": "def write(*message)\n if(connection.alive?)\n if(message.size > 1)\n debug 'Multiple message publish'\n connection.transmit(\n Command::Mpub.new(\n :topic_name => topic,\n :messages => message\n )\n )\n else\n debug 'Single message publish'\n connection.transmit(\n Command::Pub.new(\n :message => message.first,\n :topic_name => topic\n )\n )\n end\n else\n abort Error.new 'Remote connection is unavailable!'\n end\n end",
"title": ""
},
{
"docid": "cf2a6ac735ed12d088e06a0220db8680",
"score": "0.56239665",
"text": "def central_hub(message: nil, query: nil)\n print_time message: message if message\n ActiveRecord::Base.connection.execute query\n print_time if message\n end",
"title": ""
},
{
"docid": "7b465f1f13a8c386f8692c2d8abf0489",
"score": "0.56200814",
"text": "def publish(payload, topic: self.topic, headers: nil)\n publish_list([payload], topic: topic, headers: headers)\n end",
"title": ""
},
{
"docid": "17289425486a053d01e45d7491c864a0",
"score": "0.5619794",
"text": "def publish_messages(messages)\n publish_messages_impl(messages)\n end",
"title": ""
},
{
"docid": "f3ca39bc3f94c1e1e654f9750fe05eb8",
"score": "0.5592874",
"text": "def handle_publish(client, data)\n request_id, options, topic_uri, arguments, argument_keywords = data\n\n trigger(:publish, client, request_id, options, topic_uri, arguments, argument_keywords)\n end",
"title": ""
},
{
"docid": "9ff3d9dbaec7a9c36fc9a429e5f19306",
"score": "0.55911005",
"text": "def publish(channel, message); end",
"title": ""
},
{
"docid": "9ff3d9dbaec7a9c36fc9a429e5f19306",
"score": "0.55911005",
"text": "def publish(channel, message); end",
"title": ""
},
{
"docid": "3ee5fda76e4e15b3a56e35e927589606",
"score": "0.5588245",
"text": "def publish\n # Format and publish message\n resp = execute_middleware_chain\n\n # Log job completion and return result\n logger.info(\"Published message in #{publishing_duration}s\") { { duration: publishing_duration } }\n resp\n rescue StandardError => e\n logger.info(\"Publishing failed after #{publishing_duration}s\") { { duration: publishing_duration } }\n raise(e)\n end",
"title": ""
},
{
"docid": "5990faf40833b681345f915b91a232d4",
"score": "0.558815",
"text": "def publish_create_message\n publish_message :create\n end",
"title": ""
},
{
"docid": "14463a6798a460bc52324f0fa81a417b",
"score": "0.55840874",
"text": "def publish_socialq(msg)\n @socialq.publish(msg)\n @dumpq.publish(msg) if @dumpq\n end",
"title": ""
},
{
"docid": "39b3d863526bafdce5df7759d6f4e28f",
"score": "0.5573027",
"text": "def publish\n @message.published_at = DateTime.now\n @message.save\n end",
"title": ""
},
{
"docid": "28c0adcf7cc39962c5c0e3fa897579a9",
"score": "0.55556315",
"text": "def publish(message)\n @broker.publish message\n end",
"title": ""
},
{
"docid": "f311a7580147118b9a01335e5f009984",
"score": "0.5553423",
"text": "def publish_batch_messages batch\n resp = connection.publish name, batch.messages\n if resp.success?\n batch.to_gcloud_messages resp.data[\"messageIds\"]\n else\n ApiError.from_response(resp)\n end\n end",
"title": ""
},
{
"docid": "62b49d58090de12a4264e2ac855c9c36",
"score": "0.5553332",
"text": "def query(query)\n auth\n\n resp = client.execute(\n :api_method => bq_api.jobs.query,\n :body_object => { \"query\" => query },\n :parameters => { \"projectId\" => \"jovial-opus-656\",\n \"format\" => \"json\" })\n\n data_normalized_to_events(resp.body)\n end",
"title": ""
},
{
"docid": "22aacf91db6a856704d1b42d27805400",
"score": "0.55392563",
"text": "def publish_update_message\n publish_message :update\n end",
"title": ""
},
{
"docid": "95da10227f2977c95ae7d66b7d7f5c53",
"score": "0.55360645",
"text": "def publish\n PubSubModelSync::MessagePublisher.publish(self)\n end",
"title": ""
},
{
"docid": "6a5f46b69bbdf4ac6db63b82f84e9cb9",
"score": "0.55312514",
"text": "def publish(*message)\n message.each do |m|\n @message_queue.push m\n end\n end",
"title": ""
},
{
"docid": "8c0798d8d5697a21c9be7af2a77a811a",
"score": "0.5530961",
"text": "def publish(json)\n Broker.log(\"[InvocaAPI] Publishing to control queue: #{json}\")\n payload = JSON.dump(json) # Stringify JSON\n Broker.instrument('broker-invoca')\n Broker.control_queue.publish(payload)\n end",
"title": ""
},
{
"docid": "93352c57b50640a2203bf0536c2fb003",
"score": "0.5520352",
"text": "def publish!\n PubSubModelSync::MessagePublisher.publish!(self)\n end",
"title": ""
},
{
"docid": "552122ede492bad3033a5f5733203c91",
"score": "0.551304",
"text": "def publish_batch_messages batch\n resp = connection.publish name, batch.messages\n if resp.success?\n batch.to_gcloud_messages resp.data[\"messageIds\"]\n else\n fail ApiError.from_response(resp)\n end\n end",
"title": ""
},
{
"docid": "552122ede492bad3033a5f5733203c91",
"score": "0.551304",
"text": "def publish_batch_messages batch\n resp = connection.publish name, batch.messages\n if resp.success?\n batch.to_gcloud_messages resp.data[\"messageIds\"]\n else\n fail ApiError.from_response(resp)\n end\n end",
"title": ""
},
{
"docid": "0afa50a5786e296e903807c52818eb9f",
"score": "0.55100673",
"text": "def push(job)\n get_sqs_queue.send_message(job)\n end",
"title": ""
},
{
"docid": "7dd562391ae281b574dbc14c74b20ef0",
"score": "0.549687",
"text": "def publish(topic, message, host, &block)\n pubsub.publish(topic, message, prefix_host(host), &callback_logging(__method__, topic, message.operation, &block))\n end",
"title": ""
},
{
"docid": "3175ec03247d1d510918542c9c319654",
"score": "0.5495434",
"text": "def publish(topic_name: nil, event_name: nil, schema_name: nil, primary_key: nil, body:)\n defaults = self.class.get_publish_defaults\n published_messages << Maitredee.publish(\n topic_name: topic_name || defaults[:topic_name],\n event_name: event_name || defaults[:event_name],\n schema_name: schema_name || defaults[:schema_name],\n primary_key: primary_key,\n body: body\n )\n end",
"title": ""
},
{
"docid": "6d83014587e003bdaa98d3b90f682f2a",
"score": "0.5488392",
"text": "def publish message\n raise NotImplementedError.new\n end",
"title": ""
},
{
"docid": "d50f96960e18885c434d8c219e872098",
"score": "0.5480439",
"text": "def publish\n set_publish(true)\n end",
"title": ""
},
{
"docid": "d50f96960e18885c434d8c219e872098",
"score": "0.5480439",
"text": "def publish\n set_publish(true)\n end",
"title": ""
},
{
"docid": "111e3de9c8f92fa63cc642ab51324d6e",
"score": "0.5477765",
"text": "def publish_event(message, sink)\n @logger.info(\"Sending #{message[:id]} to #{sink}\")\n puts message.to_json\n r = HTTParty.post(sink, \n :headers => {\n 'Content-Type' => 'text/plain',\n 'ce-specversion' => '0.2',\n 'ce-type' => 'dev.knative.naturalevent.quake',\n 'ce-source' => 'dev.knative.usgs'\n }, \n :body => message.to_json)\n \n if r.code != 200\n @logger.error(\"Error! #{r}\")\n end\nend",
"title": ""
},
{
"docid": "3ac7f685a9f47b07da4c92cb563c4cc7",
"score": "0.54581356",
"text": "def do_publish(params)\n content_type 'text/plain', :charset => 'utf-8'\n unless params['hub.url'] and not params['hub.url'].empty?\n throw :halt, [400, \"Bad request: Empty or missing 'hub.url' parameter\"]\n end\n log_debug(\"Got update on URL: \" + params['hub.url'])\n begin\n # TODO: move the subscribers notifications to some background job (worker?)\n hash = Topic.to_hash(params['hub.url'])\n topic = DB[:topics].filter(:url => hash)\n if topic.first # already registered\n log_debug(\"Topic exists: \" + params['hub.url'])\n # minimum 5 min interval between pings\n time_diff = (Time.now - topic.first[:updated]).to_i\n if time_diff < 300\n log_error(\"Too fast update (time_diff=#{time_diff}). Try after #{(300-time_diff)/60 +1} minute(s).\")\n throw :halt, [204, \"204 Try after #{(300-time_diff)/60 +1} minute(s)\"]\n end\n topic.update(:updated => Time.now, :dirty => 1)\n # only verified subscribers, subscribed to that topic\n subscribers = DB[:subscriptions].filter(:topic_id => topic.first[:id], :state => 0)\n log_debug(\"#{params['hub.url']} subscribers count: #{subscribers.count}\")\n atom_diff = Topic.diff(params['hub.url'], true)\n postman(subscribers, atom_diff) if (subscribers.count > 0 and atom_diff)\n topic.update(:dirty => 0)\n else\n log_debug(\"New topic: \" + params['hub.url'])\n DB[:topics] << { :url => hash, :created => Time.now, :updated => Time.now }\n end\n throw :halt, [204, \"204 No Content\"]\n rescue Exception => e\n log_exception(e)\n throw :halt, [404, e.to_s]\n end\n end",
"title": ""
},
{
"docid": "56ff73cc4d2c6c0a0e810760b3ef9da0",
"score": "0.54574305",
"text": "def push_table(stream, header_row, data_rows)\n data_rows.insert(0, header_row)\n post stream, 'table' => data_rows\n end",
"title": ""
},
{
"docid": "b4676eb0f9dff0f37691762d2aae507a",
"score": "0.5453033",
"text": "def publish_to_queue\r\n return if enqueued_at.present?\r\n\r\n sns = Aws::SNS::Resource.new\r\n topic = sns.topics.detect {|t| t.arn.include?('duna_product_orders')}\r\n \r\n if topic\r\n topic.publish({\r\n message: as_message.to_json\r\n })\r\n touch :enqueued_at\r\n end\r\n rescue\r\n nil\r\n end",
"title": ""
},
{
"docid": "8917c91c2cbb6f8cbaa3800bce0c4196",
"score": "0.5449989",
"text": "def publish(event, message)\n adapter.publish(event, message)\n end",
"title": ""
},
{
"docid": "a670dea2eada972368173cef40214ade",
"score": "0.5443263",
"text": "def publish_data(channel, data)\n redis = EM::Hiredis.connect(Settings.redis)\n redis.publish(channel, data).callback do\n # only close connection after complete the publish\n redis.close_connection\n end\n end",
"title": ""
},
{
"docid": "74a28c4a38254cb72584f31f26146ada",
"score": "0.54425",
"text": "def publish topic, messages\n publish_req = Google::Pubsub::V1::PublishRequest.new(\n topic: topic_path(topic),\n messages: messages.map do |data, attributes|\n Google::Pubsub::V1::PubsubMessage.new(\n data: data, attributes: attributes)\n end\n )\n\n execute { publisher.publish publish_req }\n end",
"title": ""
},
{
"docid": "cc9e3c5f103f16c63dbd4d153f72e71e",
"score": "0.54273427",
"text": "def publish_tweet(tweet)\n\tPusher['live-tweets'].trigger('new-tweet', tweet.to_json)\nend",
"title": ""
},
{
"docid": "64147abf1a056680d03fc93fd8fcbf9c",
"score": "0.5425894",
"text": "def test_publish\n msg_id, channel = publish chid: randid, data: \"hello what is this\", ttl: 10, content_type: \"X-fruit/banana\"\n end",
"title": ""
},
{
"docid": "9aa2995f3751540161164ced9481a7b7",
"score": "0.54187655",
"text": "def publish_event(tag, msg)\n msg[:tag] = tag\n msg[:time] = snapshot()\n puts msg.to_json()\n @events.push msg\n end",
"title": ""
},
{
"docid": "a28c842d5195e6ad6ee01bdce10c0408",
"score": "0.54112524",
"text": "def publish_topic(messages)\n messages = Array.wrap(messages)\n messages.each { |msg| assert_options(msg, [:event, :service]) }\n\n publish_topic_impl(messages)\n end",
"title": ""
},
{
"docid": "c468791f5f3baa8d63b60c7530cceb81",
"score": "0.5405027",
"text": "def publish(event)\n @event_bus.publish(event, topic: @topic)\n end",
"title": ""
},
{
"docid": "34038c1d0ff225983604d1e42a713d99",
"score": "0.53875625",
"text": "def publish message = nil, attributes = {}\n ensure_connection!\n batch = Batch.new message, attributes\n yield batch if block_given?\n return nil if batch.messages.count.zero?\n publish_batch_messages batch\n rescue Gcloud::Pubsub::NotFoundError => e\n retry if lazily_create_topic!\n raise e\n end",
"title": ""
},
{
"docid": "909d766e923cf77d1e5c1d460349d1c6",
"score": "0.5379483",
"text": "def publish_message(action)\n return if ENV['RACK_ENV'] == 'test' || ENV['RAILS_ENV'] == 'test'\n publish_to_pubsub(self, action)\n end",
"title": ""
},
{
"docid": "ee71779570f1159db795716542eca4ef",
"score": "0.53711534",
"text": "def receive(event)\n @logger.debug('BQ: receive method called', event: event)\n\n # Property names MUST NOT have @ in them\n message = replace_at_keys event.to_hash\n\n # Message must be written as json\n encoded_message = LogStash::Json.dump message\n\n @batcher.enqueue(encoded_message) { |batch| publish(batch) }\n end",
"title": ""
},
{
"docid": "706b8dfc0d876d71ffa33ce78e894066",
"score": "0.5367971",
"text": "def publish\n ZC.standard_request(:post, @links[:publish])\n end",
"title": ""
},
{
"docid": "3b7b28d3d08654d7ded380abfe1bf3ec",
"score": "0.5367911",
"text": "def sender_publishes_msg; sender.publish({ :ok => 1 }, {}) end",
"title": ""
},
{
"docid": "548d72ec043e6f714615dc9c16b9dd7f",
"score": "0.53643674",
"text": "def publish(channel, data)\n connect {\n validate_channels([channel])\n \n enqueue({\n 'channel' => channel,\n 'data' => data,\n 'clientId' => @client_id\n })\n \n return if @timeout\n \n @timeout = add_timer(Connection::MAX_DELAY) do\n @timeout = nil\n flush!\n end\n }\n end",
"title": ""
},
{
"docid": "2656a07bf1cfb83c962801f0e8ee50da",
"score": "0.5363025",
"text": "def publish!\n self.publish = 1\n self.save\n end",
"title": ""
},
{
"docid": "09a695606ee08fb3c81cd23c6e9a4fbf",
"score": "0.5361049",
"text": "def central_hub(message: nil, query: nil)\n print_time message: message if message\n central_execute query\n print_time if message\n end",
"title": ""
},
{
"docid": "09a695606ee08fb3c81cd23c6e9a4fbf",
"score": "0.5361049",
"text": "def central_hub(message: nil, query: nil)\n print_time message: message if message\n central_execute query\n print_time if message\n end",
"title": ""
},
{
"docid": "4a3fc0d3fce770f2f0f2f081cb04307b",
"score": "0.5356426",
"text": "def publish(*args, &blk)\n (@client ||= connect).publish(*args, &blk)\n end",
"title": ""
},
{
"docid": "8844dddd44dfc5dfb293709289f07845",
"score": "0.5352325",
"text": "def publish(tube_name,job)\n tube = self.tube(tube_name)\n tube.put(encode_job(job))\n end",
"title": ""
},
{
"docid": "4179a5cd5c78d436d11f972d6c9abf83",
"score": "0.53374505",
"text": "def perform\n schedule_next_run\n enqueue_queries\n end",
"title": ""
},
{
"docid": "47d2ee1c72ff420ab3348a24b84ed5a2",
"score": "0.53346175",
"text": "def publish topic, messages\n gapi_msgs = messages.map do |data, attributes|\n { data: [data].pack(\"m\"), attributes: attributes }\n end\n @client.execute(\n api_method: @pubsub.projects.topics.publish,\n parameters: { topic: topic_path(topic) },\n body_object: { messages: gapi_msgs }\n )\n end",
"title": ""
},
{
"docid": "a9fbba017dd3bfc3faac16fa5406d583",
"score": "0.5327435",
"text": "def publish(msg)\n logger.debug \"Sending msg: #{msg.to_s}\"\n logger.debug \"To client: #{@client.id}\" if @client\n send_data(msg.to_s + CR)\n end",
"title": ""
},
{
"docid": "705d32e2cf0f59249d51e9e06a5e627c",
"score": "0.5326944",
"text": "def publish(data)\n faye_client.publish data_channel, id: object_id, data: data\n end",
"title": ""
},
{
"docid": "cf01f4ea9b1e5a154bea4a7101a9544b",
"score": "0.53267395",
"text": "def after_query(query)\n events = query.context.namespace(:subscriptions)[:events]\n if events && events.any?\n @schema.subscriptions.write_subscription(query, events)\n end\n end",
"title": ""
},
{
"docid": "35580e9890e3c1c716308ba359eecc3f",
"score": "0.5322874",
"text": "def publish(name, *args)\n backend.publish(name, *args)\n end",
"title": ""
},
{
"docid": "90eb88f775909793cecb9d8caba6b414",
"score": "0.53180045",
"text": "def server_pusblish_event(topic, data)\n return if topic.blank? || data.blank?\n connect_to_redis do |connection|\n connection.publish(topic, data)\n end\n rescue => exception\n log_debug(\"could not publish message #{message} into topic #{current_topic} because of #{exception.inspect}\")\n end",
"title": ""
},
{
"docid": "5573aa4f75e6d5163943d8ec44e7be2e",
"score": "0.53161526",
"text": "def myevent\n puts \"Publishing Event\"\n publish_event :hello, \"John Smith\"\n end",
"title": ""
},
{
"docid": "8153337914d0a00df3abe15b02e66e45",
"score": "0.5314886",
"text": "def publish(stream, event_name, data)\n stream = stream_name(stream)\n connection.xadd(stream, { \"#{event_name}\": data })\n end",
"title": ""
},
{
"docid": "d4a36037db51795edd9520b4a8edbd9f",
"score": "0.53130376",
"text": "def publish(queue)\n raise ArgumentError, \"Publish expects a Cloudist::Queue instance\" unless queue.is_a?(Cloudist::Queue)\n set_queue_name_header(queue)\n update_published_date!\n update_headers!\n queue.publish(self)\n end",
"title": ""
}
] |
e14740e712a67cb2f43a44bdb80e9194 | Takes a base64encoded, tarred string | [
{
"docid": "feffacaa1937e29b1e684347be1199ba",
"score": "0.0",
"text": "def initialize encoded\n tar = Base64.decode64(encoded)\n @files = {}\n Minitar::Reader.new(StringIO.new(tar)).each do |entry|\n next unless entry.file?\n @files[entry.full_name] = entry.read\n end\n end",
"title": ""
}
] | [
{
"docid": "8750a0870d213101cca93e909b5162ee",
"score": "0.8216274",
"text": "def base64(str); end",
"title": ""
},
{
"docid": "8750a0870d213101cca93e909b5162ee",
"score": "0.8216274",
"text": "def base64(str); end",
"title": ""
},
{
"docid": "48de0cab76bce6f86baf5d62e5d772b6",
"score": "0.7588747",
"text": "def urlsafe_decode64(str); end",
"title": ""
},
{
"docid": "48de0cab76bce6f86baf5d62e5d772b6",
"score": "0.7588747",
"text": "def urlsafe_decode64(str); end",
"title": ""
},
{
"docid": "250e85d84b9990facad8e974ea30709d",
"score": "0.74536806",
"text": "def base64_decode(string)\n Base64.decode64(string)\n end",
"title": ""
},
{
"docid": "1d0b339d0da22b6345c74c2aa725b7d5",
"score": "0.7382664",
"text": "def base64(string)\n require 'base64'\n\n Base64.strict_encode64(string)\nend",
"title": ""
},
{
"docid": "268f7ae1629eaaf457dd54033e10104c",
"score": "0.7347238",
"text": "def base64(string)\n [ string.to_s ].pack('m').gsub(/\\n/, '')\n end",
"title": ""
},
{
"docid": "226c6ab2858066a23af7b6722c3c10cc",
"score": "0.73412836",
"text": "def encode_into_base64 string\n Base64.encode64(string).chomp\n end",
"title": ""
},
{
"docid": "3c7f2dac511c93295c7cbae81513e4d6",
"score": "0.7340106",
"text": "def decode64(str); end",
"title": ""
},
{
"docid": "67e0b2666e45032f58c8736fbcee5eb3",
"score": "0.7196289",
"text": "def from_base64\n Base64.decode64 self\n end",
"title": ""
},
{
"docid": "081656570a81cd6bc60870bbfcd8dae7",
"score": "0.7186286",
"text": "def base64_decode(string)\n JWT::Base64.url_decode(string)\n end",
"title": ""
},
{
"docid": "a01a4b82f652adf5e73769f0787961c8",
"score": "0.71452075",
"text": "def test_hat\n assert_equal MyBase64.decode64(MyBase64.encode64(\"hat\")), \"hat\"\n end",
"title": ""
},
{
"docid": "ff0d1349233e1e2823e1b251f37b96a8",
"score": "0.69926864",
"text": "def test_base64_std_lib_fails_decoding_non_mime\n # Base64 can't decode non-MIME encoded base64\n assert_not_equal STRING, Base64::decode64(Base64Compatible.encode64(STRING))\n end",
"title": ""
},
{
"docid": "a26464dc0f6c2cddeec05e033ee383c7",
"score": "0.6978631",
"text": "def base64_decode(str)\n str.unpack(\"m*\").first\n end",
"title": ""
},
{
"docid": "a7d8f30ff50f04a96b2cdd3be51fbe6b",
"score": "0.6962215",
"text": "def base64(str)\n Base64.strict_encode64(str)\n end",
"title": ""
},
{
"docid": "ebf355941b83a079a6451c676f58bba6",
"score": "0.6960832",
"text": "def base64_encode(string)\n Base64.encode64(string).chomp\n end",
"title": ""
},
{
"docid": "7b03f932d7b888a3123bad01e2af262d",
"score": "0.69497037",
"text": "def expect_base64(string)\n expect(string).to match(%r([A-Za-z0-9+/]+={0,3}))\n expect(string.length % 4).to eq(0)\n end",
"title": ""
},
{
"docid": "a5008c827e6134e3ac589ea8f7f2d17f",
"score": "0.6944036",
"text": "def decode_base64( text )\n\ttext.unpack( \"m\" )[0]\nend",
"title": ""
},
{
"docid": "64479e5f072dedc02686cf18570182a7",
"score": "0.6914407",
"text": "def decode_urlsafe_to_original_base64(urlsafe_enconded_string)\n Base64.encode64(Base64.urlsafe_decode64(urlsafe_enconded_string))\n end",
"title": ""
},
{
"docid": "802f0cdc4c621a31090f4de2dd2aa2d6",
"score": "0.6870977",
"text": "def b64_e(data)\n Base64.encode64(data).chomp\n end",
"title": ""
},
{
"docid": "3b3505e00ceb91dad378009dd524b5a6",
"score": "0.6852551",
"text": "def hex_to_base64(hex_string)\n bytes_to_base64(hex_to_bytes(hex_string))\nend",
"title": ""
},
{
"docid": "3e28edee8a4ba9ddb71f2882c599f372",
"score": "0.6812714",
"text": "def urlsafe_decode64(str)\n self.decode64(str.tr(\"-_\", \"+/\"))\n end",
"title": ""
},
{
"docid": "9a256b1439378911d331418b5df4ebbc",
"score": "0.6804227",
"text": "def encode64(bin); end",
"title": ""
},
{
"docid": "9a256b1439378911d331418b5df4ebbc",
"score": "0.6804227",
"text": "def encode64(bin); end",
"title": ""
},
{
"docid": "2f3258f8248f8d116c9142b9524df905",
"score": "0.6801763",
"text": "def base64String s\n return base64Hex(s.unpack('H*').last)\nend",
"title": ""
},
{
"docid": "728e080c0a78a5d5495e56e8f601ee5b",
"score": "0.67818975",
"text": "def url_safe_base64(str)\n # add '=' padding\n str = case str.length % 4\n when 2 then str + '=='\n when 3 then str + '='\n else str\n end\n\n str.tr('-_', '+/')\n end",
"title": ""
},
{
"docid": "1c07387c6013af18a51bc0400e5427bd",
"score": "0.67769706",
"text": "def urlsafe_decode64(str)\n strict_decode64(str.tr(\"-_\", \"+/\"))\n end",
"title": ""
},
{
"docid": "30dbc528ad7a23b0aa96920b9e13efef",
"score": "0.6771605",
"text": "def pack_urlsafe_base64digest(bin); end",
"title": ""
},
{
"docid": "30dbc528ad7a23b0aa96920b9e13efef",
"score": "0.6771605",
"text": "def pack_urlsafe_base64digest(bin); end",
"title": ""
},
{
"docid": "b046b21f8d3316b49fb8e882f0a8322b",
"score": "0.6752124",
"text": "def u64(s)\r\n return unless s\r\n Base64.decode64 CGI.unescape(s)\r\n end",
"title": ""
},
{
"docid": "aa5af1ab7c3b229de8136c1dce80c2b3",
"score": "0.6750858",
"text": "def u64(s)\n return unless s\n Base64.decode64 CGI.unescape(s)\n end",
"title": ""
},
{
"docid": "7d54e41538ef9bc476f087328e2a01a5",
"score": "0.6749618",
"text": "def read_json_base64\n str = read_json_string\n m = str.length % 4\n if m != 0\n # Add missing padding\n (4 - m).times do\n str += '='\n end\n end\n Base64.strict_decode64(str)\n end",
"title": ""
},
{
"docid": "da2386e95bcbd18478750d245c2e6871",
"score": "0.6743505",
"text": "def from_base64\n unpack(\"m\").first\n end",
"title": ""
},
{
"docid": "255db6cac17571f78d2e931126669df9",
"score": "0.6720011",
"text": "def strict_decode64(str)\n return Base64.strict_decode64(str) if Base64.respond_to? :strict_decode64\n\n if str.include?(\"\\n\")\n raise(ArgumentError,\"invalid base64\")\n else\n Base64.decode64(str)\n end\nend",
"title": ""
},
{
"docid": "3d0ec5b1269a584b36f051063dfba549",
"score": "0.6715227",
"text": "def base64_encode(string)\n Base64.encode(string)\n end",
"title": ""
},
{
"docid": "103364a33f6e7776d0b854499a2cd602",
"score": "0.66952866",
"text": "def decoded\n Base64.decode64(@base64 || \"\")\n end",
"title": ""
},
{
"docid": "416e6a86fef8396faff95f0cde43fb4e",
"score": "0.66924614",
"text": "def base64url(bin)\n Base64.urlsafe_encode64(bin).delete('=')\nend",
"title": ""
},
{
"docid": "838538a05e140d5c28729327f243625b",
"score": "0.66569793",
"text": "def encoded\n Base64.encode(@str)\n end",
"title": ""
},
{
"docid": "7371f986d26bca9659e15a5e708e9069",
"score": "0.6643515",
"text": "def base64(data)\n result = Base64.encode64(data)\n result.delete!(\"\\n\")\n result\n end",
"title": ""
},
{
"docid": "9e11d77bbdb389125fbbad507456a8a5",
"score": "0.6627443",
"text": "def from_base64(v)\n return Base64.decode64(v)\n end",
"title": ""
},
{
"docid": "85fd87af2b5c34920fc2ea4144614ec5",
"score": "0.6625527",
"text": "def strict_encode64(bin); end",
"title": ""
},
{
"docid": "85fd87af2b5c34920fc2ea4144614ec5",
"score": "0.6625527",
"text": "def strict_encode64(bin); end",
"title": ""
},
{
"docid": "0b12fd9d8821a52865e1b0252510efdd",
"score": "0.6598741",
"text": "def strict_encode64(str)\n Base64.encode64(str).delete(\"\\n\")\n end",
"title": ""
},
{
"docid": "bcaacd74ca4f1f0b3cb67d48ca396de3",
"score": "0.65974027",
"text": "def strict_decode64(str)\n return Base64.strict_decode64(str) if Base64.respond_to? :strict_decode64\n\n unless str.include?(\"\\n\")\n Base64.decode64(str)\n else\n raise(ArgumentError,\"invalid base64\")\n end\n end",
"title": ""
},
{
"docid": "64d761b07fb4523c6c671a5840d1df85",
"score": "0.6593613",
"text": "def hex_to_base64(s)\n Base64.strict_encode64(hex_to_bytes(s).pack('c*'))\nend",
"title": ""
},
{
"docid": "50c58982d78986df19c513136fa960ac",
"score": "0.6581254",
"text": "def decode(payload)\n return Base64.decode64(URI.unescape(payload))\n end",
"title": ""
},
{
"docid": "17769885b779e2c0819d67fc69b18c2d",
"score": "0.65711856",
"text": "def decode_data str\n encoded_sig, payload = str.split('.')\n data = ActiveSupport::JSON.decode base64_url_decode(payload)\n return encoded_sig\n end",
"title": ""
},
{
"docid": "eafd645ced8c3c328aba817813ba7bae",
"score": "0.6565669",
"text": "def base64_url_decode(str)\n str += '=' * (4 - str.length.modulo(4))\n Base64.decode64(str.tr('-_', '+/'))\n end",
"title": ""
},
{
"docid": "eddbbb4db0c4cfebc420020a777b028a",
"score": "0.65646774",
"text": "def decode64\n Base64.decode64(self)\n end",
"title": ""
},
{
"docid": "cbc401759ffed74bde486439f3f977a4",
"score": "0.65605366",
"text": "def base64(data)\n result = Base64.encode64(data)\n result.delete!(\"\\n\")\n result\n end",
"title": ""
},
{
"docid": "cbc401759ffed74bde486439f3f977a4",
"score": "0.65605366",
"text": "def base64(data)\n result = Base64.encode64(data)\n result.delete!(\"\\n\")\n result\n end",
"title": ""
},
{
"docid": "37201a7023370fef88de54b31463d985",
"score": "0.65550154",
"text": "def base64_url_decode str\n encoded_str = str.gsub('-','+').gsub('_','/')\n encoded_str += '=' while !(encoded_str.size % 4).zero?\n Base64.decode64(encoded_str)\n end",
"title": ""
},
{
"docid": "60adf34651162a9d2d3a15109a588e95",
"score": "0.654666",
"text": "def pack_base64digest(bin); end",
"title": ""
},
{
"docid": "60adf34651162a9d2d3a15109a588e95",
"score": "0.654666",
"text": "def pack_base64digest(bin); end",
"title": ""
},
{
"docid": "7281f4c589cb68dd227d6d9b530e7b44",
"score": "0.6541674",
"text": "def read #b64_str\n process\n end",
"title": ""
},
{
"docid": "1304a471a72002454bb875bfbb3a2fc9",
"score": "0.6534619",
"text": "def test_hat\n assert_equal MyBase64.encode64(\"hat\"), \"aGF0\"\n end",
"title": ""
},
{
"docid": "fd24655a478cfc45e62417163312af5b",
"score": "0.6521949",
"text": "def encode(s)\n @base64 = Base64.encode64(s)\n end",
"title": ""
},
{
"docid": "e95adcfd0e319cf4356d6944467b7b96",
"score": "0.65072954",
"text": "def base64_url_decode(str)\n str = str + \"=\" * (6 - str.size % 6) unless str.size % 6 == 0\n return Base64.decode64(str.tr(\"-_\", \"+/\"))\n end",
"title": ""
},
{
"docid": "d4563755eee6660c6c9800f5b5149721",
"score": "0.65014243",
"text": "def custom_base64_urlsafe_decode(encoded_data)\n Base64.urlsafe_decode64(encoded_data.gsub('.','='))\n end",
"title": ""
},
{
"docid": "d54fbd5101f1adecb3c372842ad3bc67",
"score": "0.64955884",
"text": "def base64d(argv1)\n return nil unless argv1\n\n plain = nil\n if cv = argv1.match(%r|([+/\\=0-9A-Za-z\\r\\n]+)|)\n # Decode BASE64\n plain = Base64.decode64(cv[1])\n end\n return plain.force_encoding('UTF-8')\n end",
"title": ""
},
{
"docid": "d54fbd5101f1adecb3c372842ad3bc67",
"score": "0.64955884",
"text": "def base64d(argv1)\n return nil unless argv1\n\n plain = nil\n if cv = argv1.match(%r|([+/\\=0-9A-Za-z\\r\\n]+)|)\n # Decode BASE64\n plain = Base64.decode64(cv[1])\n end\n return plain.force_encoding('UTF-8')\n end",
"title": ""
},
{
"docid": "450ee7e84266b69a93a5b10cbe326790",
"score": "0.6492915",
"text": "def base64_decode\n Base64.decode(self.body, @config.strict_base64decode?)\n end",
"title": ""
},
{
"docid": "4499141711ff0adcadce54de1c6bee7f",
"score": "0.6486855",
"text": "def strict_encode64(str)\n Base64.encode64(str).gsub(\"\\n\", '')\n end",
"title": ""
},
{
"docid": "ee0e37710c23eb1e5f7390992b8369b3",
"score": "0.6485044",
"text": "def base64_url_decode(str)\n str += '=' * (4 - str.length.modulo(4))\n Base64.decode64(str.tr('-_', '+/'))\n end",
"title": ""
},
{
"docid": "ee0e37710c23eb1e5f7390992b8369b3",
"score": "0.6485044",
"text": "def base64_url_decode(str)\n str += '=' * (4 - str.length.modulo(4))\n Base64.decode64(str.tr('-_', '+/'))\n end",
"title": ""
},
{
"docid": "3914de34e3335695e0fe3ee7397c5f87",
"score": "0.64831644",
"text": "def send(b64_str)\n process b64_str\n end",
"title": ""
},
{
"docid": "053c9dd479d99dac44a1a1d3abc46118",
"score": "0.6465553",
"text": "def base64_encode(string)\n JWT::Base64.url_encode(string)\n end",
"title": ""
},
{
"docid": "89da301d930298a8236469eaa4bab53a",
"score": "0.6464907",
"text": "def base64_url_decode(str)\n str += '=' * (4 - str.length.modulo(4))\n Base64.decode64(str.tr('-_','+/'))\n end",
"title": ""
},
{
"docid": "89da301d930298a8236469eaa4bab53a",
"score": "0.6464907",
"text": "def base64_url_decode(str)\n str += '=' * (4 - str.length.modulo(4))\n Base64.decode64(str.tr('-_','+/'))\n end",
"title": ""
},
{
"docid": "aebc460f208381fc649ae1ed97c4806a",
"score": "0.6445255",
"text": "def decode_content(string)\n # Force encoding to UTF-8 is needed for strings that had UTF-8\n # characters in them when they were originally encoded\n Base64.strict_decode64(string).force_encoding(\"utf-8\")\n end",
"title": ""
},
{
"docid": "bfdc76efde753d0b5b0d8ebe43d49edd",
"score": "0.64412475",
"text": "def file_encode(str)\n collection = Array.new()\n enc = Base64.encode64(str)\n# while(enc.length > 60)\n# collection << enc.slice!(0..59)\n# end\n# collection << enc\n# return(collection.join(\"\\n\"))\n return(enc)\n end",
"title": ""
},
{
"docid": "f66f25c29873a843e540be1262355707",
"score": "0.6434661",
"text": "def decode(data)\n Base64.urlsafe_decode64(data)\n end",
"title": ""
},
{
"docid": "8d853c5900a4641889ffc30ca0e5ab74",
"score": "0.6426254",
"text": "def encode_base64( bin )\n\t[ bin ].pack( \"m\" ).gsub( /\\s/, \"\" )\nend",
"title": ""
},
{
"docid": "7ba51dd9b4ffdb200cf7b772a455b64f",
"score": "0.64156663",
"text": "def encode64(string)\n HttpService.encode64(string)\n end",
"title": ""
},
{
"docid": "a41e57e879abfa4028dff8a9432e54e8",
"score": "0.64104134",
"text": "def base64_url_decode(str)\n encoded_str = str.tr('-_', '+/')\n encoded_str += '=' while !(encoded_str.size % 4).zero?\n Base64.decode64(encoded_str)\n end",
"title": ""
},
{
"docid": "8781ea0832b6e22ac14353fe82d42e44",
"score": "0.64046663",
"text": "def decode(str)\n str = Base64.urlsafe_decode64 str\n des = OpenSSL::Cipher::Cipher.new ALG\n des.pkcs5_keyivgen KEY, DES_KEY\n des.decrypt\n des.update(str) + des.final\n end",
"title": ""
},
{
"docid": "963d0185aca63a5a487f9e0c2c6c8200",
"score": "0.6403036",
"text": "def base64digest!; end",
"title": ""
},
{
"docid": "e0bd98b7af318b79a0544f53de9658b3",
"score": "0.6402189",
"text": "def urlsafe_decode64(data)\n # Ruby < 2.3.0 urlsafe_decode64 use struct_decode64. So the string\n # is rejected if padding is removed (which JWK do)\n # So, we have to reinject padding\n if !data.end_with?('=') && (data.length % 4).nonzero?\n data = data.ljust((data.length + 3) & ~3, '=')\n end\n Base64.urlsafe_decode64(data)\n end",
"title": ""
},
{
"docid": "c7f38d0bdcfdd15a2543ba497cbba421",
"score": "0.64018834",
"text": "def base64url_decode(str)\n\t\t\tstr += '=' * (4 - str.length.modulo(4))\n\t\t\tBase64.decode64(str.tr('-_', '+/'))\n\t\tend",
"title": ""
},
{
"docid": "a34071cc1daa43ada0cb30895852e4b0",
"score": "0.6391231",
"text": "def base64(file)\n Base64.encode64(file).split(\"\\n\").join # Strip all newlines\n end",
"title": ""
},
{
"docid": "42af701f2344beed66739f6f1535977f",
"score": "0.6382803",
"text": "def base64digest; end",
"title": ""
},
{
"docid": "42af701f2344beed66739f6f1535977f",
"score": "0.6382803",
"text": "def base64digest; end",
"title": ""
},
{
"docid": "97aaf38ead774c3bd28673744fc19e18",
"score": "0.638114",
"text": "def data_base64\n d = data\n d ? Base64.encode64(d) : \"\"\n end",
"title": ""
},
{
"docid": "56ad88259afd10107402c6901bcc0fe5",
"score": "0.6325738",
"text": "def data_base64\n d = data\n d ? Base64::encode64(d) : ''\n end",
"title": ""
},
{
"docid": "b468df467e4c5d856be82c69f0a12b95",
"score": "0.632002",
"text": "def file_data\n Base64.decode64(Base64.encode64(tempfile.read))\n end",
"title": ""
},
{
"docid": "8205f95a77db9123aa7a9bfeb8fc49fa",
"score": "0.6315225",
"text": "def e64(s)\r\n return unless s\r\n CGI.escape Base64.encode64(s)\r\n end",
"title": ""
},
{
"docid": "e2d6fecadffb635f927e011685a6ae47",
"score": "0.63034415",
"text": "def decode_base64(something)\n if something.is_a?(Hash)\n return nil if something.empty?\n something.each {|key, value|\n something[key] = decode_base64(value)\n }\n elsif something.is_a?(Array)\n return nil if something.empty?\n something = something.map {|value|\n decode_base64(value)\n }\n elsif something.is_a?(String) and something.include? \"__base64__\"\n something.slice!(\"__base64__\")\n fix_bad_encoding Base64.decode64(something);\n else\n something\n end\n end",
"title": ""
},
{
"docid": "d096b7572c5f7c1eb6802efae54269e9",
"score": "0.6297788",
"text": "def e64(s)\n return unless s\n CGI.escape Base64.encode64(s)\n end",
"title": ""
},
{
"docid": "62d70d3403c50b17909cf4d5a0fd28e0",
"score": "0.6282772",
"text": "def decode_body(str); end",
"title": ""
},
{
"docid": "fbf3c070f5c37eea79da0f105011c849",
"score": "0.62737024",
"text": "def base64_url_encode(str)\n Base64.strict_encode64(str).tr('+/', '-_').tr('=', '')\n end",
"title": ""
},
{
"docid": "fbf3c070f5c37eea79da0f105011c849",
"score": "0.62737024",
"text": "def base64_url_encode(str)\n Base64.strict_encode64(str).tr('+/', '-_').tr('=', '')\n end",
"title": ""
},
{
"docid": "b139ed3c2816d4cfb353c1bc0cd2dd3d",
"score": "0.6264141",
"text": "def b64_encode(string)\n Base64.urlsafe_encode64(string).tr('=','')\n end",
"title": ""
},
{
"docid": "55bac7236ef9610d8ec71890361a195f",
"score": "0.6259657",
"text": "def base64urldecode(data)\n Base64.urlsafe_decode64(data + '=' * ((4 - data.length % 4) % 4))\n end",
"title": ""
},
{
"docid": "e56c1026d398a20435df23e912ef56c8",
"score": "0.6258566",
"text": "def marshal_load(s) \n a, r = s.split '$$$'\n @algorithm = a\n @raw = Base64.decode64(r)\n end",
"title": ""
},
{
"docid": "73992bbafc77e3f270be649328e2eba6",
"score": "0.6240096",
"text": "def to_base64_decode\n Base64.decode64(self)\n end",
"title": ""
},
{
"docid": "c6f10775e4d1d83d8ed240066cc1487f",
"score": "0.623604",
"text": "def decrypt_base64_to_str(data,key)\n a32_to_str(decrypt_base64_to_a32(data, key))\n end",
"title": ""
},
{
"docid": "ddc4f14b402c54ab25b376d2696207d7",
"score": "0.623503",
"text": "def strict_encode64(str)\n if Base64.respond_to?(:strict_encode64)\n Base64.strict_encode64(str)\n else\n Base64.encode64(str).gsub(\"\\n\", '')\n end\n end",
"title": ""
},
{
"docid": "28a30f373bd012b6db3d24c13bec35c6",
"score": "0.6231153",
"text": "def decode64(string=\"\")\n decoded = \"\"\n string.unpack('C*').each do |char_num|\n base64_index = CHARS.index(char_num.chr)\n decoded << \"%06d\" % base64_index.to_s(2) if base64_index\n end\n (decoded.size % 8).times { decoded.chop! }\n decoded.gsub!(/(.{8})/) { |b| b.to_i(2).chr }\n end",
"title": ""
},
{
"docid": "09ed2880ffa2b09964cc98ce184a16d2",
"score": "0.622268",
"text": "def write_json_base64(str)\n @context.write(trans)\n trans.write(@@kJSONStringDelimiter)\n trans.write(Base64.strict_encode64(str))\n trans.write(@@kJSONStringDelimiter)\n end",
"title": ""
},
{
"docid": "070895a45b3dfef32732d202ccf33c50",
"score": "0.6214165",
"text": "def decode64(encoded)\n Base64.strict_decode64(encoded)\n rescue\n raise SaslErrors::IncorrectEncoding\n end",
"title": ""
},
{
"docid": "3b8da148adde4d45c12516413c249727",
"score": "0.6185481",
"text": "def base64\n self['base64']\n end",
"title": ""
}
] |
1ed9bdbc928387681c9cdcd4d52462fa | DELETE /register_executions/1 DELETE /register_executions/1.json | [
{
"docid": "d8f1a05492589a3ce933581db73b5514",
"score": "0.5782601",
"text": "def destroy\n @analysis_execution.destroy\n respond_to do |format|\n format.html { redirect_to analysis_executions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] | [
{
"docid": "aaffbf4d2cc1113e27e91c14f98c6adf",
"score": "0.64545625",
"text": "def delete!\n url = \"#{Rails.configuration.waste_exemplar_services_url}/registrations/#{uuid}.json\"\n Rails.logger.debug \"Registration: about to DELETE\"\n deleted = true\n begin\n response = RestClient.delete url\n\n # result = JSON.parse(response.body)\n self.uuid = nil\n save\n\n rescue => e\n Airbrake.notify(e)\n Rails.logger.error e.to_s\n deleted = false\n end\n deleted\n end",
"title": ""
},
{
"docid": "016bf861ece38fe49f36ccbd6bf5d100",
"score": "0.6228759",
"text": "def destroy\n @tests_executor.destroy\n respond_to do |format|\n format.html { redirect_to tests_executors_url, notice: 'Tests executor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fecc36306d15e9c7de4fdf2b3066f546",
"score": "0.6026814",
"text": "def destroy\n @registry.destroy\n respond_to do |format|\n format.html { redirect_to registries_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d2375b11675de0e152de07976b50e9c7",
"score": "0.60241777",
"text": "def delete_request(url, queries)\n results = @@client.delete url, queries\n results.to_json\nend",
"title": ""
},
{
"docid": "e9a0c42801e67bcad9a9aa023ed64449",
"score": "0.60172766",
"text": "def destroy\n @execution = Project.find(params[:project_id]).executions.find(params[:id])\n \n if @execution.destroy\n render :json => {:status => :ok}\n else\n render :json => {:error => @execution.errors.full_messages, :status => :bad_request}\n end\n end",
"title": ""
},
{
"docid": "5a98bce934eab94fa24473229c095438",
"score": "0.60047215",
"text": "def destroy\n @register.destroy\n respond_to do |format|\n format.html { redirect_to registers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a49db061722fbfea9d603f70a67dc0ab",
"score": "0.5993585",
"text": "def test_delete_not_exist_metric\n not_exist_id = '10000'\n output = `curl -X DELETE http://localhost:8080/metrics/metrics/#{not_exist_id}`\n assert_match \"<html>\", output, \"TEST 5: delete not existing metric - FAILED\"\n end",
"title": ""
},
{
"docid": "62ab9d1a8abe04b4ee9ec5f17c92bd3c",
"score": "0.59782493",
"text": "def destroy\n @execution = Execution.find(params[:id])\n @execution.destroy\n\n respond_to do |format|\n format.html { redirect_to executions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "853ca9d3f704d2b4095c7704a799d808",
"score": "0.5977562",
"text": "def destroy\n @executive.destroy\n respond_to do |format|\n format.html { redirect_to executives_url, notice: 'Directivo eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9910e6e7e876ecdd6aefeaaf384ac9c7",
"score": "0.5967592",
"text": "def destroy\n @executive.destroy\n respond_to do |format|\n format.html { redirect_to executives_url, notice: t(\"executive.executive_destroyed\") }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "768975f552c43c444566d0c444f1f9c7",
"score": "0.59375536",
"text": "def destroy\n @execution.destroy\n respond_to do |format|\n format.html { redirect_to test_case_executions_url, notice: 'Execution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aab40e915a983b19a00c602b76a1ae9a",
"score": "0.5917818",
"text": "def delete\n RestClient.delete \"#{@uri}/api/requests/request/#{@data['requestId']||@data['id']}\"\n puts ' Deleted request: '.red + \"#{@data['requestId']||@data['id']}\".light_blue\n end",
"title": ""
},
{
"docid": "1db625d65654527538bbeb5fb56ce07b",
"score": "0.5912478",
"text": "def destroy\n ActiveRecord::Base.transaction do\n @register.names.each { |i| i.update!(register: nil) }\n @register.destroy!\n end\n respond_to do |format|\n format.html { redirect_to registers_url, notice: \"Register was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c0492720425bbca747a30146423128e1",
"score": "0.5910975",
"text": "def destroy\n @registry.destroy\n respond_to do |format|\n format.html { redirect_to registries_url, notice: 'Registry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cf29887f783b049fc0992cd836d140b7",
"score": "0.58947325",
"text": "def destroy\n @register.destroy\n respond_to do |format|\n format.html { redirect_to @register }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "74609d345f2a94b80363255db6a8d480",
"score": "0.58926624",
"text": "def delete\n @server.delete_run uuid\n end",
"title": ""
},
{
"docid": "561b57f9fa7222e279229f89405ac038",
"score": "0.58893466",
"text": "def test_delete_not_exist_experiment\n not_exist_id = '10000'\n output = `curl -X DELETE http://localhost:8080/metrics/experiments/#{not_exist_id}`\n assert_match \"<html>\", output, \"TEST 3: delete not existing experiment - FAILED\"\n end",
"title": ""
},
{
"docid": "13264067d80d4a8dc14faa370ec0a669",
"score": "0.58885366",
"text": "def destroy\n @luxe_registry = LuxeRegistry.find(params[:id])\n @luxe_registry.destroy\n\n respond_to do |format|\n format.html { redirect_to luxe_registries_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e4e59da675a89a90acdfe4d5810cd687",
"score": "0.58765244",
"text": "def destroy\n @register = Register.find(params[:id])\n @register.destroy\n\n respond_to do |format|\n format.html { redirect_to registers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1e581db683fff4538f05981e876985d2",
"score": "0.58557963",
"text": "def destroy\n @setting_execution.destroy\n respond_to do |format|\n format.html { redirect_to setting_executions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "841ca353a77422b8696dbc653af1ce55",
"score": "0.5854067",
"text": "def destroy\r\n @registry.destroy\r\n respond_to do |format|\r\n format.html { redirect_to registries_url, notice: 'Registry was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"title": ""
},
{
"docid": "2ebb6a16a1b72da025ca36e2b5df8b9e",
"score": "0.585228",
"text": "def destroy\n @execution.destroy\n respond_to do |format|\n format.html { redirect_to executions_url, notice: 'Execution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4c1c164b581dbae14285797e584e8fb7",
"score": "0.5837149",
"text": "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"title": ""
},
{
"docid": "1fc7098969e68ba6e002a316ff0f94e0",
"score": "0.5835599",
"text": "def destroy\n @quotation_registry.destroy\n respond_to do |format|\n format.html { redirect_to quotation_registries_url, notice: 'Quotation registry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f69290a028d03fe38c668a169b90438d",
"score": "0.5821336",
"text": "def destroy\n \n @registry = Registry.find(params[:id])\n @registry.destroy\n logger.info \"*-*-*-*-* #{@registry.name} deleted by #{@user.username}.\"\n\n respond_to do |format|\n format.html { redirect_to( user_gifts_url(@user)) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2148e2fd9383c12872890f51efee3615",
"score": "0.57969",
"text": "def delete\n begin\n task_id = \"#{@file}\".gsub(/\\.\\/singularity\\//, \"\").gsub(/\\.json/, \"\")\n # delete the request\n RestClient.delete \"#{@uri}/api/requests/request/#{task_id}\"\n puts \"#{task_id} DELETED\"\n rescue\n puts \"#{task_id} #{$!.response}\"\n end\n end",
"title": ""
},
{
"docid": "174b723f9e43bfa7501a9cdc389e4c1b",
"score": "0.5788692",
"text": "def delete\n @response = self.class.delete(\"#{@server_uri}/resource_name/#{@opts[:id]}.json\")\n end",
"title": ""
},
{
"docid": "56acd6025fc9aeb045002a58d6c8554b",
"score": "0.57867837",
"text": "def destroy\n @operator_register.destroy\n respond_to do |format|\n format.html { redirect_to operator_registers_url, notice: 'Operator register was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2c0f64b6d3e03bd3c048ffd57cfe7c15",
"score": "0.5775789",
"text": "def destroy\n @store_register = Store::Register.find(params[:id])\n @store_register.destroy\n\n respond_to do |format|\n format.html { redirect_to store_registers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5987b33a7efcbf5c289f5d992f717154",
"score": "0.5773496",
"text": "def destroy\n @action_registration = ActionRegistration.find(params[:id])\n @action_registration.destroy\n\n respond_to do |format|\n format.html { redirect_to administration_action_registrations_path }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4b2bdaf9ebc663867f9177b5295195fc",
"score": "0.57614064",
"text": "def destroy\n @register.destroy\n respond_to do |format|\n format.html { redirect_to registers_url, notice: 'Register was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a2e027c17d312e7272a85866f773dd84",
"score": "0.57586616",
"text": "def destroy\n @start_register.destroy\n respond_to do |format|\n format.html { redirect_to start_registers_url, notice: 'Start register was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "af125dfcc568deb403f336c90fc200b7",
"score": "0.57562625",
"text": "def destroy\n executable = Executable.find_by_version(params[:id])\n if executable != nil\n executable.jar.purge\n executable.delete\n render json: {status: \"Version deleted\"}\n else\n render json: {status: \"Unknown version\"}, status: 400\n end\n end",
"title": ""
},
{
"docid": "da3d0c2dd2d458f445ac99da28c61142",
"score": "0.5754898",
"text": "def destroy\n @horoscope_west_register = HoroscopeWestRegister.find(params[:id])\n @horoscope_west_register.destroy\n\n respond_to do |format|\n format.html { redirect_to horoscope_west_registers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "da0d55e502960710bc2b7ece54222fa3",
"score": "0.5746983",
"text": "def delete(name)\n path = \"/projects/#{project.name}/registration/functions/#{name}\"\n !!client.delete(path)\n end",
"title": ""
},
{
"docid": "93bdb7dd9f1bb9d081b02666a8f2cad8",
"score": "0.5737439",
"text": "def destroy\n @inventory_registry.destroy\n respond_to do |format|\n format.html { redirect_to inventory_registries_url, notice: 'Inventory registry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a34bfda60c936db17c9b71af42d54ded",
"score": "0.5731797",
"text": "def delete\n # TODO: validate returned json fits schema\n @json = @interface.delete_by_id @json['id']\n end",
"title": ""
},
{
"docid": "6eed9be996f761358a04ed780ffb23ce",
"score": "0.5717165",
"text": "def delete_endpoint\n end",
"title": ""
},
{
"docid": "f3dfc3ef2b7dbd3fd3cfb751f19edf48",
"score": "0.57163954",
"text": "def destroy\n @run.destroy\n head 200\n end",
"title": ""
},
{
"docid": "fbf97d1bd44655422753dcf3c0eed09c",
"score": "0.57114446",
"text": "def delete # rubocop:disable Metrics/AbcSize\n attrcheck = { 'Instance' => @options[:inst] }\n @validate.attrvalidate(@options, attrcheck)\n helper = PaasHelpers.new if @options[:paas_rest_endpoint]\n deleteconfig = File.read(@options[:config]) if @options[:function] == 'jcs'\n data_hash = JSON.parse(deleteconfig) if @options[:function] == 'jcs'\n deleteinst = InstDelete.new(@options[:id_domain], @options[:user_name], @options[:passwd], @options[:function])\n @options[:paas_rest_endpoint] = helper.paas_url(@options[:paas_rest_endpoint], @options[:function]) if @options[:paas_rest_endpoint]\n deleteinst.url = @options[:paas_rest_endpoint] if @options[:paas_rest_endpoint]\n result = deleteinst.delete(data_hash, @options[:inst]) if @options[:function] == 'jcs'\n result = deleteinst.delete(nil, @options[:inst]) if @options[:function] == 'dbcs'\n @util.response_handler(result)\n JSON.pretty_generate(JSON.parse(result.body))\n end",
"title": ""
},
{
"docid": "09e6242fe89298467d2b8133a644036c",
"score": "0.5700233",
"text": "def destroy\n sensu.reject! { |api| api['name'] == name }\n end",
"title": ""
},
{
"docid": "8d1a4287c5a28e0aece3da3d3b9af48e",
"score": "0.56921077",
"text": "def destroy\n @registration = Schedulereg.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to scheduleregs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "434dd964e8754f519adef029fcc610f5",
"score": "0.56903493",
"text": "def destroy\n @register.destroy\n respond_to do |format|\n format.html { redirect_to registers_url, notice: 'Register was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "434dd964e8754f519adef029fcc610f5",
"score": "0.56903493",
"text": "def destroy\n @register.destroy\n respond_to do |format|\n format.html { redirect_to registers_url, notice: 'Register was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "64ba25fc03567c34a6d276cee75297d9",
"score": "0.56648725",
"text": "def destroy\n @instrument_registration.destroy\n respond_to do |format|\n format.html { redirect_to instrument_registrations_url, notice: 'Instrument registration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3f09e89499b91555560763de76083789",
"score": "0.5641805",
"text": "def destroy\n @db_inst.destroy\n respond_to do |format|\n format.html { redirect_to db_insts_url, notice: 'Db inst was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fada179ca03d2bbf1f3e27d18e545818",
"score": "0.5639615",
"text": "def destroy\n @execution.destroy\n respond_to do |format|\n format.html { redirect_to executions_url, notice: 'Тестирование успешно удалено.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6c062f326c5959ab39e70afaea346576",
"score": "0.5632514",
"text": "def destroy\n arr = [].append(@link.user.regid)\n logger.debug `curl -X POST \\\n -H \\\"Authorization: key=AIzaSyCIg1eu_mSBZcjKy2g6CPbkjjZ6-5yPQsM\\\" \\\n -H \\\"Content-Type: application/json\\\" \\\n -d '{ \n \"registration_ids\": #{arr.inspect}, \n \"data\": {\"del\":\"#{@link.id}\"},\n \"priority\": \"high\"\n }' \\\n https://android.googleapis.com/gcm/send`\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\nend",
"title": ""
},
{
"docid": "0661ff25d0ad9c36635b228e8f772e3b",
"score": "0.56279314",
"text": "def destroy\n @telemetry = Telemetry.find(params[:id])\n #path = \"telemetries/IXV/#{@telemetry.database.version}/#{@telemetry.name}_#{@telemetry.version}\"\n delete = %x[rm -R #{@telemetry.path}]\n @telemetry.destroy\n respond_to do |format|\n format.html { redirect_to telemetries_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8bdd30d31a9816059b58e22d06b25b6c",
"score": "0.5627509",
"text": "def delete(conn)\n xml = conn.make_xml('EnginePoolDeleteRequest')\n xml.add_element(as_xml)\n result = conn.execute(xml, '1.2')\n result.success\n end",
"title": ""
},
{
"docid": "33ae3fbaabb68170de9f95477c22d5d1",
"score": "0.56248045",
"text": "def delete_json(path)\n retries = 0\n begin\n return resource(path).delete()\n rescue => e\n if e.kind_of?(RestClient::Exception) and e.http_code == 503 and retries < RETRY_503_MAX\n # the G5K REST API sometimes fail with error 503. In that case we should just wait and retry\n puts(\"G5KRest: DELETE #{path} failed with error 503, retrying after #{RETRY_503_SLEEP} seconds\")\n retries += 1\n sleep RETRY_503_SLEEP\n retry\n end\n handle_exception(e)\n end\n end",
"title": ""
},
{
"docid": "66a4b43c7adc02611bb27e57d9189c51",
"score": "0.56226254",
"text": "def destroy\n @person_registration = PersonRegistration.find(params[:id])\n @person_registration.destroy\n\n respond_to do |format|\n format.html { redirect_to person_registrations_url(audit: '1') }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9106867cee9e8775ba817195d3bc2020",
"score": "0.56142694",
"text": "def delete_rest(path) \n run_request(:DELETE, create_url(path)) \n end",
"title": ""
},
{
"docid": "edaaf3d39655d6285f4b029b3b6aa34f",
"score": "0.5609334",
"text": "def destroy\n @regist_1.destroy\n respond_to do |format|\n format.html { redirect_to regist_1s_url, notice: 'Regist 1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3e97a451d9f694842a2a903bb6308cc4",
"score": "0.56087404",
"text": "def destroy\n @executable = Executable.find(params[:id])\n @executable.destroy\n\n respond_to do |format|\n format.html { redirect_to(executables_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e1ac349398f5254c7f88bcca8b3fbf0a",
"score": "0.5605839",
"text": "def destroy\n @test_case_execution = TestCaseExecution.find(params[:id])\n @test_case_execution.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_case_executions_path) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "b1a17c1ee1af05c79fe156622df44818",
"score": "0.56027675",
"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": "c2fa49ad0d314d662db8b3f72cc76c20",
"score": "0.5597219",
"text": "def destroy\n @hostel.hostel_registrations.destroy_all\n @hostel.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_hostels_path, notice: 'El hostal fue eliminado.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c54f007b623fe4b2bc65ee5eaf784b16",
"score": "0.5588638",
"text": "def destroy\n @registeration = Registeration.find(params[:id])\n @registeration.destroy\n\n respond_to do |format|\n format.html { redirect_to registerations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ec1808726c65a244f734c69b352d3ca5",
"score": "0.55857706",
"text": "def delete_by_name(node)\n resp = JSON.parse($m.request('/status/hosts/list').body)['records']\n resp.each do |stat|\n if stat['hostname'] == node \n puts \"Deleting node: \" + stat['hostname']\n $m.request(\"/admin/hosts/delete\", \"id=#{stat['id']}\")\n end\n end\nend",
"title": ""
},
{
"docid": "15e0b294a5498f95eddd8906a052dc3e",
"score": "0.5583659",
"text": "def destroy\n set_instance_variables\n\n register = current_user.send(\"register_#{names}\").find(params[:id])\n register.destroy\n\n self.instance_variable_set(\"@register_#{name}\",register)\n\n respond_to do |format|\n format.html { redirect_to redirect_destroy(register) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7452c4d15daf08108aaa5a1b728adb31",
"score": "0.5583574",
"text": "def destroy\n @json.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "2ff468677a117cec1c33292db7d43420",
"score": "0.5576608",
"text": "def destroy\n @node_registration = NodeRegistration.find(params[:id])\n @node_registration.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_registrations_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6ccb66d5457795c75944cb7271fb49de",
"score": "0.5573031",
"text": "def destroy\n @account_executive.destroy\n respond_to do |format|\n format.html { redirect_to account_executives_url, notice: 'Account executive was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e753aae0cf792b7debb2f01c6a6ad9bc",
"score": "0.55706227",
"text": "def destroy\n @reg = Reg.find(params[:id])\n @reg.destroy\n\n respond_to do |format|\n format.html { redirect_to regs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "405fa26ac6dd221ad1df423665ac25dc",
"score": "0.55685055",
"text": "def destroy\n @cpu_conf.destroy\n respond_to do |format|\n format.html { redirect_to cpu_confs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2283949d8a72b62318056c2e753282f0",
"score": "0.55663735",
"text": "def destroy\n @regiestration.destroy\n respond_to do |format|\n format.html { redirect_to regiestrations_url, notice: 'Regiestration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1188dd64153bcaa3f4f68171483a4274",
"score": "0.55597705",
"text": "def destroy\n @url_command.destroy\n respond_to do |format|\n format.html { redirect_to url_commands_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "270d5e0666baa7ec0c54743a0b843220",
"score": "0.55571455",
"text": "def destroy\n @static_workload.destroy\n respond_to do |format|\n format.html { redirect_to static_workloads_url, notice: 'Static workload was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a252a3827e4f2f812b02fe6ec20c0da5",
"score": "0.5548432",
"text": "def destroy_request\n request(\"#{self.class.zabbix_name}.delete\", destroy_params)\n end",
"title": ""
},
{
"docid": "f42fa01964ad4ebe9011d42af3210f21",
"score": "0.5546715",
"text": "def delete\n Utils.call_executable_returning_status('--delete', '-i', id)\n end",
"title": ""
},
{
"docid": "473ff5d076e9428490e1219456129f63",
"score": "0.55464375",
"text": "def destroy\n @instruction.destroy\n respond_to do |format|\n format.html { redirect_to admin_instructions_path }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f800d166a81148a159285deee1efd4fa",
"score": "0.55459476",
"text": "def destroy\n @continuous_deployment.destroy\n respond_to do |format|\n format.html { redirect_to continuous_deployments_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0b24cbc6495df3923ea7679acbcd8deb",
"score": "0.5543727",
"text": "def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend",
"title": ""
},
{
"docid": "d5da7b9b44ea56deb5d3cb4022c2a854",
"score": "0.55405873",
"text": "def destroy\n @registration_response = @registration.registration_responses.find(params[:id])\n @registration_response.destroy\n\n respond_to do |format|\n format.html { redirect_to registration_registration_responses_url(@registration) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "91d4da9a6a01433faa71fcc5217c3540",
"score": "0.5538471",
"text": "def destroy\n @api_task.destroy\n end",
"title": ""
},
{
"docid": "57b799133d29316426c358002043baa2",
"score": "0.55378556",
"text": "def delete_rest(path, headers={}) \n run_request(:DELETE, create_url(path), headers) \n end",
"title": ""
},
{
"docid": "691edae2167a71e1cfc88e5fa7753576",
"score": "0.55346966",
"text": "def destroy\n @test_registration.destroy\n respond_to do |format|\n format.html { redirect_to test_registrations_url, notice: 'Test registration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b91a9994358d1b934031cb72af28e05d",
"score": "0.5532402",
"text": "def destroy\n @registration = Registration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to registrations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b91a9994358d1b934031cb72af28e05d",
"score": "0.5532402",
"text": "def destroy\n @registration = Registration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to registrations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b91a9994358d1b934031cb72af28e05d",
"score": "0.5532402",
"text": "def destroy\n @registration = Registration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to registrations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b91a9994358d1b934031cb72af28e05d",
"score": "0.5532402",
"text": "def destroy\n @registration = Registration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to registrations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b91a9994358d1b934031cb72af28e05d",
"score": "0.5532402",
"text": "def destroy\n @registration = Registration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to registrations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7a324b11e46ae1041830b7442fdae92a",
"score": "0.55290693",
"text": "def destroy\n @regress = Regress.find(params[:id])\n @regress.destroy\n\n respond_to do |format|\n format.html { redirect_to regresses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "29216cb590d0016ce2fde91196ea9660",
"score": "0.5520583",
"text": "def destroy\n @registration_config = RegistrationConfig.find(params[:id])\n @registration_config.destroy\n drop_table\n\n respond_to do |format|\n format.html { redirect_to(registration_configs_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "47925df71bd65f1bc0fe3eb65de91926",
"score": "0.5520512",
"text": "def destroy\n @registration_request.destroy\n respond_to do |format|\n format.html { redirect_to registration_requests_url, notice: 'Registration request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e0fa239b7d331683b6fe66654a465ca7",
"score": "0.55162215",
"text": "def destroy\n @dagr = Dagr.find(params[:id])\n @dagr.deleted = true\n @dagr.dagrdeletiontime = Time.now\n\n @dagr.save\n\n sql = \"DELETE FROM metadatas WHERE dagr_guid='#{params[:id]}'\"\n Metadata.connection.execute(sql)\n \n sql = \"UPDATE dagrs SET deleted=true, dagrdeletiontime='#{Time.now}' where dagr_guid in (SELECT child_guid FROM connections where parent_guid='#{params[:id]}')\"\n Dagr.connection.execute(sql)\n\n sql = \"DELETE FROM keywords where dagr_guid='#{params[:id]}'\"\n Keyword.connection.execute(sql)\n\n sql = \"DELETE FROM connections where parent_guid='#{params[:id]}'\"\n Connection.connection.execute(sql)\n\n sql = \"UPDATE mediafiles SET deleted=true, deletiontime='#{Time.now}' where dagr_guid='#{params[:id]}'\"\n Connection.connection.execute(sql)\n\n sql = \"DELETE FROM annotations where media_guid IN (SELECT media_guid FROM mediafiles where dagr_guid='#{params[:id]}')\"\n Annotation.connection.execute(sql)\n\n\n\n respond_to do |format|\n format.html { redirect_to dagrs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0ef14904c7c657c41fcbf47a1a588aff",
"score": "0.5513716",
"text": "def destroy\n @jmeter_task.destroy\n respond_to do |format|\n format.html { redirect_to jmeter_tasks_url, notice: 'Jmeter task was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5a65bc1213217f1a4d9c42dc1dea5997",
"score": "0.5512707",
"text": "def delete_operations; end",
"title": ""
},
{
"docid": "b7fd18d72db63e9d327d9f408d96f1d2",
"score": "0.55125254",
"text": "def destroy\n @institucion.destroy\n respond_to do |format|\n format.html { redirect_to instituciones_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "479781a6dd30c1aebd8cc8987972168f",
"score": "0.5512335",
"text": "def destroy\n @konnec_register.destroy\n respond_to do |format|\n format.html { redirect_to konnec_registers_url, notice: 'Konnec register was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "26d7dd7a4bcffeee97a1178d5a0483df",
"score": "0.55120623",
"text": "def destroy\n @deployment_configuration = DeploymentConfiguration.find(params[:id])\n @deployment_configuration.destroy\n\n respond_to do |format|\n format.html { redirect_to deployment_configurations_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "db107da56a216a67dcc3cd00866f3ff0",
"score": "0.55119735",
"text": "def destroy\n @registration = Registration.find(params[:id])\n @registration.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "cbda2ce8efd7c1d5dcf8b2d676805539",
"score": "0.5507381",
"text": "def destroy_deployed_REST\n @deployed = DeployedContainer.find(params[:id])\n\n nova_ip = nil\n quantum_ip = nil\n\n # Check for auth token in HTTP request\n if request.headers[\"X-Auth-Token\"] != \"\"\n logger.info \"Token not blank\"\n token = request.headers[\"X-Auth-Token\"]\n logger.info \"Token:\"\n logger.info token\n begin\n # Define OpenStack endpoint URLs\n services = Donabe::KEYSTONE.get_endpoints(token)\n logger.info \"SERVICES:\"\n logger.info services\n services[\"endpoints\"].each do |endpoint|\n if endpoint[\"name\"] == \"nova\"\n nova_ip = endpoint[\"internalURL\"]\n elsif endpoint[\"name\"] == \"quantum\"\n quantum_ip = endpoint[\"internalURL\"]\n end\n end\n rescue\n # Respond with HTTP 401 Unauthorized\n render status: :unauthorized\n end\n else\n # Respond with HTTP 401 Unauthorized\n render status: :unauthorized\n end\n \n destroy_deployed(@deployed,token,nova_ip,quantum_ip)\n\n @deployed_containers = DeployedContainer.all\n\n end",
"title": ""
},
{
"docid": "1f2c2b0f91ba3943e0c326109e91825d",
"score": "0.5507206",
"text": "def delete(index1, *rest)\n execute('delete', index1, *rest)\n end",
"title": ""
},
{
"docid": "3c6aef7534366e6d5f45c1bf9f6dc17a",
"score": "0.5506639",
"text": "def destroy\n @regulation_master.destroy\n respond_to do |format|\n format.html { redirect_to regulation_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c5a5c7b0eb437b2c3172008b2b99bc03",
"score": "0.5501586",
"text": "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6500fe3e8dfbe1fe0f50b20b4bc66e54",
"score": "0.54966575",
"text": "def destroy\n @deployment = Deployment.find(params[:id])\n checkaccountobject(\"deployments\", @deployment)\n @deployment.destroy\n\n respond_to do |format|\n format.html { redirect_to deployments_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "3e17c6252a9955923806078c4a0fa625",
"score": "0.54955703",
"text": "def destroy\n output = \"onevm delete #{resource[:name]} \", self.class.login\n `#{output}`\n end",
"title": ""
},
{
"docid": "a69868bd6350a6903324bf452b664a56",
"score": "0.54946244",
"text": "def destroy\n @instalacion = Instalacion.find(params[:id])\n @instalacion.destroy\n\n respond_to do |format|\n format.html { redirect_to instalacions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
5b5a1eaf4a329a9c6832de41b1f2206d | TODO: automatically figure this out | [
{
"docid": "9d80b0b583c5aa8c8181861c86e27e16",
"score": "0.0",
"text": "def creator\n \"Pat Allan\"\n end",
"title": ""
}
] | [
{
"docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1",
"score": "0.744697",
"text": "def private; end",
"title": ""
},
{
"docid": "0b8b7b9666e4ed32bfd448198778e4e9",
"score": "0.6633029",
"text": "def probers; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
"score": "0.6589075",
"text": "def specie; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
"score": "0.6589075",
"text": "def specie; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
"score": "0.6589075",
"text": "def specie; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
"score": "0.6589075",
"text": "def specie; end",
"title": ""
},
{
"docid": "65ffca17e416f77c52ce148aeafbd826",
"score": "0.6336207",
"text": "def schubert; end",
"title": ""
},
{
"docid": "d88aeca0eb7d8aa34789deeabc5063cf",
"score": "0.61044854",
"text": "def offences_by; end",
"title": ""
},
{
"docid": "991b6f12a63ef51664b84eb729f67eed",
"score": "0.6073047",
"text": "def formation; end",
"title": ""
},
{
"docid": "cf2231631bc862eb0c98d89194d62a88",
"score": "0.59482384",
"text": "def identify; end",
"title": ""
},
{
"docid": "13289d4d24c54cff8b70fcaefc85384e",
"score": "0.58838075",
"text": "def verdi; end",
"title": ""
},
{
"docid": "1f60ec3e87d82a4252630cec8fdc8950",
"score": "0.58735967",
"text": "def berlioz; end",
"title": ""
},
{
"docid": "4a8a45e636a05760a8e8c55f7aa1c766",
"score": "0.58713865",
"text": "def terpene; end",
"title": ""
},
{
"docid": "5971f871580b6a6e5171c35946a30c95",
"score": "0.5843434",
"text": "def stderrs; end",
"title": ""
},
{
"docid": "2cc9969eb7789e4fe75844b6f57cb6b4",
"score": "0.58268267",
"text": "def refutal()\n end",
"title": ""
},
{
"docid": "4755d31a6608e0430dd90f7323468cc5",
"score": "0.5786891",
"text": "def reflector; end",
"title": ""
},
{
"docid": "4755d31a6608e0430dd90f7323468cc5",
"score": "0.5786891",
"text": "def reflector; end",
"title": ""
},
{
"docid": "3660c5f35373aec34a5a7b0869a4a8bd",
"score": "0.57851624",
"text": "def implementation; end",
"title": ""
},
{
"docid": "3660c5f35373aec34a5a7b0869a4a8bd",
"score": "0.57851624",
"text": "def implementation; end",
"title": ""
},
{
"docid": "a02f7382c73eef08b14f38d122f7bdb9",
"score": "0.57634056",
"text": "def custom; end",
"title": ""
},
{
"docid": "a02f7382c73eef08b14f38d122f7bdb9",
"score": "0.57634056",
"text": "def custom; end",
"title": ""
},
{
"docid": "b3d7c178b277afaefb1b9648335941e7",
"score": "0.5744715",
"text": "def loc; end",
"title": ""
},
{
"docid": "b3d7c178b277afaefb1b9648335941e7",
"score": "0.5744715",
"text": "def loc; end",
"title": ""
},
{
"docid": "b3d7c178b277afaefb1b9648335941e7",
"score": "0.5744715",
"text": "def loc; end",
"title": ""
},
{
"docid": "9d841b89340438a2d53048b8b0959e75",
"score": "0.57383037",
"text": "def sitemaps; end",
"title": ""
},
{
"docid": "2d8d9f0527a44cd0febc5d6cbb3a22f2",
"score": "0.5728524",
"text": "def weber; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5720605",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5720605",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5720605",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5720605",
"text": "def from; end",
"title": ""
},
{
"docid": "ad244bd0c45d5d9274f7612fa6fee986",
"score": "0.5709882",
"text": "def suivre; end",
"title": ""
},
{
"docid": "06b6203baf3c9311f502228839c5ab4e",
"score": "0.5651384",
"text": "def intensifier; end",
"title": ""
},
{
"docid": "cdd16ea92eae0350ca313fc870e10526",
"score": "0.5624712",
"text": "def who_we_are\r\n end",
"title": ""
},
{
"docid": "cfbcefb24f0d0d9b60d1e4c0cf6273ba",
"score": "0.56190586",
"text": "def trd; end",
"title": ""
},
{
"docid": "a29c5ce532d6df480df4217790bc5fc7",
"score": "0.5613699",
"text": "def extra; end",
"title": ""
},
{
"docid": "2dbabd0eeb642c38aad852e40fc6aca7",
"score": "0.5610206",
"text": "def operations; end",
"title": ""
},
{
"docid": "2dbabd0eeb642c38aad852e40fc6aca7",
"score": "0.5610206",
"text": "def operations; end",
"title": ""
},
{
"docid": "bc658f9936671408e02baa884ac86390",
"score": "0.5605857",
"text": "def anchored; end",
"title": ""
},
{
"docid": "a7e46056aae02404670c78192ffb8f3f",
"score": "0.55628693",
"text": "def original_result; end",
"title": ""
},
{
"docid": "18b70bef0b7cb44fc22c66bf7965c231",
"score": "0.55612093",
"text": "def first; end",
"title": ""
},
{
"docid": "18b70bef0b7cb44fc22c66bf7965c231",
"score": "0.55612093",
"text": "def first; end",
"title": ""
},
{
"docid": "eb813b4c171b5a75ecb2253b743e7c3a",
"score": "0.5559397",
"text": "def parslet; end",
"title": ""
},
{
"docid": "eb813b4c171b5a75ecb2253b743e7c3a",
"score": "0.5559397",
"text": "def parslet; end",
"title": ""
},
{
"docid": "eb813b4c171b5a75ecb2253b743e7c3a",
"score": "0.5559397",
"text": "def parslet; end",
"title": ""
},
{
"docid": "eb813b4c171b5a75ecb2253b743e7c3a",
"score": "0.5559397",
"text": "def parslet; end",
"title": ""
},
{
"docid": "7ff2011fa3dc45585a9272310eafb765",
"score": "0.5550589",
"text": "def isolated; end",
"title": ""
},
{
"docid": "7ff2011fa3dc45585a9272310eafb765",
"score": "0.5550589",
"text": "def isolated; end",
"title": ""
},
{
"docid": "5ad7e5c7a147626a2b0a2c5956411be5",
"score": "0.5540841",
"text": "def r; end",
"title": ""
},
{
"docid": "5ad7e5c7a147626a2b0a2c5956411be5",
"score": "0.5540841",
"text": "def r; end",
"title": ""
},
{
"docid": "7c4e6912cde56a7ef38385e785b83259",
"score": "0.5539501",
"text": "def position; end",
"title": ""
},
{
"docid": "7c4e6912cde56a7ef38385e785b83259",
"score": "0.5539501",
"text": "def position; end",
"title": ""
},
{
"docid": "7c4e6912cde56a7ef38385e785b83259",
"score": "0.5539501",
"text": "def position; end",
"title": ""
},
{
"docid": "7c4e6912cde56a7ef38385e785b83259",
"score": "0.5539501",
"text": "def position; end",
"title": ""
},
{
"docid": "7c4e6912cde56a7ef38385e785b83259",
"score": "0.5539501",
"text": "def position; end",
"title": ""
},
{
"docid": "7c4e6912cde56a7ef38385e785b83259",
"score": "0.5539501",
"text": "def position; end",
"title": ""
},
{
"docid": "7c4e6912cde56a7ef38385e785b83259",
"score": "0.5539501",
"text": "def position; end",
"title": ""
},
{
"docid": "7c4e6912cde56a7ef38385e785b83259",
"score": "0.5539501",
"text": "def position; end",
"title": ""
},
{
"docid": "0a39799e76643367f1b6bfac65569895",
"score": "0.5537736",
"text": "def used?; end",
"title": ""
},
{
"docid": "431dbfdbf579fcf05cd1ab47f901de9e",
"score": "0.5524684",
"text": "def real_name; end",
"title": ""
},
{
"docid": "fcbedadc5c0aaa6b55a6b18ae1a7d083",
"score": "0.55233496",
"text": "def feruchemist; end",
"title": ""
},
{
"docid": "3fff7ea9b6967fb0af70c64a4d13faae",
"score": "0.5513155",
"text": "def parts; end",
"title": ""
},
{
"docid": "3fff7ea9b6967fb0af70c64a4d13faae",
"score": "0.5513155",
"text": "def parts; end",
"title": ""
},
{
"docid": "3fff7ea9b6967fb0af70c64a4d13faae",
"score": "0.5513155",
"text": "def parts; end",
"title": ""
},
{
"docid": "3103349d09f884a9193b8c4ac184a666",
"score": "0.5512632",
"text": "def wrapper; end",
"title": ""
},
{
"docid": "6cd66cd69ec6689771c8352ed1909310",
"score": "0.5505676",
"text": "def user_os_complex\r\n end",
"title": ""
},
{
"docid": "701359444c3bc529044a50b60481e991",
"score": "0.54907846",
"text": "def reflection; end",
"title": ""
},
{
"docid": "701359444c3bc529044a50b60481e991",
"score": "0.54907846",
"text": "def reflection; end",
"title": ""
},
{
"docid": "dd68931a1a7f77eb4fd41ce35988a9bb",
"score": "0.5485238",
"text": "def returns; end",
"title": ""
},
{
"docid": "07388179527877105fd7246db2b49188",
"score": "0.5480718",
"text": "def villian; end",
"title": ""
},
{
"docid": "072514f3348fe62556dcdfd4b06e3d08",
"score": "0.5479437",
"text": "def spec; end",
"title": ""
},
{
"docid": "072514f3348fe62556dcdfd4b06e3d08",
"score": "0.5479437",
"text": "def spec; end",
"title": ""
},
{
"docid": "a3c677de4120a6b1a1688fb1c77520ce",
"score": "0.5478192",
"text": "def pos; end",
"title": ""
},
{
"docid": "a3c677de4120a6b1a1688fb1c77520ce",
"score": "0.5478192",
"text": "def pos; end",
"title": ""
},
{
"docid": "a3c677de4120a6b1a1688fb1c77520ce",
"score": "0.5478192",
"text": "def pos; end",
"title": ""
},
{
"docid": "a3c677de4120a6b1a1688fb1c77520ce",
"score": "0.5478192",
"text": "def pos; end",
"title": ""
},
{
"docid": "a3c677de4120a6b1a1688fb1c77520ce",
"score": "0.5478192",
"text": "def pos; end",
"title": ""
},
{
"docid": "a3c677de4120a6b1a1688fb1c77520ce",
"score": "0.5478192",
"text": "def pos; end",
"title": ""
},
{
"docid": "48412710c08492591f41ec0553b303ce",
"score": "0.5474569",
"text": "def starting_position; end",
"title": ""
},
{
"docid": "6a6ed5368f43a25fb9264e65117fa7d1",
"score": "0.54652053",
"text": "def internal; end",
"title": ""
},
{
"docid": "8742865b78eb755e40bb1bff22199433",
"score": "0.5463629",
"text": "def internship_passed; end",
"title": ""
},
{
"docid": "b14829d2f65d2660b51171944c233567",
"score": "0.5454935",
"text": "def required_positionals; end",
"title": ""
},
{
"docid": "3b4df29992323899033bb22a35a64989",
"score": "0.5445068",
"text": "def malts; end",
"title": ""
},
{
"docid": "40ad11ae52949cc12141dcd7bf3f555c",
"score": "0.54427165",
"text": "def implemented_in; end",
"title": ""
},
{
"docid": "45b9e5d1da1562a27f15ce5cb9b634ca",
"score": "0.54379064",
"text": "def ext; end",
"title": ""
},
{
"docid": "45b9e5d1da1562a27f15ce5cb9b634ca",
"score": "0.54379064",
"text": "def ext; end",
"title": ""
},
{
"docid": "005e6fc140cba1f79535dcb415d4bcd9",
"score": "0.54275185",
"text": "def strategy; end",
"title": ""
},
{
"docid": "d8216257f367748eea163fc1aa556306",
"score": "0.5426343",
"text": "def bs; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.5425399",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.5425399",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.5425399",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.5425399",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.5425399",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.5425399",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.5425399",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.5425399",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.5425399",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.5425399",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.5425399",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.5425399",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.5425399",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.5425399",
"text": "def inspect; end",
"title": ""
}
] |
1a661da53ced61c81f5e8a816950453d | Use Faraday to connect to the collection's JSON API | [
{
"docid": "a53c37f3051e6251fe83bed660158193",
"score": "0.6090455",
"text": "def endpoint_connection\n @endpoint_connection ||= Faraday.new(url: endpoint_url) do |faraday|\n faraday.adapter :net_http\n end\n end",
"title": ""
}
] | [
{
"docid": "84ebcfdf730b55abc0407d7baaed8d74",
"score": "0.7234193",
"text": "def connection\n @connection ||= Faraday.new(api_endpoint) do |http|\n http.headers[:accept] = \"application/json, */*\"\n http.headers[:user_agent] = user_agent\n\n http.request :authorization, :Bearer, -> { token_store.get_token }\n http.request :json\n\n http.use Keap::REST::Response::RaiseError\n\n http.response :dates\n http.response :json, content_type: \"application/json\"\n # http.response :logger do |logger|\n # logger.filter(/(Bearer) (\\w+)/, '\\1 [FILTERED]')\n # end\n\n http.adapter adapter, @stubs\n end\n end",
"title": ""
},
{
"docid": "709c9686a2b33c7c34db0f6bab392908",
"score": "0.7130193",
"text": "def connection\n options = { url: api_url, ssl: { verify: false } }\n\n connection = Faraday.new(options) do |conn|\n conn.response :readmill_errors\n conn.response :mashify\n conn.response :json\n\n conn.adapter adapter\n end\n\n connection\n end",
"title": ""
},
{
"docid": "03a60ea93f1f8b792a6b9cb7bbc7a870",
"score": "0.7059596",
"text": "def connection\n Faraday.new(api_url) do |conn|\n conn.use :breakers\n conn.response :snakecase\n conn.response :json, content_type: /\\bjson$/\n conn.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "03a60ea93f1f8b792a6b9cb7bbc7a870",
"score": "0.7059596",
"text": "def connection\n Faraday.new(api_url) do |conn|\n conn.use :breakers\n conn.response :snakecase\n conn.response :json, content_type: /\\bjson$/\n conn.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "14d52c0e9ab966bd87374ffe0a28cfa6",
"score": "0.6866371",
"text": "def create_connection\n\t\t@connection = Faraday.new(:url => @base_url) do |faraday|\n\t\t\tfaraday.headers['Accept'] = 'application/json'\n\t\t\tfaraday.adapter Faraday.default_adapter\n\t\tend\n\tend",
"title": ""
},
{
"docid": "065d9402cbe514e3f6d4cf99d8061ddc",
"score": "0.68513054",
"text": "def connection\n Faraday.new(url:, headers:) do |conn|\n conn.request :json\n conn.use :breakers\n conn.use Faraday::Response::RaiseError\n conn.response :raise_error, error_prefix: service_name\n conn.response :json\n conn.response :betamocks if mock_enabled?\n conn.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "dec36c7bcb754b155059f4a134a35f0a",
"score": "0.6843171",
"text": "def setup_connection\n Faraday.new(:url => @api_url) do |connection|\n #connection.request :url_encoded\n connection.request :json\n #connection.request :retry\n\n connection.response :logger if debug?\n connection.response :raise_error\n connection.response :json, :content_type => /\\bjson$/\n\n connection.use :instrumentation\n connection.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "e1129ba20946f54a16620a15363b69ff",
"score": "0.6783695",
"text": "def connection\n Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.request :json\n\n faraday.response :raise_error, error_prefix: service_name\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "e51dbf26e388a88f94ab97be20cb422e",
"score": "0.67773294",
"text": "def connection\n Faraday.new(api_url, ssl: { verify: true }) do |conn|\n conn.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "ead8f3fd526a529fcb47b4d04486a4a1",
"score": "0.67689437",
"text": "def connection\n @connect ||= Faraday.new do |f|\n f.adapter :net_http\n f.headers = connection_headers\n f.url_prefix = \"#{default_url_prefix}/api/v#{api_version}/\"\n f.response :json, content_type: /\\bjson$/\n end\n end",
"title": ""
},
{
"docid": "3b8e2bf44068899017145db0cf771946",
"score": "0.67536277",
"text": "def connection\n @connection ||= Faraday.new(url: api_endpoint) do |faraday|\n faraday.use Faraday::Request::UrlEncoded\n faraday.use Redd::Response::RaiseError\n faraday.use Redd::Response::ParseJson\n faraday.adapter Faraday.default_adapter\n\n faraday.headers = headers\n end\n end",
"title": ""
},
{
"docid": "3880d4f8124410a971baad50f9e513d4",
"score": "0.67476207",
"text": "def connection\n Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.request :json\n\n faraday.response :raise_error, error_prefix: service_name\n faraday.response :caseflow_errors\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "2643ec42be766620e26def955776baa1",
"score": "0.674754",
"text": "def connection\n @connection ||= Faraday.new(url: 'http://api.unloq.co', headers: default_headers) do |conn|\n conn.request :json\n conn.adapter Faraday.default_adapter\n conn.response :json, :content_type => /\\bjson$/\n end\n end",
"title": ""
},
{
"docid": "0cd964f8dbb0745c3a2f92f672ab2cfe",
"score": "0.6731471",
"text": "def faraday\n @faraday ||= Faraday.new ssl: { verify: ssl_verify } do |faraday|\n authenticate!(faraday)\n\n faraday.request(:retry, max: retries) if retries\n faraday.options.timeout = read_timeout if read_timeout\n faraday.options.open_timeout = open_timeout if open_timeout\n\n faraday.request :url_encoded # Form-encode POST params\n faraday.response :raise_error\n faraday.use :http_cache, store: http_cache, serializer: Marshal\n faraday.use Faraday::CacheHeaders\n faraday.response :json, content_type: /\\bjson$/\n faraday.adapter :excon\n end\n end",
"title": ""
},
{
"docid": "ad95a8698e8c1ab08bdf8f3cc972cc51",
"score": "0.6709002",
"text": "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n faraday.request :json\n\n faraday.response :betamocks if use_mocks?\n faraday.response :snakecase, symbolize: false\n faraday.response :json, content_type: /\\bjson/\n\n faraday.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "2823ff5e2403320020a187bd7fa3d54f",
"score": "0.66859764",
"text": "def client\n @client ||= Faraday.new(api_host) do |faraday|\n faraday.headers[\"Authorization\"] = \"Bearer #{access_token}\"\n faraday.response :logger if Rails.env.test?\n faraday.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "e511fa95f4a94244aaa55628c0c328aa",
"score": "0.66702354",
"text": "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n\n faraday.request :multipart\n faraday.request :json\n\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "ca526e041a91c2f752f0c9932d409989",
"score": "0.66602033",
"text": "def connection\n @connection ||= Faraday.new(self.api_url, { ssl: { verify: false } })\n end",
"title": ""
},
{
"docid": "04fd82133744213fee3cd59775e226ea",
"score": "0.6655382",
"text": "def connection\n @connection ||= Faraday.new(ENDPOINT, connection_options)\n end",
"title": ""
},
{
"docid": "f5893609c777029ae938f6406de2722f",
"score": "0.6629673",
"text": "def connection\n @connection ||= Faraday.new @url do |c|\n c.headers[\"X-Api-Token\"] = @token\n c.use FaradayMiddleware::ParseJson, content_type: \"application/json\"\n #c.use Faraday::Response::Logger, Logger.new(\"tmp/faraday.log\")\n c.use FaradayMiddleware::FollowRedirects, limit: 3\n c.use Faraday::Response::RaiseError # raise exceptions on 40x, 50x responses\n c.use Faraday::Adapter::NetHttp\n end\n end",
"title": ""
},
{
"docid": "2c585ad0fce16d33c455f9806a28e9e4",
"score": "0.6595287",
"text": "def connection\n @connection ||= Faraday.new(url: base_url, headers: default_headers, ssl: {verify: false}) do |builder|\n builder.use Faraday::Request::UrlEncoded\n builder.use Faraday::Response::Mashify\n builder.use Faraday::Response::ParseJson\n builder.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "e861037a9c05ae457501f5bd451d7efe",
"score": "0.65915626",
"text": "def connection\n Faraday.new(:url => host) do |faraday|\n #faraday.response :logger # log requests to STDOUT\n faraday.response :xml, :content_type => /\\bxml$/\n faraday.adapter Faraday.default_adapter # make requests with Net::HTTP\n end\n end",
"title": ""
},
{
"docid": "214e4f554dc7a9cb58145115dc7470cf",
"score": "0.6579271",
"text": "def http\n Faraday.new(url: URL) do |c|\n c.token_auth self.auth_token\n c.request http_config[:request_encoding]\n c.response :json, :content_type => /\\bjson$/ # parse responses to JSON\n c.adapter http_config[:http_adapter]\n end\n end",
"title": ""
},
{
"docid": "25c61a8cc3293ed139020cfa9ded1e00",
"score": "0.65725183",
"text": "def connection\n @connection ||= Faraday.new(ENDPOINT, connection_options)\n end",
"title": ""
},
{
"docid": "1614f3d6892926d8148426fd00a134bf",
"score": "0.65561956",
"text": "def connection\n @connection ||= begin\n conn = Faraday.new(:url => @url) do |b|\n b.use Faraday::Request::UrlEncoded # convert request params as \"www-form-urlencoded\"\n b.use Faraday::Request::JSON # encode request params as json\n b.use Faraday::Response::Logger # log the request to STDOUT\n b.use Faraday::Adapter::NetHttp # make http requests with Net::HTTP \n end\n conn\n end\n end",
"title": ""
},
{
"docid": "5cbed1de0e6b61ce949ec301a0e9ea61",
"score": "0.65358555",
"text": "def connection\n @connection ||= Faraday.new(endpoint, connection_options)\n end",
"title": ""
},
{
"docid": "9029bd072b7b4c3ab6e02d3082dcf763",
"score": "0.6533321",
"text": "def connection\n @connection ||= Faraday.new(faraday_options) do |builder|\n builder.use Faraday::Request::UrlEncoded\n # builder.use QuickbooksOnlineRuby::Middleware::Mashify, nil, @options\n builder.response :json\n\n if QuickbooksOnlineRuby.log?\n builder.use QuickbooksOnlineRuby::Middleware::Logger,\n QuickbooksOnlineRuby.configuration.logger,\n @options\n end\n\n builder.adapter @options[:adapter]\n end\n end",
"title": ""
},
{
"docid": "df433a7ff9aa1452c373fb74dd48d0b4",
"score": "0.65249777",
"text": "def endpoint_connection\n @conn ||= Faraday.new(url: ENDPOINT_URL) do |faraday|\n faraday.adapter :net_http\n end\n rsp = @conn.get do |request|\n request.params = data_params\n end\n end",
"title": ""
},
{
"docid": "c065d89154b56d662235f850e47265a8",
"score": "0.65108407",
"text": "def client\n Faraday.new(url: URL) do |c|\n c.token_auth self.auth_token\n c.request :url_encoded # form-encode POST params\n c.adapter Faraday.default_adapter # Net::HTTP\n end\n end",
"title": ""
},
{
"docid": "f78bcd6d5241e0580befcd93eb520248",
"score": "0.6495175",
"text": "def faraday_connection(url = nil)\n url ||= URI.join(root, href)\n\n Faraday.new(faraday_options.merge(url: url)) do |builder|\n builder.headers.merge!(headers || {})\n builder.headers['User-Agent'] = Aptible::Resource.configuration\n .user_agent\n\n if (ba = auth[:basic])\n builder.basic_auth(*ba)\n end\n\n builder.request :url_encoded\n builder.request :retry\n builder.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "e8a79ddf4986faa067b71c13eb1597e7",
"score": "0.6487067",
"text": "def connection(base='https://api.groupme.com/')\n Faraday.new base do |f|\n f.request :multipart\n f.request :json\n f.headers[:user_agent] = GroupMe::USER_AGENT\n f.headers[\"X-Access-Token\"] = @token\n\n # f.response :logger\n f.response :mashify\n f.response :json, :content_type => /\\bjson$/\n\n f.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "725cd8a2945da8b5fb5081905e53f310",
"score": "0.648255",
"text": "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n\n faraday.request :multipart\n faraday.request :json\n\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "725cd8a2945da8b5fb5081905e53f310",
"score": "0.648255",
"text": "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n\n faraday.request :multipart\n faraday.request :json\n\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "ed91b8f25ba7832610e67da1c65c389d",
"score": "0.6460982",
"text": "def connection\n Faraday.new(url: url) do |conn|\n conn.use :breakers\n conn.response :check_in_errors\n conn.use :check_in_logging\n conn.response :raise_error, error_prefix: service_name\n conn.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "88386d16e1e400c70f41eaff6d579b01",
"score": "0.6404202",
"text": "def connection\n # @connection ||= Faraday.new connection_options do |conn|\n @faraday_connection ||= Faraday.new(:url => @url) do |conn|\n # Follow redirects\n # conn.use FaradayMiddleware::FollowRedirects, limit: 5\n conn.response :logger # log requests to STDOUT\n # Convert request params to \"www-form-encoded\"\n conn.request :url_encoded\n # Parse responses as JSON\n # conn.use FaradayMiddleware::ParseJson, content_type: 'application/json'\n # Use Faraday's default HTTP adapter\n conn.adapter Faraday.default_adapter\n #pass api_key and api_username on every request\n # conn.params['api_key'] = api_key\n # conn.params['api_username'] = api_username\n end\n return @faraday_connection\n end",
"title": ""
},
{
"docid": "5ae3b2f9f964791f3b4e9b2fced80ff8",
"score": "0.63777834",
"text": "def access_token_connection\n Faraday.new(access_token_url) do |conn|\n conn.use :breakers\n conn.response :json, content_type: /\\bjson$/\n conn.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "653676c78fbd87a42e6bcf92452e0f34",
"score": "0.6365981",
"text": "def faraday_connection(url=nil)\n url ||= self.root\n key = \"faraday_connection_#{url}\"\n return Thread.current[key] if Thread.current[key]\n\n fc = Faraday.new(:url => url)\n fc.headers.merge!('User-Agent' => \"HyperResource #{HyperResource::VERSION}\")\n fc.headers.merge!(self.headers || {})\n if ba=self.auth[:basic]\n fc.basic_auth(*ba)\n end\n Thread.current[key] = fc\n end",
"title": ""
},
{
"docid": "ae9a34d7871d02f4227aa69fe7e649a4",
"score": "0.6362299",
"text": "def endpoint_connection\n @endpoint_connection ||= Faraday.new(url: endpoint_url) do |faraday|\n faraday.request :basic_auth, user, password\n faraday.params = datasource_params\n faraday.adapter :net_http\n end\n end",
"title": ""
},
{
"docid": "bc678ac054bdbaced2fbe2af8af6ddc4",
"score": "0.636229",
"text": "def connection\n self.faraday_connection ||= Faraday.new(configuration.faraday_options) do |f|\n if configuration.authenticated?\n f.request :authorization, :basic, configuration.username, configuration.password\n end\n f.request :multipart\n f.request :url_encoded\n unless options[:raw]\n f.response :mashify\n f.response :json\n end\n\n f.response :raise_error\n f.adapter configuration.adapter\n end\n end",
"title": ""
},
{
"docid": "f5863661bedf55e43aed33d6efe5b215",
"score": "0.63540536",
"text": "def access_token_connection\n Faraday.new(access_token_url, headers: headers) do |conn|\n conn.use :breakers\n conn.response :json, content_type: /\\bjson$/\n conn.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "d36f48eca3546f0c460b27383da71efc",
"score": "0.63452184",
"text": "def connection\n @connection ||= Faraday.new(\"#{URL_PREFIX}\", connection_options) do |conn|\n conn.basic_auth(api_key, nil)\n end\n end",
"title": ""
},
{
"docid": "3ecf617683c14f4f2a2851a9a9eea254",
"score": "0.6332057",
"text": "def get(url)\n faraday = Faraday.new(url) do |faraday|\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n\n response = faraday.get do |request|\n request.url(url)\n end\n response.body\nend",
"title": ""
},
{
"docid": "ab1bb9d9bcbf75f70da7694051f0c3d0",
"score": "0.6330903",
"text": "def establish_connection(url, token)\n Faraday.new(url: url) do |faraday|\n faraday.request :json\n faraday.headers[\"Authorization\"] = token\n faraday.headers['Accept'] = 'application/json'\n faraday.response :json\n faraday.response :raise_error\n faraday.options.open_timeout = 2\n faraday.options.timeout = 100\n faraday.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "fec8ce9e781bc49325200f462175325d",
"score": "0.6328389",
"text": "def conn\n Faraday.new(:url => @config.url) do |c|\n c.adapter Faraday.default_adapter\n c.headers['User-Agent'] = @config.usr_agent\n c.params = self.options\n end\n end",
"title": ""
},
{
"docid": "a15a7f831f6d86caff7f7d1c341f0969",
"score": "0.6314508",
"text": "def conn\n @conn ||= Faraday.new(base_url, headers: @headers, ssl: ssl_options, request: timeout) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n faraday.use EVSS::ErrorMiddleware\n faraday.response :betamocks if @use_mock\n faraday.response :snakecase, symbolize: false\n faraday.response :json_parser\n faraday.use :remove_cookies\n faraday.adapter :httpclient\n end\n end",
"title": ""
},
{
"docid": "b6d43182fa47902315c361103c2e44b4",
"score": "0.6312734",
"text": "def json_connection\n @json_connection ||= Faraday.new(@json_endpoint, @connection_options.merge(:builder => @middleware))\n end",
"title": ""
},
{
"docid": "f627d572e988d10557b6ba3cb6890039",
"score": "0.6288298",
"text": "def connection(headers: {}, parse_json: true)\n super do |faraday|\n faraday.adapter(:test, stubs)\n end\n end",
"title": ""
},
{
"docid": "a65a9fe5c452984c14dae7053055ee56",
"score": "0.6286009",
"text": "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "b87c6d32c3011bb70a944a35ab23b384",
"score": "0.62735176",
"text": "def connection\n Faraday.new(url: self.configuration.base_url) do |f|\n f.response :xml, :content_type => /\\bxml$/\n f.adapter :net_http\n f.basic_auth self.configuration.username, self.configuration.password\n end\n end",
"title": ""
},
{
"docid": "91d4689daca0baae88b22cd50425f6c6",
"score": "0.6256628",
"text": "def connection(response_type = :json)\n @connection ||= Faraday.new(url: 'http://api.mendeley.com') do |connection|\n connection.request :url_encoded\n connection.request :oauth, oauth_data\n connection.response :json, content_type: //\n connection.adapter *Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "ac62f5b4987bf7ca6b67bdac1488c18c",
"score": "0.6221434",
"text": "def build_connection\n connection = Faraday.new(url: base_url)\n connection.adapter *connection_adapter\n end",
"title": ""
},
{
"docid": "5aeb4b0f7b42919e3494dc25dca1071b",
"score": "0.6203059",
"text": "def connection\n @connection ||= Faraday.new(@endpoint, @connection_options, &@middleware)\n end",
"title": ""
},
{
"docid": "cb12bb800a72e9c383a0eba09bbb2a77",
"score": "0.6200509",
"text": "def faraday\n mutex.synchronize do\n @faraday ||= create_faraday\n end\n end",
"title": ""
},
{
"docid": "af947d7452cce86d6448ef3f1b443f9a",
"score": "0.6195821",
"text": "def initialize(api_key)\n @api_key = api_key\n @conn = Faraday.new\n end",
"title": ""
},
{
"docid": "465039066d9eb97f8ce2093733fbdd40",
"score": "0.6195607",
"text": "def connection\n params = {}\n params[:oauth_token] = @access_token if @access_token\n @connection ||= Faraday.new(:url => api_url, :params => params, :headers => default_headers) do |builder|\n builder.use Faraday::Request::UrlEncoded\n builder.use Faraday::Response::Mashify\n builder.use Faraday::Response::ParseJson\n builder.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "fd2de839ac082de11c1e765e65e30007",
"score": "0.6194775",
"text": "def initialize(options={})\n @access_token = options[:access_token]\n @connection = Faraday.new(url: Behance::Client::API_URL) do |b|\n b.adapter Faraday.default_adapter\n b.use FaradayMiddleware::ParseJson\n end\n end",
"title": ""
},
{
"docid": "c82855457ec4eea483f27ac0cccaae57",
"score": "0.6187797",
"text": "def connection(options = {})\n default_options = {\n :headers => {\n :accept => 'application/json',\n :user_agent => user_agent,\n :host => EdgeCast::Config::DEFAULT_HOST\n },\n :ssl => { :verify => false },\n :url => endpoint,\n }\n\n @connection ||= Faraday.new(default_options.merge(connection_options)) do |builder|\n builder.request :auth, api_token\n builder.request :json\n builder.request :multipart\n builder.request :url_encoded\n\n builder.response :client_error\n builder.response :json\n builder.response :server_error\n\n builder.adapter(adapter)\n end\n end",
"title": ""
},
{
"docid": "98ed44da5fa6bf8aa43ca5947970781c",
"score": "0.6182078",
"text": "def connection\n @connection ||= faraday(config, logger)\n end",
"title": ""
},
{
"docid": "0e249684b709a5c6e562abad78b8c8b3",
"score": "0.61775756",
"text": "def connection\n @connection ||= begin\n conn = Faraday.new(url: url)\n conn.build do |b|\n conn_build.call(b)\n end if conn_build\n conn\n end\n end",
"title": ""
},
{
"docid": "ac94c5387607967974503594a7de83fa",
"score": "0.61574197",
"text": "def endpoint_connection\n @endpoint_connection ||= Faraday.new(url: endpoint_url) do |faraday|\n faraday.params = datasource_params\n faraday.adapter :net_http\n end\n end",
"title": ""
},
{
"docid": "ac94c5387607967974503594a7de83fa",
"score": "0.61574197",
"text": "def endpoint_connection\n @endpoint_connection ||= Faraday.new(url: endpoint_url) do |faraday|\n faraday.params = datasource_params\n faraday.adapter :net_http\n end\n end",
"title": ""
},
{
"docid": "e425f5d4e644de611bce1fd1651ee149",
"score": "0.6132376",
"text": "def connection\n Faraday.new(base_path, headers: base_request_headers, request: request_options, ssl: ssl_options) do |conn|\n conn.use :breakers\n conn.request :soap_headers\n\n conn.response :soap_parser\n conn.response :betamocks if Settings.emis.mock\n conn.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "12c35ebb352cc0032c6519df8dec0c46",
"score": "0.6126188",
"text": "def initialize(options = {})\n options = DEFAULT_ARGS.merge(options)\n\n @client = Faraday.new(\n faraday_options(options),\n ) do |conn|\n conn.response(:json)\n conn.adapter(Faraday.default_adapter)\n end\n end",
"title": ""
},
{
"docid": "d20b69e694d97df2021a340d405e2035",
"score": "0.6113533",
"text": "def connection(base: base_url, version: api_version, key: api_key)\n @connection ||= begin\n Faraday.new(url: [base, version].join('/')) do |faraday|\n faraday.response :logger do | logger |\n logger.filter(/(Bearer\\ )(\\w+)/,'\\1[REMOVED]')\n end\n faraday.options[:open_timeout] = 3\n faraday.options[:timeout] = 6\n faraday.request :url_encoded\n faraday.adapter Faraday.default_adapter\n faraday.headers['Content-Type'] = 'application/json'\n faraday.headers['Authorization'] = ['Bearer', key].join(' ')\n end\n end\n end",
"title": ""
},
{
"docid": "8011726943550265a93d6937cffe70ee",
"score": "0.60912436",
"text": "def shopify_connection\n Faraday.new(url: SHOPIFY_BASE_URL, ssl: { verify: false }) do |faraday|\n faraday.request :url_encoded # form-encode POST params\n faraday.adapter Faraday.default_adapter # make requests with Net::https\n end\nend",
"title": ""
},
{
"docid": "8011726943550265a93d6937cffe70ee",
"score": "0.60912436",
"text": "def shopify_connection\n Faraday.new(url: SHOPIFY_BASE_URL, ssl: { verify: false }) do |faraday|\n faraday.request :url_encoded # form-encode POST params\n faraday.adapter Faraday.default_adapter # make requests with Net::https\n end\nend",
"title": ""
},
{
"docid": "3ecce45a4bfef6d12f97f5a80e62fec5",
"score": "0.6090855",
"text": "def connection(uri:, params:)\n Faraday.new(\n url: \"#{@endpoint}/#{@api_version}/#{uri}\",\n params: params,\n headers: {\n 'User-Agent' => \"RubyGem-zombie_battleground-api_#{VERSION}\",\n 'Content-Type' => 'application/json'\n }\n )\n end",
"title": ""
},
{
"docid": "9f000414ecc7a55d677c0fc7188c223b",
"score": "0.60803616",
"text": "def faraday_adapter\n Faraday.default_adapter\n end",
"title": ""
},
{
"docid": "19b2a71924fcc00740e728012ab25d3a",
"score": "0.6079001",
"text": "def connection(options={})\r\n Faraday.new(:url => 'http://www.femexfut.org.mx/portalv2/webservices/ws_portal_v2.aspx/', :proxy=>\"\") do |builder|\r\n builder.use Faraday::Response::Mashify\r\n builder.use Faraday::Response::ParseXml\r\n builder.use Faraday::Response::Logger \r\n builder.adapter Faraday.default_adapter\r\n end\r\n end",
"title": ""
},
{
"docid": "821ab98ba3edbb3df78ff9101ae09d63",
"score": "0.6054537",
"text": "def connection\n @connection ||= Faraday.new(request: { timeout: ForecastIO.timeout })\n end",
"title": ""
},
{
"docid": "bc9a7a8951230f4a75c46f6ec97fecbf",
"score": "0.60218245",
"text": "def connection\n params = {}\n @connection ||= Faraday::Connection.new(:url => api_url, :ssl => ssl, :params => params, :headers => default_headers) do |builder|\n @connection_middleware.each do |middleware|\n builder.use *middleware\n end\n builder.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "4bfacea4bfd4e3809f5bee2a76eb2125",
"score": "0.60178137",
"text": "def connection(address)\n service_connection = Faraday.new(:url => \"#{address}\") do |faraday|\n faraday.request :url_encoded # form-encode POST params\n #faraday.response :logger # log requests to STDOUT\n faraday.adapter Faraday.default_adapter # make requests with Net::HTTP\n end\n return service_connection\nend",
"title": ""
},
{
"docid": "996c0b48cfdd58fd9c625c66775753ec",
"score": "0.6016027",
"text": "def get_conn url\n return Faraday.new(:url => url, :ssl => @@ssl) do |faraday|\n faraday.adapter Faraday.default_adapter\n faraday.response :logger\n end\n end",
"title": ""
},
{
"docid": "71ab53a4884b7af53ef9271d634e210c",
"score": "0.6013851",
"text": "def connection\n return unless @url\n\n @connection ||= Faraday::Connection.new(@url) do |b|\n b.request :url_encoded\n b.adapter :net_http\n end\n\n @connection.basic_auth(*@basic_auth) if @basic_auth\n @connection\n end",
"title": ""
},
{
"docid": "382a94c56d242f80d630b177b2e91300",
"score": "0.60076386",
"text": "def connection\n return unless @url\n\n @connection ||= Faraday::Connection.new(@url) do |b|\n middleware.each { |m, opts| b.use(m, opts) }\n b.request :url_encoded\n b.adapter :net_http\n end\n \n @connection.basic_auth(*@basic_auth) if @basic_auth\n @connection.token_auth(*@token_auth) if @token_auth\n @connection.authorization(*@authorization) if @authorization\n @connection\n end",
"title": ""
},
{
"docid": "8a6e3f264d28926b702152ba8e7dd10f",
"score": "0.60003185",
"text": "def conn\n @conn ||= Faraday.new(:url => uri.to_s) do |builder|\n builder.adapter self.class.adapter\n end\n end",
"title": ""
},
{
"docid": "9c343a5cbc00806584eac60fc9b001f0",
"score": "0.5993628",
"text": "def setup_http_connection(host, opt)\n conn = Faraday.new(url: host) do |client|\n client.request :url_encoded\n client.request :oauth, opt\n client.adapter Faraday.default_adapter\n end\n conn\n end",
"title": ""
},
{
"docid": "12fa5999d5e9fe544f0920cd3a1900e2",
"score": "0.5989499",
"text": "def connection\n @connection ||= Faraday.new(url: PriceHubble.configuration.base_url,\n &method(:configure))\n end",
"title": ""
},
{
"docid": "116b6c8121a8eb3cf1ae5bdbdf1c5ad5",
"score": "0.597033",
"text": "def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end",
"title": ""
},
{
"docid": "116b6c8121a8eb3cf1ae5bdbdf1c5ad5",
"score": "0.597033",
"text": "def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end",
"title": ""
},
{
"docid": "116b6c8121a8eb3cf1ae5bdbdf1c5ad5",
"score": "0.597033",
"text": "def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end",
"title": ""
},
{
"docid": "116b6c8121a8eb3cf1ae5bdbdf1c5ad5",
"score": "0.597033",
"text": "def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end",
"title": ""
},
{
"docid": "59117fb073f89a7f6f0c3b63119fe9c7",
"score": "0.5964371",
"text": "def client(token: nil)\n client = Faraday.new(url: ENV['AIRCALL_PUBLIC_API_HOST']) do |faraday|\n faraday.authorization :Bearer, token if token\n faraday.adapter Faraday.default_adapter\n faraday.headers['Content-Type'] = 'application/json'\n end\n\n client\n end",
"title": ""
},
{
"docid": "5d52459ada58b41e5095d9271aa1cbe9",
"score": "0.59612876",
"text": "def create_connection(accept_type='application/json')\n @connection = Faraday.new(:url => @base_url, :ssl => { :verify => @ssl_verify }) do |faraday|\n faraday.headers['Accept'] = accept_type\n faraday.request :att_multipart\n faraday.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "86933f48c5f4b827d913b405600d2eee",
"score": "0.5956414",
"text": "def connection\n options = {\n :headers => {'Accept' => \"application/#{SponsorPay.format}; charset=utf-8\", \n 'User-Agent' => SponsorPay.user_agent, \n 'Connection' => 'Keep-Alive'}, \n #'Accept-Encoding' => 'gzip ...' # => automatically added by net::http\n :ssl => {:verify => false},\n :url => SponsorPay.endpoint,\n }\n Faraday::Connection.new(options) do |connection|\n connection.use FaradayMiddleware::Mashify\n connection.use Faraday::Response::ParseJson if SponsorPay.format.to_s.downcase == 'json'\n connection.adapter SponsorPay.adapter\n end\n end",
"title": ""
},
{
"docid": "c55cafe22fbbfd9d99f7ce58a821f128",
"score": "0.5942182",
"text": "def connection\n @connection = begin\n connection_options = {:builder => @middleware}\n connection_options[:ssl] = {:verify => true} if @endpoint[0..4] == 'https'\n connection_options[:proxy] = @proxy if @proxy\n Faraday.new(@endpoint, @connection_options.merge(connection_options))\n end\n end",
"title": ""
},
{
"docid": "12c0d90c3d88b1e6a0ee62effd09a1b0",
"score": "0.59405935",
"text": "def base_resource\n conn = Faraday.new(:url => client.node) do |builder|\n builder.use Faraday::Response::Logger, client.logger\n builder.use GetHackMiddleware\n\n builder.adapter :net_http_persistent\n end\n\n conn.basic_auth(*client.auth) if client.auth?\n conn\n end",
"title": ""
},
{
"docid": "a3dbd9a4aea92098cf59ff4218c7b63a",
"score": "0.5936174",
"text": "def connection\n @connection ||= Faraday.new do |conn|\n conn.use Signature::Authentication, endpoint.secret\n\n yield conn if block_given?\n\n unless conn.builder.handlers.any? { |h| h.name.include? ':Adapter:' }\n conn.adapter Faraday.default_adapter\n end\n end\n end",
"title": ""
},
{
"docid": "0f76a3bdf615413bc26853d686b24535",
"score": "0.5916783",
"text": "def build_connection\n Faraday.new(url) do |f|\n f.request :retry, max: 2, interval: 0.1, backoff_factor: 2\n\n f.headers['Content-Type'] = content_type\n f.headers['User-Agent'] = user_agent\n\n f.options.timeout = timeout\n f.options.open_timeout = open_timeout\n\n f.adapter :typhoeus\n end\n end",
"title": ""
},
{
"docid": "de0f95573eb2290f4fbf725a6c144f01",
"score": "0.59127605",
"text": "def connection\n @connection ||= Faraday.new(@server_uri, :ssl => {:verify => false}) do |builder|\n builder.request :url_encoded # Encode request parameters as \"www-form-urlencoded\"\n builder.response :logger # Log request and response to STDOUT\n builder.adapter :net_http # Perform requests with Net::HTTP\n end\n end",
"title": ""
},
{
"docid": "5bca5e8b951e075dabffa54cc2e3fc7b",
"score": "0.5910625",
"text": "def gamebus_connection\n connection = Faraday.new url: Rails.application.secrets.gamebus_url do |faraday|\n faraday.request :url_encoded # form-encode POST params\n faraday.response :logger if Rails.env.development? || ENV['DEBUG_FARADAY'] # log requests to STDOUT\n faraday.adapter Faraday.default_adapter # make requests with Net::HTTP\n end\n connection.headers['Authorization'] = \"Bearer #{gamebus_key}\"\n connection.headers['Content-Type'] = 'application/json'\n return connection\n end",
"title": ""
},
{
"docid": "065b51450642795c7b6156a937eb7c95",
"score": "0.5884054",
"text": "def initialize\n @use_ssl = false\n @http_adapter = Yummly::FaradayAdapter\n end",
"title": ""
},
{
"docid": "c14602dcd69b2e9f6847e97d723e57ed",
"score": "0.58784217",
"text": "def initialize(access_token:, url:)\n @connection =\n Faraday.new(\n \"#{url}/v1/#{path}/\",\n headers: { 'Authorization' => \"Bearer #{access_token}\" }\n ) do |conn|\n conn.request :multipart\n conn.request :url_encoded\n\n conn.use RaiseError\n conn.use Faraday::Adapter::NetHttp\n end\n end",
"title": ""
},
{
"docid": "52e1fb2a58217684af99e58dafb49373",
"score": "0.58739245",
"text": "def scsb_conn\n Faraday.new(url: SCSB_URL) do |faraday|\n faraday.request :url_encoded\n faraday.response :logger\n faraday.adapter Faraday.default_adapter\n end\nend",
"title": ""
},
{
"docid": "aca3461dc9662b86bd5133ab296c8753",
"score": "0.586794",
"text": "def faraday(options = {})\n @faraday ||= Faraday.new(DEFAULT_FARADAY_OPTIONS.merge(options)) do |builder|\n\n builder.request :basic_auth, login, password\n builder.request :json\n builder.request :xml_serialize\n\n builder.response :json, :content_type => /\\bjson$/\n builder.response :xml, :content_type => /\\bxml$/\n\n # builder.response :body_logger # log requests to STDOUT\n yield builder if block_given?\n # add default Faraday.default_adapter if none present\n adapter_handler = builder.builder.handlers.find {|h| h.klass < Faraday::Adapter }\n builder.adapter Faraday.default_adapter if adapter_handler.nil?\n end\n end",
"title": ""
},
{
"docid": "c9e405b220080957c18e5a3c9a804a6d",
"score": "0.5846751",
"text": "def connection(force_ssl = false)\n opts = {\n :headers => headers\n }\n domain = @endpoint \n if(force_ssl || self.ssl)\n opts[:ssl] = {:verify => false }\n opts[:url] = @endpoint.sub /^http:/, \"https:\"\n else \n opts[:url] = @endpoint.sub /^https:/, \"http:\"\n end\n conn = Faraday::Connection.new(opts) do |builder|\n builder.adapter Faraday.default_adapter\n builder.use Faraday::Response::ParseJson\n builder.use FlexmlsApi::FaradayExt::FlexmlsMiddleware\n end\n FlexmlsApi.logger.debug(\"Connection: #{conn.inspect}\")\n conn\n end",
"title": ""
},
{
"docid": "72def71efbb5063c7eaf7c72bb7dae55",
"score": "0.5834165",
"text": "def connection\n @connection ||= Faraday.new(base_url) do |builder|\n build_middleware(builder)\n builder.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "de6e47f8b2d192bcbe19d9d163e63f1e",
"score": "0.58308625",
"text": "def connection\n @connection ||= Faraday.new(url: Leo.route_base) do |faraday|\n faraday.options.timeout = Leo.read_timeout\n faraday.options.open_timeout = Leo.open_timeout\n faraday.use Faraday::Response::RaiseError\n faraday.request :url_encoded\n faraday.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "2e4d67a76ae4c0bf0c586ad0dce5d1b5",
"score": "0.5826616",
"text": "def initialize(version: 'v4')\n @version = version\n @connection = Faraday.new(url: SERVICE_ADDRESS) do |conn|\n conn.response :json\n conn.adapter Faraday.default_adapter\n end\n end",
"title": ""
},
{
"docid": "91afd92655b6693101b5ab91f4456a02",
"score": "0.58070284",
"text": "def connection\n return @connection if defined? @connection\n\n options = {\n request: {\n timeout: Nominatim.config.timeout\n }\n }\n\n @connection = Faraday.new Nominatim.config.endpoint, options do |builder|\n builder.use Nominatim::Response::ParseJson\n builder.adapter Faraday.default_adapter\n end\n\n @connection.params[:format] = 'json'\n @connection.params[:email] = Nominatim.config.email if Nominatim.config.email\n @connection.params[:key] = Nominatim.config.key if Nominatim.config.key\n\n @connection.headers[:user_agent] = Nominatim.config.user_agent\n @connection.headers[:\"accept-language\"] = Nominatim.config.accept_language\n\n @connection\n end",
"title": ""
}
] |
abdb96e6f47995cf6ce5f2da77d6c933 | Generate a matcher that expects to equal the given +html+. | [
{
"docid": "12cf5d0b140b8280903d1c8038965967",
"score": "0.6731209",
"text": "def be_transformed_into( html )\n return TartanCloth::Matchers::TransformMatcher.new( html )\n end",
"title": ""
}
] | [
{
"docid": "b20ca44ec7c6aa66833cdb49caa75bdd",
"score": "0.69031197",
"text": "def be_the_same_html_as(expected)\n BeTheSameHtmlAs.new(expected)\n end",
"title": ""
},
{
"docid": "47f0c921e5418863aebd22f02e87676c",
"score": "0.6573339",
"text": "def test_html\n assert_instance_of(HTML, Parsing::LineMatcher.match('<a>', ''))\n assert_instance_of(HTML, Parsing::LineMatcher.match('<a href=\"bla\">', ''))\n assert_instance_of(HTML, Parsing::LineMatcher.match('<br>', ''))\n assert_instance_of(HTML, Parsing::LineMatcher.match('<br/>', ''))\n end",
"title": ""
},
{
"docid": "9799f8c9ce1906cea30e16d893492a69",
"score": "0.61260533",
"text": "def validateHtml(editor, expectedValue)\t\n\t\tgetHtml(editor)\n\t\t@html.should == expectedValue\n\tend",
"title": ""
},
{
"docid": "178e2bfa9bfa9e89b1af8b4d14e3ab7d",
"score": "0.6069554",
"text": "def tc(html, creole, options = {})\n generated_html = Creole.creolize(creole, options)\n # puts \"creole = #{creole.inspect}\"\n # puts \"generated_html = #{generated_html.inspect}\"\n generated_html.must_equal html\nend",
"title": ""
},
{
"docid": "34476018b4372ffd99d8a055de5f2faa",
"score": "0.5996026",
"text": "def assert_html_equal(expected_html_string, actual_html_string)\n # Nokogiri does not preserve the same whitespace between tags when\n # it processes HTML. This means we can't do a simple string comparison.\n # However, if we run both the expected HTML string and the actual HTML\n # string through Nokogiri, then the whitespace will be changed in\n # the same way and we can do a simple string comparison.\n expected = Nokogiri::HTML(expected_html_string).to_html\n actual = Nokogiri::HTML(actual_html_string).to_html\n preamble = \"\\n\"\n preamble = \"*****************************************************\\n\"\n preamble << \"* The actual HTML does not match the expected HTML. *\\n\"\n preamble << \"* The differences are highlighted below. *\\n\"\n preamble << \"*****************************************************\\n\"\n message = preamble.magenta\n message << Diffy::Diff.new(expected, actual).to_s(:color)\n assert_block(message) { expected == actual }\n end",
"title": ""
},
{
"docid": "80568abdfba174c42e1b91077fbca3da",
"score": "0.5911669",
"text": "def document_check(html, html_validity=ENV[\"HTML_VALIDITY\"])\n if html_validity == \"true\" || html_validity == true\n html.should be_xhtml_transitional\n end\n well_formed(html).should == \"ok\"\nend",
"title": ""
},
{
"docid": "d480e4dab13ef18f8eff8990860f45ba",
"score": "0.58224946",
"text": "def matches?( tartancloth )\n @tartancloth = tartancloth\n @output_html = tartancloth.body_html.gsub( /\\n\\n\\n/, \"\\n\\n\" )\n return @output_html.strip == @html.strip\n end",
"title": ""
},
{
"docid": "1ab444f8f3ca67e6d760729a27932925",
"score": "0.57445633",
"text": "def html_tag_matcher( tag)\n /<#{tag}([\\s]+([-[:word:]]+)[\\s]*\\=\\s*\\\"([^\\\"]*)\\\")*\\s*>.*<\\s*\\/#{tag}\\s*>/\nend",
"title": ""
},
{
"docid": "c33fd10dc72bc803c64e8fe5cba48a14",
"score": "0.5705506",
"text": "def validate_as_body(html)\n validate_html('<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">' +\n \"<html><head><title>Test</title></head><body>#{html}</body></html>\")\nend",
"title": ""
},
{
"docid": "439f7a2350c85c3275818076ef1f743d",
"score": "0.56891704",
"text": "def html_tag_matcher( tag)\n /<#{tag}([\\s]+[-[:word:]]+[\\s]*\\=\\s*\\\"[^\\\"]*\\\")*\\s*>.*<\\s*\\/#{tag}\\s*>/\nend",
"title": ""
},
{
"docid": "e51703d07a3c7e72b2f39e2dfe225de6",
"score": "0.5638017",
"text": "def set_html(html_string)\n end",
"title": ""
},
{
"docid": "73774c5f55134f738c6d0a96f6015c7a",
"score": "0.56212336",
"text": "def test_descriptions_are_not_html\n refute_match Regexp.new(\"\\<b\\>this\\<\\/b\\>\"), @text,\n \"We had some HTML; icky!\"\n end",
"title": ""
},
{
"docid": "a605f98e9128887adf40c4b304cf5513",
"score": "0.55077535",
"text": "def contains_html?(html)\n return @browser.fetch(\"_sahi._containsHTML(#{self.to_s()}, #{Utils.quoted(html)})\")\n end",
"title": ""
},
{
"docid": "a605f98e9128887adf40c4b304cf5513",
"score": "0.55077535",
"text": "def contains_html?(html)\n return @browser.fetch(\"_sahi._containsHTML(#{self.to_s()}, #{Utils.quoted(html)})\")\n end",
"title": ""
},
{
"docid": "f6e8f2053c8f26705da14264a46258b1",
"score": "0.5479893",
"text": "def contents_match?(input_html_file, html_imported_at_file)\n\n # Since the kramdown parser is specified as module in Rtfile,\n # I can't use the standard kramdown API:\n # `doc = Kramdown::Document.new(contents, :input => 'kramdown_repositext')`\n # We have to patch a base Kramdown::Document with the root to be able\n # to convert it.\n root, _warnings = @options['kramdown_parser_class'].parse(html_imported_at_file.contents)\n doc = Kramdown::Document.new('')\n doc.root = root\n\n input_html = input_html_file.contents.gsub(' ', ' ') # remove all non-breaking spaces\n input_html.gsub!('H<span class=\"smallcaps\">EERE</span>', 'Heere')\n input_html.gsub!('H<span class=\"smallcaps\">EEREN</span>', 'Heeren')\n input_html.gsub!('H<span class=\"smallcaps\">ERE</span>', 'Here')\n input_html.gsub!('H<span class=\"smallcaps\">EREN</span>', 'Heren')\n input_html.gsub!(' ', ' ') # replace non-breaking spaces with regular spaces\n input_html.gsub!('­', '') # remove discretionary hyphens\n\n\n html_doc = Nokogiri::HTML(input_html) { |cfg| cfg.noent }\n input_html_based_plain_text = html_doc.at_css('body').text\n input_html_based_plain_text.gsub!(/\\r/, \"\\n\") # normalize linebreaks\n input_html_based_plain_text.gsub!(/((?:^|\\s)\\d+[a-z]?)\\.(?!\\.)/, '\\1') # remove periods from question numbers (and any number followed by period)\n input_html_based_plain_text.gsub!('*******', '') # remove simulated hr\n input_html_based_plain_text.gsub!(/\\s/, ' ') # replace all whitespace with space\n input_html_based_plain_text.gsub!(/\\s+/, ' ') # collapse runs of spaces\n input_html_based_plain_text.gsub!(/\\s+\\]/, ']') # remove space before closing brackets\n input_html_based_plain_text.gsub!('%', ' procent') # spell out percent instead of using '%' to avoid conflict with gap_marks\n input_html_based_plain_text.gsub!('‑', '')\n input_html_based_plain_text.gsub!('…', '...') # unfix elipses\n input_html_based_plain_text.strip!\n\n at_based_plain_text = doc.send(@options['plain_text_converter_method_name'])\n at_based_plain_text.gsub!(/((?:^|\\s)\\d+[a-z]?)\\.(?!\\.)/, '\\1') # remove periods from question numbers (and any number followed by period)\n at_based_plain_text.gsub!(/\\s/, ' ') # replace all whitespace with space\n at_based_plain_text.gsub!(/\\s+/, ' ') # collapse runs of spaces\n at_based_plain_text.gsub!('…', '...') # unfix elipses\n at_based_plain_text.gsub!(/[“”]/, '\"') # unfix typographic double quotes\n at_based_plain_text.gsub!(/[’‘]/, \"'\") # unfix single typographic quotes\n at_based_plain_text.strip!\n\n error_message = \"Text mismatch between HTML source and AT from input_html in #{ input_html_file.filename }.\"\n diffs = Suspension::StringComparer.compare(input_html_based_plain_text, at_based_plain_text)\n non_whitespace_diffs = diffs.find_all { |e| ' ' != e[1] }\n\n if non_whitespace_diffs.empty?\n Outcome.new(true, nil)\n else\n # We want to terminate an import if the text is not consistent.\n # Normally we'd return a negative outcome (see below), but in this\n # case we raise an exception.\n # Outcome.new(\n # false, nil, [],\n # [\n # Reportable.error(\n # [@file_to_validate.last.filename], # subtitle/subtitle_tagging_import file\n # [\n # 'Text mismatch between subtitle/subtitle_tagging_import and input_html:',\n # non_whitespace_diffs.inspect\n # ]\n # )\n # ]\n # )\n raise TextMismatchError.new(\n [\n error_message,\n \"Cannot proceed with import. Please resolve text differences first:\",\n non_whitespace_diffs.inspect\n ].join(\"\\n\")\n )\n end\n end",
"title": ""
},
{
"docid": "085204b8ac9064d8fb9de431876ed3dd",
"score": "0.54586",
"text": "def detect_html(str); end",
"title": ""
},
{
"docid": "085204b8ac9064d8fb9de431876ed3dd",
"score": "0.54586",
"text": "def detect_html(str); end",
"title": ""
},
{
"docid": "1ed05611270be3ee7db4aaf896a7f3ea",
"score": "0.5421677",
"text": "def test_form_html \r\n assert_equal(\"\\n<BR><INPUT value=\\\"Submit\\\" type=\\\"submit\\\">\\n\".downcase(), \r\n $ff.form(:name, 'test2').html.downcase())\r\n end",
"title": ""
},
{
"docid": "9a1f832f43a0ddfa503c6666026db3b9",
"score": "0.54134095",
"text": "def html=(html)\n @html = html\n end",
"title": ""
},
{
"docid": "8faa3da0595d0b35109883124d358112",
"score": "0.54102993",
"text": "def validate_html_body_tags!\n return unless %w[html body].include?(tag) && options.empty?\n\n raise ArgumentError, 'matching <html> and <body> tags without specifying additional options does not work, see: https://github.com/kucaahbe/rspec-html-matchers/pull/75'\n end",
"title": ""
},
{
"docid": "fa8a41d785ea8599d31fca46a2e537c3",
"score": "0.54000956",
"text": "def test_html\n assert(line('<br>').html?)\n assert(line('<br><b>').html?)\n\n assert(!line(' <br>').html?)\n assert(!line(' <br><b>').html?)\n end",
"title": ""
},
{
"docid": "8abfc07f64ca99d19859c709787a9fa1",
"score": "0.5389361",
"text": "def test_input_is_html_escaped\n html_query = '<font color=\"red\">test</font>'\n get :search, :q => html_query\n assert_select 'h3', \"0 Search Results found for #{CGI.escapeHTML(\"\\\"\" + html_query + \"\\\"\")}\"\n end",
"title": ""
},
{
"docid": "db33e4a3dfd181d6095aee21f95fa30f",
"score": "0.5388278",
"text": "def assert_link_in_html(label, url, _msg = nil)\n unless url.is_a?(String)\n revised_opts = raise_params(url)\n url = url_for(revised_opts)\n end\n assert_select(\"a[href='#{url}']\", text: label)\n end",
"title": ""
},
{
"docid": "92b235dc54a62b325a8a8c171ff8894b",
"score": "0.53780967",
"text": "def test_curly_in_attribute_value\n source = %q{\np id=\"{{hello world}}\"= hello_world\n}\n\n assert_html '<p id=\"{{hello world}}\">Hello World from @env</p>', source\n end",
"title": ""
},
{
"docid": "3c125150594cb9c2ed75f89f1b490989",
"score": "0.53749025",
"text": "def test_erb_with_double_equals\n assert_equal(<<HAML.rstrip, render_erb(<<ERB))\n!= link_to \"https://github.com/haml/html2haml/issues/44\"\nHAML\n<%== link_to \"https://github.com/haml/html2haml/issues/44\" %>\nERB\n end",
"title": ""
},
{
"docid": "494ff98d2e8489cd67bf44adf7db0df0",
"score": "0.5367743",
"text": "def regexp(regexp)\n html.match(regexp)\n end",
"title": ""
},
{
"docid": "ca8b686d1ff6ec577a014ea0595faf81",
"score": "0.5362689",
"text": "def to_html; @match ? \"<span class='match'>#{@text}</span>\" : @text; end",
"title": ""
},
{
"docid": "8f0e73d665664e0f2dd2ded747a77d8d",
"score": "0.5340908",
"text": "def HTML(html) # rubocop:disable Naming/MethodName\n # Nokogiri >= 1.12.0 or Nokogumbo installed and allowed for use\n html_parser, using_html5 = if defined?(Nokogiri::HTML5) && Capybara.use_html5_parsing\n [Nokogiri::HTML5, true]\n else\n [defined?(Nokogiri::HTML4) ? Nokogiri::HTML4 : Nokogiri::HTML, false]\n end\n\n html_parser.parse(html).tap do |document|\n document.xpath('//template').each do |template|\n # template elements content is not part of the document\n template.inner_html = ''\n end\n document.xpath('//textarea').each do |textarea|\n # The Nokogiri HTML5 parser already returns spec compliant contents\n textarea['_capybara_raw_value'] = using_html5 ? textarea.content : textarea.content.delete_prefix(\"\\n\")\n end\n end\n end",
"title": ""
},
{
"docid": "a95a0adc748f7dc3c71cb14dc8701d54",
"score": "0.531297",
"text": "def test_normal_text_not_transformed\n expected = \"Some random text\\nHello Friends\"\n result = auto_html(expected) { instagram }\n assert_equal(expected, result)\n end",
"title": ""
},
{
"docid": "9e8bf186b9c0df79703bf8519417c1d5",
"score": "0.5285921",
"text": "def is_valid_html(html)\n if html.include? \"</html>\"\n return !is_valid_json(html) && !is_valid_xml(html)\n else\n return false \n end\n end",
"title": ""
},
{
"docid": "74dc006d6eff10b3b96ed174f3ac321b",
"score": "0.52755964",
"text": "def assert_html_valid\n #begin\n assert_valid_markup\n #rescue\n # print \"\\nVALIDATION FAILED:\\n\"\n # print \"HEADERS:\\n\"\n # @response.headers.each { |header,value|\n # print \"\\t#{header}: #{value}\\n\"\n # }\n # print \"BODY:\\n\"\n # print @response.body\n # print \"\\n\"\n # raise # re-raise after showing the failing body.\n #end\n end",
"title": ""
},
{
"docid": "9e3d89c67b2f0ba514c8f56613e3f5b0",
"score": "0.52014136",
"text": "def parse_html(html); end",
"title": ""
},
{
"docid": "20e59c1388fcb209107345a0f974ee5d",
"score": "0.5199816",
"text": "def instance_test_html\n @instance_test_html ||= SiteHtml::TestSuite::HTML::new(nokogiri_html)\n end",
"title": ""
},
{
"docid": "7b86da622e72848ac8daaa4ecb8f4413",
"score": "0.51846325",
"text": "def escape_once( html )\n html.to_s.gsub(/[\\\"><]|&(?!([a-zA-Z]+|(#\\d+));)/) { |special| ERB::Util::HTML_ESCAPE[special] }\n end",
"title": ""
},
{
"docid": "5cb8f5443fd3d1a6b4b8a4c05cfc4f15",
"score": "0.5152094",
"text": "def test_assert_xhtml\r\n \r\n assert_xhtml '<html><body><div id=\"forty_two\">42</div></body></html>'\r\n \r\n assert{ xpath('//div[ @id = \"forty_two\" ]').text == '42' }\r\n end",
"title": ""
},
{
"docid": "27cf0896476764c9335e8d60008bf3a2",
"score": "0.5141123",
"text": "def assert_html_result(status, **opt)\n opt[:format] = :html unless opt.key?(:format)\n assert_result(status, **opt)\n end",
"title": ""
},
{
"docid": "85bf37ec6767eb87d735fcd19b9ae0c3",
"score": "0.51397526",
"text": "def markdown_blocks(text_attribute, html_attribute)\n it 'should cache the attributes after save' do\n @elem.send(\"#{text_attribute}=\", \"## headline\")\n @elem.save\n @elem.send(html_attribute).should match(/h2/)\n end\n\n it 'should update the attribute after update-attributes' do\n @elem.send(\"#{text_attribute}=\", \"## headline\")\n @elem.save\n @elem.update_attributes(text_attribute => \"### headline\")\n @elem.send(html_attribute).should match(/h3/)\n end\n end",
"title": ""
},
{
"docid": "fbf9d424c7ef5efa3fb617327f43c75c",
"score": "0.51379365",
"text": "def validation(html, resource_name)\n resource_data_path = File.join(@data_folder, filenameize(resource_name))\n HTMLValidationResult.new(resource_name, html, resource_data_path, @tidy_flags, @options)\n end",
"title": ""
},
{
"docid": "4fb4ef9050a93bb8aa9dccc2e1a16ac0",
"score": "0.5126114",
"text": "def test_curly_in_attribute_value_with_interpolation\n source = %q{\np id=\"{{hello #{ \"world\" }}}\" = hello_world\n}\n\n assert_html '<p id=\"{{hello world}}\">Hello World from @env</p>', source\n end",
"title": ""
},
{
"docid": "d1dac669146da34879147decaeae64c3",
"score": "0.5100561",
"text": "def test_should_have_two_tr_tags_in_the_thead\n # TODO Use a validating service to make sure the rendered HTML is valid\n html = calendar_with_defaults\n assert_match %r{<thead><tr>.*</tr><tr.*</tr></thead>}, html\n end",
"title": ""
},
{
"docid": "7b11f9eddee3fee04211cdeb5d7c7d3a",
"score": "0.508764",
"text": "def escape_html(html); end",
"title": ""
},
{
"docid": "7b11f9eddee3fee04211cdeb5d7c7d3a",
"score": "0.508764",
"text": "def escape_html(html); end",
"title": ""
},
{
"docid": "26d8a8911b234da14623fe9dd28aec8b",
"score": "0.5085866",
"text": "def acceptable_html_string(text)\n return true unless text.include?('<') # Can't be a problem, no '<'\n\n # First, detect common mistakes.\n # Require HTML tags to start in a lowercase Latin letter.\n # This is in part a regression test; it prevents </a> where \"a\"\n # is the Cyrillic letter instead of the Latin letter.\n # HTML doesn't care about upper vs. lower case,\n # but it's better to be consistent, and there's a minor\n # compression advantage as described here:\n # http://www.websiteoptimization.com/speed/tweak/lowercase/\n return false if %r{<[^a-z\\/]}.match?(text) || %r{<\\/[^a-z]}.match?(text)\n return false if text.include?('href = ') || text.include?('class = ')\n return false if text.include?('target = ')\n return false if /(href|class|target)=[^\"']/.match?(text)\n return false if /(href|class|target)=[\"'] /.match?(text)\n # target= must have rel=\"noopener\"; just target= isn't enough.\n return false if text.include?('target=\"_blank\">')\n\n # Now ensure that the HTML only has the tags and attributes we permit.\n # The translators are considered trusted, but nevertheless this\n # limits problems if their accounts are subverted.\n # Translation text is okay iff the results of \"sanitizing\" it are\n # same as when we simply \"regularize\" the text without sanitizing it.\n sanitized = sanitize_html(text)\n regularized = regularize_html(text)\n if sanitized != regularized\n puts 'Error, HTML has something not permitted. Regularized:'\n puts regularized\n puts 'Sanitized:'\n puts sanitized\n end\n sanitized == regularized\n end",
"title": ""
},
{
"docid": "c3021da986a472beff4461ca600d7415",
"score": "0.5080964",
"text": "def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template_test_result.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_template.at_css('#env').content += env\n email_template.at_css(\"#circleci\")['href'] = view_build_link\n email_template.at_css(\"#allure\")['href'] = view_allure_link\n email_template.to_html\nend",
"title": ""
},
{
"docid": "987c1e87a73fbc3ed0b0bf7a0eed7f33",
"score": "0.5079801",
"text": "def test_escape_html\n assert_equal \"<b>bold!</b>\", EasyFormat.escape_html(\"<b>bold!</b>\")\n end",
"title": ""
},
{
"docid": "987c1e87a73fbc3ed0b0bf7a0eed7f33",
"score": "0.5079801",
"text": "def test_escape_html\n assert_equal \"<b>bold!</b>\", EasyFormat.escape_html(\"<b>bold!</b>\")\n end",
"title": ""
},
{
"docid": "fef1d9e1ec72f7b1daf0a23561d83ad8",
"score": "0.5077487",
"text": "def matcherize(expected)\n if matcher? expected\n expected\n\n elsif expected.respond_to? :===\n RSpec::Matchers::BuiltIn::Match.new(expected)\n\n else\n RSpec::Matchers::BuiltIn::Eq.new(expected)\n end\n end",
"title": ""
},
{
"docid": "86546335234bf1501716e7e9abb38912",
"score": "0.50756335",
"text": "def path_expects_html\n unless @path_expects_html\n basename = File.basename(self.path_file)[/(.*)@/,1] + File.extname(self.path_file)\n @path_expects_html = File.join( self.dir_expects, basename )\n unless File.exist?(@path_expects_html)\n SHARED_LOGGER.warn(\"The expectations file #{@path_expects_html} doesn’t seem to exist.\")\n end\n end\n\n @path_expects_html\n end",
"title": ""
},
{
"docid": "fc25a5f1cbf24c904ccc4ed770d43c7d",
"score": "0.5066462",
"text": "def block_html(raw)\n # The full regex can have bad performance on large inputs, so we do a\n # simple string search first.\n return raw unless raw.include?('markdown=\"1\"')\n if markdown = raw.match(/<(.*)markdown=\"1\"([^>]*)>(.*)<(\\/.+?)>/m)\n open_tag_start, open_tag_end, content, close_tag = markdown.captures\n \"<#{open_tag_start}#{open_tag_end}>\\n#{@parser.convert(content)}<#{close_tag}>\"\n else\n raw\n end\n end",
"title": ""
},
{
"docid": "89a8a2caa585e4357c9bdd166675d875",
"score": "0.50510263",
"text": "def test_assert_select_rjs_picks_up_all_statements\n render_rjs do |page|\n page.replace \"test\", \"<div id=\\\"1\\\">foo</div>\"\n page.replace_html \"test2\", \"<div id=\\\"2\\\">foo</div>\"\n page.insert_html :top, \"test3\", \"<div id=\\\"3\\\">foo</div>\"\n end\n\n found = false\n assert_select_rjs do\n assert_select \"#1\"\n assert_select \"#2\"\n assert_select \"#3\"\n found = true\n end\n assert found\n end",
"title": ""
},
{
"docid": "89a8a2caa585e4357c9bdd166675d875",
"score": "0.50510263",
"text": "def test_assert_select_rjs_picks_up_all_statements\n render_rjs do |page|\n page.replace \"test\", \"<div id=\\\"1\\\">foo</div>\"\n page.replace_html \"test2\", \"<div id=\\\"2\\\">foo</div>\"\n page.insert_html :top, \"test3\", \"<div id=\\\"3\\\">foo</div>\"\n end\n\n found = false\n assert_select_rjs do\n assert_select \"#1\"\n assert_select \"#2\"\n assert_select \"#3\"\n found = true\n end\n assert found\n end",
"title": ""
},
{
"docid": "04fe72e8562b82869fb58b963700af4d",
"score": "0.5049306",
"text": "def add_html(html)\n ele = HtmlGen::TextEle.new(html: html, inden: @inden, nl: @nl)\n @eles << ele\n ele\n end",
"title": ""
},
{
"docid": "05b617efbde78d967d67047029357b02",
"score": "0.5038682",
"text": "def has_html?(text); !!text.match(/<[a-z][\\s\\S]*>/i) end",
"title": ""
},
{
"docid": "37d6b57653cd57c2c320d8c35475037a",
"score": "0.50292546",
"text": "def expect_mass_mailing_html(candidates, rendered_or_page)\n # rubocop:disable Layout/LineLength\n expect(rendered_or_page).to have_css \"form[action='/monthly_mass_mailing_update']\"\n\n expect(rendered_or_page).to have_css(\"input[type='submit'][value='#{I18n.t('email.monthly_mail')}']\", count: 2)\n\n expect(rendered_or_page).to have_css(\"input[id='top-update'][type='submit'][value='#{I18n.t('email.monthly_mail')}']\")\n\n expect(rendered_or_page).to have_field(I18n.t('email.subject_label'), text: I18n.t('email.subject_initial_input'))\n expect(rendered_or_page).to have_field(I18n.t('email.pre_late_input_label'), text: I18n.t('email.late_initial_input'))\n expect(rendered_or_page).to have_field(I18n.t('email.pre_coming_due_input_label'), text: I18n.t('email.coming_due_initial_input'))\n expect(rendered_or_page).to have_field(I18n.t('email.completed_awaiting_input_label'), text: I18n.t('email.completed_awaiting_initial_input'))\n expect(rendered_or_page).to have_field(I18n.t('email.completed_input_label'), text: I18n.t('email.completed_initial_input'))\n expect(rendered_or_page).to have_field(I18n.t('email.closing_input_label'), text: I18n.t('email.closing_initial_input'))\n expect(rendered_or_page).to have_field(I18n.t('email.salutation_input_label'), text: I18n.t('email.salutation_initial_input'))\n expect(rendered_or_page).to have_field(I18n.t('email.from_input_label'), text: 'Vicki Kristoff')\n\n expect_sorting_candidate_list(common_columns,\n candidates,\n rendered_or_page)\n\n expect(rendered_or_page).to have_css(\"input[id='bottom-update'][type='submit'][value='#{I18n.t('email.monthly_mail')}']\")\n # rubocop:enable Layout/LineLength\n end",
"title": ""
},
{
"docid": "196e8f1dad4247e04f3a7a02a53429fd",
"score": "0.50284356",
"text": "def html_markup_html(text); end",
"title": ""
},
{
"docid": "25df951d52a27417ba1cad68ad79052c",
"score": "0.5027283",
"text": "def refute_have_tag(actual, expected, contents = nil, msg = nil)\n msg = msg.nil? ? '' : \"#{msg}\\n\"\n msg << \"Expected #{actual.inspect} to NOT have tag [#{expected.inspect}]\"\n \n doc = Nokogiri::HTML(actual)\n res = doc.css(expected)\n \n # if res has something within it that means we have mostly a match, \n # so now we need to check contents\n unless res.empty?\n msg << ', but such a tag was found'\n matching = true\n \n if contents\n if contents.is_a?(String)\n if res.inner_html == contents\n matching = true\n else\n msg << \" with contents [#{contents.inspect}], but the tag content is [#{res.inner_html}]\"\n matching = false\n end\n elsif contents.is_a?(Regexp)\n if res.inner_html =~ contents\n matching = true\n else\n msg << \" with inner_html [#{res.inner_html}],\"\n msg << \" but did not match Regexp [#{contents.inspect}]\"\n matching = false\n end\n else\n msg << \", ERROR: contents is neither String nor Regexp, it's [#{contents.class}]\"\n matching = false\n end\n else\n # no contents given, so ignore\n end\n \n else\n # such a tag was found, BAD\n matching = false\n end\n refute matching, msg\n end",
"title": ""
},
{
"docid": "5ff21e1b0c528f46133513ccca512518",
"score": "0.50260216",
"text": "def to_html\n #TODO write checkers based on SHA-1 of self @ SHA-1 of\n #pre_html_sha\n syntax_up unless @html\n @html\n end",
"title": ""
},
{
"docid": "b59a919f15d6e22b1453893b005e8d24",
"score": "0.5025894",
"text": "def have_a_page_title(expected) \n simple_matcher(\"have a page title in the <head> element with [#{expected}]\") do |given, matcher|\n given.should have_tag('head > title', expected)\n end\n end",
"title": ""
},
{
"docid": "f9084bbcedceaaa74a43d8a695a7e495",
"score": "0.5025829",
"text": "def eq(expected)\n EqMatcher.new(expected)\nend",
"title": ""
},
{
"docid": "308a613ea9122ad373e95261978964c4",
"score": "0.50166243",
"text": "def assert_seen!(str, opts={})\n if opts[:within].present?\n within(opts[:within]) do\n page.should have_content str\n end\n else\n page.should have_content str\n end\n end",
"title": ""
},
{
"docid": "21365143b791d6c1942b3193e9b9b201",
"score": "0.5012302",
"text": "def parse_html(original_html, modifier_class = false)\n html = original_html.clone\n\n if modifier_class\n html.gsub! \"$modifier-class\", \"#{modifier_class}\"\n else\n html.gsub! /\\s*\\$modifier-class/, ''\n end\n\n html\n end",
"title": ""
},
{
"docid": "6265dab566b00eae0b8f50a488803396",
"score": "0.49992874",
"text": "def html?()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "8dfe1ff0a1963e1267eb76409ba9b2af",
"score": "0.49985072",
"text": "def check_pretty_html_source(*args)\n# TODO: remove array, 'type' (just show types in a comment, above). Use undef?\n type = %w[ section div tag other ]\n prefix = %w[ <!-- <div\\ class=\" < ]\n suffix = %w[ --> \" ]\n args.map!{|e| e=[] if e.blank?; e=[e] unless e.kind_of? Array; e}\n args=Array.new(type.length,[]).fill(nil,args.length){|i| args.at i}\n# print args.inspect\n source=try(:rendered) || response.body\n big=Regexp.union( (0...args.length).map{|i|\n Regexp.new \"#{prefix.at i}#{Regexp.union args.at i}#{suffix.at i}\"} )\n line_start=Regexp.new %r\"^#{big}\"\n nl=\"\\n\"\n# So far, the application has not required repeating this substitution:\n altered=source.gsub line_start, nl\n s=altered.clone.gsub! big, ''\n return if s.blank?\n anywhere_in_line=s.split nl\n a= altered.split nl\n flunk (0...a.length).reject{|i| a.at(i)==(anywhere_in_line.at i)}.map{|i|\n [(a.at i), (anywhere_in_line.at i), '']}.flatten.join nl\n end",
"title": ""
},
{
"docid": "d82b4dc05f8ccfae579989135faf060b",
"score": "0.4995137",
"text": "def escape_once(html)\n ActiveSupport::Multibyte.clean(html.to_s).gsub(/[\\\"><]|&(?!([a-zA-Z]+|(#\\d+));)/) { |special| ERB::Util::HTML_ESCAPE[special] }\nend",
"title": ""
},
{
"docid": "0e6b074288d330c85c7db45fcd493575",
"score": "0.4986127",
"text": "def render(html)\n require 'erb'\n erb = ERB.new(html)\n erb.result(binding)\n end",
"title": ""
},
{
"docid": "3f88545769e876889f5ecfbef92fc25b",
"score": "0.49843225",
"text": "def init_html(html)\n @html = html\n show_html(html)\n end",
"title": ""
},
{
"docid": "0ba10e20bbd4d3fb24af409ecc4c56b9",
"score": "0.49635452",
"text": "def check_for_html(xpath)\n rc = nil\n Log.Debug(:h4, \"[CHECK_FOR_HTML]\") {\n _check_repl_lock\n _compile_check_for_html xpath\n rc = exec\n }\n Log.Debug \"{check_for_html} :=> \", rc\n rc\n end",
"title": ""
},
{
"docid": "c52c26999e7da0355843e84b20525fee",
"score": "0.49585035",
"text": "def handle_html b, html, plain_text\n html\n end",
"title": ""
},
{
"docid": "63fec3bfbe1bbab10935d596e18f626e",
"score": "0.49486348",
"text": "def test_nested_assert_select_rjs_with_two_results\n render_rjs do |page|\n page.replace_html \"test\", \"<div id=\\\"1\\\">foo</div>\"\n page.replace_html \"test2\", \"<div id=\\\"2\\\">foo</div>\"\n end\n\n assert_select_rjs \"test\" do |elements|\n assert_equal 1, elements.size\n assert_select \"#1\"\n end\n\n assert_select_rjs \"test2\" do |elements|\n assert_equal 1, elements.size\n assert_select \"#2\"\n end\n end",
"title": ""
},
{
"docid": "63fec3bfbe1bbab10935d596e18f626e",
"score": "0.49486348",
"text": "def test_nested_assert_select_rjs_with_two_results\n render_rjs do |page|\n page.replace_html \"test\", \"<div id=\\\"1\\\">foo</div>\"\n page.replace_html \"test2\", \"<div id=\\\"2\\\">foo</div>\"\n end\n\n assert_select_rjs \"test\" do |elements|\n assert_equal 1, elements.size\n assert_select \"#1\"\n end\n\n assert_select_rjs \"test2\" do |elements|\n assert_equal 1, elements.size\n assert_select \"#2\"\n end\n end",
"title": ""
},
{
"docid": "b1fa6a942d0a7b809b6c431c9dcee505",
"score": "0.49392667",
"text": "def assert_have_tag(actual, expected, contents = nil, msg = nil)\n msg = msg.nil? ? '' : \"#{msg}\\n\"\n msg << \"Expected #{actual.inspect} to have tag [#{expected.inspect}]\"\n \n doc = Nokogiri::HTML(actual)\n res = doc.css(expected)\n \n if res.empty?\n msg << ', but no such tag was found'\n matching = false\n else\n # such a tag was found\n matching = true\n \n if contents\n if contents.is_a?(String)\n unless res.any? { |tag| tag.inner_html == contents }\n matching = false\n msg << \" with contents [#{contents.inspect}], but the tags content found is [#{res.map(&:inner_html).join(', ')}]\"\n end\n elsif contents.is_a?(Regexp)\n if res.inner_html =~ contents\n matching = true\n else\n msg << \" with inner_html [#{res.inner_html}],\"\n msg << \" but did not match Regexp [#{contents.inspect}]\"\n matching = false\n end\n else\n msg << \", ERROR: contents is neither String nor Regexp, it's [#{contents.class}]\"\n matching = false\n end\n else\n # no contents given, so ignore\n end\n end\n assert matching, msg\n end",
"title": ""
},
{
"docid": "75e41b9ee332bf84e504811686ab1a04",
"score": "0.49355796",
"text": "def test_square_brackets_around_attributes_multiline_with_tabs\n source = \"div\\n\\tp[\\n\\t\\tclass=\\\"martian\\\"\\n\\t]\\n\\tp Next line\"\n assert_html '<div><p class=\"martian\"></p><p>Next line</p></div>', source\n end",
"title": ""
},
{
"docid": "8ad9925221308bdff43e59866a3d15e6",
"score": "0.49327525",
"text": "def matcher\n Matcher.new(@py_nlp)\n end",
"title": ""
},
{
"docid": "5563cdb7a06d9749caeee1a93975cd01",
"score": "0.49286333",
"text": "def escape_once(html)\n ERB::Util.html_escape_once(html)\n end",
"title": ""
},
{
"docid": "4f78f454cbfa4b667ec694bb1aa66630",
"score": "0.49224326",
"text": "def html= html\n native.load_html_string html, nil\n end",
"title": ""
},
{
"docid": "261706795a1905095adbda5131415ea5",
"score": "0.4917417",
"text": "def have_a_page_header(expected, tag = 'h2') \n simple_matcher(\"have an '#{tag}' page header with [#{expected.inspect}]\") do |given, matcher|\n given.should have_tag(tag, expected, :count => 1)\n end\n end",
"title": ""
},
{
"docid": "e10465ccee024c0f10a218336de6f014",
"score": "0.49084967",
"text": "def assert_compiled_javascript_matches(javascript, expectation)\n assert_equal expectation.gsub(/\\s/, ''), javascript.gsub(/\\s/, '')\nend",
"title": ""
},
{
"docid": "e10465ccee024c0f10a218336de6f014",
"score": "0.49084967",
"text": "def assert_compiled_javascript_matches(javascript, expectation)\n assert_equal expectation.gsub(/\\s/, ''), javascript.gsub(/\\s/, '')\nend",
"title": ""
},
{
"docid": "775c8912231e56792b4a844efeb9387a",
"score": "0.48997045",
"text": "def html=(html)\n @object.html = ensure_html_safety(html)\n end",
"title": ""
},
{
"docid": "a70c2ecaa8a58adfedcd97ff15649f59",
"score": "0.48981202",
"text": "def test_links_automatic()\n verbose_old = $VERBOSE\n $VERBOSE = false\n create_file( '/tmp/foo.asc' )\n create_file( '/tmp/bar.asc' )\n create_file( '/tmp/foo-bar.asc' )\n create_file( '/tmp/bar-foo-bar.asc' )\n create_file( '/tmp/compiled-website-test-file.asc' )\n #\n # Simple match\n string = <<-heredoc.unindent\n foo\n heredoc\n expected = <<-heredoc.unindent\n <a href=\"foo.html\">foo</a>\n heredoc\n source_file_full_path = '/tmp/something.asc'\n result = @o.links_automatic( string, source_file_full_path )\n assert_equal( expected, result )\n #\n # Case-insensitive match.\n string = <<-heredoc.unindent\n Foo\n heredoc\n expected = <<-heredoc.unindent\n <a href=\"foo.html\">Foo</a>\n heredoc\n source_file_full_path = '/tmp/something.asc'\n result = @o.links_automatic( string, source_file_full_path )\n assert_equal( expected, result )\n #\n # Only link the first word.\n string = <<-heredoc.unindent\n foo foo\n heredoc\n expected = <<-heredoc.unindent\n <a href=\"foo.html\">foo</a> foo\n heredoc\n source_file_full_path = '/tmp/something.asc'\n result = @o.links_automatic( string, source_file_full_path )\n assert_equal( expected, result )\nskip \"ungh, my philosophy is wrong for not_in_html(), I need another wrapper to only intelligently do that *per-line* or some sort of block_not_in_html()\"\n #\n # Only link the first word.\n string = <<-heredoc.unindent\n foo <a href=\"a\">a</a> foo\n heredoc\n expected = <<-heredoc.unindent\n <a href=\"foo.html\">foo</a> <a href=\"a\">a</a> foo\n heredoc\n source_file_full_path = '/tmp/something.asc'\n result = @o.links_automatic( string, source_file_full_path )\n assert_equal( expected, result )\n #\n #\n string = <<-heredoc.unindent\n bar\n heredoc\n expected = <<-heredoc.unindent\n <a href=\"bar.html\">bar</a>\n heredoc\n source_file_full_path = '/tmp/something.asc'\n result = @o.links_automatic( string, source_file_full_path )\n assert_equal( expected, result )\n #\n # Links two words, and don't link single words.\n string = <<-heredoc.unindent\n foo bar\n heredoc\n expected = <<-heredoc.unindent\n <a href=\"foo-bar.html\">foo bar</a>\n heredoc\n source_file_full_path = '/tmp/something.asc'\n result = @o.links_automatic( string, source_file_full_path )\n assert_equal( expected, result )\n #\n # Multi-word matches\n string = <<-heredoc.unindent\n compiled website test file\n heredoc\n expected = <<-heredoc.unindent\n <a href=\"compiled-website-test-file.html\">compiled website test file</a>\n heredoc\n source_file_full_path = '/tmp/something.asc'\n result = @o.links_automatic( string, source_file_full_path )\n assert_equal( expected, result )\n #\n # Multi-word matches, where there are dashes.\n string = <<-heredoc.unindent\n compiled-website test file\n heredoc\n expected = <<-heredoc.unindent\n <a href=\"compiled-website-test-file.html\">compiled-website test file</a>\n heredoc\n source_file_full_path = '/tmp/something.asc'\n result = @o.links_automatic( string, source_file_full_path )\n assert_equal( expected, result )\n #\n # Working with single words then removing them as possibilities.\n string = <<-heredoc.unindent\n foo\n bar foo bar\n heredoc\n expected = <<-heredoc.unindent\n <a href=\"foo.html\">foo</a>\n <a href=\"bar.html\">bar</a> <a href=\"foo-bar.html\">foo bar</a>\n heredoc\n source_file_full_path = '/tmp/something.asc'\n result = @o.links_automatic( string, source_file_full_path )\n assert_equal( expected, result )\n #\n # Allow matching within punctuation and specific endings\n string = <<-heredoc.unindent\n fooed\n heredoc\n expected = <<-heredoc.unindent\n <a href=\"foo.html\">foo</a>ed\n heredoc\n source_file_full_path = '/tmp/something.asc'\n result = @o.links_automatic( string, source_file_full_path )\n assert_equal( expected, result )\n #\n # Match, ignoring dashes in the source text.\n string = <<-heredoc.unindent\n compiled-website test file\n heredoc\n expected = <<-heredoc.unindent\n <a href=\"compiled-website-test-file.html\">compiled-website test file</a>\n heredoc\n source_file_full_path = '/tmp/something.asc'\n result = @o.links_automatic( string, source_file_full_path )\n assert_equal( expected, result )\n #\n # Don't link the current document's name.\n string = <<-heredoc.unindent\n foo\n heredoc\n expected = <<-heredoc.unindent\n foo\n heredoc\n source_file_full_path = '/tmp/foo.asc'\n result = @o.links_automatic( string, source_file_full_path )\n assert_equal( expected, result )\n #\n # Prioritizing two words before single words.\n string = <<-heredoc.unindent\n foo bar foo bar\n heredoc\n expected = <<-heredoc.unindent\n <a href=\"foo-bar.html\">foo bar</a> <a href=\"foo.html\">foo</a> <a href=\"bar.html\">bar</a>\n heredoc\n source_file_full_path = '/tmp/something.asc'\n result = @o.links_automatic( string, source_file_full_path )\n assert_equal( expected, result )\n #\n # Multiple separate matches.\n string = <<-heredoc.unindent\n bar foo\n heredoc\n expected = <<-heredoc.unindent\n <a href=\"bar.html\">bar</a> <a href=\"foo.html\">foo</a>\n heredoc\n source_file_full_path = '/tmp/something.asc'\n result = @o.links_automatic( string, source_file_full_path )\n assert_equal( expected, result )\n #\n # Maybe I can still have improved matching without being too slow. I don't want to match the 'pre' in 'preview' and so I could still require at least a small subset of punctuation can't i? Investigate.\n string = <<-heredoc.unindent\n abcfoodef\n heredoc\n expected = <<-heredoc.unindent\n abcfoodef\n heredoc\n source_file_full_path = '/tmp/something.asc'\n result = @o.links_automatic( string, source_file_full_path )\n assert_equal( expected, result )\n #\n #\n string = '<a></a>DISPLAY<b></b> foo'\n expected = '<a></a>DISPLAY<b></b> <a href=\"foo.html\">foo</a>'\n source_file_full_path = '/tmp/something.asc'\n result = @o.links_automatic( string, source_file_full_path )\n assert_equal( expected, result )\n #\n #\n File.delete( '/tmp/foo.asc' )\n File.delete( '/tmp/bar.asc' )\n File.delete( '/tmp/foo-bar.asc' )\n File.delete( '/tmp/bar-foo-bar.asc' )\n File.delete( '/tmp/compiled-website-test-file.asc' )\n $VERBOSE = verbose_old\n end",
"title": ""
},
{
"docid": "de70a83e6e6943dfe7096d75a9ceb755",
"score": "0.48923707",
"text": "def during_render\n yield\n instance_eval ContinuousThinking::ReceiveAndRender.render_method\n @receive_and_render_matchers.each do |matcher|\n response.should have_tag(matcher.parent_selector) do\n if matcher.html_escaped\n response.should have_text(ERB::Util.html_escape(matcher.text2match).to_regexp)\n else\n response.should have_tag(matcher.selector)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "695e036b15b141f74af49f4902eb3532",
"score": "0.48913753",
"text": "def search_path_in_whole_html(path, html)\n path_output = ''\n path_searchterm = path\n output_string = \"no_path\"\n if (path.include?('match'))\n puts \">#{path}< is a Regex, so skip this\"\n else\n if ( path_searchterm.include?(\"#\") || path_searchterm.include?(\".\") )\n #is searchterm a class or id-path?\n path_searchterm_identifier = path_searchterm.scan(/[#|.]/)\n #seperate searchterm by .# ord 0-9\n path_searchterm_without_number_and_identifier = path_searchterm.gsub(/[#|.]*[0-9]*/, \"\")\n content = html\n #is searchterm in content included\n if content.include?(path_searchterm_without_number_and_identifier)\n searchterm_in_content = content.scan(/#{path_searchterm_without_number_and_identifier}[0-9]*/)\n searchterm_in_content.uniq!\n path_output = \"#{path_searchterm_identifier}#{searchterm_in_content}\"\n output_string = path_output.to_s.gsub(/\\\"/, '\\'').gsub(/[\\[\\]]/, '').gsub(/'/, \"\")\n else\n output_string = path\n end\n end\n end\n puts \"OUTPUT:#{output_string}\"\n return output_string\n end",
"title": ""
},
{
"docid": "682f594884140a0282fd149edeb397dc",
"score": "0.48843533",
"text": "def code_parsing_blocks(text_attribute, html_attribute)\n it 'should filter and parse code' do\n @elem.send(\n \"#{text_attribute}=\",\n '<filter:code lang=\"ruby\"> puts \"hello world\" </filter:code>'\n )\n @elem.save\n @elem.send(html_attribute).should_not match(/filter/)\n end\n end",
"title": ""
},
{
"docid": "6001c84f611e88341776641bc2ed1b08",
"score": "0.48816043",
"text": "def rawhtml=(newhtml)\n @html = newhtml\n end",
"title": ""
},
{
"docid": "722900ff45fd8e3bb5cb1e58ca5e6b53",
"score": "0.48796603",
"text": "def add_matcher(matcher_name)\n positive_name = CapybaraMiniTestSpec::PositiveTestName.new(matcher_name)\n negative_name = CapybaraMiniTestSpec::NegativeTestName.new(matcher_name)\n [positive_name, negative_name].each do |test_name|\n CapybaraMiniTestSpec.define_expectation(test_name)\n end\n end",
"title": ""
},
{
"docid": "90fd0bb3699b0f815760678fa940e9f6",
"score": "0.48784184",
"text": "def modern_matcher_from(matcher); end",
"title": ""
},
{
"docid": "f1b6b21b99f830fea85825e95fc1220d",
"score": "0.4877741",
"text": "def html(html)\n unless RUBY_ENGINE == 'opal'\n opts.html = begin\n File.read html\n rescue\n html\n end.strip\n end\n end",
"title": ""
},
{
"docid": "852bc3ef5d16f04f049008b504a08421",
"score": "0.48683706",
"text": "def escape_html(html)\n\t\th(html.to_str)\n\tend",
"title": ""
},
{
"docid": "0990d6a08d4f25e0c6ffc767e31383a2",
"score": "0.48524913",
"text": "def check_price(html)\n price = html.td(:text,\"Price\").parent.tds[1].text\n expect(price).to start_with(\"$\")\n end",
"title": ""
},
{
"docid": "f2e8f21c35cc8e68e2468729f4af1fc2",
"score": "0.48323599",
"text": "def html=(newhtml)\n @html = \"<html>\\n<head>\\n<meta content=\\\"text/html;charset=#{@charset}\\\" http-equiv=\\\"Content-Type\\\">\\n</head>\\n<body bgcolor=\\\"#ffffff\\\" text=\\\"#000000\\\">\\n#{newhtml}\\n</body>\\n</html>\"\n end",
"title": ""
},
{
"docid": "a10ada7347c12419f87c67c440177769",
"score": "0.4826394",
"text": "def it_should_cache_markdown(text_attribute, html_attribute, params={})\n default = {\n :filter_code => true\n }.merge(params)\n eval <<-EOF\n describe 'markdown caching' do\n before_block(\"#{text_attribute}\", \"#{html_attribute}\")\n after_block(\"#{text_attribute}\", \"#{html_attribute}\")\n\n markdown_blocks(\"#{text_attribute}\", \"#{html_attribute}\")\n\n # only if the code should be generated from the <filter-tags check this\n if #{params[:filter_code]}\n code_parsing_blocks(\"#{text_attribute}\", \"#{html_attribute}\")\n end\n end\n EOF\n end",
"title": ""
},
{
"docid": "1fb9676933201a3f6375b792877b2b5a",
"score": "0.48226696",
"text": "def gen_compare_has_css_with_text css_value, lable_name, should_have_css_with_text, sTest\n\tgen_execute_script do\n\t\tif(should_have_css_with_text)\n\t\t\texpect(page).to have_css(css_value, :text =>lable_name) \n\t\t\tputs \"Test #{sTest} Passed.\"\n\t\telse\n\t\t\texpect(page).to have_no_css(css_value, :text =>lable_name) \n\t\t\tputs \"Test #{sTest} Passed.\"\n\t\tend\n\tend\nend",
"title": ""
},
{
"docid": "381eb40fd9fa42a3b57a2dd6a9e047ec",
"score": "0.4808986",
"text": "def test_xhtml_includes_last_results\n result = 'this is a command result'\n sketch = MainPageSketch.new('irrelevant', MockSession.new, result)\n \n assert_match(Regexp.new(result), sketch.to_xhtml)\n end",
"title": ""
},
{
"docid": "bc4f79ab056f0885a0a9e145eac9a4c4",
"score": "0.47974852",
"text": "def test_nested_assert_select_rjs_with_single_result\n render_rjs do |page|\n page.replace_html \"test\", \"<div id=\\\"1\\\">foo</div>\\n<div id=\\\"2\\\">foo</div>\"\n end\n\n assert_select_rjs \"test\" do |elements|\n assert_equal 2, elements.size\n assert_select \"#1\"\n assert_select \"#2\"\n end\n end",
"title": ""
},
{
"docid": "bc4f79ab056f0885a0a9e145eac9a4c4",
"score": "0.47974852",
"text": "def test_nested_assert_select_rjs_with_single_result\n render_rjs do |page|\n page.replace_html \"test\", \"<div id=\\\"1\\\">foo</div>\\n<div id=\\\"2\\\">foo</div>\"\n end\n\n assert_select_rjs \"test\" do |elements|\n assert_equal 2, elements.size\n assert_select \"#1\"\n assert_select \"#2\"\n end\n end",
"title": ""
},
{
"docid": "d6cc1f26405774419f99fd112a44b004",
"score": "0.4788785",
"text": "def match(event)\n @content << %Q|<span class=\"match\">#{event.new_element}</span><br/>\\n|\n end",
"title": ""
},
{
"docid": "da8dd18fae845bca6664414955c84806",
"score": "0.4781022",
"text": "def setup\n @html_code = \"<!DOCTYPE html>\n <html>\n <head>\n #{META_HTTP}\n <title>HaTeMiLe Tests</title>\n <meta charset=\\\"UTF-8\\\" />\n </head>\n <body>\n <section>\n <header></header>\n <article>\n \\n\n </article>\n <footer><!-- Footer --></footer>\n </section>\n <span attribute=\\\"value\\\" data-attribute=\\\"custom_value\\\">\n <!-- Comment -->\n Text node\n <strong>Strong text</strong>\n <hr />\n </span>\n <div></div>\n <p>\n <del>Deleted text</del>\n </p>\n <table>\n <thead><tr>\n <th>Table header</th>\n </tr></thead>\n <tbody class=\\\"table-body\\\">\n <tr>\n <td>Table <ins>cell</ins></td>\n </tr>\n </tbody>\n <tfoot><!-- Table footer --></tfoot>\n </table>\n <ul>\n <li id=\\\"li-1\\\">1</li>\n <li id=\\\"li-3\\\">3</li>\n </ul>\n <ol>\n <li>1</li>\n <li>2</li>\n <li>3</li>\n <li>4</li>\n <li>5</li>\n </ol>\n <form>\n <label>\n Text:\n <input type=\\\"text\\\" name=\\\"number\\\" />\n </label>\n </form>\n <div>\n <h1><span>Heading 1</span></h1>\n <h2><span>Heading 1.2.1</span></h2>\n <div>\n <span></span>\n <div><h2><span>Heading 1.2.2</span></h2></div>\n <span></span>\n </div>\n <h3><span>Heading 1.2.2.3.1</span></h3>\n <h4><span>Heading 1.2.2.3.1.4.1</span></h4>\n <h2><span>Heading 1.2.3</span></h2>\n <h3><span>Heading 1.2.3.3.1</span></h3>\n </div>\n </body>\n </html>\"\n @html_parser = Hatemile::Util::Html::NokogiriLib::NokogiriHTMLDOMParser.new(\n @html_code\n )\n end",
"title": ""
},
{
"docid": "bddf68fc537f17f8c5b4c6cb301446ff",
"score": "0.47780585",
"text": "def if_is(text, expected)\n return false if aborted?\n return push_conditional(selenium_compare(text, expected))\n end",
"title": ""
},
{
"docid": "d9163f7318d2509ae44c8b1668cdec46",
"score": "0.4772358",
"text": "def get_html_value(html, type, name, value)\r\n return nil unless html\r\n return nil unless type\r\n return nil unless name\r\n return nil unless value\r\n\r\n found = nil\r\n html.each_line do |line|\r\n if line =~ /(<#{type}[^\\/]*name=\"#{name}\".*?\\/>)/i\r\n found = $&\r\n break\r\n end\r\n end\r\n\r\n if found\r\n doc = REXML::Document.new found\r\n return doc.root.attributes[value]\r\n end\r\n\r\n ''\r\n end",
"title": ""
},
{
"docid": "c77b2f904454b113ca57d3ec844a6701",
"score": "0.4771339",
"text": "def ==(other)\n (other.instance_of?(self.class) &&\n html_text == other.html_text)\n end",
"title": ""
}
] |
65e0805dede5d4a1bc0c8da76ef3975f | Creates a new contact object | [
{
"docid": "5a85e525c01ff55e5d35782765715b4b",
"score": "0.0",
"text": "def initialize(id, name, email, phone_number)\n # TODO: Assign parameter values to instance variables.\n @id = id\n @name = name\n @email = email\n @phone_number = phone_number\n end",
"title": ""
}
] | [
{
"docid": "aa6179f387359da7d4c7491a88430de3",
"score": "0.8122467",
"text": "def create_contact()\n Contact.new(id: rand(2000)).tap do |c|\n contacts << c\n end\n end",
"title": ""
},
{
"docid": "fd25c33edb1dc3ff9cab5e94f3dd68a2",
"score": "0.7880839",
"text": "def new_contact\n @contact=Contact.new()\n end",
"title": ""
},
{
"docid": "20068dda579b52a51ca183591bc760cb",
"score": "0.77642137",
"text": "def create_contact(params={})\n @obj.post('create-contact', @auth.merge(params))\n end",
"title": ""
},
{
"docid": "4b268a623308cf6ba81525d3ed354be2",
"score": "0.7704724",
"text": "def create(contact)\n validate_type!(contact)\n\n attributes = sanitize(contact)\n _, _, root = @client.post(\"/contacts\", attributes)\n\n Contact.new(root[:data])\n end",
"title": ""
},
{
"docid": "1d1a26c53288bb34730167873c5bb008",
"score": "0.76989543",
"text": "def new\n\t\t\t\t# we are going to make a new contact yall\n\t\t\t\t# comes in like post\n\t\t\t\t# {'api_token': ..., 'contact': {}}\n\t\t\t\tcontact_params = params[:contact] # be sure to clean all the values\n\t\t\t\t# clean them up\n\t\t\t\tcontact_params = sanitize_obj(contact_params);\n\t\t\t\t# lets allow rails to build this for us automagically\n\t\t\t\tc = Contact.new\n\t\t\t\tc.from_json(contact_params.to_json) # generate from our cleaned params\n\t\t\t\t# should be it for that, as long as the keys match, rails should set it\n\t\t\t\t\n\t\t\t\t# now we can save the contact\n\t\t\t\tc.save\n\t\t\t\t@user.accounts.first.contacts << c\n\t\t\t\t@user.accounts.first.save\n\t\t\t\t\n\t\t\t\t# now let's this new contact to the client\n\t\t\t\trender json: {:status => \"success\", :contact => c}\n\t\t\tend",
"title": ""
},
{
"docid": "555ebfd29c604557792e0b2f23bdf612",
"score": "0.7587858",
"text": "def create_contact(options = {})\n post(:contacts, contacts: [options]).pop\n end",
"title": ""
},
{
"docid": "d05844089fbcc513aa18497f38da4193",
"score": "0.751371",
"text": "def new\n @contact = contacts.new\n end",
"title": ""
},
{
"docid": "a0818e6c24553bac2cc94022e025af10",
"score": "0.75006175",
"text": "def new_contact\n @contact = Spree::Address.new\n end",
"title": ""
},
{
"docid": "1a9548b34b114d4e6b0026bb5c4ce615",
"score": "0.74910545",
"text": "def contact\n Zapi::Models::Contact.new\n end",
"title": ""
},
{
"docid": "be707c16d4b771d58d333ce6cd9f1833",
"score": "0.74527794",
"text": "def create_a_new_contact(opts = {})\n create_a_new_contact_with_http_info(opts)\n nil\n end",
"title": ""
},
{
"docid": "e2d8fd8f35a308ed71815596e0055aec",
"score": "0.7411964",
"text": "def create(name, email)\n # TODO: Instantiate a Contact, add its data to the 'contacts.csv' file, and return it.\n CSV.foreach('contacts.csv') do |row|\n end\n id=$.\n new_contact = Contact.new(name, email, id)\n full_contact = new_contact.id, new_contact.name, new_contact.email\n CSV.open('contacts.csv', 'a+') do |csv|\n csv << full_contact\n end\n return new_contact\n end",
"title": ""
},
{
"docid": "383cc20e9137a672e44d9684033083ba",
"score": "0.7402705",
"text": "def new\n @contact = Contact.new\n end",
"title": ""
},
{
"docid": "383cc20e9137a672e44d9684033083ba",
"score": "0.7402705",
"text": "def new\n @contact = Contact.new\n end",
"title": ""
},
{
"docid": "33597610e50d3d9c3107696dfe8e92f1",
"score": "0.7395228",
"text": "def contact\n \t@contact = Contact.new\n end",
"title": ""
},
{
"docid": "12878a304fe6378bb56f3b9be80be2b9",
"score": "0.7293715",
"text": "def create(name, email)\n # TODO: Instantiate a Contact, add its data to the 'contacts.csv' file, and return it.\n results = connection.exec(\"SELECT * FROM contacts ORDER BY id DESC LIMIT 1;\")\n results.each do |row|\n each_info = Contact.new(row['name'], row['email'], row['id'])\n puts \"ID #{row['id']}: #{row['name']} #{row['email']}\".blue\n end\n puts \"The contact was created successfully.\".green\n end",
"title": ""
},
{
"docid": "d3bd44392fcc2dcc2e70229f0cd32b41",
"score": "0.72707456",
"text": "def create(name, email, phone_number)\n # TODO: Instantiate a Contact, add its data to the 'contacts.csv' file, and return it.\n unless contact_exists?(email)\n contacts = CSV.read(@csvfile)\n new_contact = Contact.new(contacts.length, name, email, phone_number)\n CSV.open(@csvfile, \"ab\") { |csv| csv << [new_contact.name, new_contact.email, new_contact.phone_number] }\n new_contact\n end\n end",
"title": ""
},
{
"docid": "81f2e7e0889f2e164dda4ee32d295772",
"score": "0.7167572",
"text": "def create\n klass = Contact.create_model_class(params[:contact][:klaas], params[:contact])\n \n @contact = klass.new(contact_params)\n debugger\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to contact_url @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: (contact_url @contact) }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "423e982f41fcf36538be9701f899d211",
"score": "0.7155739",
"text": "def create(name, email)\n id = CSV.read('contacts.csv').last[0].to_i + 1\n new_contact = Contact.new(id, name, email)\n CSV.open('contacts.csv', 'a') do |file|\n file << [new_contact.id, new_contact.name, new_contact.email]\n end\n new_contact\n end",
"title": ""
},
{
"docid": "de3739a714a596bb8ad15f97c22890a5",
"score": "0.7139316",
"text": "def contact_create(fields)\n query :contact_create, contact_prepare(fields)\n end",
"title": ""
},
{
"docid": "d9728e2b4b49154d733c79af49a551e0",
"score": "0.71359736",
"text": "def create(name, email, length)\n # TODO: Instantiate a Contact, add its data to the 'contacts.csv' file, and return it.\n length = length \n contact = Contact.new(name, email, length)\n File.open(\"contacts.csv\",\"a\") {|somefile| somefile.puts contact.id.to_s + \",\" + contact.name + \",\" + contact.email}\n return contact \n end",
"title": ""
},
{
"docid": "8066c3789d2cd795b05542a84eaec00f",
"score": "0.7127878",
"text": "def create(name, email)\n # TODO: Instantiate a Contact, add its data to the 'contacts.csv' file, and return it.\n CSV.open(FILE, 'a') << [name, email]\n Contact.new(name,email,Contact.all.length + 1)\n end",
"title": ""
},
{
"docid": "95e98aa9e638f7759d5414a468f31100",
"score": "0.71261436",
"text": "def create\n @contact = Contact.new(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render json: @contact, status: :created, location: @contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a6d5fdba34312e9cb8c6ea6fd7ef66cb",
"score": "0.712396",
"text": "def create\n @contact = @resource.contacts.build(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to(@resource, :notice => 'Contact was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"title": ""
},
{
"docid": "e4de644adc1bfee9f7b19a41e2db97d4",
"score": "0.7117915",
"text": "def create\n\t\t@contact = Contact.new(contact_params)\n\n\t\trespond_to do |format|\n\t\t\tif @contact.save\n\t\t\t\tformat.html { redirect_to user_contacts_path, notice: 'Contact was successfully created.' }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @contact }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.json { render json: @contact.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "26ae4db0cccc0aa494c42924566f42dd",
"score": "0.7114212",
"text": "def create\n\t\t@contact = Contact.new(contact_params)\n\t\tif @contact.save\n\t\t\tflash[:notice] = \"Contact sucessfully saved!\"\n\t\t\tredirect_to contacts_path\n\t \telse\n\t \t\tflash[:error] = \"Contact could not save!\"\n\t \t\t@contact.contact_phone_numbers.build unless @contact.contact_phone_numbers.present?\n\t \t\t@contact.contact_addresses.build unless @contact.contact_addresses.present?\n\t \trender 'new'\n\t \tend\n\tend",
"title": ""
},
{
"docid": "e14374cce0bd0a0896f554576c442c27",
"score": "0.7109919",
"text": "def create_contact(name, telephone, email)\n\tcontact_list = {\n\t\tname: name,\n\t\ttelephone: telephone,\n\t\temail: email\n\t}\n\tcontacts = []\n\tcontacts << contact_list\nend",
"title": ""
},
{
"docid": "87990b6369b4d49e363734df218cfc93",
"score": "0.71090645",
"text": "def create_contact(project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/contacts'\n\t\targs[:query]['Action'] = 'CreateContact'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :contact\n\t\t\targs[:body]['Contact'] = optional[:contact]\n\t\tend\n\t\tself.run(args)\n\tend",
"title": ""
},
{
"docid": "9bf21d975f80826493be0df65576ead1",
"score": "0.70936763",
"text": "def contact_create(contact)\n super # placeholder so that I can add some doc\n end",
"title": ""
},
{
"docid": "9bf21d975f80826493be0df65576ead1",
"score": "0.70936763",
"text": "def contact_create(contact)\n super # placeholder so that I can add some doc\n end",
"title": ""
},
{
"docid": "9c5f71a8e365d14c1e9fc161c7f47d4f",
"score": "0.70682245",
"text": "def create(contact, organization_id)\n path = get_path(organization_id)\n result = handle_response(@client.push(path, contact.attributes))\n return if result.blank?\n\n set_contact_data(contact.attributes, result['name'])\n end",
"title": ""
},
{
"docid": "8368b8dc6c3aa872e97a8e010a89d2ca",
"score": "0.70397645",
"text": "def new\n\t\t@contact=Contact.new\n\t\t$flag_edit=false\n\tend",
"title": ""
},
{
"docid": "d76db0d1ce2f3322bd78e01144764b4e",
"score": "0.7026986",
"text": "def add_contact\n\t\tprint \"First Name: \".pink\n\t\tfirst_name = gets.chomp\n\t\tprint \"Last Name: \".pink\n\t\tlast_name = gets.chomp\n\t\tprint \"Email :\".pink\n\t\temail = gets.chomp\n\t\tprint \"Note :\".pink\n\t\tnote = gets.chomp #could use a hash but it is not ideal - if you need a cutstom piece of data to be repeated you need to create a new class for that method to call on\n\n\t\tcontact = Contact.new(first_name, last_name, email, note)\n\t\t@rolodex.add_contact(contact)\n\n\tend",
"title": ""
},
{
"docid": "22c42bfbf2918db4b8e5f66e9090cd8c",
"score": "0.7010869",
"text": "def new\n\t\t@contact = Contact.new\n\t\t@contact.contact_phone_numbers.build\n\t\t@contact.contact_addresses.build\n\tend",
"title": ""
},
{
"docid": "a71900f76bd3e549e9953b581a7f8d51",
"score": "0.69957954",
"text": "def create\n @contact = @user.contacts.build(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to root_path, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5c69c168aebdeb799b4b84a2103b6405",
"score": "0.6993601",
"text": "def create\n @contact = contacts.new(params[:contact])\n\n if @contact.save\n redirect_to contacts_path, notice: '联系人创建成功'\n else\n render action: \"new\"\n end\n end",
"title": ""
},
{
"docid": "e5b75fd8e4fbebb2fa9e5bf9fd687587",
"score": "0.69884884",
"text": "def create\n Rails.logger.info \"Completed in #{contact_params}\"\n @contact = Contact.new(contact_params)\n @contact.user_id = current_user.id\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f8cc0b86202dadb5e6a6b560155eb65b",
"score": "0.6983287",
"text": "def create\n\t\t@contact = Contact.new()\n\t\t@contact.fname = params[:fname] \n\t\t@contact.lname = params[:lname]\n\t\t@contact.email = params[:email]\n\t\t@contact.reason = params[:reason]\n\t\t@contact.message = params[:message]\n\t\t@contact.save\n\t\t\n\t\trespond_with(@contact)\n end",
"title": ""
},
{
"docid": "d5d84538cab511aa389945feac829f88",
"score": "0.6970662",
"text": "def create\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.build(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to([@contact.customer, @contact], :notice => 'Contact was successfully created.') }\n format.json { render :json => @contact, :status => :created, :location => [@contact.customer, @contact] }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cb29ea597a251bd731fa281ff9ce97d0",
"score": "0.69666314",
"text": "def create(name, email, phones = nil)\n # Instantiate a Contact, add its data to the 'contacts.csv' file, and return it.\n return nil unless search(email).empty?\n size = CSV.read(CSV_FILE).size\n csv = CSV.open(CSV_FILE, 'a')\n if phones.empty?\n csv << [name,email]\n else\n csv << [name,email,phones]\n end\n id = size + 1\n\n Contact.new(name, email, id)\n end",
"title": ""
},
{
"docid": "04cd18c33c48a81f196e42710ddc457a",
"score": "0.6962557",
"text": "def create\n @contact = @current_user.contacts.new(contact_params)\n if @contact.save\n render json: {status: 201, contact: @contact}\n else\n render json: {status: 400}\n end\n end",
"title": ""
},
{
"docid": "fb5b81e70fe20a8639455fd6aae411a4",
"score": "0.69594884",
"text": "def new\r\n\t\t@contact = current_user.contacts.new\r\n\tend",
"title": ""
},
{
"docid": "9691fc29115e48d914c92144df84aaed",
"score": "0.6958118",
"text": "def create\n if !params.has_key?(:ur_contact) then\n head :internal_server_error\n end\n\n params[:ur_contact].delete(:id)\n newContact = current_user.ur_contacts.new(contact_params)\n\n if newContact.save then\n render json: newContact\n else\n Rails.logger.info \"Error when creating contacts #{newContact.errors.messages}\"\n head :internal_server_error\n return\n end\n end",
"title": ""
},
{
"docid": "8b09ee9c54f0672ec87abbb0cca31b0c",
"score": "0.6933025",
"text": "def create\n @entity_contact = EntityContact.new(params[:entity_contact])\n\n respond_to do |format|\n if @entity_contact.save\n format.html { redirect_to @entity_contact, notice: 'Entity contact was successfully created.' }\n format.json { render json: @entity_contact, status: :created, location: @entity_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "15fb2f160fd052304c63849c0634b563",
"score": "0.69087577",
"text": "def create\n @contact = Contact.new(params[:contact])\n @contact.user = User.find(session[:userid])\n # @contact = @user.contact.create(params[:contact])\n if params[:keyword].present?\n @new = Contact.new(:first_name => params[:keyword])\n @new.save\n redirect_to @contact\n end\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render json: @contact, status: :created, location: @contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2b505b9c46062af54ab1556fd4d08a88",
"score": "0.68869555",
"text": "def create\n @contact = Contact.new(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render json: @contact, status: :created, location: @contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b837dacf4e7cce2aa9071ed07d4e4019",
"score": "0.68857175",
"text": "def build_contact(params = {})\n self.contact = gateway ? gateway.build_contact(params) : Contact.new(params)\n end",
"title": ""
},
{
"docid": "20b85e7a337c54dc4d6ffa55dd59e3a0",
"score": "0.6882434",
"text": "def create_contact(create_contact_input_object, opts = {})\n data, _status_code, _headers = create_contact_with_http_info(create_contact_input_object, opts)\n data\n end",
"title": ""
},
{
"docid": "cc4c310dc8e2370b1a49a0f0e163270d",
"score": "0.6871873",
"text": "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to edit_contact_path(@contact), notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d2f6c1d463ecffdfa652986cc73563f9",
"score": "0.68680793",
"text": "def create\n @contact = Contact.new(contact_params)\n\n if @contact.save\n render json: @contact, status: :created, location: @contact\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "dfcf63f290117043a03ea9f4bffc48a1",
"score": "0.6864545",
"text": "def create\r\n\t\t@contact = current_user.contacts.new(contact_params)\r\n\t\t\r\n\t\tif @contact.save\r\n\t\t\tflash[:success] = \"New Contact Added\"\r\n\t\t\tredirect_to @contact\r\n\t\telse\r\n\t\t\trender 'new'\r\n\t\tend\r\n\tend",
"title": ""
},
{
"docid": "9876497e773569ae70357dbb9f7e35f4",
"score": "0.68527526",
"text": "def create\n @contact = Contact.new(contact_params)\n @contact.user_id = current_user.id if current_user\n @contact.request = request.headers.env.reject { |content|\n content.inspect.include?('rack') ||\n content.inspect.include?('action_dispatch') ||\n content.inspect.include?('warden') ||\n content.inspect.include?('SERVER') ||\n content.inspect.include?('COOKIE') ||\n content.inspect.include?('cookie') ||\n content.inspect.include?('session') ||\n content.inspect.include?('instance')\n }.inspect\n\n if @contact.save\n flash[:notice] = t('views.message.create.success')\n else\n flash[:alert] = ContactDecorator.flash(@contact, flash)\n end\n redirect_to :back\n end",
"title": ""
},
{
"docid": "bd44ae4b25ba452cc3e98538fb593f8a",
"score": "0.68442255",
"text": "def create_contact\n @contact = Spree::Address.new(contact_params)\n # Currently for demo, I will leave the country id to be 1, later update will be noticed!\n hard_code_contact(contact_params)\n respond_to do |format|\n if @contact.save\n @seller.spree_addresses << @contact\n format.html { redirect_to contacts_admin_seller_path, notice: \"Contacts #{@contact.firstname} #{@contact.lastname} is successfully created!\" }\n else\n flash[:error] = @contact.errors.full_messages\n format.html { render :new_contact }\n format.json { render :new_contact, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3b48f95942f7ad1634cbff3e21a23750",
"score": "0.68435967",
"text": "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to contacts_path, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "63de717903d047e2224afba2ade56a88",
"score": "0.6835854",
"text": "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "63de717903d047e2224afba2ade56a88",
"score": "0.6835854",
"text": "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "63de717903d047e2224afba2ade56a88",
"score": "0.6835854",
"text": "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "63de717903d047e2224afba2ade56a88",
"score": "0.6835854",
"text": "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "63de717903d047e2224afba2ade56a88",
"score": "0.6835854",
"text": "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "63de717903d047e2224afba2ade56a88",
"score": "0.6835854",
"text": "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1c68bdec7fd4f8273b7298affcb1ca5d",
"score": "0.68336976",
"text": "def create\n @contact = Contact.new(contact_params)\n @contact.sender = current_user.pseudo\n @contact.state = \"new\"\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to session[:previous_request_url], notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cf7c97a1c5777babedd4be89a9ae32ea",
"score": "0.6829399",
"text": "def initialize(first_name, last_name, contact)\n\t\tsuper(first_name, last_name)\n\t\t@contact = contact\n\tend",
"title": ""
},
{
"docid": "fc17c8aacda854ad22f54b364534d243",
"score": "0.6805207",
"text": "def contact\n @contact ||= OpenStruct.new(get_attr(:contact))\n end",
"title": ""
},
{
"docid": "fc26f4945872e1c354f5c221efe25af9",
"score": "0.6804075",
"text": "def create_contact_if_missing!\n return true unless contact.blank?\n\n # when creating a contact we should assume we're primary\n self.options.primary = true\n build_contact(create_contact_parameters)\n save\n end",
"title": ""
},
{
"docid": "acc69f5bf48ac533b72ddc90859008a3",
"score": "0.67974824",
"text": "def create\n # contact_params = mass assignment of form fields into contact object\n @contact = Contact.new(contact_params)\n \n # Saves the Contact object to the database\n if @contact.save\n # We need to retrieve info from contact_params\n # This stores form fields via parameters into variables\n name = params[:contact][:name]\n email = params[:contact][:email]\n body = params[:contact][:comments]\n \n # Send an email to the contact email\n ContactMailer.contact_email(name, email, body).deliver\n \n # Display the success message\n flash[:success] = \"Message sent.\"\n \n # Redirect the user back to the contact page\n redirect_to new_contact_path\n else\n # The error messages comes in as an array. \n # We need to join them together and display them\n flash[:danger] = @contact.errors.full_messages.join(\", \")\n redirect_to new_contact_path\n end\n end",
"title": ""
},
{
"docid": "8ef9123cf20f9677cc054af0f801e3b4",
"score": "0.67973506",
"text": "def build_contact(element, type)\n Record::Contact.new(\n :type => type,\n :id => node(\"#{element} ID\"),\n :name => node(\"#{element} Name\"),\n :organization => node(\"#{element} Organization\"),\n :address => node(\"#{element} Address\"),\n :city => node(\"#{element} City\"),\n :zip => node(\"#{element} Postal Code\"),\n :state => node(\"#{element} State/Province\"),\n :country_code => node(\"#{element} Country\"),\n :phone => node(\"#{element} Phone Number\"),\n :fax => node(\"#{element} Fax Number\"),\n :email => node(\"#{element} Email\")\n )\n end",
"title": ""
},
{
"docid": "2e421ccaa5e856129e0f1a0598555925",
"score": "0.6796409",
"text": "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render action: 'show', status: :created, location: @contact }\n else\n format.html { render action: 'new' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b87514207d1df6572ba66e04a4503354",
"score": "0.6792026",
"text": "def create\n @contact = Contact.new(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to(@contact, :notice => 'Contact was successfully created.') }\n format.xml { render :xml => @contact, :status => :created, :location => @contact }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "493246bcd073b53ef7a84b77ed855031",
"score": "0.6789718",
"text": "def create\n \n # Mass assignment of form fields into Contact object.\n @contact = Contact.new(contact_params)\n \n # Save the contact details into the Database.\n if @contact.save\n # If successful, save into local variables to allow\n # further processing, email.\n name = params[:contact][:name]\n email = params[:contact][:email]\n body = params[:contact][:comments]\n # Plug in the data into the mail message and send\n ContactMailer.contact_email(name, email, body).deliver\n \n # Store success message in flash hash and reset\n # new Contact screen.\n flash[:success] = \"Contact saved.\"\n redirect_to new_contact_path\n else\n # else if contact fails to save,\n # Store reported errors in flash hash and reset\n # new contact screen.\n flash[:danger] = @contact.errors.full_messages.join(\", \")\n redirect_to new_contact_path\n end\n end",
"title": ""
},
{
"docid": "ed2fc7eba9264343d5215440ab37f247",
"score": "0.678112",
"text": "def new\n print 'Name: '\n name = $stdin.gets.chomp\n print 'Email: '\n email = $stdin.gets.chomp\n phones = []\n while enter_a_phone_number?\n print 'Type: '\n type = $stdin.gets.chomp\n print 'Number: '\n number = $stdin.gets.chomp\n phones << {\n type: type,\n number: number\n }\n end\n contact = Contact.create(name, email, phones)\n puts \"Contact #{contact.id} created\"\n end",
"title": ""
},
{
"docid": "1cfb3d290c3f2248ba5ed95d7df75cce",
"score": "0.6776568",
"text": "def create\n \t@contact = Contact.create(params[:contact])\n \tredirect_to :root, notice: \"Contact Created!\"\n end",
"title": ""
},
{
"docid": "06da082021ce7106128398cc76e0baa4",
"score": "0.677514",
"text": "def create\n @contact = Contact.new(params[:contact])\n\n if @contact.save\n flash[:success] = \"Contact was successfully created.\"\n redirect_to crm_path\n else\n render :action => 'new'# Clear page\n end\n end",
"title": ""
},
{
"docid": "cd3dec32cac81884538d7a1c7d12de1c",
"score": "0.6757551",
"text": "def create\n # Contact object is re-assigning to the fields\n # Mass assigment of form fields into Contact object\n @contact = Contact.new(contact_params)\n # Save the Contact object to the database\n if @contact.save\n # If the save is successful\n # Grab the name, email, and comments from the parameters\n # and store them in these variables\n name = params[:contact][:name]\n email = params[:contact][:email]\n body = params[:contact][:comments]\n # Plug variables into Contact Mailer email method and send email\n ContactMailer.contact_email(name, email, body).deliver\n # Store success message in flash hash and redirect to new action\n flash[:success] = \"Message sent.\"\n redirect_to new_contact_path\n else\n # If Contact object doesnt save, store errors in flash hash\n # and redirect to new action\n # Errors will be in an array format\n flash[:danger] = @contact.errors.full_messages.join(\", \")\n redirect_to new_contact_path\n end\n end",
"title": ""
},
{
"docid": "271bda316fc304f831189cf9d28f8b5f",
"score": "0.67566854",
"text": "def create\n @contact = Contact.new(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Contato foi criado com sucesso.' }\n format.json { render json: @contact, status: :created, location: @contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "da71ff8cb13adc73f89707a15968db80",
"score": "0.6756685",
"text": "def add_new_contact\n\n\t\t# Getting information from user\n\t\tputs \"Enter your firstname\"\n\t\tfirstName = gets\n\n\t\tputs\"Enter your Lastname\"\n\t\tlastName = gets\n\n\t\tputs\"Enter Email\"\n\t\temail = gets\n\n\t\tputs \"Enter notes\"\n\t\tnotes = gets\n\n\t # Making a contact object\n\t contact = Contact.new(firstName, lastName, email, notes)\n\t @contacts << contact # Putting newly created object in array.\n\tend",
"title": ""
},
{
"docid": "06c5eebab0ea08578e484295f4b639e6",
"score": "0.6755166",
"text": "def create\n @contact = Contact.new(params[:contact])\n\n respond_to do |format|\n if @contact.save\n flash[:notice] = 'Contact was successfully created.'\n format.html { redirect_to(@contact) }\n format.xml { render :xml => @contact, :status => :created, :location => @contact }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "06c5eebab0ea08578e484295f4b639e6",
"score": "0.6755166",
"text": "def create\n @contact = Contact.new(params[:contact])\n\n respond_to do |format|\n if @contact.save\n flash[:notice] = 'Contact was successfully created.'\n format.html { redirect_to(@contact) }\n format.xml { render :xml => @contact, :status => :created, :location => @contact }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "06c5eebab0ea08578e484295f4b639e6",
"score": "0.6755166",
"text": "def create\n @contact = Contact.new(params[:contact])\n\n respond_to do |format|\n if @contact.save\n flash[:notice] = 'Contact was successfully created.'\n format.html { redirect_to(@contact) }\n format.xml { render :xml => @contact, :status => :created, :location => @contact }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "382c2a1362acc5e0da77109a23151674",
"score": "0.6751911",
"text": "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to new_contact_path, notice: 'We got your info! We\\'ve sent you a copy and we\\'ll get back to you soon.' }\n format.json { render :new, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8fe87ef2195f1e2f82cca1fcabf987b8",
"score": "0.6747893",
"text": "def add_new_contact \t\n\t print \"Enter First Name: \"\n\t first_name = gets.chomp\n\t print \"Enter Last Name: \"\n\t last_name = gets.chomp\n\t print \"Enter Email Address: \"\n\t email = gets.chomp\n\t print \"Enter a Note: \"\n\t note = gets.chomp\n\n\t contact = Contact.new(first_name, last_name, email, note)\n\t @rolodex.add_contact(contact)\n\tend",
"title": ""
},
{
"docid": "d7f26b3de71dc200416c79fa14eb1b45",
"score": "0.67440987",
"text": "def create\n # updating the @contact instance variable with the entered parameters (each user's information) to be saved to the db\n # 'contact_params' is a method that is called (outlined below) that says that we will securely save the entered data into the db\n # AKA: Mass assignment of form fields into Contact object\n @contact = Contact.new(contact_params)\n \n # Save the Contact object to the database\n if @contact.save\n # In order to send the ContactMailer email, we need to lift the parameter values for our instance variables from the params hash\n # From the private function below, we are grabbing :name, :email, and :comments (renamed to body) from the :contact KEY to use in our 'contact_email' method\n name = params[:contact][:name]\n email = params[:contact][:email]\n body = params[:contact][:comments]\n \n # Calls the 'contact_email' method from the contact_mailer.rb file with the above variables, and .deliver it\n ContactMailer.contact_email(name, email, body).deliver\n \n # Setting a specific message (flash) into a hash when the submission was successful\n flash[:success] = [\"Submission Successful\"]\n redirect_to new_contact_path\n else\n # Setting up the flash hash to show any errors that are incurred by concatenating them with a ', '\n # 'errors' method generates raw errors to be displayed when the '@contact.save' method was not successful\n # 'full_messages' method creates nice error messages from the raw 'errors' method that can then be joined\n flash[:danger] = @contact.errors.full_messages\n redirect_to new_contact_path\n end\n end",
"title": ""
},
{
"docid": "7c5e5d1175eb5db468e686b00d179390",
"score": "0.67421454",
"text": "def add_contact(contact_info)\n self.refresh_access_token!\n\n contact = OpenStruct.new({\n first_name: contact_info[:first_name],\n last_name: contact_info[:last_name],\n phone: contact_info[:phone]\n })\n\n haml_template = File.read(File.join(TEMPLATES_DIR, 'contact.xml.haml'))\n request_body = Haml::Engine.new(haml_template, remove_whitespace: true).render(Object.new, {\n contact: contact,\n user: self\n })\n\n @response = @oauth_access_token.post(\n 'https://www.google.com/m8/feeds/contacts/default/full',\n {\n body: request_body,\n headers: {\n 'Content-type' => 'application/atom+xml',\n 'GData-Version' => '3.0'\n }\n }\n )\n\n @response.status == 201\n end",
"title": ""
},
{
"docid": "5427b1f048571350bd5b564c076f4b4a",
"score": "0.67401886",
"text": "def create\n @contact = Contact.new(params[:contact])\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to(admin_contacts_url :notice => 'Contact was successfully created.') }\n format.xml { render :xml => @contact, :status => :created, :location => @contact }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2f26014cfa99ef4464818da8176331e9",
"score": "0.67246944",
"text": "def create(id, alas = nil)\n contact = contacts[id]\n unless alas.nil? || alas.empty?\n contact.alias = alas\n end # alas.nil? || alas.empty?\n contact\n end",
"title": ""
},
{
"docid": "2e51b71295a6380180d17b5fd2fa4000",
"score": "0.6724312",
"text": "def create\n @person_contact = PersonContact.new(params[:person_contact])\n\n respond_to do |format|\n if @person_contact.save\n format.html { redirect_to(@person_contact, :notice => 'Person contact was successfully created.') }\n format.xml { render :xml => @person_contact, :status => :created, :location => @person_contact }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @person_contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1541bf71caeebf04e065ef3a7869e0c5",
"score": "0.67238164",
"text": "def create\n @contact = @business.contacts.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to business_contact_path(@business, @contact), notice: 'Contact was successfully created.' }\n format.json { render json: @contact, status: :created, location: business_contact_path(@business,@contact) }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "494a27cd037b91a5cd76a6009dbee826",
"score": "0.67120236",
"text": "def create\n @contact = Contact.new(contact_params)\n @contact.user_id = current_user.id\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to contacts_path, notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "33c5e74f12ac14587e8103e34d0b87d0",
"score": "0.67040056",
"text": "def initialize(first_name, last_name, email, note)\n @first_name = first_name\n @last_name = last_name\n @email = email\n @note = note\n @id = @@id\n @@id += 1 # each new contact will get a different id\n end",
"title": ""
},
{
"docid": "693e850fc53da641c58a7f4ec4815668",
"score": "0.6695752",
"text": "def create(name, email, phones)\n raise 'A contact with that email already exists' if all.any? { |contact| contact.email == email }\n contact = Contact.new(next_id, name, email, phones)\n CSV.open(@@file_path, 'a') { |csv| csv << [contact.id, contact.name, contact.email, serialize_phones(contact.phones)] }\n contact\n end",
"title": ""
},
{
"docid": "3950ad0d9019715f52ac53e57118dbd6",
"score": "0.669212",
"text": "def create\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.new(params[:cust_contact])\n\n respond_to do |format|\n if @cust_contact.save\n format.html { redirect_to @cust_contact.customer, :notice => 'Contact was successfully created.' }\n format.json { render :json => @cust_contact, :status => :created, :location => @cust_contact }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1c95ef2f914a5dbbf0759fe9907c72c5",
"score": "0.66859263",
"text": "def create\n @user_contact = UserContact.new(params[:user_contact])\n\n respond_to do |format|\n if @user_contact.save\n format.html { redirect_to(@user_contact, :notice => 'UserContact was successfully created.') }\n format.xml { render :xml => @user_contact, :status => :created, :location => @user_contact }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f8349704f86fb8582c81d17bffd20d65",
"score": "0.6680011",
"text": "def add_new_contact\n print \"First Name:\"\n first_name = gets.chomp\n print \"last name:\"\n last_name = gets.chomp\n print \"Email:\"\n email = gets.chomp\n print \"Note:\"\n note = gets.chomp\n contact = Contact.new(first_name, last_name, email, note)\n add_contact(contact)\n end",
"title": ""
},
{
"docid": "67d15c7475af5592d3e5a6e14d261569",
"score": "0.66484624",
"text": "def create\n @breadcrumb = 'create'\n @corp_contact = CorpContact.new(params[:corp_contact])\n @corp_contact.created_by = current_user.id if !current_user.nil?\n # Should use attachment from drag&drop?\n if @corp_contact.avatar.blank? && !$attachment.avatar.blank?\n @corp_contact.avatar = $attachment.avatar\n end\n\n respond_to do |format|\n if @corp_contact.save\n $attachment.destroy\n $attachment = nil\n format.html { redirect_to @corp_contact, notice: crud_notice('created', @corp_contact) }\n format.json { render json: @corp_contact, status: :created, location: @corp_contact }\n else\n $attachment.destroy\n $attachment = Attachment.new\n format.html { render action: \"new\" }\n format.json { render json: @corp_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2d01962bae32b03b22e68eb2cea417dd",
"score": "0.6647914",
"text": "def create\n @contact = @current_affiliate_group.contacts.build(params[:contact])\n @contact.issue_status = IssueStatus[:New]\n\n respond_to do |format|\n if @contact.save\n flash[:notice] = 'Your message was successfully sent.'\n format.html { redirect_to(home_path) }\n format.xml { render :xml => @contact, :status => :created, :location => @contact }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0f335f601fe583686a9581eb18db8e28",
"score": "0.6647359",
"text": "def create\n @crm_contact = CrmContact.new(params[:crm_contact])\n\n respond_to do |format|\n if @crm_contact.save\n format.html { redirect_to @crm_contact, notice: 'Crm contact was successfully created.' }\n format.json { render json: @crm_contact, status: :created, location: @crm_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @crm_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c13b6ba0f297d0f8ae6761a972f662db",
"score": "0.66299295",
"text": "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to contacts_url, notice: 'Contact was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"title": ""
},
{
"docid": "f15c0a411cfecea7d300e583b1432f43",
"score": "0.66295433",
"text": "def create\n contact = Contact.create(contact_params)\n\n if contact.new_record?\n render json: { errors: contact.errors.messages }, status: 422\n else\n render json: contact, status: 201\n end\n end",
"title": ""
},
{
"docid": "4a719a31ffee378f8af2a4c4a6e80c48",
"score": "0.6628953",
"text": "def create\n @contact = current_user.contacts.new(name:params[:name], email:params[:email])\n @contact = current_user.contacts.new(params[:contact])\n @server_id = params[:server_id].to_i\n @contact.save\n end",
"title": ""
},
{
"docid": "acf807bc345c74e92707658c9e920585",
"score": "0.66211236",
"text": "def create\n @user_contact = UserContact.new(user_contact_params)\n\n respond_to do |format|\n if @user_contact.save\n format.html { redirect_to @user_contact, notice: 'User contact was successfully created.' }\n format.json { render :show, status: :created, location: @user_contact }\n else\n format.html { render :new }\n format.json { render json: @user_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "41849dafd0439eb180b2a184d1802697",
"score": "0.6619175",
"text": "def create\n \n @contact = @customer.contacts.build(params[:contact])\n\n respond_to do |format|\n if @contact.save\n flash[:notice] = _('Contact was successfully created.')\n format.html { redirect_to(customer_contact_url(:customer_id => @customer.id, :id => @contact.id)) }\n format.js { render :text => \"contact added\", :layout => false }\n format.xml { render :xml => @contact, :status => :created, :location => @contact }\n else\n format.html { render :action => \"new\", :layout => request.xhr? }\n format.xml { render :xml => @contact.errors, :status => :unprocessable_entity }\n end\n end\n\n end",
"title": ""
},
{
"docid": "1a02ff9963c028bebbcd52a65b7751f9",
"score": "0.6617423",
"text": "def create\n @contact = Contact.new(contact_params)\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: 'Kontakten skapades, success.' }\n format.json { render action: 'show', status: :created, location: @contact }\n else\n format.html { render action: 'new' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e585410ac84de2c45f308e7b5615eb61",
"score": "0.6611402",
"text": "def create\n @contact = Contacts::Person.new(contacts_person_params.merge(user: current_user))\n company = Contacts::Company.new(contacts_company_params.merge(user: current_user)) if params[:contacts_company]\n @contact.company = company if @contact.company.nil? && !company.nil? && company.valid?\n\n respond_to do |format|\n if @contact.save\n format.html { redirect_to @contact, notice: t('controllers.contacts.people.create.success') }\n format.json { render :show, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
10d48b2909e4bebb1441899b39f732d6 | Create a new dataset, if the decay factor is too big the flt ruby library is used for internal computations to allow greater precision, the performance impact should be minimal. | [
{
"docid": "3c0538097516e96fb84477cbd8e86384",
"score": "0.42229658",
"text": "def initialize(id, reservoir_size, alpha)\n @id = id\n @values = Drone::request_hash(\"#{@id}:values\")\n @count = Drone::request_number(\"#{@id}:count\", 0)\n @start_time = Drone::request_number(\"#{@id}:start_time\", current_time())\n @next_scale_time = Drone::request_number(\"#{@id}:next_scale_time\", current_time() + RESCALE_THRESHOLD)\n \n @alpha = alpha\n @reservoir_size = reservoir_size\n end",
"title": ""
}
] | [
{
"docid": "f2585052c44657155513570fdc2d9846",
"score": "0.5149174",
"text": "def prepare_data(num_rows)\n app_train = read_dataset_from_csv('./input/application_train', num_rows)\n data = app_train[\"data\"]\n set_categorical_labels(data)\n numeric_features, _categorical_features = get_numeric_cateforical_features_from_the_raw_dataset(app_train[\"data\"])\n categorical_features_one_hot_encode = get_one_hot_feature_map_from_the_origin_dataset(data)\n one_hot_encoding_using_feature_map(data, categorical_features_one_hot_encode)\n\n # NaN values for DAYS_EMPLOYED: 365243 -> nan\n data.each do |r|\n r_features = r[\"features\"]\n if r_features[\"days_empoyed\"] == 365243\n r_features[\"days_employed\"] = \"\"\n r_features[\"days_employed_anom\"] = 1\n else\n r_features[\"days_employed_anom\"] = 0 \n end \n \n add_ratio_feature(\"payment_rate\", \"amt_annuity\", \"amt_credit\", r)\n add_ratio_feature(\"annuity_income_ratio\", \"amt_annuity\", \"amt_income_total\", r)\n add_ratio_feature(\"credit_goods_ratio\", \"amt_credit\", \"amt_goods_price\", r)\n # add_ratio_feature(\"income_person_ratio\", \"amt_income_total\", \"cnt_fam_members\", r)\n add_ratio_feature(\"employed_birth_ratio\", \"days_employed\", \"days_birth\", r)\n end\n # categorical_features << \"days_employed_anom\"\n\n bureau = read_dataset_from_csv('./input/bureau', 1000, $bureau_numeric_features)\n # bureau[\"data\"].each do |r|\n # puts r[\"features\"][\"days_enddate_fact\"]\n # end\n # return\n grouped = group_data(bureau[\"data\"])\n agged = agg_group_data(grouped, $bureau_numeric_features, \"bureau\")\n merge_to_dataset(app_train, agged, $bureau_numeric_features)\n\n app_train[\"features\"] = app_train[\"data\"][0][\"features\"].keys\n\n puts \"begin to normalize the dataset......\"\n nomalizer = Normalizer.new\n nomalizer.normalize(app_train, numeric_features)\n\n puts \"begin to impute missing value......\"\n imputer = SimpleImputer.new\n imputer.fit(app_train)\n \n puts \"finish preparing the dataset!\"\n return app_train\nend",
"title": ""
},
{
"docid": "f8700ae9064e4e0c4dc18b3bce678285",
"score": "0.5135847",
"text": "def train_data\n ::RubyFann::TrainData.new(\n :inputs => inputs, \n :desired_outputs=> desired_outputs)\n end",
"title": ""
},
{
"docid": "06b0b10c0656a5ee5192217054df71b6",
"score": "0.5122931",
"text": "def new\n @dataset = Dataset.new\n 3.times do\n @dataset.dataset_variables << DatasetVariable.new\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end",
"title": ""
},
{
"docid": "d98ec01dde65aeac7c2f58833ea955e4",
"score": "0.5093774",
"text": "def initialize decay, initial = 0.0\n @decay, @average = decay.to_f, initial.to_f\n end",
"title": ""
},
{
"docid": "810fbe2a2a553e6438fa5688a58cd699",
"score": "0.50811476",
"text": "def create_measure_period_v1_data_criteria(doc,measure_period,v1_data_criteria_by_id)\n\n attributes = doc[:attributes]\n attributes.keys.each {|key| attributes[key.to_s] = attributes[key]}\n \n measure_period_key = attributes['MEASUREMENT_PERIOD'][:id]\n measure_start_key = attributes['MEASUREMENT_START_DATE'][:id]\n measure_end_key = attributes['MEASUREMENT_END_DATE'][:id]\n \n @measure_period_v1_keys = {measure_start: measure_start_key, measure_end: measure_end_key, measure_period: measure_period_key}\n \n type = 'variable'\n code_list_id,negation_code_list_id,property,status,field_values,effective_time,inline_code_list,children_criteria,derivation_operator,temporal_references,subset_operators=nil\n \n #####\n ##\n ######### SET MEASURE PERIOD\n ##\n #####\n \n measure_period_id = HQMF::Document::MEASURE_PERIOD_ID\n value = measure_period\n measure_criteria = HQMF::DataCriteria.new(measure_period_id,measure_period_id,nil,measure_period_id,code_list_id,children_criteria,derivation_operator,measure_period_id,status,\n value,field_values,effective_time,inline_code_list, false, nil, temporal_references,subset_operators,nil,nil)\n \n # set the measure period data criteria for all measure period keys\n v1_data_criteria_by_id[measure_period_key] = measure_criteria\n v1_data_criteria_by_id[measure_start_key] = measure_criteria\n v1_data_criteria_by_id[measure_end_key] = measure_criteria\n @measure_period_criteria = measure_criteria\n \n end",
"title": ""
},
{
"docid": "3692e8e07e52aba2d809847ef986f4ee",
"score": "0.5030038",
"text": "def build!(data_set_name)\n interface(data_set_name).create_empty_data_set\n library[data_set_name] = DataSet.new(data_set_name, interface(data_set_name))\n end",
"title": ""
},
{
"docid": "3d27d1e009f0eff4f8792c0ab430211a",
"score": "0.49954945",
"text": "def initialize(data=[], shape:nil, dtype: nil, device:Device.new(:numo)) # TODO: Refactor this method.\n shape ||= Shape.new()\n if data\n if data.is_a?(Array)\n data_arr = Numo::NArray[*data]\n predicted_type = DataTypes::Float64\n if data.flatten[0].is_a?(Integer)\n predicted_type = DataTypes::Int64\n elsif data.flatten[0].is_a?(Float)\n predicted_type = DataTypes::Float64\n elsif data.flatten[0].is_a?(Complex)\n predicted_type = DataTypes::Complex128\n else\n predicted_type = DataTypes::RObject\n end\n @dtype ||= predicted_type\n data = @dtype.get_dtype_on_device(device).cast(data_arr)\n @shape = shape || Shape.new(*data.shape)\n elsif data.is_a?(Numeric)\n predicted_type = DataTypes::RObject\n if data.is_a?(Integer)\n predicted_type = DataTypes::Int64\n elsif data.is_a?(Float)\n predicted_type = DataTypes::Float64\n elsif data.is_a?(Complex)\n predicted_type = DataTypes::Complex128\n end\n xmo_type = predicted_type.get_dtype_on_device(device)\n data = xmo_type[data]\n device = device\n elsif data.is_a?(Numo::NArray)\n @dtype ||= DataTypes::from_numo_dtype(data.class)\n elsif data.is_a?(Tensor)\n data = data.data\n else\n raise TypeError, \"#{data.class} is cannot convert to tensor. data must be Array or Numo::NArray.\"\n end\n @device = device\n @data = data\n @shape ||= Shape.new(*data.shape.to_a)\n @dtype ||= DataTypes::from_numo_dtype(data.class)\n else\n @device = device\n @shape = shape\n @dtype ||= DataTypes::RObject\n @data = @dtype.get_dtype_on_device(@device).zeros(*@shape.to_a)\n end\n @grad_function = nil\n @grad_tensor = nil\n @requires_grad = false\n return Functions::Constant.new.call(self)\n end",
"title": ""
},
{
"docid": "12dbdffb901daeadcdd7d502febbbc97",
"score": "0.4984932",
"text": "def train(options = {})\n options.reverse_merge!({ :max_epochs => 100000, :epochs_between_reports => 500, :desired_error => 0.0001 })\n #fann.train_on_data(train_data, 10000, 100, 0.00001)\n fann.train_on_data(train_data, options[:max_epochs], options[:epochs_between_reports], options[:desired_error] * normalization_factor)\n end",
"title": ""
},
{
"docid": "852b7cc6145f987a6a02eca98fa0e0dd",
"score": "0.49107778",
"text": "def initialize(data, fft_strategy = Digiproc::Strategies::Radix2Strategy)\r\n @data = data\r\n @strategy = fft_strategy.new\r\n end",
"title": ""
},
{
"docid": "a02d9420945deb2bc1fc9b67b14888db",
"score": "0.4909045",
"text": "def initialize(var_num, var_den, df_num, df_den, opts=Hash.new)\n @var_num=var_num\n @var_den=var_den\n @df_num=df_num\n @df_den=df_den\n @var_total=var_num+var_den\n @df_total=df_num+df_den\n opts_default={:tails=>:right, :name=>_(\"F Test\")}\n @opts=opts_default.merge(opts)\n raise \"Tails should be right or left, not both\" if @opts[:tails]==:both\n opts_default.keys.each {|k|\n send(\"#{k}=\", @opts[k])\n }\n end",
"title": ""
},
{
"docid": "640fdf204b599d827694a2b58dc34360",
"score": "0.483816",
"text": "def initialize(mean: , stddev: , size: ,generator: Digiproc::Strategies::GaussianGeneratorBoxMullerStrategy.new)\r\n @mean, @stddev, @generator, @size = mean, stddev, generator, size\r\n generator.mean = mean\r\n generator.stddev = stddev\r\n data = []\r\n size.times do \r\n data << generator.rand\r\n end\r\n @data = data\r\n initialize_modules(Digiproc::FourierTransformable => {time_data: data})\r\n end",
"title": ""
},
{
"docid": "e8030ad7c8099210a0927314f98aef6d",
"score": "0.47929594",
"text": "def predict new_data_set=nil\n if new_data_set.nil? then\n @fitted_mean_values\n else\n new_data_matrix = new_data_set.to_matrix\n b = @coefficients.to_matrix axis=:vertical\n create_vector measurement(new_data_matrix, b).to_a.flatten\n end\n end",
"title": ""
},
{
"docid": "349caba7e61704c379114e05525ab3cf",
"score": "0.47804117",
"text": "def learn(_d)\n # average\n u = @u\n @u = 0\n _d.each do |d|\n if d == \"?\"\n @u += u\n else\n @u += d\n end\n end\n @u /= _d.size\n\n # variance\n @s = 0\n _d.each do |d|\n if d == \"?\"\n # nothing\n else\n @s += (@u - d)**2\n end\n end\n @s /= _d.size\n end",
"title": ""
},
{
"docid": "072e92253cdc169924f4ca6a1cb6b17b",
"score": "0.47492868",
"text": "def dataset\n @dataset ||= data_maker.dataset\n end",
"title": ""
},
{
"docid": "ad664519dc4dfc0fcd06742bb6fb6be9",
"score": "0.47306317",
"text": "def initialize data, target, parameters\r\n\t\tsuper(data, target, parameters)\r\n\t\t@silentMode\t\t\t= !(parameters[:silentMode] || false)\r\n\t\t@gradientModel\t\t= parameters[:gradientDescent] || false\r\n\t\tnewRegressor\r\n\tend",
"title": ""
},
{
"docid": "aceec21c811ad615c19183a941a0523c",
"score": "0.47222435",
"text": "def initialize( floating_points: false )\n @weights = []\n @max_weight = BASE_WEIGHT\n @floating_points = floating_points\n end",
"title": ""
},
{
"docid": "afca6f0f4fd888d3ae47c230ef75c922",
"score": "0.47117263",
"text": "def dataset\n @dataset_class.new(self)\n end",
"title": ""
},
{
"docid": "905fbc89a973caf31caf8b5504fe9a45",
"score": "0.4695613",
"text": "def from(value)\n new(dataset.from(value))\n end",
"title": ""
},
{
"docid": "e3d7d45755de0ce9bcd0eeb6eb9740cc",
"score": "0.46938297",
"text": "def to_ds\r\n Digiproc::DigitalSignal.new(data: self.weights)\r\n end",
"title": ""
},
{
"docid": "34b0021ac98c3a0885776be00130db3f",
"score": "0.46872178",
"text": "def dataset\n @dataset ||= generate_dataset\n end",
"title": ""
},
{
"docid": "9cee9b38d6c07926fe10376481a19230",
"score": "0.46683708",
"text": "def to_dfa\n RLSM::DFA.new(subset_construction).minimize!\n end",
"title": ""
},
{
"docid": "b4d6c21bb411dcd38db5bffcd4ecc935",
"score": "0.4637698",
"text": "def train_set\n data_input = data_output = @data_input\n data_input.delete_at(data_input.index(data_input.last))\n data_output.delete_at(data_output.index(data_output.first))\n RubyFann::TrainData.new(inputs: data_input,\n desired_outputs: data_output)\n end",
"title": ""
},
{
"docid": "50f44dbc33a6919e53876f96dcea2c03",
"score": "0.46211508",
"text": "def calculate\r\n self.strategy.data = time_data if @strategy.data.nil?\r\n @fft = self.strategy.calculate\r\n @data = @fft\r\n end",
"title": ""
},
{
"docid": "8369b0ed2e85e0c9691d8990d9f0c400",
"score": "0.46166033",
"text": "def initialize(delta=0.0, data=nil)\n super(data)\n \n @delta = delta || 0.0\n end",
"title": ""
},
{
"docid": "6a28e157663d80a866e5335479ae428d",
"score": "0.46151647",
"text": "def make_copy\n attributes = self.attributes.select {|k,y| k != :id}\n factors_attributes = self.factors.map { |factor| factor.attributes.select {|k,v| k != :id} }\n fd = FactorDefinition.new(attributes)\n factors_attributes.each do |factor_attributes|\n fd.factors << Factor.new(factor_attributes)\n end\n return fd\n end",
"title": ""
},
{
"docid": "da682e54884fdae358c025dd4584a772",
"score": "0.46083912",
"text": "def initialize(normalized: nil, number_of_days: nil, data_period: nil, start_date: nil, end_date: nil, data_interval: nil, symbol: nil, type: 'price', params: ['sma'])\n @normalized = normalized\n @number_of_days = number_of_days\n @data_period = data_period\n @start_date = start_date\n @end_date = end_date\n @data_interval = data_interval\n @symbol = symbol.to_s\n @type = type.to_s\n @params = params\n end",
"title": ""
},
{
"docid": "ee4ded355d5bfa83081ae3f29c5ea90f",
"score": "0.4578344",
"text": "def dataset\n DB[SQL, from: from_truncated, to: to_truncated, tick: tick]\n end",
"title": ""
},
{
"docid": "ce281e9a2fc7f2b3bc71ce0ed1967df9",
"score": "0.45688182",
"text": "def to_fdf; end",
"title": ""
},
{
"docid": "cc1e51f7117bb8d1264a33cf7b5dcd6d",
"score": "0.4561942",
"text": "def create_dataset 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_dataset_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::AutoML::V1beta1::Dataset.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"title": ""
},
{
"docid": "b4d18e49ef0aa2cb2beca51a30521d87",
"score": "0.45267978",
"text": "def fresh_dataset\n @dataset.clone\n end",
"title": ""
},
{
"docid": "f36e0a1dd827777ed1b54dd278acc5bd",
"score": "0.45221117",
"text": "def create\n feature_params = params[:feature]\n name = feature_params[:name]\n cat = feature_params[:cat]\n weight = feature_params[:weight]\n category = feature_params[:category]\n # continuous feature creation code\n if cat.to_i == 0\n lower = feature_params[:lower]\n upper = feature_params[:upper]\n if Feature.where(name: name).empty?\n a = Feature.create(name: name)\n a.description = feature_params[:description]\n if feature_params[:description].blank?\n a.description = 'Your Own Feature(s) - Continuous'\n a.added_by = current_user.id\n a.company = true if feature_params[:company] == 'true'\n end\n a.active = true\n a.category = feature_params[:category]\n a.unit = feature_params[:unit]\n a.icon = feature_params[:icon]\n a.save!\n DataRange.create(feature_id: a.id, is_categorical: false, lower_bound: lower.to_i, upper_bound: upper.to_i)\n else\n a = Feature.where(name: name).first\n a.description = feature_params[:description]\n if feature_params[:description].blank?\n a.description = 'Your Own Feature(s) - Continuous'\n a.added_by = current_user.id\n a.company = true if feature_params[:company] == 'true'\n end\n a.active = true\n a.category = feature_params[:category]\n a.unit = feature_params[:unit]\n a.icon = feature_params[:icon]\n a.save!\n d = a.data_range\n if !d.nil?\n unless d.categorical_data_options.empty?\n d.categorical_data_options.each(&:destroy!)\n end\n d.lower_bound = lower.to_i\n d.upper_bound = upper.to_i\n d.is_categorical = false\n d.save!\n else\n DataRange.create(feature_id: a.id, is_categorical: false, lower_bound: lower.to_i, upper_bound: upper.to_i)\n end\n end\n else\n puts \"making categorical feature\"\n putsfeature_ params\n opts = feature_params[:opts].split('*')\n if Feature.where(name: name).empty?\n a = Feature.create(name: name)\n a.category = feature_params[:category]\n a.description = feature_params[:description]\n if feature_params[:description].blank?\n a.description = 'Your Own Feature(s) - Categorical'\n a.added_by = current_user.id\n a.company = true if feature_params[:company] == 'true'\n end\n a.active = true\n a.save!\n rng = DataRange.create(feature_id: a.id, is_categorical: true, lower_bound: nil, upper_bound: nil)\n opts.each do |o|\n CategoricalDataOption.create(data_range_id: rng.id, option_value: o)\n end\n else\n a = Feature.where(name: name).first\n a.description = feature_params[:description]\n if feature_params[:description].blank?\n a.description = 'Your Own Feature(s) - Categorical'\n a.added_by = current_user.id\n a.company = true if feature_params[:company] == 'true'\n end\n a.active = true\n a.category = feature_params[:category]\n a.save!\n d = a.data_range\n if !d.nil?\n unless d.categorical_data_options.empty?\n d.categorical_data_options.each(&:destroy!)\n end\n d.lower_bound = nil\n d.upper_bound = nil\n d.is_categorical = true\n d.save!\n else\n d = DataRange.create(feature_id: a.id, is_categorical: true, lower_bound: nil, upper_bound: nil)\n end\n\n feature_params[:opts].split('*').each do |o|\n CategoricalDataOption.create(data_range_id: d.id, option_value: o)\n end\n\n end\n end\n puts 'new feature and weight'\n puts a.id\n puts a.inspect\n redirect_to features_path\n end",
"title": ""
},
{
"docid": "8304319063b0cf1c29a681edd9ebbe32",
"score": "0.4517785",
"text": "def createBetaPowerEfficient\n stations = createSpaceStation\n \n return BetaPowerEfficientSpaceStation.new(stations[0])\n end",
"title": ""
},
{
"docid": "26e637f192db2608346559db1384b3a0",
"score": "0.45006138",
"text": "def initialize(limit, offset, kernel_type='RBF', features=nil)\n @features = features||Diabetic::FEATURES\n\n @test_data_set = Diabetic.limit(limit).offset(offset)\n @training_data_set = Diabetic.excludes(@test_data_set.collect(&:id))\n\n @training = @training_data_set.collect {|d| @features.collect {|f| d.send(f)}}\n\n @problem = Libsvm::Problem.new\n @parameter = Libsvm::SvmParameter.new\n @parameter.kernel_type = \"Libsvm::KernelType::#{kernel_type}\".constantize\n @parameter.cache_size = 200 # in megabytes\n @parameter.eps = 0.001\n @parameter.c = 100\n\n @parameter.svm_type = Libsvm::SvmType::NU_SVC unless ['PRECOMPUTED'].include?(kernel_type)\n @parameter.nu = 0.0001\n @parameter.degree = 1 if ['POLY'].include?(kernel_type)\n @parameter.coef0 = 0.1 if ['SIGMOID', 'POLY'].include?(kernel_type)\n @parameter.gamma = 0.1 if ['RBF', 'SIGMOID', 'POLY'].include?(kernel_type)\n\n @labels = @training.collect {|t| t.pop}\n @examples = @training.map {|ary| Libsvm::Node.features(ary)}\n\n\n @problem.set_examples(@labels, @examples)\n\n @svm = Libsvm::Model.train(@problem, @parameter)\n end",
"title": ""
},
{
"docid": "110c9a5bf961c5bf6fbab28fabb37a76",
"score": "0.44900754",
"text": "def ifft_ds\r\n Digiproc::DigitalSignal.new(data: ifft)\r\n end",
"title": ""
},
{
"docid": "d2fdc45418b22e9cb361bca1464df67f",
"score": "0.44837466",
"text": "def trainAsGradientDescent\r\n\t\tlRate \t\t\t\t= @parameters[:lRate] || @@defaultGDLearnRate \r\n\t\titerations\t\t\t= @parameters[:iterations] || @@defaultGDIterations\r\n\t\t#Skip identical train\r\n\t\treturn if @trained && @gradientModel && @learningRate == lRate && @iterations == iterations\r\n\t\t#Set hyperparameters\r\n\t\t@learningRate \t\t= lRate\r\n\t\t@iterations\t\t\t= iterations\r\n\t\t#Train Gradient Descent\r\n\t\t@lr.train_gradient_descent @learningRate, @iterations, @silentMode\r\n\t\t#Train flags update\r\n\t\t@trained \t\t\t= true\r\n\t\t@gradientModel\t\t= true\r\n\tend",
"title": ""
},
{
"docid": "da4437b2a73588c23922fb3d0a476925",
"score": "0.44807127",
"text": "def make_fit(vals)\n return vals if vals.size < SPARK_WIDTH\n\n vals << vals.last if vals.size.odd?\n ret = vals.each_slice(2).with_object([]) { |s, a| a << (s.sum / 2) }\n make_fit(ret)\n end",
"title": ""
},
{
"docid": "d34b28d363c5397fd92cd138f146beb7",
"score": "0.44783646",
"text": "def clone\n new = Signal.new(:data => @data.clone, :sample_rate => @sample_rate)\n new.instance_variable_set(:@frequency_domain, @frequency_domain)\n return new\n end",
"title": ""
},
{
"docid": "0b47dbffcc9fcf83dcc0de60a9bacb26",
"score": "0.44704315",
"text": "def initialize(old_data, new_data)\n @old_data = old_data.is_a?(StackDataSet) ? old_data : StackDataSet.new(old_data)\n @new_data = new_data.is_a?(StackDataSet) ? new_data : StackDataSet.new(new_data)\n analyze\n end",
"title": ""
},
{
"docid": "26908bf8b9d492e05b9de7e73d23c583",
"score": "0.4468132",
"text": "def newRegressor\r\n\t\t@trained\t\t= false\r\n\t\t@lr \t\t\t= RubyLinearRegression.new\r\n\t\tputs trainingData.getDataStructure(useHash).first\r\n\t\t@lr.load_training_data trainingData.getDataStructure(useHash), trainingDataAsArray\r\n\tend",
"title": ""
},
{
"docid": "090c3388397bf3164530c5aaa2a3eb0e",
"score": "0.4451569",
"text": "def sampling_data(fun, v1=vv1, v2=vv2, repeat1=30, plan=NULL)\n len = v1.length\n data1 = Array.new(len, 0)\n len.times {|factor1|\n data1[factor1] = make_data_set(fun, v1, v2, factor1, repeat1, plan)\n }\n\n print \"sampling_data data is \\n\"\n p data1\n\n data1\nend",
"title": ""
},
{
"docid": "194ac4c4429599d54b8cfe6e66a62727",
"score": "0.44501635",
"text": "def test_multipliers\n revenue = Dataset::Measure.new(:name => \"Revenue\", :units => Dataset::Units::Dollars)\n assert_equal(\"dollars\", revenue.describe)\n r1 = revenue.instance(50, :million)\n assert_equal(50_000_000, r1.value)\n end",
"title": ""
},
{
"docid": "a002a92a0cc2ec74eeaf4126f389fc39",
"score": "0.44472015",
"text": "def initialize\n\t\t@training_list=Array.new\n\t\t@w = Array.new(FEATURE_SIZE,0)\n\tend",
"title": ""
},
{
"docid": "a1cdebba6b1904c78dfa16cf921486be",
"score": "0.444153",
"text": "def adaBoostTrainDS(dataArr,classLabels,numIt=40)\n weakClassArr = []\n m = shape(dataArr)[0]\n d = Array.new(m, 1.0/m) # init D to all equal\n aggClassEst = zeros(m,0)\n numIt.times do |i|\n bestStump,error,classEst = buildStump(dataArr,classLabels,d) # build Stump\n #printf(\"\\t[Test] classEst=%s\\n\", classEst)\n alpha = float(0.5*Math.log((1.0-error)/[error,1e-16].max)) #calc alpha, throw in max(error,eps) to account for error=0\n #printf(\"\\t[Test] alpha=#{alpha}\\n\")\n bestStump['alpha'] = alpha\n weakClassArr << bestStump #store Stump Params in Array\n # expon = multiply(-1*alpha*mat(classLabels).T,classEst)\n expon = (classLabels.multi(classEst)).multi(-1*alpha)\n #printf(\"\\t[Test] d=#{d} (expon=#{expon})\\n\")\n d = d.to_enum(:each_with_index).collect{|v,i| v*Math.exp(expon[i])}\n #d = d.multi(Math.exp(expon))\n #printf(\"\\t[Test] d=#{d} (d.sum=#{d.sum})\\n\") \n d = d/(d.sum)\n printf(\"\\t[Test] d=#{d}\\n\")\n #calc training error of all classifiers, if this is 0 quit for loop early (use break) \n #aggClassEst += alpha*classEst\n aggClassEst.plus!(classEst.multi(alpha))\n #printf(\"\\t[Test] aggClassEst=%s\\n\", aggClassEst)\n aggErrors = []\n aggClassEst.each_with_index do |v,i|\n #printf(\"\\t[Test] sign(%s)=%s <-> %s\\n\", v, sign(v), int(classLabels[i]))\n if Float(sign(v))!=classLabels[i]\n aggErrors << 1\n else\n aggErrors << 0\n end\n end\n errorRate = aggErrors.sum/Float(m) \n printf(\"\\t[Loop#{i+1}] total error: #{errorRate}...\\n\") \n break if errorRate == 0.0 \n end \n return weakClassArr\n end",
"title": ""
},
{
"docid": "d536d632f708570928be3dfcf6a1a1c9",
"score": "0.4441501",
"text": "def initialize(dataset = [], options = {})\r\n @dataset = dataset\r\n @dataset_normalized = []\r\n\r\n @normalization = options[:normalization] || :none # linear or standard_deviation\r\n\r\n normalize()\r\n end",
"title": ""
},
{
"docid": "513bf1fb24a48fcc6043732187fe81ad",
"score": "0.44326603",
"text": "def learning_curve factor\n @learning_curve = []\n current_week_data = current_user.reports.where(exam_date:(Time.now.all_week())).map {|x| x.send(:\"#{factor}\")}\n prev_week_data = current_user.reports.where(exam_date:((Time.now-1.week).all_week())).map {|x| x.send(:\"#{factor}\")}\n @learning_curve << (average(current_week_data) - average(prev_week_data)).round(2)\n current_month_data = current_user.reports.where(exam_date:(Time.now.all_month())).map {|x| x.send(:\"#{factor}\")}\n prev_month_data = current_user.reports.where(exam_date:((Time.now-1.month).all_month())).map {|x| x.send(:\"#{factor}\")}\n @learning_curve << (average(current_month_data) - average(prev_month_data)).round(2)\n @learning_curve = [0,0] if @learning_curve.empty?\n end",
"title": ""
},
{
"docid": "bb9785a886dc4f2f63c9b81f628dde95",
"score": "0.44307923",
"text": "def build_data(id, range, mean, start_date, end_date,ch_id)\n cols=[:measure_id, :site_id, :channel_id, :dt, :value]\n batch_data=[]\n start_date.upto(end_date) { |dt|\n puts \"DATE #{dt}\"\n Site.find(:all).each { |site|\n r=rand*2-1\n #Instead of a pure random value we use a normal distribution to get the values to crowd around the mean.\n val=Statistics2.normaldist(r)*range+(mean-range/2)\n batch_data <<[id, site.id,ch_id,dt,val]\n #measrec=Measurement.create(:measure_id => id, :site_id => site.id, \n #:channel_id => ch.id, :dt => dt, :value => val)\n }\n }\n Measurement.import(cols, batch_data)#Mass importing of data. A lot faster than 1 insert at a time.\n #Put the limit writing code here.\nend",
"title": ""
},
{
"docid": "1897238c581849bf7a2558c5b6d6a7d4",
"score": "0.44288796",
"text": "def make_training_set training_set_size\n sample = $ou.to_a.sample(training_set_size).shuffle\n data_to_csv 'train.csv', sample\nend",
"title": ""
},
{
"docid": "7e41bda2dd05d024d5b07752fa90bd44",
"score": "0.44256",
"text": "def predict new_data_set=nil\n if new_data_set.nil? then\n @fitted_mean_values\n else\n new_data_matrix = new_data_set.to_matrix\n # this if statement is done because Statsample::GLM::MLE::Normal#measurement expects that\n # the coefficient vector has a redundant last element (which is discarded by #measurement\n # in further computation)\n b = if self.is_a?(Statsample::GLM::MLE::Normal) then\n Matrix.column_vector(@coefficients.to_a + [nil])\n else\n @coefficients.to_matrix(axis=:vertical)\n end\n create_vector measurement(new_data_matrix, b).to_a.flatten\n end\n end",
"title": ""
},
{
"docid": "40e8ffed818bbe4a9aa73b0b8aa6a6cc",
"score": "0.4413525",
"text": "def initialize(strategy: Digiproc::Strategies::Radix2Strategy, time_data: nil, size: nil, window: Digiproc::RectangularWindow, freq_data: nil, inverse_strategy: Digiproc::Strategies::IFFTConjugateStrategy)\r\n raise ArgumentError.new(\"Either time or frequency data must be given\") if time_data.nil? and freq_data.nil?\r\n raise ArgumentError.new('Size must be an integer') if not size.nil? and not size.is_a?(Integer) \r\n raise ArguemntError.new('Size must be greater than zero') if not size.nil? and size <= 0 \r\n raise ArgumentError.new('time_data must be an array') if not time_data.respond_to?(:calculate) and not time_data.is_a? Array\r\n \r\n if time_data.is_a? Array\r\n @time_data_size = time_data.length\r\n if not size.nil?\r\n if size <= time_data.length\r\n @time_data = time_data.dup.map{ |val| val.dup }.take(size)\r\n else \r\n zero_fill = Array.new(size - time_data.length, 0)\r\n @time_data = time_data.dup.map{ |val| val.dup }.concat zero_fill\r\n end\r\n else\r\n @time_data = time_data.dup.map{ |val| val.dup}\r\n end\r\n @strategy = strategy.new(@time_data.map{ |val| val.dup})\r\n @window = window.new(size: time_data_size)\r\n else\r\n @time_data = time_data\r\n @strategy = strategy.new\r\n @window = window.new(size: freq_data.length)\r\n end\r\n @inverse_strategy = inverse_strategy\r\n @data = freq_data\r\n end",
"title": ""
},
{
"docid": "05fa74f75630c718aa781b7010571d58",
"score": "0.4408048",
"text": "def create(entity)\n @dataset.create(\n _serialize(entity)\n )\n end",
"title": ""
},
{
"docid": "05fa74f75630c718aa781b7010571d58",
"score": "0.4408048",
"text": "def create(entity)\n @dataset.create(\n _serialize(entity)\n )\n end",
"title": ""
},
{
"docid": "2c0742c61137d1385b7ab4fb5a87bbbb",
"score": "0.44079402",
"text": "def initialize(len, scale); @len = len; @scale = scale end",
"title": ""
},
{
"docid": "9479263d2c02dea929f2274846a3e3c2",
"score": "0.44052327",
"text": "def create_data\n @entities_total.times do |i|\n @data << entity_class.new(i, self)\n end\n end",
"title": ""
},
{
"docid": "bf0af67f2f06baa6deaec51f18d1c6f0",
"score": "0.44014236",
"text": "def dev\n only_with('dev', 'DateTime', 'Numeric')\n var.sqrt(20)\n end",
"title": ""
},
{
"docid": "02095b54ba9841836171f68f3f8108f7",
"score": "0.43951118",
"text": "def createTotalCustomerValueDataSet\n\t\t\n\tend",
"title": ""
},
{
"docid": "53211abf87fd0ef529394ce94a07214d",
"score": "0.43939757",
"text": "def create_dataset(filename, x_size, y_size, bands: 1, type: :GDT_Byte, **options)\n log \"creating dataset with size #{x_size},#{y_size}\"\n\n dataset_pointer = GDALCreate(@gdal_driver_handle,\n filename,\n x_size,\n y_size,\n bands,\n type,\n nil\n )\n\n raise CreateFail if dataset_pointer.null?\n\n dataset = Dataset.new(dataset_pointer)\n yield(dataset) if block_given?\n dataset.close\n\n dataset\n end",
"title": ""
},
{
"docid": "a66a5113d04e5d8d61a194ee96a3b5f3",
"score": "0.43868282",
"text": "def new_data_field(field)\n datafield = MARC::DataField.new(field['2'],\n field.indicator1,\n field.indicator2)\n field.subfields.each do |sf|\n unless %w[0 2 3].include?(sf.code)\n datafield.append(MARC::Subfield.new(sf.code, sf.value))\n end\n end\n datafield\n# puts \"DATAFIELD: #{datafield.inspect}\"\n end",
"title": ""
},
{
"docid": "8ce318a4bdded137e24a20cda37d5a0a",
"score": "0.4385698",
"text": "def create\n @dataset = Dataset.new(dataset_params)\n\n if @dataset.save\n redirect_to @dataset, notice: 'Dataset was successfully created.'\n else\n redirect_to datasets_path, notice: 'Dataset could not be created.'\n end\n end",
"title": ""
},
{
"docid": "85a3795a4f7624a8bbc4caf90d64bb78",
"score": "0.437955",
"text": "def initialize(data, start, constant_pool)\r\n creator = AttributesCreator.new(data, start, constant_pool)\r\n creator.create!\r\n @attributes = creator.attributes\r\n @size = creator.size\r\n end",
"title": ""
},
{
"docid": "5d493377395c354283004972fc420c75",
"score": "0.4377483",
"text": "def train\n puts '>>> 1'\n train = RubyFann::TrainData.new(filename: './train.data')\n\n puts '>>> 2'\n @fann = RubyFann::Standard.new(num_inputs: @number_of_inputs, hidden_neurons: [@number_of_inputs/20, @number_of_inputs/40], num_outputs: @number_of_outputs)\n\n puts '>>> 3'\n @fann.train_on_data(train, 1000, 10, 0.1) # 1000 max_epochs, 10 errors between reports and 0.1 desired MSE (mean-squared-error)\n @fann.save('./headlines.net')\n\n puts '>>> 4'\n test\n end",
"title": ""
},
{
"docid": "f6ce299e48bc3cf2b00ba2154551efbe",
"score": "0.4372053",
"text": "def add_variance\n\n end",
"title": ""
},
{
"docid": "dce506f5f83867aefddf3bb5354f3c3a",
"score": "0.4370227",
"text": "def nfa_to_dfa\n\n partition_edges\n minimize\n\n @start_state.generate_pdf(\"_SKIP_prefilter.pdf\") if @generate_pdf\n\n if @with_filter\n filter = Filter.new(@start_state)\n filter.verbose = @generate_pdf\n filter.apply\n if filter.modified\n # Re-minimize the dfa, since it's been modified by the filter\n minimize\n @start_state.generate_pdf(\"_SKIP_postfilter.pdf\") if @generate_pdf\n end\n end\n\n @start_state\n end",
"title": ""
},
{
"docid": "a228ea3f100b9327b2f3b2ee82aa2a77",
"score": "0.436691",
"text": "def dataset(table_name)\n Dataset.new(self, table_name)\n end",
"title": ""
},
{
"docid": "63528bca709f27a2638de0a5ac9e782c",
"score": "0.43434352",
"text": "def initialize(learning_rate: 0.01, decay: nil, momentum: 0.9,\n fit_bias: true, bias_scale: 1.0, max_iter: 1000, batch_size: 50, tol: 1e-4,\n solver: 'auto',\n n_jobs: nil, verbose: false, random_seed: nil)\n check_params_numeric(learning_rate: learning_rate, momentum: momentum,\n bias_scale: bias_scale, max_iter: max_iter, batch_size: batch_size)\n check_params_boolean(fit_bias: fit_bias, verbose: verbose)\n check_params_string(solver: solver)\n check_params_numeric_or_nil(decay: decay, n_jobs: n_jobs, random_seed: random_seed)\n check_params_positive(learning_rate: learning_rate, max_iter: max_iter, batch_size: batch_size)\n super()\n @params.merge!(method(:initialize).parameters.map { |_t, arg| [arg, binding.local_variable_get(arg)] }.to_h)\n @params[:solver] = if solver == 'auto'\n enable_linalg?(warning: false) ? 'svd' : 'lbfgs'\n else\n solver.match?(/^svd$|^sgd$|^lbfgs$/) ? solver : 'lbfgs'\n end\n @params[:decay] ||= @params[:learning_rate]\n @params[:random_seed] ||= srand\n @rng = Random.new(@params[:random_seed])\n @loss_func = LinearModel::Loss::MeanSquaredError.new\n @weight_vec = nil\n @bias_term = nil\n end",
"title": ""
},
{
"docid": "b3868e2f694e43d449225ed852cfa766",
"score": "0.43428957",
"text": "def initialize(label)\n @label = label.to_f\n @features = [1.0] # First feature is always the bias value\n end",
"title": ""
},
{
"docid": "455d2f174f3e64fe3e63dddd7eb55feb",
"score": "0.4337106",
"text": "def inferDataTypes( dataset, year, filename, tablename, single_point_as_dec, nameEditor )\n file = File.new( filename, 'r' );\n line = 0\n maxvals = []\n n = 0\n topline = []\n CSV.foreach( file, { col_sep:\"\\t\" } ){\n |elements|\n line += 1\n if( line == 1 )then\n topline = elements\n n = topline.length\n n.times{\n |i|\n maxvals[i] = INT\n }\n # elsif line >= 500 then\n # break;\n else\n i = 0\n elements.each{\n |cell|\n colname = nameEditor.edit( topline[i].downcase() )\n if colname =~ /.*sernum.*/i then\n maxvals[i] = SERNUM \n elsif cell =~ /.*\\/.*/ then\n puts \"infering DATE for #{colname}; cell is |#{cell}|\\n\"\n maxvals[i] = [ maxvals[i], DATE ].max() \n elsif cell =~ /.*[\"'`a-z].*/i then\n maxvals[i] = [ maxvals[i], STRING ].max() \n elsif cell =~ /[0-9]+\\.[0-9]$/ and single_point_as_dec then \n # FIXME exactly one point as decimal XX,1; \n # this is in HSE for industry codes and so on but probably not general\n puts \"infering DECIMAL for #{colname}; cell is |#{cell}|\\n\"\n maxvals[i] = [ maxvals[i], DECIMAL ].max() \n elsif cell =~ /[0-9]+\\.[0-9]+/ or cell =~/^\\.[0-9]+/ or cell =~ /^[0-9]\\.$/ then\n puts \"infering AMOUNT for #{colname}; cell is |#{cell}|\\n\"\n maxvals[i] = [ maxvals[i], AMOUNT ].max() \n # FIXME should we blow up if remainder not obviously an integer?\n else # int of some kind - check for extreme values\n x = cell.to_f()\n if( x > 2147483647.0 ) or ( x < -2147483648.0 )then # out of postgres integer range\n puts \"inferring SERNUM for #{colname}; cell=|#{cell}|\\n\"\n maxvals[i] = [ maxvals[i], SERNUM ].max() \n end\n end # ignore enums for now\n i += 1\n } \n end\n }\n file.close()\n # connection = getConnection()\n n.times{\n |i|\n if maxvals[i] != INT then # since we default to INT anyway\n colname = nameEditor.edit( topline[i].downcase() )\n puts \"changing #{} to #{maxvals[i]}\\n\"\n puts \"#{maxvals[i]} #{dataset}, #{tablename}, #{year}, #{colname}\\n\"\n updateVarType( maxvals[i], dataset, tablename, year, colname ) \n # statement.execute( maxvals[i], dataset, tablename, year, colname ) \n end\n }\n # connection.disconnect()\nend",
"title": ""
},
{
"docid": "8dabc2d56ec95afe411ed7d0302202ca",
"score": "0.43207452",
"text": "def create_fact(name, value)\n\n Fact.new name, convert_variable(value)\n\n end",
"title": ""
},
{
"docid": "7a6f7cc1584bd3773ca2be4f987c75b1",
"score": "0.43185893",
"text": "def train_one_classifier(dataset)\n model = LogisticRegressionModelL2.new(0.000)\n lr = 1\n w = Hash.new {|h,k| h[k] = (rand * 0.1) - 0.05}\n sgd = StochasticGradientDescent.new(model, w, lr)\n sgd, iter, losses = train(sgd, model, w, dataset, num_epoch = 18, batch_size = 20)\n df = Daru::DataFrame.new({x: iter, y: losses})\n df.plot(type: :line, x: :x, y: :y) do |plot, diagram|\n plot.x_label \"Batches\"\n plot.y_label \"Cumulative Loss\"\n end.export_html\n return sgd\nend",
"title": ""
},
{
"docid": "0eaa57302a98368b1183eea0c290c4e0",
"score": "0.43093157",
"text": "def train(dataset)\n raise 'Override me!'\n end",
"title": ""
},
{
"docid": "8cfbf9b6833626a77f7120c89b580f42",
"score": "0.43049935",
"text": "def df(*args)\n if @datafields.has_key?(args.to_s)\n # Manny Rodriguez: 3/16/18\n # Bugfix for ANW-146\n # Separate creators should go in multiple 700 fields in the output MARCXML file. This is not happening because the different 700 fields are getting mashed in under the same key in the hash below, instead of having a new hash entry created.\n # So, we'll get around that by using a different hash key if the code is 700.\n # based on MARCModel#datafields, it looks like the hash keys are thrown away outside of this class, so we can use anything as a key.\n # At the moment, we don't want to change this behavior too much in case something somewhere else is relying on the original behavior.\n\n if(args[0] == \"700\" || args[0] == \"710\" || args[0] == \"035\" || args[0] == \"506\")\n @datafields[rand(10000)] = @@datafield.new(*args)\n else\n @datafields[args.to_s]\n end\n else\n\n @datafields[args.to_s] = @@datafield.new(*args)\n @datafields[args.to_s]\n end\n end",
"title": ""
},
{
"docid": "ec532ff69501f30a3827302980a944db",
"score": "0.42986798",
"text": "def data=(v) DataTypeValidator.validate \"Series.data\", [NumDataSource], v; @data = v; end",
"title": ""
},
{
"docid": "ec532ff69501f30a3827302980a944db",
"score": "0.42986798",
"text": "def data=(v) DataTypeValidator.validate \"Series.data\", [NumDataSource], v; @data = v; end",
"title": ""
},
{
"docid": "17ec49883b4b62448ed00850805bc5b8",
"score": "0.4296679",
"text": "def build\n @frequence = value_from_option(\"FREQ\")\n @monthly = value_from_option_byday\n @count = value_from_option(\"COUNT\")\n @until = string_to_date value_from_option(\"UNTIL\")\n self\n end",
"title": ""
},
{
"docid": "bd4d3e525ce88bf6f84276624731e0d9",
"score": "0.42952192",
"text": "def initialize(a,b,c,d, opts=Hash.new)\n @a,@b,@c,@d=a,b,c,d\n \n opts_default={\n :name=>_(\"Tetrachoric correlation\"),\n :ruby_engine=>false\n }\n \n @opts=opts_default.merge opts\n @opts.each{|k,v| self.send(\"#{k}=\",v) if self.respond_to? k}\n #\n # CHECK IF ANY CELL FREQUENCY IS NEGATIVE\n #\n raise \"All frequencies should be positive\" if (@a < 0 or @b < 0 or @c < 0 or @d < 0)\n compute\n end",
"title": ""
},
{
"docid": "7c32f1875dced95e2ca469a6d210699e",
"score": "0.42891786",
"text": "def new\n @facturation_milk = FacturationMilk.new\n end",
"title": ""
},
{
"docid": "389c8cb682f650f1843eaad56b7db7fa",
"score": "0.42824408",
"text": "def initialize(dataset)\n @dataset = dataset\n end",
"title": ""
},
{
"docid": "f84139ba115499ef6991ec00f8cd47da",
"score": "0.42736968",
"text": "def initialize(d, n, a, t)\n\n @date = d.to_s #storing data as string\n @payee = n.to_s #storing payee as string\n @amount = a.to_f #storing amount as float\n @type = t.to_c #storing type as char\n @currBalance = 0.0 #setting current balance as zero just to initilize as float\n\n end",
"title": ""
},
{
"docid": "0be5e23f25203f280d9396320f2bc44f",
"score": "0.4269398",
"text": "def coerce(other)\n other = self.data.class.new.fill(other) if other.kind_of?(Numeric)\n [Chainer::Variable.new(other, requires_grad: false), self]\n end",
"title": ""
},
{
"docid": "b08430ec910e3dbf8db8e18852c16e57",
"score": "0.42613286",
"text": "def generate_raw_data\n self.raw_data = Estimation::RawData.factory(cols: parameter_space.size, rows: project_setting.accuracy)\n end",
"title": ""
},
{
"docid": "2bc45dada7a824708fac0e0a5a475bf6",
"score": "0.42536288",
"text": "def derivative\n return Signal.new(:sample_rate => @sample_rate, :data => Calculus.derivative(@data))\n end",
"title": ""
},
{
"docid": "28235c634025d635b6a67684a38fe914",
"score": "0.4247215",
"text": "def create_datasets(builder)\n each_dataset(builder) do |ds|\n builder.create_dataset(ds, mapping: true, parents: ds.root?)\n end\n end",
"title": ""
},
{
"docid": "adf03cb37d06412066ad344c6ebeb8d9",
"score": "0.42412165",
"text": "def collect data\n i = 0\n data_size = data.size\n while i < data_size\n remaining = data_size - i\n space = @bins - @fft_pos\n actual = [remaining,space].min\n new_fft_pos = @fft_pos + actual\n @fft[@fft_pos...new_fft_pos] = data[i...i+actual]\n @fft_pos = new_fft_pos\n if @fft_pos == @bins\n @fft_pos = 0\n @next_fft = @fft.dup\n end\n i += actual\n end\n end",
"title": ""
},
{
"docid": "f7a4195dc03549ff63c11a30f8f44c5b",
"score": "0.4239789",
"text": "def fft\r\n self.data\r\n end",
"title": ""
},
{
"docid": "58f89fe8fe7dd87968725eebb4cf8c88",
"score": "0.4238862",
"text": "def inject_zero_storage!\n null_curve = Array.new(8760, 0.0)\n\n @node.dataset_set(@context.curve_name(:input), null_curve)\n @node.dataset_set(@context.curve_name(:output), null_curve)\n\n inject_storage(0.0) { Array.new(8760, 0.0) }\n end",
"title": ""
},
{
"docid": "61b580443e566ea7c84de8ccb63f9b84",
"score": "0.4238363",
"text": "def initialize(enumerable, **options)\n @dataset = enumerable\n end",
"title": ""
},
{
"docid": "a251e397595ccce81e63f4dc2d011900",
"score": "0.4236043",
"text": "def initialize( point_array )\n @datapoints ||= {}\n @count = count || 30\n \n point_array.each do |x_value, y_value|\n y_value = y_value.to_f\n @datapoints[x_value] = y_value\n end\n end",
"title": ""
},
{
"docid": "8624888f03639d26e0a637d28e06cdfa",
"score": "0.4235748",
"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": "9dfd15293c42c1b43db8cdbb302f1785",
"score": "0.42333695",
"text": "def calculate_and_build_metlife_premium_tables\n (20..65).each do |metlife_age|\n @metlife_age = metlife_age\n key = \"#{@rate[:plan_id]},#{@rate[:effective_date].to_date.year}\"\n rating_area = @rate[:rate_area_id]\n @results[key] << {\n age: metlife_age,\n start_on: @rate[:effective_date],\n end_on: @rate[:expiration_date],\n cost: calculate_metlife_cost,\n rating_area: rating_area\n }\n end\n end",
"title": ""
},
{
"docid": "3cda274104b15d6b50b669f2602bceef",
"score": "0.42292625",
"text": "def decay_conversation\n # we half-life the conversation every minute\n units = (Time.now - @last_faded_weights)/60\n if units > 1 \n @last_faded_weights = Time.now \n if incoming_weight > 0 or outgoing_weight > 0\n @outgoing_weight /= (2**units) if outgoing_weight > 0\n @incoming_weight /= (2**units) if incoming_weight > 0\n end\n end\n end",
"title": ""
},
{
"docid": "8036d1bacb0fd504d3a512b5318c8008",
"score": "0.42266586",
"text": "def unlimited\n cached_dataset(:_unlimited_ds){clone(:limit=>nil, :offset=>nil)}\n end",
"title": ""
},
{
"docid": "d552245ac851ab4b4be00d966be537a6",
"score": "0.42214835",
"text": "def initialize(data)\n @raw = data.map { |d, s| Datapoint.new(Date.parse(d), s.to_i) }.sort_by(&:date)\n enable_caching %i[to_h today streaks longest_streak streak max mean\n std_var quartile_boundaries quartiles start_date\n end_date]\n end",
"title": ""
},
{
"docid": "bca85f69853597690ca4d6a38a99373a",
"score": "0.42147878",
"text": "def default_data collection, factor\n your_data, comparison_data, l1_data, l2_data, l3_data = [], [], [], [], []\n average_l1_comp_data, average_l2_comp_data, average_l3_comp_data = [],[],[]\n duration = params[\"duration\"]\n uniq_exam_dates = collection.map(&:exam_date).uniq\n if duration == \"12\"\n Date.today.month.times do |count|\n l1_temp_data, l2_temp_data, l3_temp_data = [], [], []\n collection.where(exam_date:(Time.now-count.month).all_month()).each do |r|\n l1_temp_data << r.send(:\"l1_#{factor}\")\n l2_temp_data << r.send(:\"l2_#{factor}\")\n l3_temp_data << r.send(:\"l3_#{factor}\")\n end\n l1_comp_data, l2_comp_data, l3_comp_data = [], [], [] \n Report.where(exam_date: (Time.now-count.month).all_month(), school_id:current_user.school.id).each do |m|\n l1_comp_data << m.send(:\"l1_#{factor}\")\n l2_comp_data << m.send(:\"l2_#{factor}\")\n l3_comp_data << m.send(:\"l3_#{factor}\")\n end\n l1_data << average(l1_temp_data)\n l1_data.reverse!\n l2_data << average(l2_temp_data)\n l2_data.reverse!\n l3_data << average(l3_temp_data)\n l3_data.reverse!\n average_l1_comp_data << average(l1_comp_data)\n average_l1_comp_data.reverse!\n average_l2_comp_data << average(l2_comp_data)\n average_l2_comp_data.reverse!\n average_l3_comp_data << average(l3_comp_data)\n average_l3_comp_data.reverse!\n end\n else\n uniq_exam_dates.each do |date|\n l1_temp_data, l2_temp_data, l3_temp_data = [], [], []\n collection.where(exam_date:date).each do |r|\n l1_temp_data << r.send(:\"l1_#{factor}\")\n l2_temp_data << r.send(:\"l2_#{factor}\")\n l3_temp_data << r.send(:\"l3_#{factor}\")\n end\n l1_comp_data, l2_comp_data, l3_comp_data = [], [], [] \n Report.where(exam_date: date, school_id:current_user.school.id).each do |m|\n l1_comp_data << m.send(:\"l1_#{factor}\")\n l2_comp_data << m.send(:\"l2_#{factor}\")\n l3_comp_data << m.send(:\"l3_#{factor}\")\n end\n l1_data << average(l1_temp_data)\n l2_data << average(l2_temp_data)\n l3_data << average(l3_temp_data)\n average_l1_comp_data << average(l1_comp_data)\n average_l2_comp_data << average(l2_comp_data)\n average_l3_comp_data << average(l3_comp_data)\n end\n end\n your_data = [l1_data, l2_data, l3_data]\n comparison_data = [average_l1_comp_data, average_l2_comp_data, average_l3_comp_data]\n factor == \"time\" ? plot_timedistribution(your_data, comparison_data) : plot_strategy(your_data, comparison_data)\n end",
"title": ""
},
{
"docid": "03fe0cad02da9a05272aec44091fd1a8",
"score": "0.42132702",
"text": "def to_dfa\n fa.determinize\n end",
"title": ""
},
{
"docid": "4f3f14c9b433c6d55061a1e4cc53af01",
"score": "0.4211151",
"text": "def initialize(dataset = [], options = {})\r\n @dataset = dataset\r\n @dataset_normalized = []\r\n \r\n @matrix_conv = {}\r\n @matrix_conv_inv = {}\r\n @matrix_conv_det = {}\r\n\r\n @normalization = options[:normalization] || :none # linear or standard_deviation\r\n\r\n set_classes\r\n normalize\r\n build_matrix_conv\r\n end",
"title": ""
},
{
"docid": "bf550ec99430a78612f0e3b8c4ca33f8",
"score": "0.42062458",
"text": "def increase_bandwidth\n intervals = (time - @start_time) / @phase_length\n @bandwidth = (DEFAULT_STARTING_MAXIMUM_OPS_PER_SECOND * (1.5**intervals.floor)).to_f\n end",
"title": ""
},
{
"docid": "4b820af8f59727430cdfc41bc4b48608",
"score": "0.42059633",
"text": "def new\n @performance = Performance.new\n end",
"title": ""
},
{
"docid": "c27353fdc5f07aece7d5cdc550c2c176",
"score": "0.42051786",
"text": "def batch_new\n @records = Array.new(BATCH_SIZE) { record_class.new }\n end",
"title": ""
},
{
"docid": "d136df9e3e2fd9be7e3cd07d7c7b857a",
"score": "0.42037296",
"text": "def stat_data_initialize(opts)\n self.loyalty = opts[:loyalty] || data.base_loyalty\n self.rareness = opts[:rareness]\n ev_data_initialize(opts)\n iv_data_initialize(opts)\n @nature = (opts[:nature] || (@code >> 16)) % GameData::Natures.size\n self.hp = max_hp\n end",
"title": ""
},
{
"docid": "696482fc32615ff365a5be8be9fbf55f",
"score": "0.42032292",
"text": "def initialize(date = nil, batch_size = nil)\n @date = date\n @batch_size = batch_size\n end",
"title": ""
},
{
"docid": "ef73280035c7ff83b9a6763aea7bb1f9",
"score": "0.42031407",
"text": "def create_float_attribute(database_id:, collection_id:, key:, required:, min: nil, max: nil, default: nil, array: nil)\n path = '/databases/{databaseId}/collections/{collectionId}/attributes/float'\n .gsub('{databaseId}', database_id)\n .gsub('{collectionId}', collection_id)\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n if collection_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"collectionId\"')\n end\n\n if key.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"key\"')\n end\n\n if required.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"required\"')\n end\n\n params = {\n key: key,\n required: required,\n min: min,\n max: max,\n default: default,\n array: array,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::AttributeFloat\n )\n end",
"title": ""
}
] |
9a343beb9346bb62599c3bf57b5b595f | Deletes the star record if it exists. | [
{
"docid": "1f13579f738e7edd7d2ee720f74eaf3f",
"score": "0.0",
"text": "def unstar(starable)\n if star = get_star_from(starable)\n star.destroy\n end\n end",
"title": ""
}
] | [
{
"docid": "d5160143440daef9f71eeb6c307fbc00",
"score": "0.6725125",
"text": "def delete\n @table.delete @record\n end",
"title": ""
},
{
"docid": "fe03f3f869acf986ecfcb64d1c018942",
"score": "0.66648793",
"text": "def destroy\n @star = Star.find(params[:id])\n @star.destroy\n respond_with(@star)\n end",
"title": ""
},
{
"docid": "707b17cc1cbb3c79135bd723161d0123",
"score": "0.6651553",
"text": "def destroy\n @star = Star.find(params[:id])\n @star.destroy\n\n respond_to do |format|\n format.html { redirect_to(stars_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "be411205f3ae2b39cb45869b0f23cad9",
"score": "0.65880555",
"text": "def destroy\n @star = Star.find(params[:id])\n @star.destroy\n\n respond_to do |format|\n format.html { redirect_to stars_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f84d121d0126a410c77d18c458d659f8",
"score": "0.65850264",
"text": "def destroy\n\t\t@star.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to stars_url, notice: 'Star was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "ca6d31e142cd6edf14f28f8e4cae82c6",
"score": "0.65443265",
"text": "def unstar!(starred)\n star = self.stars.find_by_starred_id(starred.id)\n star.destroy!\n end",
"title": ""
},
{
"docid": "5259443bd877dec200b6e40ff8c0f6ee",
"score": "0.6495818",
"text": "def delete\n\t\tis_record_marked_for_deletion = true\n\tend",
"title": ""
},
{
"docid": "776e24b4eb55fc30ac53090111b5647b",
"score": "0.64706284",
"text": "def delete(statement)\n Redland.librdf_model_remove_statement(@model.rdf_model, statement.rdf_statement).zero?\n end",
"title": ""
},
{
"docid": "55ef9ea2a8cef93a816af9772c1b1cda",
"score": "0.6460263",
"text": "def destroy\n @fnss_simple_star.destroy\n respond_to do |format|\n format.html { redirect_to fnss_simple_stars_url, notice: 'Fnss simple star was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4c57cd69c208084cc91462e7158e6307",
"score": "0.6419497",
"text": "def destroy\n @star_rate = StarRate.find(params[:id])\n @star_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to(star_rates_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2b8edda29b7b3177d821dbad7a896abf",
"score": "0.6404395",
"text": "def delete?; end",
"title": ""
},
{
"docid": "2b8edda29b7b3177d821dbad7a896abf",
"score": "0.6404395",
"text": "def delete?; end",
"title": ""
},
{
"docid": "2b8edda29b7b3177d821dbad7a896abf",
"score": "0.6404395",
"text": "def delete?; end",
"title": ""
},
{
"docid": "e1af0f74c0382de89c6bae67ba24ee70",
"score": "0.6366125",
"text": "def delete(i)\n fail UnexistantRecordException.new(\"Invalid index : #{i}\") if @shp.record_count <= i\n @deleted[i] = true\n end",
"title": ""
},
{
"docid": "217ee849e02347fd823e65800593628b",
"score": "0.6361654",
"text": "def delete_record(label)\n record = records.find { |r| r.label == label.to_s }\n return unless record\n\n File.delete(record.path)\n records.delete(record)\n end",
"title": ""
},
{
"docid": "58ff6d3a85ac704976ccaf47cb242d69",
"score": "0.63314927",
"text": "def destroy\n (self.record = model.find(params[primary_key])).destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "58ff6d3a85ac704976ccaf47cb242d69",
"score": "0.63314927",
"text": "def destroy\n (self.record = model.find(params[primary_key])).destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "7cbce3e2cdc1da663f0b7398a4a6fcce",
"score": "0.6314198",
"text": "def destroy\n if @pornstar.destroy\n flash[:notice] = \"Successfully deleted pornstar!\"\n redirect_to pornstars_path\n else\n flash[:notice] = \"Error updating pornstar!\"\n end\n end",
"title": ""
},
{
"docid": "da8cda1f3cc552e78d0e1f4bbbe83ad1",
"score": "0.63094765",
"text": "def delete!\n raise StandardError, \"Unable to delete file if object hasn't been saved yet\" if new_record?\n delete_method(RAISE_TRUE)\n end",
"title": ""
},
{
"docid": "b16656160f3ab16dfbfac8088af608c8",
"score": "0.6308759",
"text": "def delete(i)\r\n raise UnexistantRecordException.new(\"Invalid index : #{i}\") if @shp.record_count <= i \r\n @deleted[i] = true\r\n end",
"title": ""
},
{
"docid": "dab4b1f0d4a4b8ac635a56eeb172b33f",
"score": "0.63033706",
"text": "def delete!\n deleted\n save!\n end",
"title": ""
},
{
"docid": "4fee2b6d9a0cc18cec471ebbc3615071",
"score": "0.6285906",
"text": "def unstar!(design)\n star = self.stars.find_by_design_id(design.id)\n star.destroy!\n end",
"title": ""
},
{
"docid": "ac82a074f0f2ec8a579d67ef7451c96c",
"score": "0.62746847",
"text": "def destroy\n @star_rating.destroy\n respond_to do |format|\n format.html { redirect_to star_ratings_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d287c1b6f3fb879f561e25544b167c50",
"score": "0.62635475",
"text": "def delete\n\n @query.searchout || @table.raise_error\n end",
"title": ""
},
{
"docid": "5b157fd631991950cebf22f6fd55482a",
"score": "0.62332654",
"text": "def delete\n db.do_query(\"delete from #{self.class.quoted_table_name} where row_id = ?\", @row_id)\n mark_dirty\n @tuple = nil\n @row_id = nil\n end",
"title": ""
},
{
"docid": "f816e1d051bf32c905529147ce9d175e",
"score": "0.62149006",
"text": "def unstar\n connection.delete(\"#{path_prefix}/star\").status == 204\n end",
"title": ""
},
{
"docid": "d7291f6223d7c4995fed2ee35c89549d",
"score": "0.6212502",
"text": "def destroy\n self.class.query(self, :delete).nil?\n end",
"title": ""
},
{
"docid": "fb5d503caafc76896ab72ef094c461d5",
"score": "0.62003595",
"text": "def unstar!(resto)\n star = self.stars.find_by_resto_id(resto.id)\n star.destroy!\n end",
"title": ""
},
{
"docid": "1b44d2ac6173b492a368d0ff7f4d89bc",
"score": "0.61999154",
"text": "def delete!\n clear!\n delete\n end",
"title": ""
},
{
"docid": "daa56604e9c3c631eca2ca4067c09d33",
"score": "0.61940855",
"text": "def delete\n @delete = true\n end",
"title": ""
},
{
"docid": "b53efa07cc09cc6000218ecb78cb9407",
"score": "0.6192379",
"text": "def destroy\n @rating.destroy\n end",
"title": ""
},
{
"docid": "b53efa07cc09cc6000218ecb78cb9407",
"score": "0.6192379",
"text": "def destroy\n @rating.destroy\n end",
"title": ""
},
{
"docid": "b53efa07cc09cc6000218ecb78cb9407",
"score": "0.6192379",
"text": "def destroy\n @rating.destroy\n end",
"title": ""
},
{
"docid": "39cdeda79ebe464b5c8f8c7396f07a2c",
"score": "0.6171466",
"text": "def destroy\n @north_star.destroy\n respond_to do |format|\n format.html { redirect_to north_stars_url, notice: \"North star was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fa262f3cb85272167c6ae39536940c26",
"score": "0.61668104",
"text": "def del\n delete\n end",
"title": ""
},
{
"docid": "689294b375ab7ac2ad5d1e9fca21a699",
"score": "0.6163163",
"text": "def delete\n @deleted = true\n # XXX BUG: prevent further modification\n end",
"title": ""
},
{
"docid": "689294b375ab7ac2ad5d1e9fca21a699",
"score": "0.6163163",
"text": "def delete\n @deleted = true\n # XXX BUG: prevent further modification\n end",
"title": ""
},
{
"docid": "443707f6b6e5e0d93afd3c1d0551a329",
"score": "0.6161838",
"text": "def destroy\n if @rating.destroy\n render :json => {:success => true, :errors => [\"Delete successful.\"]}\n else\n render :json => {:success => false, :errors => [\"Delete failed.\"]}\n end\n end",
"title": ""
},
{
"docid": "60fc4fad15b8d733c086321ef28143a4",
"score": "0.61481845",
"text": "def delete\n deleted\n save\n end",
"title": ""
},
{
"docid": "d5dcca36ec9f815d696201d9b18a9c6f",
"score": "0.61008835",
"text": "def delete(record)\n self.lock.synchronize do\n self.records.delete(record)\n end\n end",
"title": ""
},
{
"docid": "6b431d079d3c0d903c0a41bccfd5927a",
"score": "0.6099237",
"text": "def delete\n begin\n delete!\n rescue CouchSpring::ResourceNotFound\n false\n end\n end",
"title": ""
},
{
"docid": "8f11af8b9a4fefb079b34923ff0e3f7e",
"score": "0.6095642",
"text": "def destroy\n @rating.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Duplicate Rating was successfully Removed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7b23e5c84dca7cc90fed36efab4cdfc4",
"score": "0.6093158",
"text": "def unstar!(restaurant)\n star = self.stars.find_by_restaurant_id(restaurant.id)\n star.destroy!\n end",
"title": ""
},
{
"docid": "599ce297822787e0940350169d14a64d",
"score": "0.6090352",
"text": "def delete(obj)\n @records.delete(obj)\n @modified = true\n end",
"title": ""
},
{
"docid": "227c5ef033728a26fc38f802620ce12a",
"score": "0.6088329",
"text": "def delete\n (self.class.linked_records[self.class] or []).each do |linked_record|\n self.class.remove_existing_linked_records(self, linked_record)\n end\n\n self.class.prepare_for_deletion(self.class.where(:id => self.id))\n\n super\n\n uri = self.class.my_jsonmodel(true) && self.uri\n\n if uri\n Tombstone.create(:uri => uri)\n RealtimeIndexing.record_delete(uri)\n end\n end",
"title": ""
},
{
"docid": "9e87ae4fb6d0c35cdf82cbe2cc15797a",
"score": "0.6070735",
"text": "def delete(_ = nil, _ = nil, _ = nil)\n @one.info\n @one.delete\n end",
"title": ""
},
{
"docid": "5259b489d931bddb638be023691006b4",
"score": "0.60579103",
"text": "def delete_existing_row!( mrs )\n if mrs && mrs.destroy # --- DELETE ---\n # Store Db-diff text for DELETE\n sql_diff_text_log << to_sql_delete( mrs, false, \"\\r\\n\" )\n true\n else # (no error, nothing done)\n false\n end\n end",
"title": ""
},
{
"docid": "860de52273e142872b97fe1eeb32aa9a",
"score": "0.6046647",
"text": "def delete\n del unless new_record? || destroyed?\n set_deleted_properties\n end",
"title": ""
},
{
"docid": "70e177e287d17ffa452fe70034006166",
"score": "0.6040162",
"text": "def delete!\n delete_if { true }\n end",
"title": ""
},
{
"docid": "5f95b6104abfac1e4ceb20e0b19f33d7",
"score": "0.6028428",
"text": "def delete\n self.class.complain(\"deleted\")\n end",
"title": ""
},
{
"docid": "4f338f6e75b3f845ce830271b6dbaf34",
"score": "0.6027723",
"text": "def delete\n begin\n @mg.delete(@key)\n true\n rescue => e\n puts \"delete error: #{e.inspect}, key: #{@key}\"\n false\n end\n end",
"title": ""
},
{
"docid": "848ab1f9a942b7611845a090d66ff5c2",
"score": "0.60198975",
"text": "def delete!\n @deleted = true\n end",
"title": ""
},
{
"docid": "bc7b880772f3084ddafb0d0bb98bd918",
"score": "0.6003117",
"text": "def delete_record\n fail 'Method not supported in this persistor'\n end",
"title": ""
},
{
"docid": "929955085ffdbd1ee6b3f81887143ec9",
"score": "0.6002007",
"text": "def destroy\n @guest_star.destroy\n respond_to do |format|\n format.html { redirect_to guest_stars_url, notice: 'Guest star was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f4e96b41035d0606ce703bd8f6310256",
"score": "0.60008985",
"text": "def destroy()\n db = Db.get()\n db.execute(\"DELETE FROM ratings WHERE post_id = ? AND user_id = ?\", @post.id, @user_id)\n end",
"title": ""
},
{
"docid": "bab2955f15cdfddabf327c1c883eb1de",
"score": "0.5999916",
"text": "def delete\n delete!\n rescue StandardError\n false\n end",
"title": ""
},
{
"docid": "7e9bd2c75273bb095e23bfc035ba9c06",
"score": "0.5995427",
"text": "def delete\n __java_obj.remove unless new_record? || destroyed?\n set_deleted_properties\n # __java_obj.record.reload if __java_obj\n end",
"title": ""
},
{
"docid": "66096e352c36574a4eeba92d35a1a975",
"score": "0.59887743",
"text": "def destroy\n @rating = Rating.find(params[:id])\n @rating.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "ee19b0972fd8359c495eb3bb4c59f0a4",
"score": "0.59749526",
"text": "def destroy\n flush_deletes\n @dirty = false\n true\n end",
"title": ""
},
{
"docid": "8fbbdb0652342bcc287f772738cc87d5",
"score": "0.5974702",
"text": "def destroy\n return false if new_record?\n return false unless repository.delete(to_query)\n\n reset\n\n true\n end",
"title": ""
},
{
"docid": "0e87fc3ff4027ce0108c9b4d8622ee04",
"score": "0.5969172",
"text": "def delete\n # Well, nothing here, really.\n end",
"title": ""
},
{
"docid": "9210ff04d92addafe63da7deb01dfb12",
"score": "0.596007",
"text": "def delete\n artists_in_table = CONNECTION.execute(\"SELECT COUNT(*) FROM albums_artists WHERE artist_id = #{@id};\")\n if artists_in_table.first[0] == 0\n CONNECTION.execute(\"DELETE FROM artists WHERE id = #{@id};\")\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "c06177cb069db4417c93f7b0bc615552",
"score": "0.59550667",
"text": "def destroy\n return false unless self.id\n DBConnection.execute(<<-SQL)\n DELETE FROM #{table_name} WHERE id = #{self.id}\n SQL\n\n true\n end",
"title": ""
},
{
"docid": "5819703317c4e77b2d8cc23774f813aa",
"score": "0.59519815",
"text": "def destroy\n student_id = @star_test.student.id\n @star_test.destroy\n respond_to do |format|\n format.html { redirect_to star_tests_url(student_id: @star_test.student.id), notice: 'Star test was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5819703317c4e77b2d8cc23774f813aa",
"score": "0.59519815",
"text": "def destroy\n student_id = @star_test.student.id\n @star_test.destroy\n respond_to do |format|\n format.html { redirect_to star_tests_url(student_id: @star_test.student.id), notice: 'Star test was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a3ed59a2544aa5ce5713463353201211",
"score": "0.593938",
"text": "def destroy\n raise Codeplane::UnsavedResourceError, \"the id attribute is not set\" if new_record?\n Codeplane::Request.delete(resource_path) && true\n end",
"title": ""
},
{
"docid": "ab397f5c5a77191ad4dcb457a6e66f73",
"score": "0.5934604",
"text": "def destroy\n @rating.destroy\n @ratings = Rating.all\n end",
"title": ""
},
{
"docid": "ecdd77c84ed950f63b9c7917430df274",
"score": "0.59333223",
"text": "def delete\n begin\n database.delete(\"#{id}?rev=#{rev}\") unless new_record?\n rescue DocumentNotFound\n # OK - document is already deleted\n end\n \n read_only!\n self\n end",
"title": ""
},
{
"docid": "0da166e73b858b2159305fc013b5ea81",
"score": "0.59313595",
"text": "def destroy\n\t\t@video_star.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to @video, notice: 'Video star was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "5a2d783ef0b9a13525c5b43ead3234b6",
"score": "0.59240234",
"text": "def delete\n @sql = 'DELETE'\n\n self\n end",
"title": ""
},
{
"docid": "3499d750647b1c168ce7aa5a5b388399",
"score": "0.59199256",
"text": "def destroy\r\n if (@new_record)\r\n raise 'Cannot delete object from database because it has not been inserted'\r\n end\r\n \r\n id = get_attribute(primary_key)\r\n #delete(id)\r\n options = { :id => id }\r\n @@dbcontroller.delete(table_name, options)\r\n set_attribute(primary_key, default_primary_key_value)\r\n @new_record = true\r\n end",
"title": ""
},
{
"docid": "010438c6de61514971be51393f2c08c6",
"score": "0.5910495",
"text": "def delete\n OK\n end",
"title": ""
},
{
"docid": "dc4618e0590fbb77604221910b497dfd",
"score": "0.5907035",
"text": "def delete\n begin\n riak_client.delete(uploader.riak_bucket, identifier)\n true\n rescue Exception => e\n # If the file's not there, don't panic\n nil\n end\n end",
"title": ""
},
{
"docid": "5c78daead14ce737087a3b7b002b225f",
"score": "0.5899432",
"text": "def delete\n CONNECTION.execute(\"DELETE FROM trains WHERE id = #{self.id};\")\n end",
"title": ""
},
{
"docid": "85731848a0e037564c3713a67c422435",
"score": "0.58945197",
"text": "def delete\n #TODO\n end",
"title": ""
},
{
"docid": "7a9ef9cf9c1bb6f0dc1d92d5884cf002",
"score": "0.5884379",
"text": "def destroy\n @rating.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7e9cdb5db8a90b3129cf4a83fc456330",
"score": "0.58808905",
"text": "def delete\n begin\n oss_connection.delete(@path)\n true\n rescue Exception => e\n # If the file's not there, don't panic\n puts \"carrierwave-aliyun delete file failed: #{e}\"\n nil\n end\n end",
"title": ""
},
{
"docid": "039a8c1fd873a2c0705fb7babbb73702",
"score": "0.58790135",
"text": "def delete\n end",
"title": ""
},
{
"docid": "91d55b34a3799d5de3508b0d49690195",
"score": "0.58780557",
"text": "def delete\n remove\n end",
"title": ""
},
{
"docid": "d1672bdddf27e425f46b4f51cb9b4597",
"score": "0.58731335",
"text": "def delete_record(id)\n if ok_to_delete?(id)\n CONNECTION.execute(\"DELETE FROM #{self.to_s.pluralize} WHERE id = #{id};\")\n else\n false\n end\n end",
"title": ""
},
{
"docid": "f5599e0f2f5f2ff757e41f03fac9b1a0",
"score": "0.5871095",
"text": "def delete_song_record(delete_selected)\n CONNECTION.execute(\"DELETE FROM songs WHERE id = '#{delete_selected}';\")\n end",
"title": ""
},
{
"docid": "3847a07819002c61f314baccc7ff22d2",
"score": "0.5870961",
"text": "def delete_record\n logger.info 'Deleting the record'\n click_delete_button\n wait_for_element_and_click confirm_delete_button\n when_not_exists(confirm_delete_button, Config.short_wait)\n end",
"title": ""
},
{
"docid": "797119a424f583c2f0b1c9180b17fb1d",
"score": "0.5866239",
"text": "def delete_unecessary_query\n\t\tdelete_middle_query\n\t\tscore = calculate_score\n\t\tself.delete if score.zero?\n\tend",
"title": ""
},
{
"docid": "4a81774596b4e6ba92a17367817d86f9",
"score": "0.58635974",
"text": "def delete_record(asset)\n post(\"metadata.delete\", self.class.xml_doc.request { |r|\n r.uuid asset.uuid\n }) rescue nil # Geonetwork 500's if the record doesn't exist...\n end",
"title": ""
},
{
"docid": "67be63bfc3554378cc2fa9f8d3191019",
"score": "0.58526504",
"text": "def destroy\n @star_customer = Star::Customer.find(params[:id])\n @star_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to star_customers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "48d2cc32160a6c99ab006442e7e5e298",
"score": "0.5848614",
"text": "def destroy\n return false unless has_valid_id?\n\n count = MysqlAdapter.delete \"DELETE FROM #{self.class.table_name} WHERE id = #{self.id}\"\n count == 1\n rescue Mysql::Error\n false\n end",
"title": ""
},
{
"docid": "37a44064d4717656b217a776817ee8e5",
"score": "0.5846014",
"text": "def destroy\n errors.clear\n @record = nil\n true\n end",
"title": ""
},
{
"docid": "36887f2b24d31f98fbb51687409e73f6",
"score": "0.5840916",
"text": "def delete; end",
"title": ""
},
{
"docid": "36887f2b24d31f98fbb51687409e73f6",
"score": "0.5840916",
"text": "def delete; end",
"title": ""
},
{
"docid": "36887f2b24d31f98fbb51687409e73f6",
"score": "0.5840916",
"text": "def delete; end",
"title": ""
},
{
"docid": "36887f2b24d31f98fbb51687409e73f6",
"score": "0.5840916",
"text": "def delete; end",
"title": ""
},
{
"docid": "36887f2b24d31f98fbb51687409e73f6",
"score": "0.5840916",
"text": "def delete; end",
"title": ""
},
{
"docid": "36887f2b24d31f98fbb51687409e73f6",
"score": "0.5840916",
"text": "def delete; end",
"title": ""
},
{
"docid": "36887f2b24d31f98fbb51687409e73f6",
"score": "0.5840916",
"text": "def delete; end",
"title": ""
},
{
"docid": "cbd06dbac17dc1b2f91ea54ee896af2b",
"score": "0.5838039",
"text": "def delete_resource\n\t\tQuote.find(id).destroy\n\t\ttrue\n\tend",
"title": ""
},
{
"docid": "361715cbcd12a27b899f68433a987576",
"score": "0.58238304",
"text": "def delete_student(db, name)\n\tdb.execute(\"DELETE FROM students WHERE name = ?\", [name])\nend",
"title": ""
},
{
"docid": "bfed9b29a8aedab0d4bad81be89d4978",
"score": "0.5823084",
"text": "def delete_record(id)\n if ok_to_delete?(id)\n CONNECTION.execute(\"DELETE FROM #{table_name} WHERE id = #{id};\")\n else\n false\n end\n end",
"title": ""
},
{
"docid": "733154eb206eb7c9045cbadaa6a80bb5",
"score": "0.58166456",
"text": "def destroy\n @make_rating.destroy\n respond_to do |format|\n format.html { redirect_to make_ratings_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "db2278eef855c5b458ed9424364c5208",
"score": "0.5810623",
"text": "def delete(key)\n record = get(key)\n return false if record.nil?\n\n record.destroy\n end",
"title": ""
},
{
"docid": "3e897bafdd0aec5ecf1b2011e91a1375",
"score": "0.5810128",
"text": "def destroy()\n unless @new_record == true\n retval = @collection.remove({'_id' => self._id}, :w => 1)\n @new_record = true\n self._id = nil\n ## maybe some other things\n end\n end",
"title": ""
},
{
"docid": "071ce750b29fd0ac67852d1c3bf20af0",
"score": "0.5805627",
"text": "def destroy\n @import_student.destroy\n end",
"title": ""
}
] |
ea72b095492ad3c87f0fb81f453c64e4 | The sequential record_id field is not a fixed name. Get the first field from the data dictionary | [
{
"docid": "f817ab2c96a828c9b0f783081a7d5848",
"score": "0.79538083",
"text": "def record_id_field\n all_fields.keys.first\n end",
"title": ""
}
] | [
{
"docid": "52b2131f375cd2f81a10a48e7041c39b",
"score": "0.7814805",
"text": "def record_id_field\n data_dictionary.record_id_field\n end",
"title": ""
},
{
"docid": "8d9a6aa05457b0e056a56249f41abbad",
"score": "0.74806184",
"text": "def record_id\n rec_metadata[:id]\n end",
"title": ""
},
{
"docid": "8a9a1ce2267a78cf49c10315c442a180",
"score": "0.7284156",
"text": "def get_record_id(record)\n record[0].partition('_').last.to_i\n end",
"title": ""
},
{
"docid": "689d5752356ea66a8e204c068ef27840",
"score": "0.718732",
"text": "def record_id\n @entries.size > 0 ? @entries.first.record_id : nil\n end",
"title": ""
},
{
"docid": "ac929d25e1eff068925570292aa56f1e",
"score": "0.71681404",
"text": "def record_id\n doc['record_id']\n end",
"title": ""
},
{
"docid": "2be4e32b36a61cdc312bed3d37098cf6",
"score": "0.70010316",
"text": "def record_id\n @doc['id']\n end",
"title": ""
},
{
"docid": "77ab102bfffbd151ddd9c9e7d109a26c",
"score": "0.69152457",
"text": "def record_identifier\n descMetadata.record_identifier\n end",
"title": ""
},
{
"docid": "974400107e93308e4e3e7c7453019701",
"score": "0.6730637",
"text": "def record_identifier(record)\n { label_id: record.id, label_name: record.title }\n end",
"title": ""
},
{
"docid": "bfccedf8620825f995751faa4e0f249d",
"score": "0.66969514",
"text": "def record_id\n self[:id]\n end",
"title": ""
},
{
"docid": "f07bf134e5aad770f6a08d202995ac82",
"score": "0.66645265",
"text": "def get_key *record\n record.first\n end",
"title": ""
},
{
"docid": "cb6682e3bcc1df7f15a50f89a36b5bcc",
"score": "0.6590772",
"text": "def get_key(record)\n :__first_group__\n end",
"title": ""
},
{
"docid": "4646d205d0f7a4f8f87f83cc74e81ca0",
"score": "0.6480701",
"text": "def first_image_index_record_number\n @first_image_index_record_number ||= @data[108, 4].unpack('N*')[0]\n end",
"title": ""
},
{
"docid": "f8e70bfc9c5c228bccebd7ccfd77e9ea",
"score": "0.6426212",
"text": "def identifier\n emma_recordId.to_s\n end",
"title": ""
},
{
"docid": "0802961d2166d594404bbff411ed154c",
"score": "0.64086705",
"text": "def get_key record\n :__first__group__\n end",
"title": ""
},
{
"docid": "a109f017baa142605c804e013b5a8ea8",
"score": "0.63765675",
"text": "def id\n @fields[1]\n end",
"title": ""
},
{
"docid": "abc0253fd36f3c62f45e9f9d8504d814",
"score": "0.63673323",
"text": "def record_identifier(record)\n { milestone_iid: record.iid, milestone_name: record.name }\n end",
"title": ""
},
{
"docid": "90fe4a236ae7ad618037bba764e2c163",
"score": "0.6355195",
"text": "def get_key record\n :__first_group__\n end",
"title": ""
},
{
"docid": "d636f8596938b886129cf3fe7d0262d3",
"score": "0.63518095",
"text": "def record_identifiers(record)\n rec_ids = { record_id_field => record[record_id_field] }\n\n record_id_extra_fields&.each do |f|\n rec_ids[f] = record[f]\n end\n\n rec_ids\n end",
"title": ""
},
{
"docid": "e5bacb12588b0c36eff12064d84d0666",
"score": "0.6316174",
"text": "def id\n key = self.key\n key.first if key.size == 1\n end",
"title": ""
},
{
"docid": "e5bacb12588b0c36eff12064d84d0666",
"score": "0.6316174",
"text": "def id\n key = self.key\n key.first if key.size == 1\n end",
"title": ""
},
{
"docid": "10180c03c7196e2c1ee15e29fb2d8d69",
"score": "0.6263295",
"text": "def first\n @data[:first]\n end",
"title": ""
},
{
"docid": "10180c03c7196e2c1ee15e29fb2d8d69",
"score": "0.6263295",
"text": "def first\n @data[:first]\n end",
"title": ""
},
{
"docid": "9d10e0c50bf25649adceef6631df7b81",
"score": "0.6209351",
"text": "def id\n value[0]\n end",
"title": ""
},
{
"docid": "c4d278db7fc9ec4d7a0b78b5b040d4a5",
"score": "0.6184259",
"text": "def correct_field_key(field)\n field.first\n end",
"title": ""
},
{
"docid": "ad6dc17f1a989c3da2e177e5c460257f",
"score": "0.6177306",
"text": "def get id\n indexed?\n if fpos = indexer_get(id)\n get_rec(fpos)\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "fb4178f6cab9715ed39c0cee11cb0c6e",
"score": "0.6148064",
"text": "def first_record_preamble\n return nil unless header[:first_rec_group] > 0\n cursor(header[:first_rec_group]).name(\"header\") do |c|\n type_and_flag = c.name(\"type\") { c.get_uint8 }\n type = type_and_flag & RECORD_TYPE_MASK\n type = RECORD_TYPES[type] || type\n single_record = (type_and_flag & SINGLE_RECORD_MASK) > 0\n case type\n when :MULTI_REC_END, :DUMMY_RECORD\n { :type => type }\n else\n {\n :type => type,\n :single_record => single_record,\n :space => c.name(\"space\") { c.get_ic_uint32 },\n :page_number => c.name(\"page_number\") { c.get_ic_uint32 },\n }\n end\n end\n end",
"title": ""
},
{
"docid": "b36ce615b4119ac8c5cb870e62c6c096",
"score": "0.61442393",
"text": "def get_first_field(data_obj)\n raise ArgumentError, \"data_obj cannot be nil\" if data_obj.nil? || data_obj == FFI::Pointer::NULL\n\n SscFfi.ssc_data_first(data_obj)\n end",
"title": ""
},
{
"docid": "1b90b4a99dbcd46bc4b5358315e84d58",
"score": "0.61260146",
"text": "def extract_id_field(attributes)\n id_fields.each do |k|\n if v = attributes[k]\n return v\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "c73ee10df5fa37ca45ba4f453c4fa3ab",
"score": "0.611703",
"text": "def id\n return @fields[:id] if @fields.key?(:id)\n end",
"title": ""
},
{
"docid": "068867a7520f7cc7038a2e85ca067fa5",
"score": "0.6100233",
"text": "def getNativeID(data)\n\n\t id= data[\"id\"]\n\n\t native_id = id.split(\":\")[-1]\n\n\t return native_id\n end",
"title": ""
},
{
"docid": "8b73fe125c9feb74dadf5740d6711de1",
"score": "0.6095759",
"text": "def record\n @record ||= begin\n if header[:first_rec_group] != 0\n c = cursor(header[:first_rec_group])\n type_and_flag = c.get_uint8\n type = type_and_flag & RECORD_TYPE_MASK\n type = RECORD_TYPES[type] || type\n single_record = (type_and_flag & SINGLE_RECORD_MASK) > 0\n {\n :type => type,\n :single_record => single_record,\n :content => record_content(type, c.position),\n :space => c.get_ic_uint32,\n :page_number => c.get_ic_uint32,\n }\n end\n end\n end",
"title": ""
},
{
"docid": "098e74d11d7b4695d5d716b6fdd84295",
"score": "0.6082549",
"text": "def current_id\n data = current_row_as_array()\n return nil unless data\n data.first\n end",
"title": ""
},
{
"docid": "942b1c0948682b823184a467261fc49a",
"score": "0.6066328",
"text": "def entry_id\n @id = self.record('HEADER').first.idCode unless @id\n @id\n end",
"title": ""
},
{
"docid": "d8b34bd3d6da09b8b9a982a336a0d4d5",
"score": "0.6055876",
"text": "def get_record_metadata(dbf, record_number)\n dbf.nil? ? {} : dbf.find(record_number - 1).attributes\n end",
"title": ""
},
{
"docid": "762e8a39ed84ec08db359dfc74944fcf",
"score": "0.6055065",
"text": "def get_id_data(rec)\n id_data = { '001' => '',\n '003' => '',\n '019' => [],\n '035' => [],\n '035z' => [],\n '035q' => []}\n \n Traject::MarcExtractor.cached('001:003:019:035a', alternate_script: false).each_matching_line(rec) do |field, spec, extractor|\n case field.tag\n when '001'\n id_data['001'] = field.value\n when '003'\n id_data['003'] = field.value\n when '019'\n field.subfields.select{ |sf| sf.code == 'a' }.each do |sf|\n id_data['019'] << sf.value\n end\n when '035'\n field.subfields.select{ |sf| sf.code == 'a' }.each do |sf|\n id_data['035'] << sf.value\n end\n field.subfields.select{ |sf| sf.code == 'z' }.each do |sf|\n id_data['035z'] << sf.value\n end\n field.subfields.select{ |sf| sf.code == 'q' }.each do |sf|\n id_data['035q'] << sf.value\n end\n end\n end\n \n return id_data\n end",
"title": ""
},
{
"docid": "81091d63eaf8f0c8546c4be5ec1fd0fd",
"score": "0.6002361",
"text": "def record_id(object)\n eval \"object.#{object.class.primary_key}\"\n end",
"title": ""
},
{
"docid": "81091d63eaf8f0c8546c4be5ec1fd0fd",
"score": "0.6002361",
"text": "def record_id(object)\n eval \"object.#{object.class.primary_key}\"\n end",
"title": ""
},
{
"docid": "81091d63eaf8f0c8546c4be5ec1fd0fd",
"score": "0.6002361",
"text": "def record_id(object)\n eval \"object.#{object.class.primary_key}\"\n end",
"title": ""
},
{
"docid": "bb38aac98da7e25475db5dbcd4359674",
"score": "0.6001442",
"text": "def pub_field(record)\n # Check for 264 field first. If multiple fields, prioritizing based on indicator2 field.\n ['1', '3', '2', '0'].each do |indicator2|\n field = record.find { |f| f.tag == '264' && f.indicator2 == indicator2 }\n return field unless field.nil?\n end\n\n # If no valid 264 fields present, return 260 field.\n record.find { |f| f.tag == '260' }\n end",
"title": ""
},
{
"docid": "3c9cc5aac52322c51f6cb8d1931c742f",
"score": "0.59957886",
"text": "def get_id\n # extract ID from control numbers, see\n # http://www.loc.gov/marc/authority/ad001.html\n #field001 = record.fields.select {|f| f if f.tag == '001' }.first.value\n #field003 = record.fields.select {|f| f if f.tag == '003' }.first.value\n #\"#{field003}-#{field001}\"\n get_fields(@@config.field_auth_id).first.value\n end",
"title": ""
},
{
"docid": "d2fdb6341fc4294d27e0e266118de112",
"score": "0.5986605",
"text": "def __get_id_from_document(document)\n document[IDS.find { |id| document[id] }]\n end",
"title": ""
},
{
"docid": "d2fdb6341fc4294d27e0e266118de112",
"score": "0.5986605",
"text": "def __get_id_from_document(document)\n document[IDS.find { |id| document[id] }]\n end",
"title": ""
},
{
"docid": "9e854b57bb8c7927e635251d2dc5d12f",
"score": "0.59813434",
"text": "def Id\n @raw_hash[:id].is_a?(Array) ? @raw_hash[:id].first : @raw_hash[:id]\n end",
"title": ""
},
{
"docid": "56556042d994c9200ad7a5eff2a21112",
"score": "0.59809816",
"text": "def get_container_id_from_record(record)\n record[@container_id_attr]\n end",
"title": ""
},
{
"docid": "4d5c0e0db5e84135408f492d8d4fa44c",
"score": "0.5976001",
"text": "def record_id=(value)\n doc['record_id'] = value\n end",
"title": ""
},
{
"docid": "4fd0b786d13ada5259095314bb2b3b0c",
"score": "0.59727496",
"text": "def find_record_id(options)\n table = options[\"table\"]\n field = options[\"field\"]\n value = options[\"value\"]\n \n if value.is_a?(Integer)\n @id_array = DATABASE.execute(\"SELECT id FROM #{table} WHERE #{field} = #{value}\")\n else\n @id_array = DATABASE.execute(\"SELECT id FROM #{table} WHERE #{field} = '#{value}'\")\n end\n \n value_array = []\n \n if @id_array.length > 1\n @id_array.each do |placeholder|\n placeholder.delete_if do |key, value|\n key.is_a?(Integer)\n end\n placeholder.each do |key, value|\n value_array << value\n @record_id = value_array\n end\n end\n else\n @record_id = @id_array[0][0].to_s\n end\n\n return @record_id\n end",
"title": ""
},
{
"docid": "09e232ccda6af437f66dae64f88c48e7",
"score": "0.5962688",
"text": "def key_for(record)\n [record.id, record.mapping.salesforce_model]\n end",
"title": ""
},
{
"docid": "9c3771d5ae033978734c3492a421d5e6",
"score": "0.5952932",
"text": "def first_id()\n return @ids.first if @ids.respond_to?(\"first\")\n return nil\n end",
"title": ""
},
{
"docid": "27b6d84e0b23372d5a58a7126a75dcff",
"score": "0.59375566",
"text": "def record_uid(rec)\n rec.search('UID').text\n end",
"title": ""
},
{
"docid": "9fbf8710ed2161d82a268371de1af101",
"score": "0.59366757",
"text": "def primary_key\n @primary_key ||= @attributes.first[0]\n end",
"title": ""
},
{
"docid": "9cd4507b56ed6fc96d8edae456962f78",
"score": "0.59268713",
"text": "def get_container_id_from_record(record)\n record.access(@container_id_attr)\n end",
"title": ""
},
{
"docid": "2c1bfcb70b919753ffada95146bdd06a",
"score": "0.59236807",
"text": "def get_primary_key\n return @payload.get_path(\"primary_key\"){\"id\"}\n end",
"title": ""
},
{
"docid": "5a241cea7b7a7c8b556999bbbbcd9d9c",
"score": "0.59156626",
"text": "def record_for(record, type = nil)\n unless type\n type = record.class.to_s.downcase\n end\n \"data-#{type}-id=#{record.id}\"\n end",
"title": ""
},
{
"docid": "374cc71b1d465f556c088eebc492701e",
"score": "0.590868",
"text": "def get_record(data, name)\n data.find { |r| r['name'] == name }\n end",
"title": ""
},
{
"docid": "0e5659bf6b3b2c132e72e262849f51bc",
"score": "0.5905376",
"text": "def first_pk_col\n if @primary_key.is_a? Array\n @primary_key.first\n else\n @primary_key\n end\n end",
"title": ""
},
{
"docid": "6130bd0935c06e2dafeff50fdd486879",
"score": "0.58967644",
"text": "def __object_unique_id__\n return @args[:data][:Field]\n end",
"title": ""
},
{
"docid": "2b100c18e2676e122eb256fb6d96f7b8",
"score": "0.5883443",
"text": "def get_first_field(object_name, columns, html)\n return unless columns.first\n first_field = \"id=\\\"#{object_name}_#{columns.first.first}\"\n return unless (match = /#{first_field}.*?\"/.match(html)) # scoop up chars that follow\n match[0][4,99].chop # lop off the leading id=\" and trailing \"\n end",
"title": ""
},
{
"docid": "acc787f456b706b62b5f30e5f1955d30",
"score": "0.5878519",
"text": "def first\n to_h.first\n end",
"title": ""
},
{
"docid": "3af219ba80e55bc254f6e4549ef14b51",
"score": "0.5873071",
"text": "def id\n @data['id']\n end",
"title": ""
},
{
"docid": "59c225c5d072ee3c6503e1dc01431902",
"score": "0.5867648",
"text": "def id\n data[:id]\n end",
"title": ""
},
{
"docid": "ca27650bd5594af728874c672a67beef",
"score": "0.5867156",
"text": "def parse_record(record)\n record.correlation_id = @test_id\n record.medical_record_number = rand(1_000_000_000_000_000)\n record\n rescue StandardError\n nil\n end",
"title": ""
},
{
"docid": "b4d9da28daf253e1861e2e39a7fbfc4a",
"score": "0.5865778",
"text": "def convert_id(doc)\n doc[:id] = doc['id'].try(:first) if doc\n doc\n end",
"title": ""
},
{
"docid": "270f65aa205aab0305e980b6c268cc97",
"score": "0.5860583",
"text": "def cache_key(record)\n record.object_id\n end",
"title": ""
},
{
"docid": "270f65aa205aab0305e980b6c268cc97",
"score": "0.5860583",
"text": "def cache_key(record)\n record.object_id\n end",
"title": ""
},
{
"docid": "270f65aa205aab0305e980b6c268cc97",
"score": "0.5860583",
"text": "def cache_key(record)\n record.object_id\n end",
"title": ""
},
{
"docid": "e4cd99df3ada62396db0bb3148afe2eb",
"score": "0.58529246",
"text": "def _id\n @data[:id]\n end",
"title": ""
},
{
"docid": "d6beac60253154caa3fb6de86b1df85f",
"score": "0.58519816",
"text": "def identifier\r\n self.identifiers.first\r\n end",
"title": ""
},
{
"docid": "8962aa7a8cff0d04baa8e2bae4d70e4f",
"score": "0.5851187",
"text": "def first\n @data.first\n end",
"title": ""
},
{
"docid": "6c3f5c37d7c02891e1126d228fb51bb1",
"score": "0.5847056",
"text": "def id\n @data['id']\n end",
"title": ""
},
{
"docid": "f0f50112239031ef2b9d6717962917f2",
"score": "0.5845899",
"text": "def pk\n if pk_columns.size == 1\n @row[ pk_columns[ 0 ] ]\n else\n pk_values\n end\n end",
"title": ""
},
{
"docid": "5312ba6b619b8da08a93b41f20e49737",
"score": "0.5845613",
"text": "def cache_key(record)\n record.object_id\n end",
"title": ""
},
{
"docid": "5312ba6b619b8da08a93b41f20e49737",
"score": "0.5845613",
"text": "def cache_key(record)\n record.object_id\n end",
"title": ""
},
{
"docid": "5312ba6b619b8da08a93b41f20e49737",
"score": "0.5845613",
"text": "def cache_key(record)\n record.object_id\n end",
"title": ""
},
{
"docid": "8d1b3eeb4adf061518178b53b275d207",
"score": "0.5838753",
"text": "def bib_record_id\n unless params[\"id\"].nil?\n id = chop_bib_id ? params[\"id\"].chop : params[\"id\"]\n end \n end",
"title": ""
},
{
"docid": "b1c085e222af9fb61759d156cb657b43",
"score": "0.5835807",
"text": "def id\n @data['id']\n end",
"title": ""
},
{
"docid": "bd8eb5b151223b69af89e13a24133759",
"score": "0.5833077",
"text": "def first_primary_key\n @db.schema(self).map{|k, v| k if v[:primary_key] == true}.compact.first\n end",
"title": ""
},
{
"docid": "292e153ec5cb9e0c692dd29bf90bddee",
"score": "0.58297175",
"text": "def cache_key(record)\n record.object_id\n end",
"title": ""
},
{
"docid": "292e153ec5cb9e0c692dd29bf90bddee",
"score": "0.58297175",
"text": "def cache_key(record)\n record.object_id\n end",
"title": ""
},
{
"docid": "ab1af4016dd2cb8c4c1e53d509ace6a1",
"score": "0.582917",
"text": "def sub_record_names\n sub_records.map(&:first)\n end",
"title": ""
},
{
"docid": "b6e4430b0b42da6a95730bbf5ddb183b",
"score": "0.5817151",
"text": "def parse_id; end",
"title": ""
},
{
"docid": "bc1a4028ed12b13d7255ce009fb7d8af",
"score": "0.5808436",
"text": "def id\n info[0]\n end",
"title": ""
},
{
"docid": "18d7ff4ae27dc9299b2f5c2e4269a232",
"score": "0.5793846",
"text": "def decode_record(rec)\n\t\t\t\t\treturn rec.chomp!()\n\t\t\t\tend",
"title": ""
},
{
"docid": "d93dad0ebb12ff88d763186a3d344009",
"score": "0.5792881",
"text": "def first(field)\n @attributes[field]\n end",
"title": ""
},
{
"docid": "d93dad0ebb12ff88d763186a3d344009",
"score": "0.5792881",
"text": "def first(field)\n @attributes[field]\n end",
"title": ""
},
{
"docid": "c3a13e37f311b9505804e0eefdb350e8",
"score": "0.5784972",
"text": "def identifier\n @obj['ID']\n end",
"title": ""
},
{
"docid": "c3a13e37f311b9505804e0eefdb350e8",
"score": "0.5784972",
"text": "def identifier\n @obj['ID']\n end",
"title": ""
},
{
"docid": "9d441159e40538280d341168905c5b9d",
"score": "0.5779982",
"text": "def entry_id\n if @data['entry_id']\n @data['entry_id']\n else\n @data['entry_id'] = field_fetch('H')\n end\n end",
"title": ""
},
{
"docid": "a28bf0b8de8008f2398e4d5ca5fbb1ec",
"score": "0.57696515",
"text": "def record(id)\n @records[id.to_i]\n end",
"title": ""
},
{
"docid": "7eff7f71a0d047c55d495375130a697c",
"score": "0.57663465",
"text": "def record_fields\n mappings = super\n # we pull the title info from the json_fields. Also ditch any blank values. \n mappings['title'] = nil\n mappings.delete_if { |k,v| v.blank? } \n mappings['identifier'] ||= record.json['display_string']\n mappings\n end",
"title": ""
},
{
"docid": "9e8241a4f6df5332377e14e7d59a6160",
"score": "0.57610726",
"text": "def first\n @data.first\n end",
"title": ""
},
{
"docid": "9b831a790dfe845abb0a51e37d680a98",
"score": "0.5752504",
"text": "def cache_key(record)\n record.id\n end",
"title": ""
},
{
"docid": "cb44d73c1540d799119c0505cfe4d912",
"score": "0.5751121",
"text": "def id\n @data[:s]\n end",
"title": ""
},
{
"docid": "cb44d73c1540d799119c0505cfe4d912",
"score": "0.5751121",
"text": "def id\n @data[:s]\n end",
"title": ""
},
{
"docid": "4487bde1583ee56be8a57462f1f4191a",
"score": "0.5747114",
"text": "def avatax_id(record)\n \"#{record.class.name}-#{record.id}\"\n end",
"title": ""
},
{
"docid": "b4fc900f2310418039b78ea8f09c47b0",
"score": "0.57464856",
"text": "def identifier\n return @identifiers[0]\n end",
"title": ""
},
{
"docid": "127e501ce6fcc72b65e7d09a3a204aff",
"score": "0.57457554",
"text": "def fetch_single_record(data)\n url_path = self.url + \"/api/resource/\" + data[:doctype] + \"/\" + data[:id]\n encoded_url_path = URI.encode url_path\n\n response = HTTParty.get(encoded_url_path, :headers => {\n \"Cookie\" => self.session_cookie, \"Accept\" => \"application/json\",\n \"X-Frappe-CSRF-Token\" => self.session_cookie\n })\n return response.parsed_response\n end",
"title": ""
},
{
"docid": "bb8af3551684e58fead6945324e3e2b7",
"score": "0.57421297",
"text": "def id\n @obj['id']\n end",
"title": ""
},
{
"docid": "308f78bf708c1130b1489e76ec6e891c",
"score": "0.5738674",
"text": "def id\n structure.proxy.first.to_s\n end",
"title": ""
},
{
"docid": "308f78bf708c1130b1489e76ec6e891c",
"score": "0.5738674",
"text": "def id\n structure.proxy.first.to_s\n end",
"title": ""
},
{
"docid": "1688ccec03220d376c5154be0aaf15ee",
"score": "0.57357144",
"text": "def find_record(id)\n @records[@ids.index(id)]\n end",
"title": ""
}
] |
9e1cf2d2a79eb773e629d14c448f89ee | Public: Determines if the VM exists or not. This method looks for the VM's conf file ('.vmx') to determine if the VM exists or not. Examples | [
{
"docid": "cad943cc60610cddebe2cff91aaac1ea",
"score": "0.58102995",
"text": "def exists?\n conf_file.successful?\n end",
"title": ""
}
] | [
{
"docid": "684b94e2f65b09d81b97589e318d79eb",
"score": "0.7622194",
"text": "def exists?\n File.exists? vmx_path\n end",
"title": ""
},
{
"docid": "4e0419d8b2ec8900a31c26bc5e14e23b",
"score": "0.754773",
"text": "def check_fusion_vm_exists(options)\n set_vmrun_bin(options)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n if not File.exist?(fusion_vmx_file)\n if options['verbose'] == true\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} does not exist\")\n end\n exists = false\n else\n if options['verbose'] == true\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} exists\")\n end\n exists = true\n end\n return exists\nend",
"title": ""
},
{
"docid": "4578c191e3f06392e6527bf970e7c3e9",
"score": "0.7458194",
"text": "def vm_exists?(pool_name, vm_name)\n !get_vm(pool_name, vm_name).nil?\n end",
"title": ""
},
{
"docid": "4578c191e3f06392e6527bf970e7c3e9",
"score": "0.7458194",
"text": "def vm_exists?(pool_name, vm_name)\n !get_vm(pool_name, vm_name).nil?\n end",
"title": ""
},
{
"docid": "87a7c7c5f6dd0c11380f6aa1db8da69b",
"score": "0.72291404",
"text": "def check_vbox_vm_config_exists(client_name)\n exists = \"no\"\n vbox_vm_dir = get_vbox_vm_dir(client_name)\n config_file = vbox_vm_dir+\"/\"+client_name+\".vbox\"\n if File.exist?(config_file)\n exists = \"yes\"\n else\n exists = \"no\"\n end\n return exists\nend",
"title": ""
},
{
"docid": "370cb51c481cf9e07447d0516cdbf2f9",
"score": "0.71238846",
"text": "def vm_exists?(uuid)\n end",
"title": ""
},
{
"docid": "5eee40bc77ad4a640ca1cdbd82de2117",
"score": "0.7053148",
"text": "def is_vm?\n cmd = \"VBoxManage showvminfo \\\"#{@vbox_name}\\\"\"\n _, stderr, _ = Open3.capture3(cmd)\n if stderr.include? 'Could not find a registered machine named'\n raise \"Virtual Machine #{@vbox_name} does not exist\"\n end\n end",
"title": ""
},
{
"docid": "b9bef0a0421a92d8804635972770d4db",
"score": "0.69420063",
"text": "def check_parallels_vm_exists(options)\n set_vmrun_bin(options)\n exists = false\n vm_list = get_all_parallels_vms(options)\n vm_list.each do |vm_name|\n if vm_name.match(/^#{options['name']}$/)\n exists = true\n return exists\n end\n end\n return exists\nend",
"title": ""
},
{
"docid": "22c63ed2e9502e520dddacb4daae6c73",
"score": "0.6885644",
"text": "def created?(vm_name, provider='virtualbox')\n\tFile.exist?(\".vagrant/machines/#{vm_name}/#{provider}/id\")\nend",
"title": ""
},
{
"docid": "7480cce50cdaca175a11694dbf97d88e",
"score": "0.6843978",
"text": "def vm_exists_silent\n return false unless @state.key?(:id) && !@state[:id].nil?\n\n existing_vm = run_ps ensure_vm_running_ps\n return false if existing_vm.nil? || existing_vm[\"Id\"].nil?\n\n true\n end",
"title": ""
},
{
"docid": "15d5e6783ccd1899c84b416a6d9922f4",
"score": "0.68160194",
"text": "def kvm_exists?(kvm_name)\n begin\n virt.lookup_domain_by_name(kvm_name)\n true\n rescue Libvirt::RetrieveError\n false\n end\nend",
"title": ""
},
{
"docid": "bc4fc817b10069d6092a9325e46e8974",
"score": "0.68004954",
"text": "def exists?\n\t\tbegin\n\t\t\tdom\n\t\t\tdebug \"Domain %s exists? true\" % [resource[:name]]\n\t\t\ttrue\n\t\trescue Libvirt::RetrieveError => e\n\t\t\tdebug \"Domain %s exists? false\" % [resource[:name]]\n\t\t\tfalse # The vm with that name doesnt exist\n\t\tend\n\tend",
"title": ""
},
{
"docid": "7bb65a98c9b8a37c6482ecf2f332bd3d",
"score": "0.6784",
"text": "def check_fusion_vm_doesnt_exist(options)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\"\n end\n fusion_vmx_file = fusion_vm_dir+\"/\"+options['name']+\".vmx\"\n fusion_disk_file = fusion_vm_dir+\"/\"+options['name']+\".vmdk\"\n if File.exist?(fusion_vmx_file)\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} already exists\")\n quit(options)\n end\n return fusion_vm_dir,fusion_vmx_file,fusion_disk_file\nend",
"title": ""
},
{
"docid": "959f22fd8252d55d0a0196ba374f28dc",
"score": "0.67590314",
"text": "def exists?\n\n\t\tbegin\n\t\t\tdom\n\t\t\tdebug \"Domain %s exists? true\" % [resource[:name]]\n\t\t\ttrue\n\t\trescue Libvirt::RetrieveError => e\n\t\t\tdebug \"Domain %s exists? false\" % [resource[:name]]\n\t\t\tfalse # The vm with that name doesnt exist\n\t\tend\n\n\tend",
"title": ""
},
{
"docid": "757c8e2d2d29ab3efb16f90bf1d0bd0e",
"score": "0.6726877",
"text": "def provisioned?(vm_name='default', provider='virtualbox')\n File.exist?(\".vagrant/machines/#{vm_name}/#{provider}/action_provision\")\nend",
"title": ""
},
{
"docid": "e13500af57c36ae2a75bdac7fcfad839",
"score": "0.6713914",
"text": "def provisioned?(vm_name=\"default\", provider=\"virtualbox\")\n File.exist?(\".vagrant/machines/#{vm_name}/#{provider}/action_provision\")\nend",
"title": ""
},
{
"docid": "2a0a8721b31855a7cf2d4afdb9de97b6",
"score": "0.6643735",
"text": "def vm_exists?(uuid)\n 5.times do\n result = raw(@prlctl_path, 'list', uuid)\n return true if result.exit_code == 0\n\n # Sometimes this happens. In this case, retry.\n # If we don't see this text, the VM really doesn't exist.\n return false unless result.stderr.include?('Login failed:')\n\n # Sleep a bit though to give Parallels Desktop time to fix itself\n sleep 2\n end\n\n # If we reach this point, it means that we consistently got the\n # failure, do a standard prlctl now. This will raise an\n # exception if it fails again.\n execute_prlctl('list', uuid)\n true\n end",
"title": ""
},
{
"docid": "30aa24913fcd2931c57eb9f2f1757903",
"score": "0.66268003",
"text": "def check_multipass_vm_exists(options)\n exists = false\n if options['name'] == options['empty']\n handle_output(options,\"Warning:\\tNo client name specified\")\n quit(options)\n end\n vm_name = options['name'].to_s\n message = \"Information:\\tChecking if VM #{vm_name} exists\"\n command = \"multipass list |grep #{vm_name}\"\n output = execute_command(options,message,command)\n if output.match(/#{vm_name}/)\n exists = true\n end\n return exists\nend",
"title": ""
},
{
"docid": "5ef285e8c225e4799b35b63f35c08852",
"score": "0.65253115",
"text": "def check_parallels_vm_doesnt_exist(options)\n exists = check_parallels_vm_exists(options)\n if exists == true\n handle_output(options,\"Parallels VM #{options['name']} already exists\")\n quit(options)\n end\n return\nend",
"title": ""
},
{
"docid": "74f8b2436f554cca76bbd3209ea6dcb7",
"score": "0.6507069",
"text": "def check_docker_vm_exists(options)\n exists = false\n message = \"Information:\\tChecking docker instances for #{options['name']}\"\n command = \"docker-machine ls\"\n output = execute_command(options,message,command)\n output = output.split(/\\n/)\n output.each do |line|\n line = line.chomp\n items = line.split(/\\s+/)\n host = items[0]\n if host.match(/^#{options['name']}$/)\n exists = true\n return exists\n end\n end\n return exists\nend",
"title": ""
},
{
"docid": "f1fbc44bfc0a766a9dfffd0d11ed2a65",
"score": "0.64989924",
"text": "def has_vm?(vm_id)\n with_thread_name(\"has_vm?(#{vm_id})\") do\n begin\n @logger.info(\"Checking if VM with id = #{vm_id} exists...\")\n vm = @vm_manager.get_virtual_machine(vm_id)\n !vm.nil? ? true : false\n rescue => e\n @logger.error(e)\n false\n end\n end\n end",
"title": ""
},
{
"docid": "44e5750804217c031826190dc462c85d",
"score": "0.64126563",
"text": "def vip_installed?\n ssh.directory_exists?(vip_path)\n end",
"title": ""
},
{
"docid": "606c1136f0949e198e38febc3dc3a6a4",
"score": "0.64092386",
"text": "def provisioned?(vm_name='default', provider='virtualbox')\n File.exist?(\".vagrant/machines/#{vm_name}/#{provider}/action_provision\")\n end",
"title": ""
},
{
"docid": "a436ba69b2ef5eefe9ef298d5b4273a2",
"score": "0.64028245",
"text": "def check_vbox_vm_exists(client_name)\n message = \"Checking:\\tVM \"+client_name+\" exists\"\n command = \"VBoxManage list vms |grep -v 'inaccessible'\"\n host_list = execute_command(message,command)\n if !host_list.match(client_name)\n puts \"Information:\\tVirtualBox VM \"+client_name+\" does not exist\"\n exists = \"no\"\n else\n exists = \"yes\"\n end\n return exists\nend",
"title": ""
},
{
"docid": "36a79dc0d803cedee44e513de3b344ee",
"score": "0.63713723",
"text": "def has_vm?(vm_cid)\n @telemetry_manager.monitor('initialize') do\n _init_azure\n end\n with_thread_name(\"has_vm?(#{vm_cid})\") do\n @telemetry_manager.monitor('has_vm?', id: vm_cid) do\n vm = @vm_manager.find(InstanceId.parse(vm_cid, _azure_config.resource_group_name))\n !vm.nil? && vm[:provisioning_state] != 'Deleting'\n end\n end\n end",
"title": ""
},
{
"docid": "b46661ec112ca59a5c50ec7c71f0b042",
"score": "0.62955374",
"text": "def check_fusion_vm_is_running(options)\n list_vms = get_running_fusion_vms(options)\n if list_vms.to_s.match(/#{options['name']}.vmx/)\n running = \"yes\"\n else\n running = \"no\"\n end\n return running\nend",
"title": ""
},
{
"docid": "3366048be03e59570ded28ac9b9bc216",
"score": "0.6277653",
"text": "def looks_like_orionvm_v2?\n File.exists?('/etc/orion_base')\n end",
"title": ""
},
{
"docid": "7480d94afe0c8ddabef4a9c8138f95c3",
"score": "0.6156936",
"text": "def user_template_exists?\n !options['puppet_config_template'].nil? &&\n File.exist?(options['puppet_config_template'])\nend",
"title": ""
},
{
"docid": "2820315998f4c298435fb1465a94ce54",
"score": "0.60958904",
"text": "def check_vbox_vm_doesnt_exist(client_name)\n message = \"Checking:\\tVM \"+client_name+\" doesn't exist\"\n command = \"VBoxManage list vms\"\n host_list = execute_command(message,command)\n if host_list.match(client_name)\n puts \"Information:\\tVirtualBox VM #{client_name} already exists\"\n exit\n end\n return\nend",
"title": ""
},
{
"docid": "721618cbb7043bb26e46e9a8a4220f6a",
"score": "0.6033109",
"text": "def vagrant?\n @vagrant ||= `id vagrant 2>&1`.index 'uid'\n end",
"title": ""
},
{
"docid": "5fd2afbc91ad1c6aa4d99ad707f60673",
"score": "0.60249454",
"text": "def exists?\n @lxc.exists?(self.name)\n end",
"title": ""
},
{
"docid": "3b3357f39b78ef664e07ff66439d3d15",
"score": "0.6021568",
"text": "def vbox_host?\n host = false\n if !virtualization.nil? && (virtualization[\"system\"] == \"vbox\" || virtualization[\"systems\"][\"vbox\"] == \"host\")\n host = true if which(\"VBoxManage\")\n end\n host\n end",
"title": ""
},
{
"docid": "f1a6f4eee53df8808d63794fc1626227",
"score": "0.5981733",
"text": "def instance_exists(path)\n result = $evm.instance_exists?(path)\n if result\n $evm.log('info',\"Instance:<#{path}> exists. Result:<#{result.inspect}>\") if @debug\n else\n $evm.log('info',\"Instance:<#{path}> does not exist. Result:<#{result.inspect}>\") if @debug\n end\n return result\n end",
"title": ""
},
{
"docid": "0959a111294d59a6a057308dcfeba2b5",
"score": "0.5970859",
"text": "def running?\n ck_valid\n kvm = File.basename(SysConf.value_for :kvm_bin)\n cmdline =~ /#{kvm}/\n end",
"title": ""
},
{
"docid": "26ea3f69726bbd354048cf2760712d89",
"score": "0.59292",
"text": "def exists?(vid)\n perform_request(:action => 'vserver-checkexists', :vserverid => vid)\n !statusmsg.match(/Virtual server exists/i).nil?\n end",
"title": ""
},
{
"docid": "507b9477a9275f41abcc173412528e91",
"score": "0.58930904",
"text": "def has_vm?(server_id)\n with_thread_name(\"has_vm?(#{server_id})\") do\n server = @openstack.with_openstack { @openstack.compute.servers.get(server_id) }\n !server.nil? && !%i[terminated deleted].include?(server.state.downcase.to_sym)\n end\n end",
"title": ""
},
{
"docid": "1fcf688e5da302f8b1f3d19952e324b0",
"score": "0.58738047",
"text": "def vm_ok?\n unless @vm\n warn 'No VM initialized'\n return false\n end\n inf = vm_info\n # wait while vm is waiting for instantiating\n while [0, 1, 2].include? inf['VM']['LCM_STATE'].to_i\n sleep 10\n inf = vm_info\n end\n inf['VM']['STATE'].to_i == 3 # state 3 - VM is running\n end",
"title": ""
},
{
"docid": "19b89ae2ab798c73e471a65bc7c6087d",
"score": "0.5873051",
"text": "def show_fusion_vm_config(options)\n fusion_vmx_file = \"\"\n exists = check_fusion_vm_exists(options)\n if exists == true\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n if File.exist?(fusion_vmx_file)\n print_contents_of_file(options,\"#{options['vmapp']} configuration\",fusion_vmx_file)\n end\n end\n return\nend",
"title": ""
},
{
"docid": "7e08f2ad690c73e58e85e80394be39a1",
"score": "0.5847041",
"text": "def conf_file\n vmx_path = File.join path, \"*.vmx\"\n conf_files = Dir.glob vmx_path\n\n response = Response.new\n\n case conf_files.count\n when 0\n response.code = 1\n response.message = \"Unable to find a config file for VM '#{@name}' (in '#{vmx_path}')\"\n when 1\n response.code = 0\n response.data = conf_files.first\n else\n if conf_files.include?(File.join(File.dirname(vmx_path), \"#{@name}.vmx\"))\n response.code = 0\n response.data = File.join(File.dirname(vmx_path), \"#{@name}.vmx\")\n else\n response.code = 1\n output = \"Multiple config files found for VM '#{@name}' (\"\n output << conf_files.sort.map { |f| \"'#{File.basename(f)}'\" }.join(', ')\n output << \" in '#{File.dirname(vmx_path)}')\"\n response.message = output\n end\n end\n\n response\n end",
"title": ""
},
{
"docid": "c664d6843d993ca7eef943b5dd81f6d7",
"score": "0.5841146",
"text": "def suspend_file_exists?\n File.file? File.join(path, \"#{@name}.vmem\")\n end",
"title": ""
},
{
"docid": "c664d6843d993ca7eef943b5dd81f6d7",
"score": "0.5841146",
"text": "def suspend_file_exists?\n File.file? File.join(path, \"#{@name}.vmem\")\n end",
"title": ""
},
{
"docid": "f81f9bf18cc6dcfd3a4589c75d9550c7",
"score": "0.5821627",
"text": "def exists?(vid)\n perform_request(action: 'vserver-checkexists', vserverid: vid)\n !!statusmsg.match(/Virtual server exists/i)\n end",
"title": ""
},
{
"docid": "d25368afc22d206cfe3a25ea624a60d0",
"score": "0.5814084",
"text": "def rvm?\n\t\t\tFile.exists?(RvmPow::RVM_BINARY)\n\t\tend",
"title": ""
},
{
"docid": "5742838dc27c100f71e838c9d1ce0864",
"score": "0.57964104",
"text": "def exists?\n vnic\n end",
"title": ""
},
{
"docid": "540ca4ae4de90bb9c06faa148d4ed104",
"score": "0.5773551",
"text": "def can_be_configured?(vagrant_config, file_config)\n true\n end",
"title": ""
},
{
"docid": "3d84090a5a67db93e3b5b43a4f939418",
"score": "0.5758059",
"text": "def mmkv_file_exists(file)\n is_exist = false\n if File.methods.include?(:exists?)\n is_exist = File.exists? file\n else\n is_exist = File.exist? file\n end\n return is_exist\nend",
"title": ""
},
{
"docid": "656bb3ecd98a85dc8143802995ba8f3a",
"score": "0.5718108",
"text": "def conf_file\n vmx_path = File.join path, \"*.vmx\"\n conf_files = Dir.glob vmx_path\n\n response = Response.new\n\n case conf_files.count\n when 0\n response.code = 1\n response.message = \"Unable to find a config file for VM '#{@name}' (in '#{vmx_path}')\"\n when 1\n response.code = 0\n response.data = conf_files.first\n else\n if conf_files.include?(File.join(File.dirname(vmx_path), \"#{@name}.vmx\"))\n response.code = 0\n response.data = File.join(File.dirname(vmx_path), \"#{@name}.vmx\")\n else\n response.code = 1\n output = \"Multiple config files found for VM '#{@name}' (\"\n output << conf_files.sort.map { |f| \"'#{File.basename(f)}'\" }.join(', ')\n output << \" in '#{File.dirname(vmx_path)}')\"\n response.message = output\n end\n end\n\n response.data.gsub! ' ', '\\ ' if response.successful?\n\n response\n end",
"title": ""
},
{
"docid": "697ec7495899a8b78207fd41469352a0",
"score": "0.570965",
"text": "def get_fusion_vm_status(options)\n exists = check_fusion_vm_exists(options)\n if exists == true\n vm_list = get_running_fusion_vms(options)\n if vm_list.to_s.match(/#{options['name']}/)\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Running\")\n else\n handle_output(options,\"Information:\\t#{options['vmapp']} VM #{options['name']} is Not Running\")\n end\n else\n handle_output(options,\"Warning:\\t#{options['vmapp']} VM #{options['name']} doesn't exist\")\n end\n return\nend",
"title": ""
},
{
"docid": "67744066d5066656a97fa7460756fbf4",
"score": "0.5707357",
"text": "def vboxchk(session)\n vm = false\n vboxprocs = [\n \"vboxservice.exe\",\n \"vboxtray.exe\"\n ]\n session.sys.process.get_processes().each do |x|\n vboxprocs.each do |p|\n if p == (x['name'].downcase)\n vm = true\n end\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\DSDT')\n if srvvals and srvvals.include?(\"VBOX__\")\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\FADT')\n if srvvals and srvvals.include?(\"VBOX__\")\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\RSDT')\n if srvvals and srvvals.include?(\"VBOX__\")\n vm = true\n end\n end\n if not vm\n key_path = 'HKLM\\HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port 0\\Scsi Bus 0\\Target Id 0\\Logical Unit Id 0'\n if registry_getvaldata(key_path,'Identifier') =~ /vbox/i\n vm = true\n end\n end\n if not vm\n if registry_getvaldata('HKLM\\HARDWARE\\DESCRIPTION\\System','SystemBiosVersion') =~ /vbox/i\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\SYSTEM\\ControlSet001\\Services')\n if srvvals and srvvals.include?(\"VBoxMouse\")\n vm = true\n elsif srvvals and srvvals.include?(\"VBoxGuest\")\n vm = true\n elsif srvvals and srvvals.include?(\"VBoxService\")\n vm = true\n elsif srvvals and srvvals.include?(\"VBoxSF\")\n vm = true\n end\n end\n if vm\n report_note(\n :host => session.session_host,\n :type => 'host.info.vm',\n :data => { :hypervisor => \"VirtualBox\" },\n :update => :unique_data\n )\n print_good(\"This is a Sun VirtualBox Virtual Machine\")\n return \"VirtualBox\"\n end\n end",
"title": ""
},
{
"docid": "284b839637b604fb5d0784ca6ae15378",
"score": "0.57050616",
"text": "def should_install_vagrant?\n vagrant_v_output = run_command('vagrant -v')[:output]\n installed_version = vagrant_v_output.match(/^Vagrant ([0-9.]+)\\s*$/)[1]\n SemVersion.new(VAGRANT_VERSION) > SemVersion.new(installed_version)\n rescue Errno::ENOENT\n true\n end",
"title": ""
},
{
"docid": "e4540e35a20fd4a27d71a9de2048e33d",
"score": "0.57035035",
"text": "def only_vmware?(server)\n return false if server['general']['alive'].to_i == 1\n return false unless server['netdb'].empty?\n return true unless server['vmware'].empty?\n\n false\n end",
"title": ""
},
{
"docid": "8eca74864d940145b80d55f879f774a0",
"score": "0.569838",
"text": "def vmwarechk(session)\n vm = false\n srvvals = registry_enumkeys('HKLM\\SYSTEM\\ControlSet001\\Services')\n if srvvals and srvvals.include?(\"vmdebug\")\n vm = true\n elsif srvvals and srvvals.include?(\"vmmouse\")\n vm = true\n elsif srvvals and srvvals.include?(\"VMTools\")\n vm = true\n elsif srvvals and srvvals.include?(\"VMMEMCTL\")\n vm = true\n end\n if not vm\n if registry_getvaldata('HKLM\\HARDWARE\\DESCRIPTION\\System\\BIOS','SystemManufacturer') =~ /vmware/i\n vm = true\n end\n end\n if not vm\n key_path = 'HKLM\\HARDWARE\\DEVICEMAP\\Scsi\\Scsi Port 0\\Scsi Bus 0\\Target Id 0\\Logical Unit Id 0'\n if registry_getvaldata(key_path,'Identifier') =~ /vmware/i\n vm = true\n end\n end\n if not vm\n vmwareprocs = [\n \"vmwareuser.exe\",\n \"vmwaretray.exe\"\n ]\n session.sys.process.get_processes().each do |x|\n vmwareprocs.each do |p|\n if p == (x['name'].downcase)\n vm = true\n end\n end\n end\n end\n\n if vm\n report_note(\n :host => session.session_host,\n :type => 'host.info.vm',\n :data => { :hypervisor => \"VMware\" },\n :update => :unique_data\n )\n print_good(\"This is a VMware Virtual Machine\")\n return \"VMWare\"\n end\n end",
"title": ""
},
{
"docid": "4df2795f0b898348b2ec01634cb70356",
"score": "0.5665839",
"text": "def has_checkpoint?(vm_name, checkpoint_name) \n\n if !ENV['UPLF_NO_VAGRANT_CHECKPOINTS'].nil?\n _log.info(\"#{vm_name}: [-] provision checkpoint: #{checkpoint_name} (UPLF_NO_VAGRANT_CHECKPOINTS is set)\")\n \n return false \n end\n \n file_name = \".vagrant/machines/#{vm_name}/virtualbox/.uplift/.checkpoint-#{checkpoint_name}\"\n exists = File.exist?(file_name)\n \n if exists == true \n _log.info_light(\"#{vm_name}: [+] provision checkpoint: #{checkpoint_name}\")\n else \n _log.info(\"#{vm_name}: [-] provision checkpoint: #{checkpoint_name}\")\n end\n \n return exists\n end",
"title": ""
},
{
"docid": "fc9d3e65967133cd7623942cc4275b83",
"score": "0.5661506",
"text": "def vagrant?\n begin\n vagrant_range = IPAddr.new LeapCli.leapfile.vagrant_network\n rescue ArgumentError => exc\n Util::bail! { Util::log :invalid, \"ip address '#{@node.ip_address}' vagrant.network\" }\n end\n\n begin\n ip_address = IPAddr.new @node.get('ip_address')\n rescue ArgumentError => exc\n Util::log :warning, \"invalid ip address '#{@node.get('ip_address')}' for node '#{@node.name}'\"\n end\n return vagrant_range.include?(ip_address)\n end",
"title": ""
},
{
"docid": "fc9d3e65967133cd7623942cc4275b83",
"score": "0.5661506",
"text": "def vagrant?\n begin\n vagrant_range = IPAddr.new LeapCli.leapfile.vagrant_network\n rescue ArgumentError => exc\n Util::bail! { Util::log :invalid, \"ip address '#{@node.ip_address}' vagrant.network\" }\n end\n\n begin\n ip_address = IPAddr.new @node.get('ip_address')\n rescue ArgumentError => exc\n Util::log :warning, \"invalid ip address '#{@node.get('ip_address')}' for node '#{@node.name}'\"\n end\n return vagrant_range.include?(ip_address)\n end",
"title": ""
},
{
"docid": "960e6ef071ab0af34649f468c7bf3f35",
"score": "0.56606936",
"text": "def exists?\n #notice(\"DEBUG + \" + resource[:content])\n configs = Hash.new\n qmgmt(['volume', 'config', 'list']).each_line { |l|\n configs[l.chomp()] = true\n }\n\n # diff config is volume config exists\n if ( configs[resource[:name]] )\n diff_config\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "4ff1ae2c3c25fbbfee6649793eaacb7a",
"score": "0.56564575",
"text": "def is_vmware(machine)\n machine.provider_name.to_s().start_with?('vmware')\n end",
"title": ""
},
{
"docid": "7ca61adc0584d366d6d418eccda82c1a",
"score": "0.5641744",
"text": "def active_instance_dir_exists?\n return File.directory?( @resource['instances_dir'] + \"/\" + @resource[:name] )\n end",
"title": ""
},
{
"docid": "1a26e5aab82bb4cd7af0d9e38d029dcd",
"score": "0.56353986",
"text": "def raise_if_no_exists_in_vcenter\n raise 'vCenter device does not exist at the moment' unless exists?\n end",
"title": ""
},
{
"docid": "c7457ee9f96680b67236dbd5349c137c",
"score": "0.5626639",
"text": "def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end",
"title": ""
},
{
"docid": "c7457ee9f96680b67236dbd5349c137c",
"score": "0.5626639",
"text": "def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end",
"title": ""
},
{
"docid": "c7457ee9f96680b67236dbd5349c137c",
"score": "0.5626639",
"text": "def exists?\n return File.exists?(\"/tmp/cloud-#{resource[:name]}\")\n end",
"title": ""
},
{
"docid": "08d833112871283a007ea0791a4c1060",
"score": "0.5619923",
"text": "def agent_template_exists?(agent)\n if target_guestshell?(agent)\n opts = { acceptable_exit_codes: [0, 2], pty: true }\n else\n opts = { acceptable_exit_codes: [0, 2] }\n end\n result = on agent, \"#{pp(agent)} ls #{get_puppet_config(agent)}\", opts\n result.exit_code == 0\nend",
"title": ""
},
{
"docid": "5ac3df9d579a93ed8308d5a049b614de",
"score": "0.56073624",
"text": "def find_or_create_vm(bootstrap_options, machine_spec, action_handler)\n vm = vsphere_helper.find_vm(\n bootstrap_options[:vm_folder],\n machine_spec.name\n )\n if vm\n Chef::Log.info machine_msg(\n machine_spec.name,\n vm.config.instanceUuid,\n 'already created'\n )\n else\n\t if bootstrap_options[:create_new_vm]\n\t vm = clone_vm(\n action_handler,\n bootstrap_options,\n machine_spec.name)\n\t\t else\n raise \"#{machine_spec.name}is not present in the vCenter. Aborting the node creation\"\n end\n end\n vm\n end",
"title": ""
},
{
"docid": "9fe470750957766d6fb9666bc4d2aa3d",
"score": "0.55953074",
"text": "def get_machine_id()\n machine_id_filepath = \".vagrant/machines/default/virtualbox/id\"\n\n if not File.exists? machine_id_filepath\n # VM hasn't been created yet.\n return false\n end\n\n # This is probably not a great way to do this: shell out to the cat command.\n # It seems likely that ruby has a get-file-contents function somewhere,\n # but I'm definitely not a ruby dev right now.\n machine_id = `cat #{machine_id_filepath}`\nend",
"title": ""
},
{
"docid": "17081e0259af0117d3688264fa04f4ac",
"score": "0.5576798",
"text": "def valid?(home_path)\n return false if !vagrantfile_path\n return false if !vagrantfile_path.directory?\n\n # Create an environment so we can determine the active\n # machines...\n found = false\n env = vagrant_env(home_path)\n env.active_machines.each do |name, provider|\n if name.to_s == self.name.to_s &&\n provider.to_s == self.provider.to_s\n found = true\n break\n end\n end\n\n # If an active machine of the same name/provider was not\n # found, it is already false.\n return false if !found\n\n # Get the machine\n machine = nil\n begin\n machine = env.machine(self.name.to_sym, self.provider.to_sym)\n rescue Errors::MachineNotFound\n return false\n end\n\n # Refresh the machine state\n return false if machine.state.id == MachineState::NOT_CREATED_ID\n\n true\n end",
"title": ""
},
{
"docid": "4e8834a8c3988aee113ff895733bc4fe",
"score": "0.5576044",
"text": "def vm_running?\n `docker-machine ls | grep #{project_config['docker-machine']['name']}` =~ /running/i ? true : false\nend",
"title": ""
},
{
"docid": "d914c465c7a7d891d94fb239b7321370",
"score": "0.5563672",
"text": "def virtual_host_exists?(host)\n if File.exists?(host)\n separator\n puts \"Sorry, but a virtual host in the same name already exist!\"\n puts \"Please try with a diffrent name.\"\n puts \"[Hint: speedy new_name.local ]\"\n separator\n exit!\n end\n end",
"title": ""
},
{
"docid": "173b0467943001fd0d9ae6235ea15ce8",
"score": "0.55414474",
"text": "def file_exists?(name)\n\n #if file exists return true\n Chef::Log.debug \"DEBUG: Checking to see if the curent file: '#{ name }.conf' exists in pool directory #{ node[\"php_fpm\"][\"pools_path\"] }\"\n ::File.file?(\"#{ node[\"php_fpm\"][\"pools_path\"] }/#{ name }.conf\")\n\nend",
"title": ""
},
{
"docid": "ba0f30ec2933a68370e7017f4743234d",
"score": "0.55245733",
"text": "def get_fusion_vm_vmx_file_value(options)\n vm_value = \"\"\n vmx_file = get_fusion_vm_vmx_file(options)\n if File.exist?(vmx_file)\n if File.readable?(vmx_file)\n vm_config = ParseConfig.new(vmx_file)\n vm_value = vm_config[options['search']]\n else\n vm_value = \"File Not Readable\"\n end\n else\n if options['verbose'] == true\n handle_output(options,\"Warning:\\tWMware configuration file \\\"#{vmx_file}\\\" not found for client\")\n end\n end\n return vm_value\nend",
"title": ""
},
{
"docid": "0aacc7f21ea6fe43900032f32bcf1736",
"score": "0.55184805",
"text": "def hypervchk(session)\n vm = false\n sfmsvals = registry_enumkeys('HKLM\\SOFTWARE\\Microsoft')\n if sfmsvals and sfmsvals.include?(\"Hyper-V\")\n vm = true\n end\n if not vm\n if registry_getvaldata('HKLM\\HARDWARE\\DESCRIPTION\\System','SystemBiosVersion') =~ /vrtual/i\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\FADT')\n if srvvals and srvvals.include?(\"VRTUAL\")\n vm = true\n end\n end\n if not vm\n srvvals = registry_enumkeys('HKLM\\HARDWARE\\ACPI\\RSDT')\n if srvvals and srvvals.include?(\"VRTUAL\")\n vm = true\n end\n end\n\n if vm\n report_note(\n :host => session.session_host,\n :type => 'host.hypervisor',\n :data => { :hypervisor => \"MS Hyper-V\" },\n :update => :unique_data\n )\n print_good(\"This is a Hyper-V Virtual Machine\")\n return \"MS Hyper-V\"\n end\n end",
"title": ""
},
{
"docid": "c1b6c0bb41e30a45e37e19447fea6fe2",
"score": "0.551343",
"text": "def verify_puppet_exists\n MakeMakefile::Logging.instance_variable_set(:@logfile, File::NULL)\n find_executable0('puppet')\n end",
"title": ""
},
{
"docid": "e523a5237ff6248fea9a54b9b1b40da8",
"score": "0.5506248",
"text": "def exists?\n Puppet.debug(self.class.to_s.split('::').last + ': Calling exists method : ')\n @property_hash[:ensure] == :present\n end",
"title": ""
},
{
"docid": "6dbb036996227ad156e2e58c4fcbb86d",
"score": "0.5491483",
"text": "def config_template_exist?\n Chef::Log.debug(\"config_template_exist?: Checking for config file template #{new_resource.config_file}\")\n config_resource = !find_resource!(:template, ::File.join(new_resource.config_file)).nil?\n\n Chef::Log.debug(\"config_template_exist?: #{config_resource}\")\n config_resource\n rescue Chef::Exceptions::ResourceNotFound\n Chef::Log.debug(\"config_template_exist?: Config file template #{new_resource.config_file} ResourceNotFound\")\n false\n end",
"title": ""
},
{
"docid": "d1d0513444f6b5c81010ae46feb80b2f",
"score": "0.5465176",
"text": "def check_vbox_is_installed()\n app_dir = \"/Applications/VirtualBox.app\"\n if !File.directory?(app_dir)\n puts \"Warning:\\tVirtualbox not installed\"\n exit\n end\nend",
"title": ""
},
{
"docid": "93ed06a9b9019d063ea23a8d9d010c6f",
"score": "0.5453937",
"text": "def vagrant_provision\n if @env\n puts \"Running vagrant provision.\"\n @env.cli(\"provision\") && FileUtils.touch('.vagrant_last_provisioned')\n else\n puts \"Setting up vagrant environment.\"\n setup_vagrant && FileUtils.touch('.vagrant_last_provisioned')\n end\nend",
"title": ""
},
{
"docid": "7d34e93b42e78461e3c976e46321f5d2",
"score": "0.54403067",
"text": "def vm_guest_ip?(vm)\n vm.guest.guestState == 'running' && vm.guest.toolsRunningStatus == 'guestToolsRunning' && !vm.guest.ipAddress.nil? && IPAddr.new(vm.guest.ipAddress).ipv4?\n end",
"title": ""
},
{
"docid": "2a4568a3bbfa02fda7f14730aae8fb44",
"score": "0.5427152",
"text": "def multivm?\n vms.length > 1\n end",
"title": ""
},
{
"docid": "29f280c78c2c8d9b4a8d74871cceb3c8",
"score": "0.5424652",
"text": "def exists?\n name_exists? ? exact_deployment? : false\n end",
"title": ""
},
{
"docid": "da731797a391ef1776c2b6f3ca41c1b4",
"score": "0.5420268",
"text": "def controller_exists(name, controller_name)\n return false if name.nil?\n\n out, err = Open3.capture2e(\"VBoxManage showvminfo #{name}\")\n raise out unless err.exitstatus === 0\n\n out.split(/\\n/)\n .select { |x| x.start_with? 'Storage Controller Name' }\n .map { |x| x.split(':')[1].strip }\n .any? { |x| x == controller_name }\nend",
"title": ""
},
{
"docid": "cb6039dadda3fc272a91a8230db3757b",
"score": "0.54172486",
"text": "def exists?\n get_lxd_config_value(resource[:config]) != nil\n end",
"title": ""
},
{
"docid": "2fec39c0b4512ea0de7fca6570c5c754",
"score": "0.5409959",
"text": "def vm_ready?(_pool_name, _vm_name)\n raise(\"#{self.class.name} does not implement vm_ready?\")\n end",
"title": ""
},
{
"docid": "2fec39c0b4512ea0de7fca6570c5c754",
"score": "0.5409959",
"text": "def vm_ready?(_pool_name, _vm_name)\n raise(\"#{self.class.name} does not implement vm_ready?\")\n end",
"title": ""
},
{
"docid": "89d8d35a257ade5f9374a7a25fc3d048",
"score": "0.54052496",
"text": "def first_run?\n not File.exists? '/boot/config/.boxcar'\n end",
"title": ""
},
{
"docid": "e4effd9f09303e4e98dcba0b04417c82",
"score": "0.54006785",
"text": "def exists?\n\t\t# Look for volume\n\t\t@vol_id = DSMAPIVolume.find_volume(@resource[:name], @resource[:storagecenter])\n\t\tif @vol_id == nil\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend",
"title": ""
},
{
"docid": "d2239603ae19c74cb8842eacadf34078",
"score": "0.53967637",
"text": "def apparently_configured?\n return false unless File.exist?(user_vimrc_path)\n\n FileUtils.compare_file(user_vimrc_path, template_vimrc_path)\n end",
"title": ""
},
{
"docid": "1c27c86f529c2fd3031d393e806e13e6",
"score": "0.53864086",
"text": "def config_exists?(path)\n File.exist?(path)\n end",
"title": ""
},
{
"docid": "cbd7589b34c7e4e5b8a66755b3d40baa",
"score": "0.5386372",
"text": "def exists?(name)\r\n \t!template_paths(name).empty?\r\n end",
"title": ""
},
{
"docid": "3e14d3a8173f3a389a221582f6fd99a9",
"score": "0.53811646",
"text": "def inactive_instance_dir_exists?\n return File.directory?( @resource['instances_dir'] + \"/\" + \"_\" + @resource[:name] )\n end",
"title": ""
},
{
"docid": "9504e26da20fdbde3e72bfc184148f36",
"score": "0.5375952",
"text": "def exists?\n # Puppet.notice(\"cert - exists - resource = #{resource.inspect}\")\n # Puppet.notice(\"cert - exists - resource = #{@resource.inspect}\")\n cert = certificate\n priv_key = private_key\n # Check for the certificate existing at all\n # Check if the given private key matches the given cert\n # Check if the certificate exists in Vault\n # Check if the certificate is expired or not\n # Check if the cert is revoked or not\n (cert && priv_key && cert.check_private_key(priv_key) &&\n check_cert_exists && !check_cert_expiring && !check_cert_revoked)\n end",
"title": ""
},
{
"docid": "8b3fe23276e8c5db64711d634f096fbf",
"score": "0.5371709",
"text": "def exists?\n prepare_environment\n load_template(@data['serverProfileTemplateUri'], 'new_profile')\n return @resource_type.find_by(@client, @data).any? if resource['ensure'].to_sym == :absent\n super([nil, :found, :get_available_targets, :get_available_networks, :get_available_servers, :get_compliance_preview,\n :get_messages, :get_profile_ports, :get_transformation, :absent])\n end",
"title": ""
},
{
"docid": "f3197bba98bcacf7ee518c9cf2a7d187",
"score": "0.53708977",
"text": "def controller_exists(name, controller_name)\n out, err = Open3.capture2e(\"VBoxManage showvminfo #{name}\")\n\n return false if err.exitstatus != 0\n\n out.split(/\\n/)\n .select { |x| x.start_with? 'Storage Controller Name' }\n .map { |x| x.split(':')[1].strip }\n .any? { |x| x == controller_name }\nend",
"title": ""
},
{
"docid": "f3197bba98bcacf7ee518c9cf2a7d187",
"score": "0.53692836",
"text": "def controller_exists(name, controller_name)\n out, err = Open3.capture2e(\"VBoxManage showvminfo #{name}\")\n\n return false if err.exitstatus != 0\n\n out.split(/\\n/)\n .select { |x| x.start_with? 'Storage Controller Name' }\n .map { |x| x.split(':')[1].strip }\n .any? { |x| x == controller_name }\nend",
"title": ""
},
{
"docid": "be660e209aa9a2af9ab8c502f00eafe7",
"score": "0.53597814",
"text": "def centos?\n File.exist?('/etc/centos-release')\nend",
"title": ""
},
{
"docid": "579790422341b0a8fbef2ee867c4aeaf",
"score": "0.5353105",
"text": "def computer_exists?(fwip)\n system(\"ping -c1 -w1 #{fwip}\")\nend",
"title": ""
},
{
"docid": "89f762e0abbbd3000bbcb09c91bc862a",
"score": "0.5343634",
"text": "def check_vbox_hostonly_network()\n message = \"Checking:\\tVirtualBox hostonly network exists\"\n command = \"VBoxManage list hostonlyifs |grep '^Name' |awk '{print $2}' |head -1\"\n if_name = execute_command(message,command)\n if_name = if_name.chomp\n if !if_name.match(/vboxnet/)\n message = \"Plumbing:\\tVirtualBox hostonly network\"\n command = \"VBoxManage hostonlyif create\"\n execute_command(message,command)\n message = \"Finding:\\tVirtualBox hostonly network name\"\n command = \"VBoxManage list hostonlyifs |grep '^Name' |awk '{print $2}' |head -1\"\n if_name = execute_command(message,command)\n if_name = if_name.chomp\n if_name = if_name.gsub(/'/,\"\")\n message = \"Disabling:\\tDHCP on \"+if_name\n command = \"VBoxManage dhcpserver remove --ifname #{if_name}\"\n execute_command(message,command)\n end\n message = \"Checking:\\tVirtualBox hostonly network \"+if_name+\" has address \"+$default_hostonly_ip\n command = \"VBoxManage list hostonlyifs |grep 'IPAddress' |awk '{print $2}' |head -1\"\n host_ip = execute_command(message,command)\n host_ip = host_ip.chomp\n if !host_ip.match(/#{$default_hostonly_ip}/)\n message = \"Configuring:\\tVirtualBox hostonly network \"+if_name+\" with IP \"+$default_hostonly_ip\n command = \"VBoxManage hostonlyif ipconfig #{if_name} --ip #{$default_hostonly_ip} --netmask #{$default_netmask}\"\n execute_command(message,command)\n end\n gw_if_name = get_osx_gw_if_name()\n check_osx_nat(gw_if_name,if_name)\n return if_name\nend",
"title": ""
},
{
"docid": "d4d2e23c423d0b57c83333fbbc5b1089",
"score": "0.53428864",
"text": "def exists?\n @aws_instance.exists? && @aws_instance.state.name != 'terminated'\n end",
"title": ""
},
{
"docid": "6a0c9a9edaa9cdcb0534ecf70a570522",
"score": "0.5338691",
"text": "def exists?\n zk.exists?(path)\n end",
"title": ""
},
{
"docid": "b3cb0b2d8c21ce24a93c727132ef81a1",
"score": "0.5334823",
"text": "def checkFileExists()\n if(File.exist?(@fileName_vars))\n return\n else\n abort(\"Error: could not find the config file. Please make sure it is in the root of the application folder.\")\n end\n end",
"title": ""
}
] |
92d5d4e5dcc8c0ef28513dc69ca602d9 | below are methods pertaining to the "rotate" notion where you may want to look at the same tree data organized another way FIXME: remove baked in underscore separator in field name | [
{
"docid": "942283c9037471b71bea1d8dbf60919c",
"score": "0.0",
"text": "def is_hierarchical?(field_name)\n (prefix,order) = field_name.split(/_/, 2)\n list = blacklight_config.facet_display[:hierarchy][prefix] and list.include?(order)\n end",
"title": ""
}
] | [
{
"docid": "2d25017ec9586ab19016a6858e93d3fd",
"score": "0.6107726",
"text": "def transform_data(tree)\n data = {}\n last_level = 0\n path = []\n # root -> left -> right\n tree.traverse_preorder do |level, node|\n d = node.leaf? ? leaf_info(node) : directory_info(node)\n\n if level == 0\n data = d\n path << d\n elsif level > last_level\n path[-1][:children] << d\n path << d\n elsif level == last_level\n path[-2][:children] << d\n path[-1] = d\n else\n path[level - 1][:children] << d\n path[level] = d\n path = path[0..level]\n end\n last_level = level\n end\n data\n end",
"title": ""
},
{
"docid": "2d8237a886b35df3240b1f080d83333d",
"score": "0.59566945",
"text": "def rotate\n case left.height - right.height\n when 2\n if left.left.height < left.right.height # case b\n @left = left.rotate_left\n end\n root = rotate_right # case a\n when -2\n if right.right.height < right.left.height # case d\n @right = right.rotate_right\n end\n root = rotate_left # case c\n else\n root = self\n end\n\n root.update_height\n root\n end",
"title": ""
},
{
"docid": "44ae74084bd613be1e4f28995a0598ca",
"score": "0.5930296",
"text": "def render_facet_rotate(field_name)\n if is_hierarchical?(field_name)\n (prefix,order) = field_name.split(/_/, 2)\n\n return if blacklight_config.facet_display[:hierarchy][prefix].length < 2\n\n new_order = facet_after(prefix,order)\n new_params = rotate_facet_params(prefix,order,new_order)\n new_params[\"#{prefix}_facet_order\"] = new_order\n link_to image_tag('icons/rotate.png', :title => new_order.upcase).html_safe, new_params, :class => 'no-underline'\n end\n end",
"title": ""
},
{
"docid": "17fefcf9c769a9d2f7f0a9c522d5db04",
"score": "0.5875292",
"text": "def left_rotate(node)\n r_child = node.r\n node.r = r_child.l\n r_child.l.parent = node if r_child.l\n r_child.parent = node.parent\n if node.parent \n node == node.parent.l ? node.parent.l = r_child : node.parent.r = r_child\n else\n @root = r_child\n end\n r_child.l = node\n node.parent = r_child\n end",
"title": ""
},
{
"docid": "015c91aa3ca7f537b9ee6e8f5c55179e",
"score": "0.5825748",
"text": "def left_rotate(parent, root)\n node = parent.right\n node_lchild = node.left\n\n node.parent == parent.parent\n if !parent.parent.nil?\n parent.parent.left = node if parent.parent.left == parent \n parent.parent.right = node if parent.parent.right == parent\n end\n\n node.left = parent\n parent.parent = node\n parent.right = node_lchild\n node_lchild.parent = parent if ndoe_lchild\n\n if parent == root\n return node\n else\n return root\n end\nend",
"title": ""
},
{
"docid": "1ec6bc58978a9abd4d91d1d912631562",
"score": "0.5817378",
"text": "def tree; end",
"title": ""
},
{
"docid": "1ec6bc58978a9abd4d91d1d912631562",
"score": "0.5817378",
"text": "def tree; end",
"title": ""
},
{
"docid": "12697661406331d08fb47021c1b99bc7",
"score": "0.5784804",
"text": "def build_tree(preorder, inorder)\n\nend",
"title": ""
},
{
"docid": "7d1574e02b0bed143e76fb4e629e7d5c",
"score": "0.5740756",
"text": "def right_rotate(node)\n l_child = node.l\n node.l = l_child.r\n l_child.r.parent = node if l_child.r \n l_child.parent = node.parent\n if node.parent\n node == node.parent.l ? node.parent.l = l_child : node.parent.r = l_child\n else\n @root = l_child \n end\n l_child.r = node\n node.parent = l_child\n end",
"title": ""
},
{
"docid": "05756afa7c0a359f4aa20619abadbc5e",
"score": "0.5704901",
"text": "def restructure(node)\n parent = node.parent\n grand_parent = parent.parent\n if left_child?(node) && left_child?(parent)\n right_up_rotation parent\n parent.set_black!\n node.set_red!\n grand_parent.set_red!\n elsif right_child?(node) && left_child?(parent)\n left_up_rotation node\n right_up_rotation node\n node.set_black!\n parent.set_red!\n grand_parent.set_red!\n elsif right_child?(node) && right_child?(parent)\n left_up_rotation parent\n parent.set_black!\n node.set_red!\n grand_parent.set_red!\n else\n right_up_rotation node\n left_up_rotation node\n node.set_black!\n parent.set_red!\n grand_parent.set_red!\n end\n end",
"title": ""
},
{
"docid": "b1d866d924a13dfff6d6d0658888c066",
"score": "0.570311",
"text": "def rotate(direction)\n puts \"Rotating node #{value} to the #{direction}...\" if DEBUG\n\n previous_parent = parent\n\n case direction\n when :left\n x = self # Current root.\n y = x.right\n x_clone = x.clone\n t2 = y.left\n x_clone.right = t2\n y.left = x_clone\n x.copy_attrs_from y # Original x get all y's data (value + left/right subtrees), in practice making y the new root.\n when :right\n raise \"Invalid condition found for right rotation. Current node (#{value}) must be necessarily greater than left node (#{left.value})\" if compare(value, left.value) != 1\n\n y = self # Current root.\n x = y.left\n y_clone = y.clone\n t2 = x.right\n y_clone.left = t2\n x.right = y_clone\n y.copy_attrs_from x # Original y get all x's data (value + left/right subtrees), in practice making x the new root.\n end\n end",
"title": ""
},
{
"docid": "197fb43ed7f2477f07e466ce76385209",
"score": "0.56854415",
"text": "def leftRotate( x)\n y = x.right\n t = y.left\n # Rotation\n y.parent = x.parent\n y.left = x\n x.parent = y\n x.right = t\n if (t != nil)\n t.parent = x\n end\n if (y.parent != nil && y.parent.left == x)\n y.parent.left = y\n elsif (y.parent != nil && y.parent.right == x)\n y.parent.right = y\n end\n # Return new root\n return y\n end",
"title": ""
},
{
"docid": "0553929cbf471b34ae67cf687bbc9d15",
"score": "0.5667536",
"text": "def restore(node, dir)\n return node if (size(node.childs[0]) - size(node.childs[1])).abs <= 1\n if node.childs[dir].childs[dir^1] and size(node.childs[dir].childs[dir]) < size(node.childs[dir].childs[dir^1])\n node.childs[dir] = rotate(node.childs[dir], dir)\n end\n return rotate(node, dir^1)\n end",
"title": ""
},
{
"docid": "e8ae97d98172cb257db3234358b66bcb",
"score": "0.56485784",
"text": "def rotate(dir)\n new_root = child(~dir)\n node = new_child(~dir, new_root.child(dir), new_root.color)\n new_root.new_children(dir, node, new_root.child(~dir), @color)\n end",
"title": ""
},
{
"docid": "b07a588b59f1dfb432628641509a0fbe",
"score": "0.5644019",
"text": "def build_move_tree #finding children\n \n end",
"title": ""
},
{
"docid": "260d7025a8ec46d6497e613155b5f553",
"score": "0.5637392",
"text": "def transform_tree\n @tree.transform\n self\n end",
"title": ""
},
{
"docid": "edd5587966275c202cb81a678ed5e0d7",
"score": "0.5619175",
"text": "def rotate_left\n n = self.right\n self.right = n.left\n n.left = self\n n\n end",
"title": ""
},
{
"docid": "0a01455ca71c1cacdd63a14bbaab4987",
"score": "0.56181276",
"text": "def reconstruct_binary_tree(in_order, pre_order)\nend",
"title": ""
},
{
"docid": "3f663a174b8290a20a4427aca1622aba",
"score": "0.5603073",
"text": "def preorder(tree)\n if tree\n p tree.key\n preorder(tree.leftChild)\n preorder(tree.rightChild)\n end\nend",
"title": ""
},
{
"docid": "549d556ec390ca2a02e98f2eca658181",
"score": "0.55811936",
"text": "def level_order(root)\nend",
"title": ""
},
{
"docid": "acb6fc63bb95330617e40b3fe537fda9",
"score": "0.5579458",
"text": "def _l_rotate(x, y)\n return if x.nil? || x.pnode.nil?\n #\n _rotate_hlp(x, y, :left)\n end",
"title": ""
},
{
"docid": "9e0c177cd7cfd048cad648d9cd84268d",
"score": "0.55515075",
"text": "def rotateWithRightChild(k1)\n k2 = k1.right\n k1.right = k2.left\n k2.left = k1\n k1.height = max( height( k1.left ), height( k1.right ) ) + 1\n k2.height = max( height( k2.right ), k1.height ) + 1\n return k2\n end",
"title": ""
},
{
"docid": "f3260c438dc302c2ff42d654712bd160",
"score": "0.5551261",
"text": "def doubleWithLeftChild(k3)\n k3.left = rotateWithRightChild(k3.left)\n return rotateWithLeftChild(k3)\n end",
"title": ""
},
{
"docid": "2e6fd9d40c570197a4f3376a2473f5cc",
"score": "0.5546816",
"text": "def rotateWithLeftChild(k2)\n k1 = k2.left\n k2.left = k1.right\n k1.right = k2\n k2.height = max( height( k2.left ), height( k2.right ) ) + 1\n k1.height = max( height( k1.left ), k2.height ) + 1\n return k1\n end",
"title": ""
},
{
"docid": "1de77c50ffaa662c2c6b44d0064b74f7",
"score": "0.550322",
"text": "def restructure\n node_id = params[:node_id].to_i\n parent_id = params[:parent_id].to_i\n prev_id = params[:prev_id].to_i\n next_id = params[:next_id].to_i\n\n return :text=>\"alert('do nothing');\" if parent_id.zero? && prev_id.zero? && next_id.zero?\n\n # havn't prev and next\n # have prev\n # have next\n if prev_id.zero? && next_id.zero?\n Page.find(node_id).move_to_child_of Page.find(parent_id)\n elsif !prev_id.zero?\n Page.find(node_id).move_to_right_of Page.find(prev_id)\n elsif !next_id.zero?\n Page.find(node_id).move_to_left_of Page.find(next_id)\n end\n\n render(:nothing=>true)\n end",
"title": ""
},
{
"docid": "968b15ca920ed10267db497ac095e8e8",
"score": "0.5500835",
"text": "def deep_transform_keys(&block); end",
"title": ""
},
{
"docid": "1b3ae89639f55392b98c88f901a34d4a",
"score": "0.54967785",
"text": "def rekey_children\r\n _pos = 1\r\n this_rational_number = self.rational_number\r\n self.children.each do |child|\r\n new_rational_number = this_rational_number.child_from_position(_pos)\r\n move_node_and_save_if_changed(child, new_rational_number)\r\n _pos += 1\r\n end\r\n end",
"title": ""
},
{
"docid": "4f9f2b2f14f6832b5277fd9125c1c30b",
"score": "0.5486263",
"text": "def rotate_left\n root = right\n @right = right.left\n root.left = self\n root.left.update_height\n root\n end",
"title": ""
},
{
"docid": "896815738e3e8de7cbdf958043d95e9d",
"score": "0.54854506",
"text": "def leftRotate( x)\n y = x.right\n t = y.left\n # Rotation\n y.left = x\n x.right = t\n # Update heights\n x.height = self.max(self.height(x.left), self.height(x.right)) + 1\n y.height = self.max(self.height(y.left), self.height(y.right)) + 1\n # Return new root\n return y\n end",
"title": ""
},
{
"docid": "facde1d7c2c5cb8ba45cf4a7640ee2ee",
"score": "0.5483979",
"text": "def rotate_left\n return unless right\n\n me = RedBlackTree.new(value, color, deleted, left, right)\n\n x = me.right\n me.right = x.left\n x.left = me\n\n copy x\n end",
"title": ""
},
{
"docid": "4d7203e2d9a3e000dcb66bd4f767f1dd",
"score": "0.54692054",
"text": "def right_rotate(parent, root)\n node = parent.left\n node_rchild = node.right\n\n\n node.parent = parent.parent\n if !parent.parent.nil?\n parent.parent.left = node if parent.parent.left == parent\n parent.parent.right = node if parent.parent.right == parent\n end\n\n node.right = parent\n parent.parent = node\n parent.left = node_rchild\n node_rchild.parent = parent if node_rchild\n\n if parent == root\n return node\n else\n return root\n end\nend",
"title": ""
},
{
"docid": "e3af763ad4110e58f8da065d8371f5a3",
"score": "0.54685915",
"text": "def flat_structure(repo_tree)\n # Used to add ancestry within github main tree\n # We sort them by path\n # maybe use sha for ancestry items ?\n # file = \"/path/to/xyz.mp4\"\n # TO DO => refacto\n # comp = File.basename file # => \"xyz.mp4\"\n # extn = File.extname file # => \".mp4\"\n # name = File.basename file, extn # => \"xyz\"\n # path = File.dirname file # => \"/path/to\n repo_tree.sort_by do |item|\n split_path = item.path.split('/')\n item[:id] = item.sha\n item[:name] = split_path.last\n item[:ancestry] = split_path.select {|v| v != item[:name]}.join('/')\n item[:ancestry] = nil if item[:ancestry].empty?\n item[:parent] = split_path[-2]\n item.type == 'tree' ? item[:extension] = 'folder' : item[:extension] = File.extname(item.path)\n # split_path.length == 1 ? item[:node] = item[:id] : item[:node] = split_path[-2]\n item.path\n end\n end",
"title": ""
},
{
"docid": "f4d27e996485adde6a3e65469836d5da",
"score": "0.5457113",
"text": "def rotate_once(x, dir)\n y = x.childs[dir^1]\n x.childs[dir^1] = y.childs[dir]\n y.childs[dir] = x\n y.color = x.color\n x.color = Node::RED\n return y\n end",
"title": ""
},
{
"docid": "02b4a3bd836de2f7aa056efd7c16de52",
"score": "0.5437394",
"text": "def rotate_left!\n=begin\n= x b\n= a b => x f\n= c d e f a e ...\n=end\n if @parent then #then our node have parent\n if @parent.left == self then @parent.left = @right\n else @parent.right = @right\n end\n end\n\n @right.parent, @parent = @parent, @right\n\n @right = @right.left\n @right.parent = self if @right\n\n @parent.left = self\n #returns node x\n end",
"title": ""
},
{
"docid": "ae0579bc0deba2835b5bade498395182",
"score": "0.543158",
"text": "def tree_reduce new_tree\n names = new_tree.map { | node | node.name }.compact\n # p names\n nrows = []\n names.each do | name |\n nrows << find(name).clone\n end\n new_aln = Alignment.new(nrows)\n new_aln.attach_tree(new_tree.clone)\n new_aln\n end",
"title": ""
},
{
"docid": "478fdfd020b3f2af0f203b78dbb68915",
"score": "0.5424802",
"text": "def balanceTree\n\n if @leftCount > @rightCount*2\n return rotateLeft\n elsif @rightCount > @leftCount*2\n return rotateRight\n end\n\n return self\n end",
"title": ""
},
{
"docid": "e479253f046e2671dfad16928f8064a9",
"score": "0.5424186",
"text": "def tree(records)\n records.inject({}) do |acc, record|\n name, type, ttl, value,\n weight, set,\n health_check_id = [ record[:name], record[:type],\n record[:ttl], record[:value],\n record[:weight], record[:set_identifier],\n record[:health_check_id] ]\n reference = acc[name] ||= {}\n reference = reference[type] ||= {}\n reference = reference[set] ||= {} if set\n appended = (reference[:value] or []) << value\n reference[:ttl] = ttl\n reference[:value] = appended.sort.uniq\n reference[:weight] = weight if weight\n reference[:health_check_id] = health_check_id if health_check_id\n acc\n end\nend",
"title": ""
},
{
"docid": "1a87cfdddbb3c9818ec8b1480379f33a",
"score": "0.5423292",
"text": "def renumber_tree(query={})\n reference = [0]\n level = 1\n level_offset = 0\n\n where(query).sort(:reference.asc).all.each do |node|\n\n # it's a level up\n if node.reference.size > (level + level_offset)\n if reference == [0]\n level_offset = 1\n else\n level += 1\n reference[level-1] = 0\n end\n\n # back down a level or more\n elsif node.reference.size < (level + level_offset)\n level = node.depth\n\n if level_offset > 0\n\n if level == 1\n level_offset = 0\n else\n level -= level_offset\n end\n end\n\n reference = reference[0, level]\n end\n\n reference[level-1] += 1\n\n if node.reference != reference\n node.set(:reference => reference)\n end\n end\n end",
"title": ""
},
{
"docid": "d59b4b808f3a7668823bb2e312e9dbd5",
"score": "0.5408336",
"text": "def rightRotate( x)\n y = x.left\n t = y.right\n # Rotation\n y.parent = x.parent\n y.right = x\n x.parent = y\n x.left = t\n if (t != nil)\n t.parent = x\n end\n if (y.parent != nil && y.parent.left == x)\n y.parent.left = y\n elsif (y.parent != nil && y.parent.right == x)\n y.parent.right = y\n end\n # Return new root\n return y\n end",
"title": ""
},
{
"docid": "52c542b424533a202b3203ded168d1ea",
"score": "0.53941166",
"text": "def rotate_l(z)\n y = z.r\n return false if y.nil_node?\n\n puts_debug \"Rotate L: #{z.as_str}\"\n\n y_new_height = z.height\n # reduce tree_height to force recaulculation if rotation could reduce the tree_height\n if z.height == (tree_height - 2)\n puts_debug \"Reduce height to #{z.height}\"\n @tree_height = z.height\n end\n\n # set parent of y\n y.p = z.p\n if z == root\n @root = y\n elsif z == z.p.l\n z.p.l = y\n else\n z.p.r = y\n end\n\n # set z.r to y.l\n z.r = y.l\n y.l.p = z if !y.l.nil_node?\n\n # set y.l\n y.l = z\n z.p = y\n\n update_height(y, y_new_height)\n\n z\n end",
"title": ""
},
{
"docid": "174398de74da4fdac112998234962508",
"score": "0.53936356",
"text": "def build_tree(in_order_elements, post_order_elements)\nend",
"title": ""
},
{
"docid": "3fe16723cfe073a33d3a2398f331e395",
"score": "0.53932565",
"text": "def transformations; end",
"title": ""
},
{
"docid": "3fe16723cfe073a33d3a2398f331e395",
"score": "0.53932565",
"text": "def transformations; end",
"title": ""
},
{
"docid": "c5dbcbb40b9d03394bee23591071cc7f",
"score": "0.5384318",
"text": "def displayStructure(tree)\n result = \"\"\n tree.set_depth 0\n tree.transversePreOrder do |node|\n result = result + node.structure + \"\\n\"\n end\n puts result\nend",
"title": ""
},
{
"docid": "0b752d02fe7fab1bfc255e0716b86672",
"score": "0.5374917",
"text": "def postorder(tree)\n if tree\n postorder(tree.leftChild)\n postorder(tree.rightChild)\n p tree.key\n end\nend",
"title": ""
},
{
"docid": "519875a49f92af63a23c92299b79ea8d",
"score": "0.5366541",
"text": "def get_tree\n tree = super\n\n # Transform number based indexes in nested sections by\n # unique name identification based on the section content\n # (e.g., usually the \"NAME\" value from inside the section). E.g.\n # AUTH_MAD_CONF['1']['MAX_TOKEN_TIME'] -->\n # AUTH_MAD_CONF['core']['MAX_TOKEN_TIME']\n tree.keys.each do |section|\n # we check every element of our tree, which\n # contains Hash structure inside\n next unless tree[section].is_a? Hash\n\n # If section is not described in known SECTIONS, it must\n # contain only unindexed (nil) subsection identification.\n # If it contains multiple or indexed subsections, the file\n # is **semantically wrong**.\n #\n # E.g., good example:\n # \"VXLAN_IDS\"=>\n # {nil=>{\"START\"=>[\"\\\"2\\\"\", \"VXLAN_IDS[1]/START\"]}}\n #\n # bad example:\n # \"VXLAN_IDS\"=>\n # {\"1\"=>{\"START\"=>[\"\\\"2\\\"\", \"VXLAN_IDS[1]/START\"]},\n # \"2\"=>{\"START\"=>[\"\\\"2\\\"\", \"VXLAN_IDS[2]/START\"]}},\n unless SECTIONS.key?(section)\n next if tree[section].keys.length == 1 &&\n tree[section].keys.include?(nil)\n\n raise OneCfg::Config::Exception::StructureError,\n \"Invalid multiple sections of #{section}\"\n end\n\n id = SECTIONS[section]\n\n tree[section].keys.each do |idx|\n # Section doesn't have key inside we use for unique\n # identification. E.g., TM_MAD_CONF without NAME\n unless tree[section][idx].key?(id)\n raise OneCfg::Config::Exception::StructureError,\n \"Missing #{id} identification for \" \\\n \"#{section}[#{idx}]\"\n end\n\n # Section can't have multiple keys which are used for\n # unique identification. E.g., TM_MAD_CONF with 2x NAME\n unless tree[section][idx][id].is_a?(Array) &&\n tree[section][idx][id].length == 1\n raise OneCfg::Config::Exception::StructureError,\n \"Multiple #{id} identifications for \" \\\n \"#{section}[#{idx}]\"\n end\n\n # TODO: unquote???\n # new_idx = unquote(tree[section][idx][id][0])\n new_idx = tree[section][idx][id][0]\n\n # Section is already defined. There is a section\n # with same key value multiple times. E.g.,\n # 2x TM_MAD_CONF with same NAME=ceph\n if tree[section].key?(new_idx)\n raise OneCfg::Config::Exception::StructureError,\n 'Duplicate identification for ' \\\n \"#{section}[#{new_idx}]\"\n end\n\n tree[section][new_idx] = tree[section].delete(idx)\n end\n end\n\n tree\n end",
"title": ""
},
{
"docid": "4d03f484f006efd5bf06aeaa1f51eaa7",
"score": "0.5362114",
"text": "def rotateLeft root\n newRoot = root.right\n root.right = newRoot.left\n newRoot.left = root\n update root\n update newRoot\n return newRoot\n end",
"title": ""
},
{
"docid": "e57fd6d9f51eb7ed447da285e83f0bdb",
"score": "0.5358668",
"text": "def rotate_left(root)\n temp_node = root.link_right\n root.link_right = temp_node.link_left\n temp_node.link_left = root\n temp_node\n end",
"title": ""
},
{
"docid": "3943d78115811606133c798a2f6bb811",
"score": "0.53574884",
"text": "def pre_order(root)\nend",
"title": ""
},
{
"docid": "6eff623aef6a101eb66870c45565d18a",
"score": "0.5351503",
"text": "def left_rotation\n # - Left Rotation:\n # Steps:\n # - Left rotation triggered on a node(now known as rotation_target)\n # - Remove rotation_target connection to right child(now known as new_parent)\n # - Remove new_parent's connection to it's left child(now known as new_child)\n # - new_parent's left child becomes rotation_target\n # - rotation_target's right child becomes new_child\n end",
"title": ""
},
{
"docid": "dad50ec37bd28e6c05319bb07ecbd379",
"score": "0.5350503",
"text": "def rotateLeft()\n #Children must implement this method themselves\n end",
"title": ""
},
{
"docid": "6d278418799259a1b16c67aacc7b3585",
"score": "0.5332595",
"text": "def invert_tree(root)\n \nend",
"title": ""
},
{
"docid": "95d01147445adbc7f5dda74f811ef9c4",
"score": "0.5330652",
"text": "def deep_transform_keys!(&block); end",
"title": ""
},
{
"docid": "95d01147445adbc7f5dda74f811ef9c4",
"score": "0.5330652",
"text": "def deep_transform_keys!(&block); end",
"title": ""
},
{
"docid": "95d01147445adbc7f5dda74f811ef9c4",
"score": "0.5330652",
"text": "def deep_transform_keys!(&block); end",
"title": ""
},
{
"docid": "5539a32b86ffa95e7c82820f0d4a78b4",
"score": "0.5323904",
"text": "def rotate_left; end",
"title": ""
},
{
"docid": "40d17ae2dcfd3b9a3b32b0dcac139d85",
"score": "0.5321529",
"text": "def refactor_data(data, direction, position, field = nil)\n fields = data['fields']\n unless fields.nil?\n if direction == 1\n new_field = {}\n new_field['typeID'] = field.typeID\n new_field['unitName'] = field.unitName\n new_field['fieldID'] = field.fieldID\n new_field['fieldName'] = field.fieldName\n fields.insert(position, new_field)\n else\n fields.delete_at(position)\n end\n data['fields'] = fields\n end\n\n dp = data['dataPoints']\n unless dp.nil? or dp.length == 0\n dp.each_with_index do | d, i |\n if direction == 1 # up migration\n dp[i].insert(position, '')\n else # down migration\n dp[i].delete_at(position)\n end\n end\n data['dataPoints'] = dp\n\n text_fields = data['textFields']\n unless text_fields.nil? or text_fields.length == 0\n text_fields.each_with_index do | f, i |\n # if greater than position, add 1 because it was shifted over\n if f >= position\n text_fields[i] += direction\n end\n end\n text_fields.push(position)\n text_fields.sort!\n end\n data['textFields'] = text_fields\n\n time_fields = data['timeFields']\n unless time_fields.nil? or time_fields.length == 0\n time_fields.each_with_index do | f, i |\n # if greater than position, add 1 because it was shifted over\n if f >= position\n time_fields[i] += direction\n end\n end\n end\n data['timeFields'] = time_fields\n\n numeric_fields = data['numericFields']\n unless numeric_fields.nil? or numeric_fields.length == 0\n numeric_fields.each_with_index do | f, i |\n # if greater than position, add 1 because it was shifted over\n if f >= position\n numeric_fields[i] += direction\n end\n end\n end\n data['numericFields'] = numeric_fields\n\n geo_fields = data['geoFields']\n unless geo_fields.nil? or geo_fields.length == 0\n geo_fields.each_with_index do | f, i |\n # if greater than position, add 1 because it was shifted over\n if f >= position\n geo_fields[i] += direction\n end\n end\n end\n data['geoFields'] = geo_fields\n\n normal_fields = data['normalFields']\n unless normal_fields.nil? or normal_fields.length == 0\n normal_fields.each_with_index do | f, i |\n # if greater than position, add 1 because it was shifted over\n if f >= position\n normal_fields[i] += direction\n end\n end\n end\n data['normalFields'] = normal_fields\n\n end\n data\n end",
"title": ""
},
{
"docid": "c0ff16b5cfdfe87ee11ce01f881f62ab",
"score": "0.532106",
"text": "def alignment_node(node); end",
"title": ""
},
{
"docid": "4f64f5416b3b49b1933df8c720cf1b28",
"score": "0.5320643",
"text": "def level_order_rec\n end",
"title": ""
},
{
"docid": "ba0b6b556f291344799ee2a1b383effc",
"score": "0.5314429",
"text": "def rotate_r(z)\n y = z.l\n return false if y.nil_node?\n\n puts_debug \"Rotate R: #{z.as_str}\"\n\n y_new_height = z.height\n # reduce tree_height to force recaulculation if rotation could reduce the tree_height\n if z.height == (tree_height - 2)\n puts \"Reduce height to #{z.height}\"\n @tree_height = z.height\n end\n\n # set parent of y\n y.p = z.p\n if z == root\n @root = y\n elsif z.p.l == z\n z.p.l = y\n else\n z.p.r = y\n end\n\n # set z.l to y.r\n z.l = y.r\n y.r.p = z if !y.r.nil_node?\n\n # set y.r\n y.r = z\n z.p = y\n\n update_height(y, y_new_height)\n\n z\n end",
"title": ""
},
{
"docid": "9145c1a81b43624712339b3aba35300e",
"score": "0.53127074",
"text": "def collection_edit_tree_recurse(node)\n node['children'].each_with_index do |child, i|\n item = @model.find(child['id'])\n item.update(parent_id: node['id'], sort_order: i)\n\n collection_edit_tree_recurse(child) if child['children']\n end\n end",
"title": ""
},
{
"docid": "f50f2f7145ef806ed08ee24af8106e26",
"score": "0.5310487",
"text": "def inorder(tree)\n if tree\n inorder(tree.leftChild)\n p tree.key\n inorder(tree.rightChild)\n end\nend",
"title": ""
},
{
"docid": "e27c74272b7608a483c2a1279179202f",
"score": "0.53102213",
"text": "def needs_moving! \n if left_col_val && right_col_val && !self.class.in_tree_load?\n @prev_left = left_col_val\n self.left_col_val = nil\n @prev_right = right_col_val\n self.right_col_val = nil\n @needs_moving = true\n end \nend",
"title": ""
},
{
"docid": "64550d8144475f7c7e6f1d2f19f9df63",
"score": "0.5298445",
"text": "def renumber_tree_if_reference_changed\n renumber_tree if reference_changed?\n end",
"title": ""
},
{
"docid": "113289d3842fcaa1046111768485a0f5",
"score": "0.5281404",
"text": "def arrange_nodes(nodes); end",
"title": ""
},
{
"docid": "e7268649d089dd6a858b99b6bc0ebfa5",
"score": "0.52777934",
"text": "def deletion_restructure(node)\n parent = node.parent\n grand_parent = parent.parent\n if left_child?(node) && left_child?(parent)\n right_up_rotation parent\n if grand_parent.red?\n parent.set_red!\n else\n parent.set_black!\n end\n node.set_black!\n grand_parent.set_black!\n elsif right_child?(node) && left_child?(parent)\n left_up_rotation node\n right_up_rotation node\n if grand_parent.red?\n node.set_red!\n else\n node.set_black!\n end\n parent.set_black!\n grand_parent.set_black!\n elsif right_child?(node) && right_child?(parent)\n left_up_rotation parent\n if grand_parent.red?\n parent.set_red!\n else\n parent.set_black!\n end\n node.set_black!\n grand_parent.set_black!\n else\n right_up_rotation node\n left_up_rotation node\n if grand_parent.red?\n node.set_red!\n else\n node.set_black!\n end\n parent.set_black!\n grand_parent.set_black!\n end\n end",
"title": ""
},
{
"docid": "fd55a13f1bb274355338dd8ea1e0c6da",
"score": "0.5277542",
"text": "def right_rotation(node, parent, grand_parent, to_recolor)\n grand_grand_parent = grand_parent.parent\n # grandfather will become the right child of parent\n update_parent(parent, grand_parent, grand_grand_parent)\n\n old_right = parent.right\n parent.right = grand_parent\n grand_parent.parent = parent\n grand_parent.left = old_right\n old_right.parent = grand_parent\n\n # recolor the nodes after a move to preserve invariants\n if to_recolor\n parent.color = :BLACK\n node.color = :RED\n grand_parent.color = :RED\n end\n end",
"title": ""
},
{
"docid": "0fed2ace1ae018dfe54f59634dd2242d",
"score": "0.5276171",
"text": "def ordered_transforms\n %w[expand_insertions strip_blanks erase_comments\n uncomment join_lines rstrip_lines \n pipeline bracket flatten_nested]\n end",
"title": ""
},
{
"docid": "1e405dca3fafd672bc50d2371fb9406f",
"score": "0.52748144",
"text": "def format_sorted tree\n \treturn if tree.nil?\n \tformat_sorted tree.left\n puts tree.value\n \tformat_sorted tree.right\n end",
"title": ""
},
{
"docid": "9677dbb0552ded827e2364023e9b1024",
"score": "0.52616507",
"text": "def append_rows_col_order(tree, options)\n # Hash to store unique attribute_keys with their values for each object\n # in the tree. Used to look up object attribute values for a specific\n # column when options[:column_order] is specified. \n result_hash = {}\n\n # Array to hold string values to append as next csv row.\n next_row = []\n \n # Array of arrays which will store row information. Each level\n # of the result holds a row array to be used later to append to csv.\n result = []\n \n # Array which holds symbol names corresponding to attribute_hash keys\n column_order = options[:column_order]\n\n # Dept-first traversal through tree\n tree.each do |node|\n if (node.has_children? == false)\n # Arrived at a leaf node. Now back trace all the way to root\n # while acquiring attribute values along the way.\n\n # Go back up tree following parent path.\n while node.parent\n attributes_hash = node.content\n\n # Append all key-value pairs to result_hash\n attributes_hash.each do |key, value|\n result_hash[key] = value \n end\n\n node = node.parent\n end\n\n # Now node is root, so get its attributes. \n attributes_hash = node.content\n\n # Append all key-value pairs to result_hash\n attributes_hash.each do |key, value|\n result_hash[key] = value \n end\n\n # Build up the next csv row.\n column_order.each do |key|\n next_row << result_hash[key]\n end\n \n # Store array of next row.\n result << next_row unless next_row.empty?\n \n # Reset next row and result_hash \n next_row = []\n result_hash = {}\n \n end #if node.has_chilren?\n end #tree.each\n result\n end",
"title": ""
},
{
"docid": "90e3c1ab51fd38be95ab2352f78fd966",
"score": "0.52591825",
"text": "def rearrange_children!\n @rearrange_children = true\n end",
"title": ""
},
{
"docid": "b2694bcaf8b91cbfd4428bacebe2edf7",
"score": "0.52540123",
"text": "def balanced_rotate(dir)\n target = child(~dir)\n if target.child(dir).red? and target.child(~dir).black?\n node = new_child(~dir, target.rotate(~dir))\n else\n node = self\n end\n node = node.rotate(dir)\n node.new_children(dir, node.child(dir).new_color(:BLACK), node.child(~dir).new_color(:BLACK))\n end",
"title": ""
},
{
"docid": "1b3d81937feff87bd522a374de3553cd",
"score": "0.5245366",
"text": "def build_k_tree\nend",
"title": ""
},
{
"docid": "0b452fff8f78aa05b529d158b6c01bbe",
"score": "0.5241287",
"text": "def preorder\n #Current, Left, Right\n new_array = Array.new()\n preorder_helper(@root, new_array)\n end",
"title": ""
},
{
"docid": "8583f7809d0f7143ba111b7e607c49c3",
"score": "0.5226408",
"text": "def parsed_tree; end",
"title": ""
},
{
"docid": "aa0210b775396ca2154c596b4831c6b8",
"score": "0.52262473",
"text": "def rotate_right\n return unless left\n\n me = RedBlackTree.new(value, color, deleted, left, right)\n\n x = me.left\n me.left = x.right\n x.right = me\n\n copy x\n end",
"title": ""
},
{
"docid": "dd3bb4ef639c84421c1483b6f9831912",
"score": "0.52258694",
"text": "def rotateL\n newLeft = Node.new(@value, @left, @right.left);\n @value, @right, @left = @right.value, @right.right, newLeft\n end",
"title": ""
},
{
"docid": "db7714abb849ebf9169b304663835d4d",
"score": "0.5225694",
"text": "def transformation\n end",
"title": ""
},
{
"docid": "db7714abb849ebf9169b304663835d4d",
"score": "0.5225694",
"text": "def transformation\n end",
"title": ""
},
{
"docid": "db7714abb849ebf9169b304663835d4d",
"score": "0.5225694",
"text": "def transformation\n end",
"title": ""
},
{
"docid": "1d18a7cdb4ea5b23d20e4dc6a649004f",
"score": "0.52156806",
"text": "def _r_rotate(x, y)\n return if x.nil? || y.nil? # x.pnode.nil?\n #\n _rotate_hlp(x, y, :right)\n end",
"title": ""
},
{
"docid": "7a61ee394c02db6b6f1051003ddeca82",
"score": "0.5214673",
"text": "def rotate_right\n root = left\n @left = left.right\n root.right = self\n root.right.update_height\n root\n end",
"title": ""
},
{
"docid": "dc5af3c842312df9918b26f4ec400b1d",
"score": "0.521048",
"text": "def diff_index(treeish); end",
"title": ""
},
{
"docid": "69dbb0c2f86a39082e1aa1569554afd5",
"score": "0.520962",
"text": "def reorder\n @root.reorder\n return self\n end",
"title": ""
},
{
"docid": "c859cd908213980a1c9596228f00c59d",
"score": "0.5204386",
"text": "def write_tree(tree = nil, now_tree = nil)\n tree = self.tree if !tree\n tree_contents = {}\n\n # fill in original tree\n now_tree = read_tree(now_tree) if(now_tree && now_tree.is_a?(String))\n now_tree.contents.each do |obj|\n sha = [obj.id].pack(\"H*\")\n k = obj.name\n k += '/' if (obj.class == Gifts::Grit::Tree)\n tmode = obj.mode.to_i.to_s ## remove zero-padding\n tree_contents[k] = \"%s %s\\0%s\" % [tmode, obj.name, sha]\n end if now_tree\n\n # overwrite with new tree contents\n tree.each do |k, v|\n case v\n when Array\n sha, mode = v\n if sha.size == 40 # must be a sha\n sha = [sha].pack(\"H*\")\n mode = mode.to_i.to_s # leading 0s not allowed\n k = k.split('/').last # slashes not allowed\n str = \"%s %s\\0%s\" % [mode, k, sha]\n tree_contents[k] = str\n end\n when String\n sha = write_blob(v)\n sha = [sha].pack(\"H*\")\n str = \"%s %s\\0%s\" % ['100644', k, sha]\n tree_contents[k] = str\n when Hash\n ctree = now_tree/k if now_tree\n sha = write_tree(v, ctree)\n sha = [sha].pack(\"H*\")\n str = \"%s %s\\0%s\" % ['40000', k, sha]\n tree_contents[k + '/'] = str\n when false\n tree_contents.delete(k)\n end\n end\n\n tr = tree_contents.sort.map { |k, v| v }.join('')\n @last_tree_size = tr.size\n self.repo.git.put_raw_object(tr, 'tree')\n end",
"title": ""
},
{
"docid": "6269600ab7c9fdcedee3cc5c7d29b6c4",
"score": "0.5204003",
"text": "def display_tree(tree_parent) # Need to work on this\nend",
"title": ""
},
{
"docid": "c97ef684f213120e44ecd9e9247e19ea",
"score": "0.52030486",
"text": "def rotateRL\n newLeft = Node.new(@value, @left, @right.left.left)\n @value, @right.left, @left = @right.left.value, @right.left.right, newLeft\n @right.set_height\n end",
"title": ""
},
{
"docid": "e0810b4e345b9cc8e4d871358aa7962d",
"score": "0.5202903",
"text": "def transform(node)\n # find downrule\n #\n\n process_results=proc{|rule, result, node|\n if node.gid\n case rule.get_mode\n when :insert\n node.set!(result)\n when :add\n node.setlast!(result)\n when :setfirst\n node.setfirst!(result)\n when :discard\n else\n raise \"unsupported rule mode: #{rule.get_mode}\"\n end\n end\n }\n\n # todo: support special rules for Ruby object\n # \n if node.bw_gid\n rule=_find_rule(node, :down)\n\n #$log.debug \"#{node.gid}(#{rule.get_subjects}): #{rule.get_direction}, #{rule.get_mode})\"\n\n # evaluate downrule\n result = [rule.get_body.call(node)].flatten\n\n process_results.call(rule, result, node)\n\n #transform the result\n #node.contents.select{|n|n.class==node.class}.each{|subnode|\n node.contents.each{|subnode|\n transform(subnode)\n } if node.bw_gid\n\n # find uprule\n rule = _find_rule(node, :up)\n\n if rule\n # evaluate uprule\n result = [rule.get_body.call(node)].flatten#.map{|n| n._bwclone}\n\n # process rule\n [process_results.call(rule, result, node)].flatten\n end\n end\n node\n\n end",
"title": ""
},
{
"docid": "4cccdf24bdcae729200655371a5ee7c5",
"score": "0.51997524",
"text": "def transproc\n return __transformation__ unless nested\n Functions[:recursion, Functions[:is, Hash, __transformation__]]\n end",
"title": ""
},
{
"docid": "e48a06f0738319420e275f04e56e73d6",
"score": "0.5191272",
"text": "def rightRotate( x)\n y = x.left\n t = y.right\n # Rotation\n y.right = x\n x.left = t\n # Update heights\n x.height = self.max(self.height(x.left), self.height(x.right)) + 1\n y.height = self.max(self.height(y.left), self.height(y.right)) + 1\n # Return new root\n return y\n end",
"title": ""
},
{
"docid": "f2adf5bbe608a18df13b7aa46b186fcd",
"score": "0.51850575",
"text": "def rotate_image(image, lvl = 0)\n len = (image.length - (lvl * 2))\n return image if len <= 0\n\n (0 + lvl).upto((len + lvl) - 2) do |i|\n temp = image[lvl][i]\n j = (lvl + len) - 1\n\n image[ lvl ][ i ] = image[j - i][ lvl ]\n image[j - i][ lvl ] = image[ j ][j - i]\n image[ j ][j - i] = image[ i ][ j ]\n image[ i ][ j ] = temp\n end\n\n return rotate_image(image, lvl += 1)\nend",
"title": ""
},
{
"docid": "52d43a1f0463fe19c20223569c00adfd",
"score": "0.51845634",
"text": "def rotate_left\n root = @right\n @right = root.left\n root.left = self\n root.swap_color(root.left)\n root\n end",
"title": ""
},
{
"docid": "fe7e4d33642847622e0f03c9e5172374",
"score": "0.5179115",
"text": "def rekey_former_siblings\r\n former_siblings = base_class.where(:parent_id => attribute_was('parent_id')).\r\n and(:rational_number_value.gt => (attribute_was('rational_number_value') || 0)).\r\n excludes(:id => self.id)\r\n former_siblings.each do |prev_sibling|\r\n new_rational_number = prev_sibling.parent_rational_number.child_from_position(prev_sibling.position - 1)\r\n move_node_and_save_if_changed(prev_sibling, new_rational_number)\r\n end\r\n end",
"title": ""
},
{
"docid": "5160a8f66984bdcb4eb83fe61533c591",
"score": "0.51774406",
"text": "def rotate_left!\r\n root = @parent\r\n root.right_child = @left_child\r\n root.right_child.parent = root unless @left_child.nil?\r\n @left_child = root\r\n self.parent = @left_child.parent\r\n unless self.parent.nil?\r\n if self.parent.right_child == @left_child\r\n self.parent.right_child = self \r\n else\r\n self.parent.left_child = self\r\n end\r\n end\r\n @left_child.parent = self\r\n update_heights!(left_child, self)\r\n end",
"title": ""
},
{
"docid": "e9646dceadbbed1ca96b18ef64fb3712",
"score": "0.51746756",
"text": "def doubleWithRightChild(k1)\n k1.right = rotateWithLeftChild(k1.right)\n return rotateWithRightChild(k1)\n end",
"title": ""
},
{
"docid": "a7db71e4c1bbcdb11e9c809b941e92b2",
"score": "0.51683414",
"text": "def tree3\n \tg = TDB.new\n \t2.times { g.add_to_db(TDB.new) }\n \tg.for_each_db_entry { |e| 2.times { e.add_to_db(TDB.new) } }\n \tg.for_each_db_entry do |e|\n \t\te.for_each_db_entry { |f| 2.times { f.add_to_db(TDB.new) } }\n \tend\n \treturn g\n end",
"title": ""
},
{
"docid": "5eece30083ec6bf5040d025d8486075a",
"score": "0.51661456",
"text": "def rotate_left(parent)\n child = parent.right\n \n #Attach the pointers for the grandparent\n grandparent = parent.parent\n child.parent = grandparent\n if grandparent == nil\n @root = child\n elsif grandparent.left == parent\n grandparent.left = child\n else\n grandparent.right = child\n end\n parent.parent = child\n \n #Attach the pointers for the child\n parent.right = child.left\n parent.right.parent = parent\n child.left = parent\n \n nil\n end",
"title": ""
},
{
"docid": "9022b499deff252d458ca1c966274aef",
"score": "0.5164304",
"text": "def sortable_tree_member_actions\n# member_action :move_to_top do\n# if resource.first?\n# redirect_to :back, :notice => I18n.t('awesome_nested_set.illegal_move_to_top', :resource => resource_class.to_s.camelize.constantize.model_name.human ) \n# return\n# end \n# \n# resource.move_to_top\n# redirect_to :back, :notice => I18n.t('awesome_nested_set.moved_to_top', :resource => resource_class.to_s.camelize.constantize.model_name.human )\n# end\n# \n# member_action :move_to_bottom do\n# if resource.last?\n# redirect_to :back, :notice => I18n.t('awesome_nested_set.illegal_move_to_bottom', :resource => resource_class.to_s.camelize.constantize.model_name.human ) \n# return\n# end \n# \n# resource.move_to_bottom\n# redirect_to :back, :notice => I18n.t('awesome_nested_set.moved_to_bottom', :resource => resource_class.to_s.camelize.constantize.model_name.human )\n# end\n\n member_action :move_up do\n unless resource.left_sibling\n redirect_to :back, :notice => I18n.t('awesome_nested_set.illegal_move_up', :resource => resource_class.to_s.camelize.constantize.model_name.human ) \n return\n end \n \n resource.move_left\n redirect_to :back, :notice => I18n.t('awesome_nested_set.moved_up', :resource => resource_class.to_s.camelize.constantize.model_name.human )\n end\n\n member_action :move_down do\n unless resource.right_sibling\n redirect_to :back, :notice => I18n.t('awesome_nested_set.illegal_move_down', :resource => resource_class.to_s.camelize.constantize.model_name.human ) \n return\n end \n \n resource.move_right\n redirect_to :back, :notice => I18n.t('awesome_nested_set.moved_down', :resource => resource_class.to_s.camelize.constantize.model_name.human )\n end \n end",
"title": ""
},
{
"docid": "1b6a694c1385c4d376d0bc8ccbd59969",
"score": "0.5160643",
"text": "def refactor_data(data, direction, position, field = nil)\n fields = data['fields']\n unless fields.nil?\n if direction == 1\n new_field = {}\n new_field['typeID'] = field.typeID\n new_field['unitName'] = field.unitName\n new_field['fieldID'] = field.fieldID\n new_field['fieldName'] = field.fieldName\n fields.insert(position, new_field)\n else\n fields.delete_at(position)\n end\n data['fields'] = fields\n end\n\n dp = data['dataPoints']\n unless dp.nil? or dp.length == 0\n h = {} # Hash so we don't have to keep doing lookups\n dp.each_with_index do | d, i |\n if direction == 1\n # This is the group the data point belongs to.\n # We need to add the group to every data point\n if field.fieldName == 'Contributors'\n # Every point has a data set name value, we can get the id from that, then we can get the contributor who created it\n # Get data set id between last two parenthesis from data set name, ex. 'Data Set name(101)'\n ds_name = dp[i][1]\n\n begin\n ds_id = ds_name.split('(').last.split(')').first.to_i\n name = h[ds_id.to_s]\n if name.nil?\n name = look_up_contributor(ds_id)\n h[ds_id.to_s] = name\n end\n rescue\n name = 'Unknown'\n end\n dp[i].insert(position, name)\n elsif field.fieldName == 'Number Fields'\n dp[i].insert(position, '')\n elsif field.fieldName == 'Data Point'\n dp[i].insert(position, i)\n end\n\n # down migration\n else\n dp[i].delete_at(position)\n end\n end\n data['dataPoints'] = dp\n\n text_fields = data['textFields']\n unless text_fields.nil? or text_fields.length == 0\n text_fields.each_with_index do | f, i |\n # if greater than position, add 1 because it was shifted over\n if f >= position\n text_fields[i] += direction\n end\n end\n text_fields.push(position)\n text_fields.sort!\n end\n data['textFields'] = text_fields\n\n time_fields = data['timeFields']\n unless time_fields.nil? or time_fields.length == 0\n time_fields.each_with_index do | f, i |\n # if greater than position, add 1 because it was shifted over\n if f >= position\n time_fields[i] += direction\n end\n end\n end\n data['timeFields'] = time_fields\n\n numeric_fields = data['numericFields']\n unless numeric_fields.nil? or numeric_fields.length == 0\n numeric_fields.each_with_index do | f, i |\n # if greater than position, add 1 because it was shifted over\n if f >= position\n numeric_fields[i] += direction\n end\n end\n end\n data['numericFields'] = numeric_fields\n\n geo_fields = data['geoFields']\n unless geo_fields.nil? or geo_fields.length == 0\n geo_fields.each_with_index do | f, i |\n # if greater than position, add 1 because it was shifted over\n if f >= position\n geo_fields[i] += direction\n end\n end\n end\n data['geoFields'] = geo_fields\n\n normal_fields = data['normalFields']\n unless normal_fields.nil? or normal_fields.length == 0\n normal_fields.each_with_index do | f, i |\n # if greater than position, add 1 because it was shifted over\n if f >= position\n normal_fields[i] += direction\n end\n end\n end\n data['normalFields'] = normal_fields\n\n end\n data\n end",
"title": ""
},
{
"docid": "ad11393e4af714aeb150b959ad956451",
"score": "0.5155682",
"text": "def rotate(matrix)\n n = matrix.length\n (0..(n / 2) - 1).each do |layer|\n last = (n - 1) - layer\n (layer..last - 1).each do |i|\n offset = i - layer\n top = matrix[layer][i]\n # left -> top\n matrix[layer][i] = matrix[last - offset][layer]\n # bottom -> left\n matrix[last - offset][layer] = matrix[last][last - offset]\n # right -> bottom\n matrix[last][last - offset] = matrix[i][last]\n # top -> right\n matrix[i][last] = top # matrix[last - offset][layer]\n end\n end\n matrix\nend",
"title": ""
},
{
"docid": "6831b54b375e8ab6d3089f62448ce3ef",
"score": "0.51486135",
"text": "def after_save\n if parent\n if @needs_moving && @children.size > 0 # if we're moving from somewhere else\n @children.clear\n scale = ((right_col_val-left_col_val)/(@prev_right - @prev_left)).abs\n old_mid_point = (@prev_right + @prev_left)/2\n new_mid_point = (right_col_val+left_col_val)/2\n sql = \"update #{self.class.table_name} set #{left_col_name} = ((#{left_col_name} - #{old_mid_point})*#{scale})+#{new_mid_point}, #{right_col_name} = ((#{right_col_name} - #{old_mid_point})*#{scale})+#{new_mid_point} where #{left_col_name} >#{@prev_left} and #{right_col_name} < #{@prev_right} \" \n connection.update_sql(sql)\n @needs_moving =false\n build_full_tree # get the children back \n else \n @children.each{|child| child.save if !(child.left_col_val && child.right_col_val) } # save only the ones that need lft and rgt\n end\n @prev_left = @prev_right = nil\n @new_parent = false\n end \nend",
"title": ""
}
] |
b103b449556353d65a3da8c050457f86 | Try to acquire a lock using SQL UPDATE. Returns true if successfully acquired. | [
{
"docid": "814102cad56331baa540707a83016964",
"score": "0.73466307",
"text": "def acquire_lock\n\t\t@@logger.info { \"Acquiring a lock in the database.\" } if have_logger?\n\t\tTournament.dataset.filter(:id => self.id, :locked => false).update(:locked => true) != 0\n\tend",
"title": ""
}
] | [
{
"docid": "83f75b7a013a464f945e8b35f02693ee",
"score": "0.73523533",
"text": "def acquire_lock(lock_name)\n begin\n acquired = false\n sql = lock_query(lock_name)\n connection.query(sql) do |result|\n acquired = result.fetch_row.first == \"1\"\n end\n acquired\n rescue ::Exception\n false\n end\n end",
"title": ""
},
{
"docid": "1e95dfbb6e186e065b68958e3d067f97",
"score": "0.68197703",
"text": "def try_lock\n if locked_out?\n false\n else\n lock\n true\n end\n end",
"title": ""
},
{
"docid": "3bd8295d8f9e968d42f30f9f2b6d9851",
"score": "0.6520742",
"text": "def select_lock_sql(sql)\n @opts[:lock] == :update ? sql : super\n end",
"title": ""
},
{
"docid": "a2181fc47e7ff3ce84c4556588434d7c",
"score": "0.646449",
"text": "def update\n return if params_missing([ :id, :lock_serial ], params, true)\n\n lock = Lock.get_active_else_not(params)\n return render_error_modelname(404, :MISSING_RECORD, Lock) if !lock\n\n # Only the owner can update the lock record\n return render_error(403, :NOT_BELONGING, Lock) if lock.user_id != @current_user_device.user_id\n return render_error(404, :LOCK_DECOMMISSIONED) if lock.decommissioned?\n\n lock.assign_attributes(params_app_allowed)\n\n new_lock = false\n if !lock.commissioned?\n # New lock, set it all up\n new_lock = true\n lock.commission_date = DateTime.now\n end\n\n return check_save_failure(lock) if !lock.save\n\n # Owner's key not created until commissioning is completed (saved) successfully.\n # TODO Transaction around this and the commissioning?\n if new_lock\n key = create_user_key(lock.id, lock.user, lock.user)\n # Validation errors may fail in interesting ways here.\n end\n\n render_lock_reply(lock)\n end",
"title": ""
},
{
"docid": "99aba7c99c205b34fb62f5fcd3fe4ace",
"score": "0.63163066",
"text": "def acquire\n lock = lockSession\n if lock\n return resource[:acquire]\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "4316d552dbfbb82d57b28423d0c51456",
"score": "0.6303038",
"text": "def try_lock\n lock_expire = (Time.now + expire_timeout).to_f\n lock_full_ident = owner_ident\n !!if 1 == eval_safe(@eval_try_lock, @ns_names, [lock_full_ident, (lock_expire*1000.0).to_i])\n @lock_expire = lock_expire\n @locked_owner_id = lock_full_ident\n end\n end",
"title": ""
},
{
"docid": "db67814761c785eb70662b67b32491b5",
"score": "0.629599",
"text": "def try_lock\n end",
"title": ""
},
{
"docid": "9eb7fb9e18c31b9fa162a99bc2ffad81",
"score": "0.62845397",
"text": "def lock id\n begin\n @db[:locks].insert :id => id, :locked => 1\n return TRUE\n rescue\n return FALSE\n end\n end",
"title": ""
},
{
"docid": "0197374aca48f2f72da5c95df0b2ad2e",
"score": "0.6259069",
"text": "def lock\n # locking will automatically trigger reload\n # locker older than 1 hour is considered stale\n if !is_locked || (is_locked && locked_at < Time.now - 3600)\n self.is_locked = true\n self.locked_at = Time.now\n save!\n else\n false\n end\n end",
"title": ""
},
{
"docid": "91b2871588a2cfb642fec29ca1f27d02",
"score": "0.6245201",
"text": "def lock(group_id) \n synchronize do\n if @@lock_table[group_id].nil?\n @@lock_table[group_id] = group_id\n return true\n end\n false\n end\n end",
"title": ""
},
{
"docid": "b1dcae085282f76fa756fdc1b8631935",
"score": "0.616518",
"text": "def locking?\n @locking\n end",
"title": ""
},
{
"docid": "28ec3558c6619a87ce2f801e6357c63a",
"score": "0.61413336",
"text": "def work\n stat :attempting_lock_on, item_id: object_id\n if @mutex.try_lock\n stat :has_lock_on, item_id: object_id\n chore\n stat :releasing_lock_on, item_id: object_id\n @mutex.unlock\n else\n stat :bailed_on, item_id: object_id\n end\n end",
"title": ""
},
{
"docid": "08e5a6a0390ac32f2bd6724f8a707df0",
"score": "0.61390436",
"text": "def locking_enabled?\n lock_optimistically && columns_hash[locking_column]\n end",
"title": ""
},
{
"docid": "76e631b0777199adf4fdd73c44967931",
"score": "0.6132977",
"text": "def supports_locking?\n false #true\n end",
"title": ""
},
{
"docid": "8b12f948c58e0d90961f0deeaca27495",
"score": "0.6124517",
"text": "def lock?\n return true if @_lock_type\n false\n end",
"title": ""
},
{
"docid": "73eed1f8fb0ab5094e6bcf647877f16e",
"score": "0.61164665",
"text": "def lock!\n self.for_update!\n end",
"title": ""
},
{
"docid": "669b95c9054424849b4ddd4a67e12b52",
"score": "0.61037385",
"text": "def with_app_lock( &block )\n # acquire lock_expiration\n ok = with_connection_lock do |locked_self|\n if locked_self.lock_expiration.nil? then\n row.update_all lock_expiration: Time.now + DELTA\n true\n end\n end\n # use and release lock_expiration outside of the connection_lock\n if ok then\n begin\n block.call\n ensure\n row.update_all lock_expiration: nil\n end\n end\n end",
"title": ""
},
{
"docid": "45e0b5a95c4ff34eed5a85bcea86ee57",
"score": "0.6081068",
"text": "def lock(worker)\n return true if locked? && locked_by == worker.name\n #all this to make sure the check and the lock are simultanious:\n cnt = repository.update({properties[:lock_name]=>worker.name},self.class.all(:id=>self.id,:lock_name=>nil))\n if 0 != cnt\n @lock_name = worker.name\n true\n else\n worker.say( \"Worker #{worker.name} Failed to aquire lock on job #{id}\" )\n false\n end\n end",
"title": ""
},
{
"docid": "aaedc1331a4c8ed1dde2a05d8dc3df2d",
"score": "0.60776365",
"text": "def acquire_lock!(lock_name = table_name, wait_timeout = 0, &block)\n acquire_lock(lock_name, table_name, &block) or raise LockTimeout, 'Timeout waiting for lock'\n end",
"title": ""
},
{
"docid": "77739d38a1e3492a5ade25b18e4b9f08",
"score": "0.60741395",
"text": "def return_lock\n\t\t@@logger.info { \"Returning the lock to the database.\" } if have_logger?\n\t\tTournament.dataset.filter(:id => self.id, :locked => true).update(:locked => false) != 0\n\tend",
"title": ""
},
{
"docid": "39ccc12b9fccf7c8ce6042033909f786",
"score": "0.60729766",
"text": "def update_current\n statement = current_to_false_sql_statement\n\n affected_rows = self.class.connection.update statement\n\n unless affected_rows == 1\n raise ActiveRecord::StaleObjectError.new(self, \"update_current (version #{current_lock_value})\")\n end\n true\n end",
"title": ""
},
{
"docid": "63f76f44b54814b0a81af4efc1376a48",
"score": "0.6047885",
"text": "def lock(mode, &block)\n sql = LOCK % [@opts[:from], mode]\n @db.synchronize do\n if block # perform locking inside a transaction and yield to block\n @db.transaction {@db.execute(sql); yield}\n else\n @db.execute(sql) # lock without a transaction\n self\n end\n end\n end",
"title": ""
},
{
"docid": "a180f2a86c2f7a8be07815facccfdc3a",
"score": "0.60390794",
"text": "def lock_update(vars={})\n return false unless valid?\n run_callbacks :save do\n run_callbacks :update do\n begin\n yield self\n result = flex.store({:params => {:version => _version}}.merge(vars))\n rescue Flex::HttpError => e\n if e.status == 409\n reload\n retry\n else\n raise\n end\n end\n end\n @_id = result['_id']\n @_version = result['_version']\n end\n self\n end",
"title": ""
},
{
"docid": "66f1be427e8000432a25ce1725a9f845",
"score": "0.6006356",
"text": "def lock\n if block_given?\n raise 'Race condition' if locking?\n\n @locking = true\n yield\n return @locking = false\n end\n @locking = true\n end",
"title": ""
},
{
"docid": "b3b5c07772e08f5ea05ae0709afa3b0f",
"score": "0.59956443",
"text": "def locked?\n end",
"title": ""
},
{
"docid": "0951fa2a7f98f11d46a19b72ece4e5df",
"score": "0.59764534",
"text": "def lock(&block)\n # TODO: only use replace strategy when server is executing the lock\n return call_strategy unless (locked_token = locksmith.lock(&block))\n\n locked_token\n end",
"title": ""
},
{
"docid": "b63f1651b274b41efb1324b3775b7f76",
"score": "0.59613657",
"text": "def acquire_lock(dbconn_reports_transaction,get_or_release, reports_or_recovery_string)\n begin\n if get_or_release == ACQUIRE_LOCK\n @lock_obj = dbconn_reports_transaction.select_one(\"SELECT IS_FREE_LOCK('#{reports_or_recovery_string}')\" )\n if @lock_obj[0] == 1\n @get_lock_stat = dbconn_reports_transaction.select_one(\"SELECT GET_LOCK('#{reports_or_recovery_string}',10)\")\n else\n executed = false\n begin # begin while loop\n #puts \"ROTATE LOOP\"\n @lock_obj = dbconn_reports_transaction.select_one(\"SELECT IS_FREE_LOCK('#{reports_or_recovery_string}')\" )\n if @lock_obj[0] == 1\n executed = true \n @get_lock_stat = dbconn_reports_transaction.select_one(\"SELECT GET_LOCK('#{reports_or_recovery_string}',10)\")\n else\n executed = false\n end # end of @lock_obj[0] == 1 inside begin loop\n sleep(0.1)\n end while (executed == false) \n end # end of @lock_obj[0] == 1\n return @get_lock_stat[0]\n elsif get_or_release == RELEASE_LOCK\n #puts \"RELEASE lock method\"\n dbconn_reports_transaction.select_one(\"SELECT RELEASE_LOCK('#{reports_or_recovery_string}')\")\n end \n rescue Exception =>e\n puts \"Error in ClassName: AnalyticsDataReducer MethodName: acquire_lock ErrInfo:#{e.to_s}\" \n end\n end",
"title": ""
},
{
"docid": "6c3ad20d1c74fabe1922eccb4fa40f5c",
"score": "0.59520245",
"text": "def is_locked?\n return true if have_lock?\n begin\n return true unless acquire_lock\n ensure\n release_lock\n end\n false\n end",
"title": ""
},
{
"docid": "0e8c0b5365653ef10780bd7f25f744d8",
"score": "0.5951293",
"text": "def add_lock!(sql, options)\n case lock = options[:lock]\n when true; sql << ' FOR UPDATE'\n when String; sql << \" #{lock}\"\n end\n end",
"title": ""
},
{
"docid": "7d9aa515074208546f5eaf525ee2682f",
"score": "0.5928011",
"text": "def touch_lock(record)\n new_attributes = lock_attributes\n result = update_all(new_attributes, { :id => record })\n\n if result == 1\n new_attributes.each do |key, value|\n record.write_attribute_without_dirty(key, value)\n end\n end\n\n result\n end",
"title": ""
},
{
"docid": "ba237285109abc2ed6886237f91da43e",
"score": "0.5923187",
"text": "def lock(mode, &block)\n sql = LOCK % [source_list(@opts[:from]), mode]\n @db.synchronize do\n if block # perform locking inside a transaction and yield to block\n @db.transaction {@db.execute(sql); yield}\n else\n @db.execute(sql) # lock without a transaction\n self\n end\n end\n end",
"title": ""
},
{
"docid": "141dad8fd4b568905f0b57f219e1859f",
"score": "0.59042567",
"text": "def lock!\n @locked = true\n end",
"title": ""
},
{
"docid": "d7403987ba00003895f72e1a9997ab57",
"score": "0.59006387",
"text": "def try_lock\n\t\t\t@nested_locks += 1 and return true if @locked == Thread.current\n\t\t\tresult = false\n\t\t\tThread.critical = true\n\t\t\tunless @locked\n\t\t\t\t@locked = Thread.current\n\t\t\t\tresult = true\n\t\t\tend\n\t\t\tThread.critical = false\n\t\t\tresult\n\t\tend",
"title": ""
},
{
"docid": "528f6062e246806e4eff8e6eba915c2c",
"score": "0.5887494",
"text": "def try_enter\n raise 'Already locked' if @locked\n enter_primitive ? @locked = true : false\n end",
"title": ""
},
{
"docid": "615e386db319915834120f4bc1b7073f",
"score": "0.5866271",
"text": "def lock\n if lockfile.lock\n begin\n yield\n ensure\n lockfile.unlock\n end\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "51703b78fd1bef95a5359076bbe183a4",
"score": "0.5865618",
"text": "def lock!\n create_lock_file!\n if have_first_lock?(false)\n @locked = true\n else\n cleanup_lock_file!\n false\n end\n end",
"title": ""
},
{
"docid": "f994ef94da6b3c32e29cd6d15f2b5174",
"score": "0.58641076",
"text": "def try_lock\n puts \"I couldn't get a lock.\" unless \n open_lock('contested', 'w', File::LOCK_EX | File::LOCK_NB) do\n puts \"I've got a lock!\" \n true\n end\nend",
"title": ""
},
{
"docid": "48df2f5720518e511a60ed115fa3a990",
"score": "0.5854508",
"text": "def lock(key)\n returned_from_block = nil\n client.lock(key, @ttl) do |locked|\n raise UnableToAcquireLockError unless locked\n returned_from_block = yield\n end\n returned_from_block\n end",
"title": ""
},
{
"docid": "bd6c1cd751e6e9265c0e31b27dacaba4",
"score": "0.5853859",
"text": "def lock!\n @locked = true\n end",
"title": ""
},
{
"docid": "1d0b00c4c5b15a55d3bf5be08805965d",
"score": "0.58451897",
"text": "def lock_delivery(del)\n r = Candygram.queue.update({'_id' => del['_id'], 'locked' => {'$exists' => false}}, # query\n {'$set' => {'locked' => dispatch_id}}, # update\n :safe => true)\n update_succeeded?(r)\n rescue Mongo::OperationFailure\n false\n end",
"title": ""
},
{
"docid": "b45a6056af76830992a9512db781a688",
"score": "0.5843772",
"text": "def have_lock?\n !!@handle\n end",
"title": ""
},
{
"docid": "65072e29d18dfae81452a5526a827b19",
"score": "0.5838787",
"text": "def perform(options = {}, &block)\n @record.transaction do\n @record.class.lock('FOR UPDATE NOWAIT').find(@record.id)\n yield\n end\n rescue\n nil\n end",
"title": ""
},
{
"docid": "e864cea9f0e657e310a865dd21d0814a",
"score": "0.5827431",
"text": "def try_lock\n @client.service.service.insert_object(\n @bucket.name,\n name: @object.name,\n if_generation_match: 0,\n upload_source: StringIO.new(@uuid),\n )\n\n true\n rescue Google::Apis::ClientError => e\n raise unless e.status_code == 412 && e.message.start_with?('conditionNotMet:')\n\n false\n end",
"title": ""
},
{
"docid": "d7ef0d1ea1d6e1a3ff363cf5aee4f460",
"score": "0.5818323",
"text": "def is_locked?\n locked\n end",
"title": ""
},
{
"docid": "f532bd554650758569dbe31916af07c7",
"score": "0.58181775",
"text": "def run_atomically(lock_key, tries=ConcurrentRestriction.lock_tries)\n acquired_lock = false\n exp_backoff = 1\n\n tries.times do\n lock_expiration = Time.now.to_i + ConcurrentRestriction.lock_timeout\n if acquire_lock(lock_key, lock_expiration)\n acquired_lock = true\n begin\n yield\n ensure\n release_lock(lock_key, lock_expiration)\n end\n break\n else\n sleep(rand(100) * 0.001 * exp_backoff)\n exp_backoff *= 2\n end\n end\n \n return acquired_lock\n end",
"title": ""
},
{
"docid": "679f53af88ad4b196154b089c4488f8b",
"score": "0.5814101",
"text": "def locked?\n @object.reload!\n @object.exists?\n rescue Google::Cloud::NotFoundError\n false\n end",
"title": ""
},
{
"docid": "68905ecaff5c5730fa6c5c2152a5d8a8",
"score": "0.5813526",
"text": "def lock\n if @unlocked == false\n raise Exception.new(\"a locked door needith not to be locked\")\n else\n return @unlocked = false\n end\n end",
"title": ""
},
{
"docid": "09d8d8aa43703e754daf43ab7cb359eb",
"score": "0.5797642",
"text": "def lock(key, admin = false)\n if @lockable and not @locked and (@keys.include? key or admin)\n @locked = true\n\n if self.can? :connected_to\n other = $manager.find self.connected_to\n other.lock(key, admin) if other.can? :lock\n end\n\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "c9f786fd2ee089cdd188ad71c81a9fb4",
"score": "0.5793653",
"text": "def ensure_atomic_update!\n quoted_col_name_clean = connection.quote_column_name('clean_version')\n quoted_col_name_dirty = connection.quote_column_name('dirty_version') \n affected_rows = connection.update(<<-end_sql, \"#{self.class.name} Update with 'clean/dirty version' locking\")\n UPDATE #{self.class.quoted_table_name}\n SET dirty_version = dirty_version + 1, clean_version = clean_version + 1\n WHERE #{self.class.primary_key} = #{quote_value(id)}\n AND #{quoted_col_name_clean} = #{quote_value(self.clean_version)} \n AND #{quoted_col_name_dirty} = #{quote_value(self.dirty_version)}\n end_sql\n \n unless affected_rows == 1\n raise AlreadyCleaned, \n \"Attempted to update clean_version on an invoice already cleaned up to that version\"\n end\n end",
"title": ""
},
{
"docid": "2ef0236dd240fc0c76d2c176f7d4d5f7",
"score": "0.57808346",
"text": "def recover_from_timeout(pid, name)\n with_dedicated_connection do |con|\n lock = select_one(<<~SQL, pid, name, connection: con)\n SELECT locktype, objid, pid, granted FROM pg_locks \\\n WHERE pid = ? AND locktype = 'advisory' AND objid = hashtext(?)\n SQL\n return false unless lock\n\n if lock['granted']\n logger&.info 'DBLock: Lock was acquired after all'\n true\n else\n res = select_value 'SELECT pg_cancel_backend(?)', pid, connection: con\n logger&.warn 'DBLock: Failed to cancel ungranted lock query' unless res == true\n false\n end\n end\n end",
"title": ""
},
{
"docid": "e2611ea363008c8058c80e6841c94caf",
"score": "0.57411677",
"text": "def try_await_lock(table, i); end",
"title": ""
},
{
"docid": "dff25d633d7a48146d340bf735bab564",
"score": "0.5739843",
"text": "def acquire_lock_algorithm!(lock_key, *args)\n now = Time.now.to_i\n lock_until = now + lock_timeout\n acquired = false\n\n return [true, lock_until] if lock_redis.setnx(lock_key, lock_until)\n # Can't acquire the lock, see if it has expired.\n lock_expiration = lock_redis.get(lock_key)\n if lock_expiration && lock_expiration.to_i < now\n # expired, try to acquire.\n lock_expiration = lock_redis.getset(lock_key, lock_until)\n if lock_expiration.nil? || lock_expiration.to_i < now\n acquired = true\n end\n else\n # Try once more...\n acquired = true if lock_redis.setnx(lock_key, lock_until)\n end\n\n [acquired, lock_until]\n end",
"title": ""
},
{
"docid": "09292ceabfeca65860c44fbedcaf6792",
"score": "0.5724547",
"text": "def update_startlock?\r\n # When waiting for event execution or locked\r\n return (@starting or lock?)\r\n end",
"title": ""
},
{
"docid": "f985d192b0b1475843fa6923aab3b649",
"score": "0.57142305",
"text": "def assert_locked_for_update!(name=nil)\n raise ZK::Exceptions::MustBeExclusivelyLockedException unless locked_for_update?(name)\n end",
"title": ""
},
{
"docid": "5c5155f367169f7f7f2a40c4645afece",
"score": "0.56910807",
"text": "def acquire\n return unless @running\n\n @lock.acquire.callback {\n if !@locked\n @onlocked.call if @onlocked\n @locked = true\n end\n\n # Re-acquire lock near the end of the period\n @extend_timer = EM.add_timer(@timeout.to_f * 2 / 3) {\n acquire()\n }\n }.errback { |e|\n if @locked\n # We were previously locked\n @onunlocked.call if @onunlocked\n @locked = false\n end\n\n if e.kind_of?(EM::Hiredis::RedisError)\n err = e.redis_error\n EM::Hiredis.logger.warn \"Unexpected error acquiring #{@lock} #{err}\"\n end\n\n @retry_timer = EM.add_timer(@retry_timeout) {\n acquire() unless @locked\n }\n }\n end",
"title": ""
},
{
"docid": "4cbfd7d2db4cea744f461a112b00bb5e",
"score": "0.5676548",
"text": "def acquire_lock_impl!(lock_key_method, failed_hook, *args)\n acquired = false\n lock_key = self.send(lock_key_method, *args)\n\n unless lock_timeout > 0\n # Acquire without using a timeout.\n acquired = true if lock_redis.setnx(lock_key, true)\n else\n # Acquire using the timeout algorithm.\n acquired, lock_until = acquire_lock_algorithm!(lock_key, *args)\n end\n\n self.send(failed_hook, *args) if !acquired\n lock_until && acquired ? lock_until : acquired\n end",
"title": ""
},
{
"docid": "e981552a6b18ee6a4f3b2ce82516be35",
"score": "0.5671472",
"text": "def locked?\n @mutex.locked?\n end",
"title": ""
},
{
"docid": "709a9f6e00eac0e14f31359d41ca6e83",
"score": "0.5666439",
"text": "def redis_safe_update(keys, update_condition, update_action)\n redis.watch(keys) do\n if update_condition.call(redis)\n result = redis.multi do |multi|\n update_action.call(multi)\n end\n if result.nil?\n raise 'Transaction aborted due to a race condition. Try again.'\n end\n else\n redis.unwatch\n end\n end\n true\n end",
"title": ""
},
{
"docid": "c7aa751a4ab744f386bdefa39b547137",
"score": "0.56624544",
"text": "def acquire_lock\n return true if @handle\n begin\n @handle = File.open(status_file_path, File::RDWR | File::CREAT)\n raise StandardError.new('Already locked') unless @handle.flock(File::LOCK_EX | File::LOCK_NB)\n @handle.rewind\n @handle.truncate 0\n rescue\n if @handle\n @handle.flock(File::LOCK_UN)\n @handle.close\n end\n @handle = nil\n end\n !!@handle\n end",
"title": ""
},
{
"docid": "ed381b5a6e0de525c8be50efe765b737",
"score": "0.56575286",
"text": "def has_lock?\n @has_lock || false\n end",
"title": ""
},
{
"docid": "d314fc4cce43f16b8acd6cb3abbe6d34",
"score": "0.5657456",
"text": "def lock\n if @mutex\n if @owner != Thread.current.object_id\n @mutex.lock\n @owner = Thread.current.object_id\n end\n @count += 1\n end\n true\n end",
"title": ""
},
{
"docid": "b9fb4d14e9d6d426cb53d3bc9159da6c",
"score": "0.565703",
"text": "def lock_status?\n return @unlocked == true\n end",
"title": ""
},
{
"docid": "62f19b38806f5ae24681cdbbc7d12d1e",
"score": "0.56528676",
"text": "def acquire_lock\n retry_failed_hooks? ? acquire_lock_on_failed_hooks : acquire_lock_on_fresh_hooks\n end",
"title": ""
},
{
"docid": "8fc417610261a88e227572874f569de5",
"score": "0.56505454",
"text": "def locked?\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "117ca2b852b006c78d69c8bbf6710e5f",
"score": "0.56503206",
"text": "def updatable?(database)\n result = true\n database.execute 'BEGIN'\n begin\n database.execute update_stmt\n rescue PG::UndefinedFile, PG::UndefinedObject, PG::ReadOnlySqlTransaction => err\n @error = err.message\n result = false\n end\n database.execute 'ROLLBACK'\n\n result\n end",
"title": ""
},
{
"docid": "1a39c7192ed00961c093e4a51cd5c845",
"score": "0.5648639",
"text": "def lock\n self.is_locked = true\n self\n end",
"title": ""
},
{
"docid": "375700dbd6f75cd8a4408f83ff5a3038",
"score": "0.5647532",
"text": "def locked?\n fetch_lock_info\n\n obj_exists_and_is_not_type? obj: @lock_info, type: []\n end",
"title": ""
},
{
"docid": "af68ef2ec65b1b45b3e4d5e021d827aa",
"score": "0.56169796",
"text": "def locked?\n @locked\n end",
"title": ""
},
{
"docid": "61e51d9d1d1a899c3b1dcd3ad9e696c4",
"score": "0.56160593",
"text": "def supports_advisory_locks?\n false\n end",
"title": ""
},
{
"docid": "61e51d9d1d1a899c3b1dcd3ad9e696c4",
"score": "0.56160593",
"text": "def supports_advisory_locks?\n false\n end",
"title": ""
},
{
"docid": "eaac1bc3b9b276ae8b7695b900eaf6f1",
"score": "0.5604607",
"text": "def before_enqueue_lock(*args)\n key = lock(*args)\n now = Time.now.to_i\n timeout = now + lock_timeout + 1\n\n # return true if we successfully acquired the lock\n return true if Resque.redis.setnx(key, timeout)\n\n # see if the existing timeout is still valid and return false if it is\n # (we cannot acquire the lock during the timeout period)\n return false if now <= Resque.redis.get(key).to_i\n\n # otherwise set the timeout and ensure that no other worker has\n # acquired the lock\n now > Resque.redis.getset(key, timeout).to_i\n end",
"title": ""
},
{
"docid": "ff9e0febba21e7a6c6ac602f97a9b67f",
"score": "0.5603752",
"text": "def locked_open?\n lock == :open\n end",
"title": ""
},
{
"docid": "f246896bd0b16c2fc456e1e6d8507c26",
"score": "0.5596771",
"text": "def locked?\n @locked\n end",
"title": ""
},
{
"docid": "d063f7290bf24dcec0cbd5da62b1003e",
"score": "0.5589621",
"text": "def update\n perform && updated?\n end",
"title": ""
},
{
"docid": "72771b1f74fee975c178b122741afebf",
"score": "0.5579992",
"text": "def lock\n if unlocked_status == false\n raise ArgumentError.new(\"You cannot lock this door - it is already locked\")\n else\n door_hash[:unlocked_status] = false\n end\n end",
"title": ""
},
{
"docid": "a3e3cff71f2a6ad9bf04aacbbba0928e",
"score": "0.5577538",
"text": "def locked?\n @locked\n end",
"title": ""
},
{
"docid": "a3e3cff71f2a6ad9bf04aacbbba0928e",
"score": "0.5577538",
"text": "def locked?\n @locked\n end",
"title": ""
},
{
"docid": "a3e3cff71f2a6ad9bf04aacbbba0928e",
"score": "0.5577538",
"text": "def locked?\n @locked\n end",
"title": ""
},
{
"docid": "a3e3cff71f2a6ad9bf04aacbbba0928e",
"score": "0.5577538",
"text": "def locked?\n @locked\n end",
"title": ""
},
{
"docid": "8b424fac830db5916818083f72b5eb75",
"score": "0.5575684",
"text": "def sync_try_lock(m = Sync_m::EX)\n li = locker_info(m)\n fire_on_try_lock_request(li)\n have_lock = super\n if have_lock\n push_lock_info(li)\n check_watchdog\n end\n fire_on_try_lock_return(li, have_lock)\n have_lock\n end",
"title": ""
},
{
"docid": "897c4cfced5101e1d67825624136b9e5",
"score": "0.55735266",
"text": "def locked?\n self.is_locked\n end",
"title": ""
},
{
"docid": "fa41cf25b4df02de7d015b584343994f",
"score": "0.55719376",
"text": "def add_lock!( sql, options )\n sql\n end",
"title": ""
},
{
"docid": "800e355e4db01a59b130774e03a50c00",
"score": "0.5567332",
"text": "def locked?\n self.released?\n end",
"title": ""
},
{
"docid": "4b6a2f9bb88302c4618bce9b345088fb",
"score": "0.5548767",
"text": "def lock\n shaz_nolock_lock if !@nolock\n end",
"title": ""
},
{
"docid": "7bdebf03b99ada06873cacf71df4e152",
"score": "0.5534487",
"text": "def set_sleep_check_lock\n\tNet::SSH.start(Config[\"remote_server\"], Config[\"ssh_user\"]) do |ssh|\n\t\tret = ssh_exec!(ssh, \"echo '\" + Config[\"unique_id\"] + \"' > \" + Config[\"lock_path\"])\n\t\tif ret[2] != 0\n\t\t\tputs \"Error setting lock!\"\n\t\t\tputs \"Got this error on remote host: \" + ret[1]\n\t\tend\n\t\t# check lock for unique id just in case someone else snuck in there at the same time\n\t\tsleep(1)\n\t\tret = ssh_exec!(ssh, \"cat \" + Config[\"lock_path\"])\n\t\tif ret[0].chomp != Config[\"unique_id\"]\n\t\t\treturn 1\n\t\telse return 0\n\t\tend\n\tend\nend",
"title": ""
},
{
"docid": "2a8c82fca59bae99036f98895defd045",
"score": "0.55332977",
"text": "def locked?\n !!locked_by && !!locked_at && (locked_at + Delayed::Worker.max_run_time) >= Delayed::Job.db_time_now\n end",
"title": ""
},
{
"docid": "4772408909aef8cf2e13b1f3874b68e7",
"score": "0.5526444",
"text": "def unlocked?\n unlocked, _, @active_worker_timestamp = Sidekiq.redis do |redis| \n redis.multi do\n redis.setnx(@locking_key, @current_worker_timestamp)\n redis.expire(@locking_key, 600)\n redis.get(@locking_key)\n end\n end\n unlocked\n end",
"title": ""
},
{
"docid": "9d777e471e4a828b81807de79bdd3b4a",
"score": "0.55252165",
"text": "def update_record \n if valid? && exists?\n query_string = \"UPDATE #{table} SET #{parameters_and_values_sql_string} WHERE id = #{@id};\"\n run_sql(query_string)\n @id\n else\n false\n end\n end",
"title": ""
},
{
"docid": "7b7fc7fb29c186288793606e9e3bcf07",
"score": "0.55233026",
"text": "def acquire_one_time_pessimistic_lock(reason)\n acquire_pessimistic_lock(ONE_TIME_LOCKING_LOCK_HOLDER,reason)\n end",
"title": ""
},
{
"docid": "9d730654ae154cab0d1eaf472946502b",
"score": "0.55156195",
"text": "def lockable?\n @lockable\n end",
"title": ""
},
{
"docid": "99cc6c99da226e8891185690f47e6ad1",
"score": "0.55021",
"text": "def lock?\n record.unlocked? && (director?(record.event) || competition_admin? || super_admin?)\n end",
"title": ""
},
{
"docid": "c9a8a2e62483797dab783337fd089feb",
"score": "0.55016476",
"text": "def set_lock\n if File.exists? lock_file_name\n false\n else\n FileUtils.touch lock_file_name\n true\n end\n end",
"title": ""
},
{
"docid": "361253a9371716d9d5e6ae0a2794c627",
"score": "0.5497989",
"text": "def acquire!(locker)\n self.locked_by = locker\n self.locked_at = Time.now\n save!\n end",
"title": ""
},
{
"docid": "2a053c40f2d740dbb6469801a84bd8ef",
"score": "0.548251",
"text": "def lock_expired?; end",
"title": ""
},
{
"docid": "dd40abf13938298b455c5aa6c0cb366e",
"score": "0.5481045",
"text": "def self_locked?\n results = mysql2.query(%Q[select is_used_lock('#{key}')], as: :array)\n lock_id = results.to_a.first.first\n return nil if lock_id.nil?\n results = mysql2.query(%Q[select connection_id()], as: :array)\n self_id = results.to_a.first.first\n self_id == lock_id\n end",
"title": ""
},
{
"docid": "95447870964e5cb66c0cc124c4845ba6",
"score": "0.5480361",
"text": "def locked?\n\t\t\t@locked\n\t\tend",
"title": ""
},
{
"docid": "7f64f5d0ef7024e571a7a476cb35370e",
"score": "0.54796946",
"text": "def locked?\n !!read\n end",
"title": ""
},
{
"docid": "17386ec0e1799b7c32d59d709efdba3c",
"score": "0.5478484",
"text": "def acquire_read_lock(java_entity)\n end",
"title": ""
},
{
"docid": "380ab00731804514edef2a78d8b4a553",
"score": "0.5476577",
"text": "def acquire_lock(lock_key, lock_expiration)\n # acquire the lock to work on the restriction queue\n expiration_time = lock_expiration + 1\n acquired_lock = Resque.redis.setnx(lock_key, expiration_time)\n\n # If we didn't acquire the lock, check the expiration as described\n # at http://redis.io/commands/setnx\n if ! acquired_lock\n # If expiration time is in the future, then someone else beat us to getting the lock\n old_expiration_time = Resque.redis.get(lock_key)\n return false if old_expiration_time.to_i > Time.now.to_i\n\n # if expiration time was in the future when we set it, then someone beat us to it\n old_expiration_time = Resque.redis.getset(lock_key, expiration_time)\n return false if old_expiration_time.to_i > Time.now.to_i\n end\n\n # expire the lock eventually so we clean up keys - not needed to timeout\n # lock, just to keep redis clean for locks that aren't being used'\n Resque.redis.expireat(lock_key, expiration_time + 300)\n\n return true\n end",
"title": ""
},
{
"docid": "7c1485879f406f0b347c86b69214d56b",
"score": "0.54678106",
"text": "def acquire(timeout:)\n timeout_time = Time.now + timeout\n loop do\n locked = redis.set(redis_key, owner, nx: true, px: ttl_ms)\n return true if locked\n return false if Time.now >= timeout_time\n sleep(@sleep_interval)\n end\n end",
"title": ""
}
] |
5446512cef82ac23171d624cb4e9ee55 | POST /exercises POST /exercises.json | [
{
"docid": "d3c1ef3767dd5a4b6ae21242972e89dc",
"score": "0.70962274",
"text": "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, :notice => 'exercise was successfully created.' }\n format.json { render :json => @exercise, :status => :created, :location => @exercise }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] | [
{
"docid": "d34f7fa06b4bf364069154fdf002ac26",
"score": "0.7109185",
"text": "def create\n @api_v1_exercise = Api::V1::Exercise.new(api_v1_exercise_params)\n\n respond_to do |format|\n if @api_v1_exercise.save\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_exercise }\n else\n format.html { render :new }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "53446c9a57b683eee298cd7c606c4b2e",
"score": "0.70019597",
"text": "def create\n @exercise = @workout.exercises.new(exercise_params)\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: I18n.t('exercises.created') }\n format.json { render :show, status: :created, location: @exercise }\n else\n format.html { render :new }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "70414cfb1572b4a3cf5e1ae6114a5b42",
"score": "0.69918406",
"text": "def create\n exercise = Exercise.create(exercise_params)\n if exercise\n render json: exercise\n else\n render json: {error: 'Workout was not created.'}\n end\n end",
"title": ""
},
{
"docid": "d36a664118d9babbb3e637767f55e3fb",
"score": "0.6982696",
"text": "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: 'Exercise was successfully created.' }\n format.json { render json: @exercise, status: :created, location: @exercise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3f481248327b3b7b2cc7de31fb0ad806",
"score": "0.6879251",
"text": "def create\n @exercise = current_user.exercises.new(exercise_params)\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: 'Uebung was successfully created.' }\n format.json { render action: 'show', status: :created, location: @exercise }\n else\n format.html { render action: 'new' }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ee7348773a738f55c403e3a1ff09d9d4",
"score": "0.6862878",
"text": "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: 'Exercise was successfully created.' }\n format.json { render json: @exercise, status: :created, location: @exercise }\n else\n flash.now[:error] = @exercise.errors.full_messages\n format.html { render action: \"new\"}\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "98fffa555015c3d3e8404f3bc3e90b73",
"score": "0.6856047",
"text": "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n flash[:class] = \"alert alert-success\"\n format.html { redirect_to @exercise, :notice => 'exercise was successfully created.' }\n format.json { render :json => @exercise, :status => :created, :location => @exercise }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "79f130537d22dd56bc6092bf51d052c1",
"score": "0.6811362",
"text": "def create\n @exercise = Exercise.new(exercise_params)\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: 'Exercise was successfully created.' }\n format.json { render action: 'show', status: :created, location: @exercise }\n else\n format.html { render action: 'new' }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e19e0ca76c4b8f2f75f43d9e5a2383ca",
"score": "0.66803247",
"text": "def exercise_params\n params.require(:exercise).permit(:workout_id, :title, :sets, :reps)\n end",
"title": ""
},
{
"docid": "2fa9c47599e81386039cf49565663205",
"score": "0.6631677",
"text": "def create\n @exercise = current_user.exercises.build(exercise_params)\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to exercise_weight_logs_path(@exercise)}\n format.json { render :show, status: :created, location: @exercise }\n else\n format.html { render :new }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dce449e43b433aaf1ea17a447740d1d3",
"score": "0.6548024",
"text": "def create\n @performed_exercise = PerformedExercise.new(performed_exercise_params)\n\n respond_to do |format|\n if @performed_exercise.save\n format.html { redirect_to @performed_exercise, notice: 'Performed exercise was successfully created.' }\n format.json { render :show, status: :created, location: @performed_exercise }\n else\n format.html { render :new }\n format.json { render json: @performed_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0d9ff0e17b2692ea52d94761d6e20d54",
"score": "0.6527623",
"text": "def exercise_params\n params.require(:exercise).permit(:name, :kata_details)\n end",
"title": ""
},
{
"docid": "2bb1c8b71514b6f7798e9b883f3bc02c",
"score": "0.6509552",
"text": "def create\n @do_exercise = DoExercise.new(params[:do_exercise])\n\n respond_to do |format|\n if @do_exercise.save\n format.html { redirect_to @do_exercise, notice: 'Do exercise was successfully created.' }\n format.json { render json: @do_exercise, status: :created, location: @do_exercise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @do_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "072529842cd6e6c6afdfcb2eaa2e08e6",
"score": "0.6453499",
"text": "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end",
"title": ""
},
{
"docid": "072529842cd6e6c6afdfcb2eaa2e08e6",
"score": "0.6453499",
"text": "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end",
"title": ""
},
{
"docid": "072529842cd6e6c6afdfcb2eaa2e08e6",
"score": "0.6453499",
"text": "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end",
"title": ""
},
{
"docid": "072529842cd6e6c6afdfcb2eaa2e08e6",
"score": "0.6453499",
"text": "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end",
"title": ""
},
{
"docid": "217e77aa3aaef9d99931645e750b4624",
"score": "0.64214003",
"text": "def api_v1_exercise_params\n params.require(:api_v1_exercise).permit(:title, :description, :deadline, :visible_date, :do_plagiarism_check, :exercise_test, :exercise_hidden_test, :exercise_stub)\n end",
"title": ""
},
{
"docid": "6adedb1e0d28f12409f8e66da991ca54",
"score": "0.64120775",
"text": "def exercise_params\n params.require(:exercise).permit(:name)\n end",
"title": ""
},
{
"docid": "650c5669c27c9d3e450e1c6f81cb372f",
"score": "0.6391337",
"text": "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @exercise }\n end\n\n end",
"title": ""
},
{
"docid": "735c6780ed4966d2ebaaccddbc4c1c48",
"score": "0.63911957",
"text": "def exercise_params\n params.require(:exercise).permit(:name, :muscles)\n end",
"title": ""
},
{
"docid": "238423659b9f424683de37ca6d21030f",
"score": "0.6382996",
"text": "def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @exercise }\n end\n end",
"title": ""
},
{
"docid": "8b75615b25b1d3a869892034770f1477",
"score": "0.6363269",
"text": "def create\n @exercise = Exercise.new(exercise_params)\n @exercise.author = current_user\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to @exercise, notice: \"Exercise was successfully created.\" }\n format.json { render :show, status: :created, location: @exercise }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "702316f81f7a084cb8e67cbf5bbbc062",
"score": "0.6357607",
"text": "def exercise_params\n params.require(:exercise).permit(:body, :last_import, :category_id)\n end",
"title": ""
},
{
"docid": "f52239ab062c98f078ea777f29e441fc",
"score": "0.63459635",
"text": "def create\n @patient_exercise = PatientExercise.new(params[:patient_exercise])\n\n respond_to do |format|\n if @patient_exercise.save\n format.html { redirect_to @patient_exercise, notice: 'Patient exercise was successfully created.' }\n format.json { render json: @patient_exercise, status: :created, location: @patient_exercise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @patient_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7ab8738ee7a69a4e9b018c1c726b1a88",
"score": "0.63356954",
"text": "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"title": ""
},
{
"docid": "7ab8738ee7a69a4e9b018c1c726b1a88",
"score": "0.63356954",
"text": "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"title": ""
},
{
"docid": "f3495686e9396fb2e05e5907fcbdd463",
"score": "0.6303029",
"text": "def exercise_params\n params.require(:exercise).permit(:date, :exercise, :weight, :reps, :max, :bulk, :tone, :user_id)\n end",
"title": ""
},
{
"docid": "99ced048b1f4899851bf917c425fc98c",
"score": "0.628884",
"text": "def create\n @exercise = Exercise.all.map{ |c| [c.name, c.id]}\n @training = Training.new(training_params)\n\n respond_to do |format|\n if @training.save\n format.html { redirect_to @training, notice: 'Training was successfully created.' }\n format.json { render :show, status: :created, location: @training }\n else\n format.html { render :new }\n format.json { render json: @training.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ab87211ed6b3fd6ca8c9a6c21551e0cb",
"score": "0.6282776",
"text": "def create\n @exercise = Exercise.new(params[:exercise])\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to(@exercise, :notice => 'Exercise was successfully created.') }\n format.xml { render :xml => @exercise, :status => :created, :location => @exercise }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d36df6648c0c258e22be18459890d591",
"score": "0.6281969",
"text": "def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end",
"title": ""
},
{
"docid": "a29bc4904bd21a62f76c929b815e18bc",
"score": "0.6276768",
"text": "def exercise_params\n params.require(:exercise).permit(:name, :description, :time, :workout_id)\n end",
"title": ""
},
{
"docid": "7f4e96b381184bc58eaa7f1cf0134f2b",
"score": "0.6239176",
"text": "def new\n @do_exercise = DoExercise.new(params[:do_exercise])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @do_exercise }\n end\n end",
"title": ""
},
{
"docid": "23c76bb9808ee27eff36936b9aae9124",
"score": "0.62323433",
"text": "def create\n @exercise_set = ExerciseSet.new(params[:exercise_set])\n\n respond_to do |format|\n if @exercise_set.save\n format.html { redirect_to @exercise_set, notice: 'Exercise set was successfully created.' }\n format.json { render json: @exercise_set, status: :created, location: @exercise_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "74e67bcc23295798f2f58cb8120241d3",
"score": "0.6213526",
"text": "def exercise_params\n params.require(:exercise).permit(:name, :question, :feedback,\n :experience, :id, :is_public, :priority, :question_type,\n :exercise_version, :exercise_version_id, :commit,\n :mcq_allow_multiple, :mcq_is_scrambled, :languages, :styles,\n :tag_ids)\n end",
"title": ""
},
{
"docid": "6d0d8cab712200ae7706b93d6c8129eb",
"score": "0.6167401",
"text": "def create\n @daily_exercise = DailyExercise.new(params[:daily_exercise])\n\n respond_to do |format|\n if @daily_exercise.save\n format.html { redirect_to @daily_exercise, notice: 'Daily exercise was successfully created.' }\n format.json { render json: @daily_exercise, status: :created, location: @daily_exercise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @daily_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "70aa99b10700f062d2d00528fd6f908e",
"score": "0.61227494",
"text": "def index\n @do_exercises = DoExercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @do_exercises }\n end\n end",
"title": ""
},
{
"docid": "7f247c1e36d18c324fa7ed05f0a207c2",
"score": "0.6120827",
"text": "def create\n @exercise_task = ExerciseTask.new(exercise_task_params)\n \n respond_to do |format|\n if @exercise_task.save\n format.html { redirect_to @exercise_task, notice: 'Exercise task was successfully created.' }\n format.json { render :show, status: :created, location: @exercise_task }\n else\n format.html { render :new }\n format.json { render json: @exercise_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e6fe8045906d9246760de8c6859f6f0d",
"score": "0.6118863",
"text": "def exercise_params\n params.require(:exercise).permit(:name, :trainingsart, :anzset, :anzwdh, :beschreibung, :muskelgruppe, :published)\n end",
"title": ""
},
{
"docid": "27d47b011fe1af43d6c817836f18f0ea",
"score": "0.61153275",
"text": "def index\n @api_v1_exercises = Api::V1::Exercise.all\n end",
"title": ""
},
{
"docid": "9bfc32964d0f94cd3725ada1b03f4d80",
"score": "0.61076903",
"text": "def addExistingExercise\n @workout_day = WorkoutDay.find(params[:id])\n exerciseId = params[:exercise][:id]\n\n exercise = Exercise.find(exerciseId)\n\n if !exercise.nil?\n @workout_day.exercises << exercise\n end\n\n @workout_day.save\n\n respond_to do |format|\n format.html { redirect_to @workout_day, notice: 'Exercise successfully added' }\n format.json { render json: @workout_day, status: :created, location: @workout_day }\n end\n end",
"title": ""
},
{
"docid": "9582c691eef766309763b1ff6a4fec07",
"score": "0.6060917",
"text": "def create\n @exerciseoverview = Exerciseoverview.new(exerciseoverview_params)\n\n respond_to do |format|\n if @exerciseoverview.save\n format.html { redirect_to @exerciseoverview, notice: 'Exerciseoverview was successfully created.' }\n format.json { render action: 'show', status: :created, location: @exerciseoverview }\n else\n format.html { render action: 'new' }\n format.json { render json: @exerciseoverview.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a1abb633810d5561120b12cfeeb8d61d",
"score": "0.60548407",
"text": "def create\n @programme_exercise = ProgrammeExercise.new(programme_exercise_params)\n\n respond_to do |format|\n if @programme_exercise.save\n format.html { redirect_to @programme_exercise, notice: 'Programme exercise was successfully created.' }\n format.json { render action: 'show', status: :created, location: @programme_exercise }\n else\n format.html { render action: 'new' }\n format.json { render json: @programme_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "994c46fbf9e665afbd773ae206ebfb67",
"score": "0.6053949",
"text": "def new\n @exercise_set = ExerciseSet.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_set }\n end\n end",
"title": ""
},
{
"docid": "e1bc01d1929a02291fd0bfe20a4e6ef1",
"score": "0.6018808",
"text": "def create\n @exercice = Exercice.new(params[:exercice])\n\n respond_to do |format|\n if @exercice.save\n format.html { redirect_to @exercice, notice: 'Exercice was successfully created.' }\n format.json { render json: @exercice, status: :created, location: @exercice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercice.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2edf86b9c7e9b4de07aa51a700204b8e",
"score": "0.6008048",
"text": "def create\n @my_exercise = MyExercise.new(params[:my_exercise])\n\n respond_to do |format|\n if @my_exercise.save\n flash[:notice] = 'MyExercise was successfully created.'\n format.html { redirect_to(@my_exercise) }\n format.xml { render :xml => @my_exercise, :status => :created, :location => @my_exercise }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @my_exercise.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2e4899d50bde17b6a197370875999431",
"score": "0.5987647",
"text": "def create\n @exercise_name = ExerciseName.new(exercise_name_params)\n\n respond_to do |format|\n if @exercise_name.save\n format.html { redirect_to @exercise_name, notice: 'Exercise name was successfully created.' }\n format.json { render :show, status: :created, location: @exercise_name }\n else\n format.html { render :new }\n format.json { render json: @exercise_name.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "54834df46afc825506d70afbc10bfc4b",
"score": "0.5979285",
"text": "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "54834df46afc825506d70afbc10bfc4b",
"score": "0.5979285",
"text": "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "506e38bcaac4cca3d827b47ff23fb190",
"score": "0.5949174",
"text": "def api_v1_exercise_params\n params.fetch(:api_v1_exercise, {}).permit *Api::V1::Exercise::STRONG_PARAMETERS #I had to put tests extra\n end",
"title": ""
},
{
"docid": "4b9e5da71c4a4ffea4f2e3cc56f6ea5d",
"score": "0.59241986",
"text": "def physio_exercise_params\n params.require(:physio_exercise).permit(\n :name,\n :description,\n :client_id,\n :duration,\n :user_id\n )\n end",
"title": ""
},
{
"docid": "1284b2fccbe6b37588cc8a922a0757e4",
"score": "0.5917649",
"text": "def create\n @exercise_template = ExerciseTemplate.new(exercise_template_params)\n\n if @exercise_template.save\n render json: @exercise_template, status: :created, location: @exercise_template\n else\n render json: @exercise_template.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f0d77eef29d7feae076708ab4e3148f4",
"score": "0.5900787",
"text": "def create\n @exercise = Exercise.new(params[:exercise].update(:company_id => current_company.id))\n #TODO agregar cuentas a un ejercicio nuevo. Seleccionar las cuentas del último ejercicio\n #@exercise.accounts = \n \n flash[:notice] = t('flash.actions.create.notice', :resource_name => Exercise.model_name.human) if @exercise.save\n respond_with(@exercise, :location => exercises_path)\n end",
"title": ""
},
{
"docid": "ddc682f9e04e26261fb870b0e4285ec5",
"score": "0.5893272",
"text": "def exercise_params\n params.require(:exercise).permit(:name, :notes,:base_weight)\n end",
"title": ""
},
{
"docid": "1f5e3e292f76ecb629451b7a78749119",
"score": "0.5890298",
"text": "def create\n @user = current_user\n @exercise = Exercise.new(exercise_params)\n @exercise = Exercise.where(name: @exercise.name).first_or_create(exercise_params)\n unless @user.exercises.where(name: @exercise.name).exists?\n @exercise.save\n @user.exercises << @exercise\n end\n respond_to do |format|\n if @user.save\n format.html { redirect_to user_exercises_path, notice: 'Exercise was successfully created.' }\n format.json { render :show, status: :created, location: @exercise }\n else\n format.html { render :new }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7af5b68ee6e6c06a42263d90d1801d65",
"score": "0.5882878",
"text": "def new\n @exercise = Exercise.setup\n respond_with(@exercise)\n end",
"title": ""
},
{
"docid": "34872fe2ff870f36f0b769d90b2f6740",
"score": "0.58358777",
"text": "def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "786b78c8df5a991fb0e52607e6109acd",
"score": "0.5824334",
"text": "def create\n @exercise = Exercise.new(params[:exercise])\n @exercise.lecture_id = params[:lecture_id]\n @exercise.clclass_id = params[:clclass_id]\n\n respond_to do |format|\n if @exercise.save\n format.html { redirect_to [@clclass,@exercise], notice: 'Exercise was successfully created.' }\n format.json { render json: @exercise, status: :created, location: @exercise }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "47293433df52a80cf2ae9f4dc64b7249",
"score": "0.58074486",
"text": "def new\n @patient_exercise = PatientExercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient_exercise }\n end\n end",
"title": ""
},
{
"docid": "e94779d29d0e7ac76e5572ce0731d576",
"score": "0.5797917",
"text": "def index\n @exercises = Exercise.all\n @user = current_user # changed get logged user\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"title": ""
},
{
"docid": "fa2d7626d109dab7dbaab1c9c87e8c62",
"score": "0.5777598",
"text": "def new\n @daily_exercise = DailyExercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daily_exercise }\n end\n end",
"title": ""
},
{
"docid": "29a09e5a15671c186e3730945a9541bc",
"score": "0.57528734",
"text": "def create\n @tutorial_quest = Tutorial::Quest.new(params[:tutorial_quest])\n\n respond_to do |format|\n if @tutorial_quest.save\n format.html { redirect_to @tutorial_quest, notice: 'Quest was successfully created.' }\n format.json { render json: @tutorial_quest, status: :created, location: @tutorial_quest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutorial_quest.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3fd744dfde94b6da5a0b05fe7bfeba22",
"score": "0.57403624",
"text": "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3fd744dfde94b6da5a0b05fe7bfeba22",
"score": "0.57401603",
"text": "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3fd744dfde94b6da5a0b05fe7bfeba22",
"score": "0.57401603",
"text": "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3fd744dfde94b6da5a0b05fe7bfeba22",
"score": "0.57401603",
"text": "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3fd744dfde94b6da5a0b05fe7bfeba22",
"score": "0.57401603",
"text": "def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e7a52a87da2f55db10bc34bf240235bb",
"score": "0.57318574",
"text": "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: \"Exercise was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f0e7d569e23fa0e35e20c9c83248e100",
"score": "0.57291085",
"text": "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f0e7d569e23fa0e35e20c9c83248e100",
"score": "0.57291085",
"text": "def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6ec53fded8cdf4f4054023c854c9008e",
"score": "0.57192945",
"text": "def create\n @workout = Workout.new(workout_params)\n if user_signed_in?\n @workout.owner = current_user\n @workout.users << current_user\n else\n @workout.owner = temp_user\n session[:workout_id] = @workout.id\n end \n @workout.save\n ex_params = exercise_params[:exercise].map do |e|\n e[:dur] = e[:dur][:minutes].to_i*60 + e[:dur][:seconds].to_i\n e[:workout_id] = @workout.id\n e\n end\n @exercises = @workout.exercises.create(ex_params)\n\n respond_to do |format|\n if @workout.save\n format.html { redirect_to @workout, notice: \"Workout was successfully created\" }\n format.json { render json: {workoutId: @workout.id}, status: 200 }\n else\n format.html { render :new }\n format.json { render json: @workout.errors, status: 500 }\n end\n end\n end",
"title": ""
},
{
"docid": "7373b7e955b478ae96e732d1a0e26207",
"score": "0.5716063",
"text": "def destroy\n @oncourse_exercise.destroy\n respond_to do |format|\n format.html { redirect_to oncourse_exercises_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6e238f6dfaa4ed1a431e26ef3a4a64cb",
"score": "0.57096016",
"text": "def index\n @exercises = Exercise.paginate(:page => params[:page], :per_page => 10).order('created_at DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end",
"title": ""
},
{
"docid": "124a9c468c010af9981954a0663ebc48",
"score": "0.56814486",
"text": "def performed_exercise_params\n params.require(:performed_exercise).permit(:exercise_type_id, :duration, :calories_burned, :done_on)\n end",
"title": ""
},
{
"docid": "a30ec81a27597d1531781daa16d96b97",
"score": "0.56786585",
"text": "def new\n @exercise_instruction = ExerciseInstruction.new\n @exercise_instruction.exercise_id = params[:exercise_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_instruction }\n end\n end",
"title": ""
},
{
"docid": "7894bb43eb8e5119b66800dc3ba6ada2",
"score": "0.5678054",
"text": "def create\n @exercise_log = ExerciseLog.new(params[:exercise_log])\n\n respond_to do |format|\n if @exercise_log.save\n format.html { redirect_to @exercise_log, notice: 'Exercise log was successfully created.' }\n format.json { render json: @exercise_log, status: :created, location: @exercise_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b5c84dcc6827e3111635f8ab1ddc4117",
"score": "0.56572294",
"text": "def create\n @exercise_instruction = ExerciseInstruction.new(params[:exercise_instruction])\n @exercise_instruction.user_id = current_user.id\n\n respond_to do |format|\n if @exercise_instruction.save\n format.html { redirect_to @exercise_instruction.exercise, notice: 'Note was successfully created.' }\n format.json { render json: @exercise_instruction, status: :created, location: @exercise_instruction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_instruction.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bc9fc0c4d97c6f2e44c7a8e9cf0b88b0",
"score": "0.56554747",
"text": "def create\n @tutorials = Tutorial.all\n @tutorial = Tutorial.new(tutorial_params)\n\n if @tutorial.save\n render json: @tutorial\n else\n render json: @tutorial.errors.full_messages, status:400\n end\n end",
"title": ""
},
{
"docid": "c5a8aa18c311e1de9cae1ff8fb0d5e3d",
"score": "0.5654664",
"text": "def destroy\n @performed_exercise.destroy\n respond_to do |format|\n format.html { redirect_to performed_exercises_url, notice: 'Performed exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "dc7782085329c028b7eab46412e45c5a",
"score": "0.56484634",
"text": "def set_api_v1_exercise\n @api_v1_exercise = Api::V1::Exercise.find(params[:id])\n end",
"title": ""
},
{
"docid": "dc7782085329c028b7eab46412e45c5a",
"score": "0.56484634",
"text": "def set_api_v1_exercise\n @api_v1_exercise = Api::V1::Exercise.find(params[:id])\n end",
"title": ""
},
{
"docid": "96a77511476a7f04fa43848c51f79a50",
"score": "0.564663",
"text": "def oncourse_exercise_params\n\n params.require(:oncourse_exercise).permit(:date, :prac_id, :change_agent_id, :precondition, :technique, :postcondition, :tti_date, :tti_days, :test, :futurepacing, :coach_name)\n end",
"title": ""
},
{
"docid": "e68624a0fd0baa2e6be5ae5c0c0876a0",
"score": "0.56412333",
"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": "03112c1ba1befd4c436cf177f783139e",
"score": "0.5630925",
"text": "def exercise_name_params\n params.require(:exercise_name).permit(:name)\n end",
"title": ""
},
{
"docid": "649d08785e2c0e4196e9132ad9056eac",
"score": "0.5629905",
"text": "def show\n render json: @exercise_template\n end",
"title": ""
},
{
"docid": "65a2c71e8e83272626bb3aa4e204380d",
"score": "0.5597357",
"text": "def index\n @programme_exercises = ProgrammeExercise.all\n end",
"title": ""
},
{
"docid": "d8f4765cdcfc56d83e8d8aff428fe95a",
"score": "0.55953676",
"text": "def index\n @oncourse_exercises = OncourseExercise.all\n\n\n\n end",
"title": ""
},
{
"docid": "dea2ab5d17a1a7533400f1249f78e155",
"score": "0.55885196",
"text": "def destroy\n @do_exercise = DoExercise.find(params[:id])\n @do_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to do_exercises_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8468e3ae2df0fcaa4452c620b66a9763",
"score": "0.5577634",
"text": "def new\n @exercise_log = ExerciseLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_log }\n end\n end",
"title": ""
},
{
"docid": "74e9c57ab4aa1500bfdf9ef9bbf04cb3",
"score": "0.5575717",
"text": "def create\n @exam = Exam.new(params[:exam])\n\n respond_to do |format|\n if @exam.save\n format.html { redirect_to @exam, notice: 'Exam was successfully created.' }\n format.json { render json: @exam, status: :created, location: @exam }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a5caa1314759adaa07483c1279122156",
"score": "0.5571508",
"text": "def destroy\n @programme_exercise.destroy\n respond_to do |format|\n format.html { redirect_to programme_exercises_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aead26f2334203ec47019ff89745cd16",
"score": "0.55454314",
"text": "def create\n @exercise_category = ExerciseCategory.new(params[:exercise_category])\n\n respond_to do |format|\n if @exercise_category.save\n format.html { redirect_to @exercise_category, notice: 'Exercise category was successfully created.' }\n format.json { render json: @exercise_category, 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": "b8737eb349d5ad6e8a82a583c9377e53",
"score": "0.55362904",
"text": "def programme_exercise_params\n params.require(:programme_exercise).permit(:programme_id, :exercise_id, :exercise_id, :order, :time, :rest, :sets, :time_per_set)\n end",
"title": ""
},
{
"docid": "2beb8c0fede2a735f60a5e01d3897524",
"score": "0.55307204",
"text": "def new\n @exercice = Exercice.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercice }\n end\n end",
"title": ""
},
{
"docid": "4c3244d33edfc1d6e98cfb47ac3996d5",
"score": "0.55102175",
"text": "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end",
"title": ""
},
{
"docid": "4c3244d33edfc1d6e98cfb47ac3996d5",
"score": "0.55102175",
"text": "def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end",
"title": ""
},
{
"docid": "fb4b726c4fcab51b1b405839c64350f0",
"score": "0.55079496",
"text": "def create\n # puts params\n questions = JSON.parse(params[:questions])\n q_hash = questions[\"questions\"]\n @assignment = Assignment.new\n @assignment.course_id = params[:course_id]\n @assignment.type = \"Homework\"\n @assignment.start_date = params[:start_date]\n @assignment.end_date = params[:end_date]\n @assignment.name = params[:name]\n # Following is the question hash\n q_hash.each do |key, value|\n a_hash = key[\"answers\"]\n question = key[\"question\"]\n puts question\n new_question = Question.new\n new_question.description = question\n new_question.type = \"MultipleChoice\"\n # Answer hash\n a_hash.each do |k,v|\n puts k[\"is_correct\"]\n puts k[\"description\"]\n new_answer = Answer.new\n new_answer.description = k[\"description\"]\n new_answer.is_correct = k[\"is_correct\"]\n new_question.association(:answers).add_to_target(new_answer)\n end\n @assignment.association(:questions).add_to_target(new_question)\n end\n \n if @assignment.save\n render :show, status: :created, location: @assignment\n else\n render json: @assignment.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "8faf23de06e28e43bdb05a54c6ff4e26",
"score": "0.5504837",
"text": "def index\n @user = User.find(params[:user_id])\n @exercises = @user.exercises.all\n end",
"title": ""
},
{
"docid": "6fbcde4d8ca4edfa3e27e8ba6c17fc7f",
"score": "0.5500487",
"text": "def create\n @room = Room.new(room_params)\n \n respond_to do |format|\n if @room.save\n trivia_category = (@room.category.eql? \"any\") ? '' : \"category=\" + @room.category\n \n questions_response = RestClient::Request.execute(\n method: :get,\n url: 'https://opentdb.com/api.php?amount=7&type=multiple&' + trivia_category\n )\n questions = JSON.parse(questions_response)['results']\n\n questions.each do |question|\n Question.create(\n :problem => question['question'],\n :category => question['category'],\n :correct_answer => question[\"correct_answer\"],\n :incorrect_answer_one => question[\"incorrect_answers\"][0],\n :incorrect_answer_two => question[\"incorrect_answers\"][1],\n :incorrect_answer_three => question[\"incorrect_answers\"][2],\n :room_id => @room.id\n )\n end\n format.html { redirect_to @room, notice: 'Room was successfully created.' }\n format.json { render :show, status: :created, location: @room }\n else\n format.html { render :new }\n format.json { render json: @room.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b45e1d1a0a2011e73119f30fcec40f6f",
"score": "0.5500358",
"text": "def set_exercise\n @exercise = Exercise.find(params[:id])\n end",
"title": ""
}
] |
8c9f8045a8695cf7637f314aa91c49e7 | This is a great question for interview prep, so let's not google it. Instead, try whiteboarding, and thinking of your approach before coding. There are multiple approaches to this question, so try to think of the most efficient one you can! Write a method that will take a string as an argument. The method will check this string, and count the amount of 'x's and 'o's. It should return true if the amount of 'x's and 'o's are the same, and should return false if they are different. It should also be case insensitive.E.g. exes_and_ohs("ooxx") should return true E.g. exes_and_ohs("oOxXxoX") should return falseE.g. exes_and_ohs("zpzpzpp") should return true !/usr/bin/env ruby | [
{
"docid": "c2199fa79875137aad7344846a208b47",
"score": "0.8192611",
"text": "def exes_and_ohs(str)\n arr = str.downcase.split(\"\")\n\n count_o = 0\n count_x = 0\n \n arr.each do |i|\n if i == \"o\"\n count_o += 1\n elsif\n i == \"x\"\n count_x += 1\n else\n return true\n end\n end\n\n return count_x == count_o\n\nend",
"title": ""
}
] | [
{
"docid": "adf4c355346c15af25ec0654cde741e5",
"score": "0.8513731",
"text": "def ex_oh(str)\n str.downcase.scan(/x/).count == str.downcase.scan(/o/).count\nend",
"title": ""
},
{
"docid": "acfb283dfcddfb689519939527c4f1eb",
"score": "0.84668297",
"text": "def XO(str)\n str.downcase.count('x') == str.downcase.count('o')\n\nend",
"title": ""
},
{
"docid": "cdf7ea1bc70c2e4b5189b4f1ed965968",
"score": "0.8455339",
"text": "def ExesAndOhs(string)\n \n counter_x = string.chars.count { |x| x == \"x\" || x == \"X\" }\n counter_o = string.chars.count { |x| x == \"o\" || x == \"O\"\t}\n\n counter_x == counter_o\n\nend",
"title": ""
},
{
"docid": "c67a3cf0d994ce6f73ef19fb20b0dc0c",
"score": "0.84141093",
"text": "def XO(str)\n exes = str.downcase.count('x')\n ohs = str.downcase.count('o')\n exes == ohs ? true : false\nend",
"title": ""
},
{
"docid": "61daee0677b8dbc633893bbc60dd99a8",
"score": "0.8413802",
"text": "def XO(str)\n x = str.downcase.count(\"x\")\n o = str.downcase.count(\"o\")\n x == o ? true : false\nend",
"title": ""
},
{
"docid": "4da42a6ba23e6cfcb92c21d97c0e92c4",
"score": "0.8406804",
"text": "def XO(str)\n str.downcase.count(\"x\") === str.downcase.count(\"o\")\nend",
"title": ""
},
{
"docid": "add4e7f09ba5466882435384768d9a24",
"score": "0.8278791",
"text": "def XO(str)\n puts str.downcase.count('x') == str.downcase.count('o') ? true : false\nend",
"title": ""
},
{
"docid": "7463d932df8ec706ed5a74d013a9d8dd",
"score": "0.8257183",
"text": "def XO(str)\n if (str.downcase.count('x') == str.downcase.count('o') )\n puts \"true\"\n return true\n else puts \"false\" \n return false\n end\nend",
"title": ""
},
{
"docid": "b5ae589959703c5d2f89e895cfc978d6",
"score": "0.82382375",
"text": "def XO(str)\n p = str.downcase\n g = p.count(\"x\")\n h = p.count(\"o\")\n (g == h ? true : false)\nend",
"title": ""
},
{
"docid": "a7f0d4c5e089d1899f6ccecf74f58a7a",
"score": "0.8191504",
"text": "def ExOh(str)\n str.scan(\"x\").count == str.scan(\"o\").count ? true : false\nend",
"title": ""
},
{
"docid": "8fe700c774478b5c236b94ec59784ede",
"score": "0.81063646",
"text": "def XO(str)\n \n counter_1 = 0\n counter_2 = 0\n \n letters = str.downcase.split('')\n\n letters.each do |letter|\n case letter\n when 'x'\n counter_1 += 1\n when 'o'\n counter_2 += 1\n end\n end\n \n counter_1 == counter_2\n \nend",
"title": ""
},
{
"docid": "8b89ae3e79a409b6aa6bca3ccedaf50c",
"score": "0.80613434",
"text": "def xo(str)\n\to_count = str.downcase.scan('o').count\n\tx_count = str.downcase.scan('x').count\n\treturn o_count == x_count ? true : false\nend",
"title": ""
},
{
"docid": "153f04204b41fc130fbde70afaa82f65",
"score": "0.8059168",
"text": "def ExOh(str)\n\n return true if str.scan(/x/).size == str.scan(/o/).size\n return false \n \nend",
"title": ""
},
{
"docid": "4750a096015af4b3531534fa5850c1bf",
"score": "0.8059041",
"text": "def ExOh(str)\n countZ = 0 \n countO = 0 \n # code goes here\n if str.each_char do |letter|\n if letter == \"x\"\n countZ += 1\n elsif letter == \"o\"\n countO += 1\n end\n end\n \n\t#return countZ == countO ? true : false \n if countZ == countO \n return true \n else\n return false \n end\n \nend\nend",
"title": ""
},
{
"docid": "34309126d4c5ffcbb588fa2e63e1f9df",
"score": "0.7788999",
"text": "def XO(str)\n xstring_count = str.count(\"x,X\")\n ostring_count = str.count(\"o,O\")\n if xstring_count == ostring_count\n true\n else\n false\n end\nend",
"title": ""
},
{
"docid": "a56e6f064b99da5624df00047d244f18",
"score": "0.77559674",
"text": "def XO(str)\n\treturn true if (str.downcase.count \"x\") == (str.downcase.count \"o\")\n\tfalse\nend",
"title": ""
},
{
"docid": "19a836062d4c27064151635310cddd73",
"score": "0.7748586",
"text": "def ExOh(str)\n str.scan('x').count == str.scan('o').count ? p(\"true\") : p(\"false\")\nend",
"title": ""
},
{
"docid": "084faae3e4bdbf83c7186b659b535bc7",
"score": "0.7600811",
"text": "def XO(str)\n if str.scan(/[xX]/).count == str.scan(/[oO]/).count\n true\n elsif str.scan(/[xXoO]/).count == 0\n true\n else\n false\n end\nend",
"title": ""
},
{
"docid": "79582383d71be1b8c1d1b9a2d840ed64",
"score": "0.7533889",
"text": "def step_through_with(s)i\n # It doesn't solve the kata because it returns true even if same chars are met in diffrent part of the word. Like \"ThaT\"\n s.chars.count == s.chars.uniq.count\nend",
"title": ""
},
{
"docid": "c894f5c045464a452ef254858f24db42",
"score": "0.7432615",
"text": "def exes_and_ohs(input_string)\n unique_array = input_string.downcase.split('').uniq\n input_array = input_string.downcase.split('')\n if (unique_array.length == 2)\n count_1 = input_array.count(unique_array[0])\n count_2 = input_array.count(unique_array[1])\n if count_1 == count_2\n return true\n else\n return false\n end\n else \n return false\n end\nend",
"title": ""
},
{
"docid": "3730b111991b3f3fd35b057f7314dae1",
"score": "0.73013425",
"text": "def isValid(s)\n # Write your code here\n character_hash = {}\n ('a'..'z').to_a.each do |ch|\n occurences = s.count(ch)\n character_hash[ch] = occurences unless character_hash[ch]\n end\n occurances_array = character_hash.values.select{ |a| a > 0 }\n max_occurence = occurances_array.max\n min_occurence = occurances_array.min\n return 'YES' if max_occurence == min_occurence\n return 'YES' if max_occurence - min_occurence == 1 && (occurances_array.count(max_occurence) == 1 || occurances_array.count(min_occurence) == 1)\n return 'YES' if min_occurence == 1 && occurances_array.count(min_occurence) == 1 && occurances_array.uniq.count == 2\n return 'NO'\nend",
"title": ""
},
{
"docid": "10d6e0f543cbd0d6cda2db351408cd94",
"score": "0.7290081",
"text": "def XO(str)\n # Method for amount of x's\n # Method for amount of o's\n # Comparison of these amounts ==> return boolean\n\n x_list = []\n o_list = []\n \n #loop through the letters, add these to an array first?\n # if current index is an x, add it to x_list\n # for x in str.length - scan through then check each letter (index)\n \n for i in 0..str.length do\n if str[i] == \"x\"or str[i] == \"X\"\n \n #Add to array\n\n x_list.push(str[i])\n end\n end\n\n for i in 0..str.length do\n if str[i] == \"o\" or str[i] == \"o\"\n\n\n #Add to array\n\n o_list.push(str[i])\n end\n end\n\n if (x_list.length == o_list.length)\n return true\n else \n return false\n\n end\n\nend",
"title": ""
},
{
"docid": "bad9a2befcec7bd317337825e27712ee",
"score": "0.71611387",
"text": "def duplicate_count(str)\n str.downcase.each_char.find_all { |c| str.downcase.count(c) > 1 }.uniq.size\nend",
"title": ""
},
{
"docid": "7d097980d4e39bcaab239c30f5366c1d",
"score": "0.7134765",
"text": "def custom_count(string, search_characters)\r\n i = 0\r\n checked = \"\"\r\n #for every character that must be searched, name the character \"fetcher\"\r\n search_characters.each_char do |fetcher|\r\n #if checked list contains the letter we want,\r\n #then we already looked for it,\r\n #so jump to the next iteration (aka, duplicates shall not pass!)\r\n if checked.include?(fetcher)\r\n next\r\n end\r\n #for each character in the string we're counting,\r\n #add 1 to the counter if the \"char\" is what we want\r\n string.each_char { |char| i += 1 if char == fetcher}\r\n checked << fetcher\r\n end\r\n i\r\n\r\nend",
"title": ""
},
{
"docid": "c620cbad0ad761bea235d15a4ae708a6",
"score": "0.71155345",
"text": "def is_isogram(s)\narr = [ ]\nb = \"a\"..\"z\"\nb.map do |x| p arr << s.downcase.split(\"\").count(x)\nend\narr.include?(2) || arr.include?(3) ? false : true\nend",
"title": ""
},
{
"docid": "010290c652e54a28d065edb11d57c6ca",
"score": "0.71000355",
"text": "def duos(str)\n count = 0\n str.each_char.with_index do |char, idx|\n count += 1 if char == str[idx+1]\n end\n count\nend",
"title": ""
},
{
"docid": "43739e9bbfa8aac8a2ada97b4bef52eb",
"score": "0.70638686",
"text": "def isValid(s)\n hash = s.strip.chars.inject(Hash.new(0)) { |total, e| total[e] += 1 ;total}\n puts hash.to_s\n values = hash.values.sort\n if values.count(values[0]) == values.size or\n (values.count(values[0]) == values.size - 1 and values[-1] - values[-2] == 1) or \n (values.count(values[-1]) == values.size - 1 and values[0] == 1)\n \"YES\"\n else\n \"NO\"\n end\n\nend",
"title": ""
},
{
"docid": "298a83e9514ba8644dfdccfa2094a394",
"score": "0.70324427",
"text": "def duplicate_count(text)\n text = text.downcase\n // ('a'..'z').count { |c| text.downcase.count(c) > 1 }\n return text.chars.uniq.count { |char| text.count(char) > 1 }\nend",
"title": ""
},
{
"docid": "316ac6c146ff389204753c8319422b49",
"score": "0.70147485",
"text": "def commonCharacterCount(s1, s2)\n a1 = s1.split(\"\").uniq\n a2 = s2.split(\"\").uniq\n \n b = a1 - a2\n c = a2 - a1\n \n check_a = a1 - b - c\n \n count = 0\n \n check_a.each do |char|\n count_1 = s1.split(\"\").count(\"#{char}\")\n count_2 = s2.split(\"\").count(\"#{char}\")\n \n if count_1 < count_2\n count += count_1\n else\n count += count_2\n end\n end\n \n count\nend",
"title": ""
},
{
"docid": "bd93f07d977ba8fc6526331db040314c",
"score": "0.69796044",
"text": "def duplicate_count(text)\n ('a'..'z').count { |c| text.downcase.count(c) > 1 }\nend",
"title": ""
},
{
"docid": "c91e87720520b62626c60820a81be87a",
"score": "0.697594",
"text": "def is_isogram(string)\n string.downcase.each_char { |char| return false if string.downcase.count(char) > 1 }\n true\nend",
"title": ""
},
{
"docid": "beed61eb2f3177bf64af3ba7aa750396",
"score": "0.6969329",
"text": "def repeating_letters?(str)\n # your code goes here\n # new_str = str.downcase\n # hash = Hash.new(0)\n\n # new_str.each_char do |char|\n # hash[char] += 1\n # end\n\n # hash.each do |k,v|\n # if v > 1\n # return true\n # end\n # end\n # false\n\n str.downcase.chars.uniq.length != str.length\nend",
"title": ""
},
{
"docid": "12d7ae890e0300d82a25ce1b650523f6",
"score": "0.69562376",
"text": "def duos(str)\n count = 0\n str.each_char.with_index do |char,idx|\n\n count += 1 if str[idx+1] == char \n\n end\n count\n\nend",
"title": ""
},
{
"docid": "b0ba55a5b46c5309b14ff796bc9891f4",
"score": "0.6953325",
"text": "def num_repeats(string)\n i = 0 \n count = 0\n check = nil\n \n while i < string.length\n letter = string[i]\n i2 = 1 \n while i2 < string.length\n letter2 = string[i2]\n \n if i < i2\n if letter == letter2\n if check == nil\n check = letter\n count += 1\n elsif letter != check\n count += 1\n check = letter\n end\n end\n end\n \n i2 += 1\n end\n i += 1\n end\n return(count)\nend",
"title": ""
},
{
"docid": "924541a0bea00bd3fe68917c2b1541d9",
"score": "0.6929671",
"text": "def duplicate_count(text)\n return 0 if text.empty?\n\n hash = Hash.new { 0 }\n text.split('').map(&:downcase).map(&:to_sym).each do |char|\n hash[char] += 1\n end\n\n hash.count { |_, v| v >= 2 }\nend",
"title": ""
},
{
"docid": "c309941ac12575d84cb6251dde05f8e4",
"score": "0.69222856",
"text": "def solution(s)\n return 0 if s.empty?\n t = 0\n ('A'..'Z').to_a.each do |c|\n t += s.count(c)\n end\n t + 1\nend",
"title": ""
},
{
"docid": "80c7b1d7f2a88a1df9b9ee7952d000c2",
"score": "0.6880715",
"text": "def count_x(str)\n return 0 if str.length == 0 \n if str[0] == \"x\"\n return 1 + count_x(str[1, str.length - 1])\n else\n return count_x(str[1, str.length - 1])\n end\nend",
"title": ""
},
{
"docid": "3a01813c4c2df0d0e749b9e3964a43e6",
"score": "0.6860033",
"text": "def duplicate_count(text)\n characters = {}\n\n text.downcase.each_char do |chr|\n characters[chr] ? characters[chr] += 1 : characters[chr] = 1\n end\n\n characters.values.select{|count| count > 1}.size\nend",
"title": ""
},
{
"docid": "5c660dce6d3f6b62a125913ce926ad45",
"score": "0.6858689",
"text": "def duplicate_count(text)\n text.downcase.chars.find_all{|char| text.downcase.count(char.downcase) > 1}.uniq.size\nend",
"title": ""
},
{
"docid": "33949a3714084c595c5f6a1f0dd970b0",
"score": "0.6852419",
"text": "def custom_count(string, search_characters)\n total_chars = 0\n #\n search_characters.each_char do |sc|\n # split the string and review letter & sc\n letters = string.each_char { |letter| letter == sc ? total_chars += 1 : next }\n\n end # end of do (search chars)\n\n total_chars\nend",
"title": ""
},
{
"docid": "73334e3967f653670d6f8669c2374db3",
"score": "0.6849033",
"text": "def mutation?(string_1, string_2)\n \n string_2.each_char do |char|\n if string_1.count(char) < string_2.count(char)\n return false\n break\n else\n return true\n break\n end \n end \nend",
"title": ""
},
{
"docid": "711dc92bf62b21d7ae4eba9a94ac8b28",
"score": "0.684309",
"text": "def anagram?(str1,str2)\r\n count = Hash.new(0)\r\n str1.each_char {|char| count[char] +=1}\r\n str2.each_char {|char| count[char] -=1}\r\n count.values.all?(0)\r\nend",
"title": ""
},
{
"docid": "8c55d81e85bfab8fee84240b00a22409",
"score": "0.6835493",
"text": "def fourth_anagram?(string1, string2)\n # count1 = Hash.new(0)\n # count2 = Hash.new(0)\n\n # string1.each_char {|char| count1[char] += 1}\n # string2.each_char {|char| count2[char] += 1}\n\n # count1 == count2\n\n count = Hash.new(0)\n\n string1.each_char {|char| count[char] += 1}\n string2.each_char do |char|\n count[char] -= 1\n return false if count[char] < 0\n end\n\n count.values.all? {|el| el == 0}\nend",
"title": ""
},
{
"docid": "7b9e8609c323da52c73547616a00b9bc",
"score": "0.68322426",
"text": "def fourth_anagram?(first_str, second_str)\n first_count = Hash.new(0)\n second_count = Hash.new(0)\n first_str.each_char { |char| first_count[char] += 1 } # n\n second_str.each_char { |char| second_count[char] += 1 } # m\n first_count == second_count\n\n\n\n\n# O(n)\n anagram = true\n count = Hash.new(0)\n first_str.each_char { |char| count[\"first_#{char}\"] += 1 }\n second_str.each_char { |char| count[\"second_#{char}\"] += 1 }\n first_str.each_char do |char|\n anagram = false unless count[\"first_#{char}\"] == count[\"second_#{char}\"]\n end\n anagram\nend",
"title": ""
},
{
"docid": "7eed3e4557381178acae6739827c6785",
"score": "0.6814204",
"text": "def conect_chars_with_word( str, word )\n split_word = word.split( // ) # split word into characters\n matching_char_count = 0 # if chars are included in str, add to this\n \n split_word.each do |char| # loop through split word characters\n if str.include?( char ) # does str have this character\n matching_char_count += 1 # add to char_count\n end\n end\n return str.size == matching_char_count # if the char count equals \nend",
"title": ""
},
{
"docid": "e572a84d7f2e16ab911a29487a3a0995",
"score": "0.6811821",
"text": "def duplicate_count(text)\n count = 0\n text.downcase.chars.uniq.each do |char|\n count += 1 if text.downcase.chars.count(char) > 1\n end\n count\nend",
"title": ""
},
{
"docid": "f4c96b8c73284cf1a9d3031d8552d6c4",
"score": "0.68101966",
"text": "def duplicate_count(text)\n characters = text.downcase.chars.each_with_object(Hash.new(0)) do |chr, hash|\n hash[chr] += 1\n end\n\n characters.values.select{|count| count > 1}.size\nend",
"title": ""
},
{
"docid": "a9e8732809086dc3ae9bf3f011a01c3c",
"score": "0.68060225",
"text": "def hamm one, two\n count = 0\n uno = one.split('')\n dos = two.split('')\n i = 0\n uno.each do |x|\n if x != dos[i]\n count += 1\n end\n i += 1\n end\n puts count\nend",
"title": ""
},
{
"docid": "1ad9a0f78c31094628c251a6ec1f35f7",
"score": "0.67952067",
"text": "def double_letter_count(string)\ncount = 0\narr = string.split(\"\")\n\ni = 0\nwhile i < arr.length\n\tif arr[i] == arr[i + 1]\n\t\tcount += 1\n\tend\n\ti += 1\nend\n\n\n\nreturn count\n\nend",
"title": ""
},
{
"docid": "acc49390aebc328acc07a16e3f149809",
"score": "0.6782864",
"text": "def isValid(s)\n freqs = Array.new 26,0\n s.split('').each do |char|\n freqs[char.ord - 'a'.ord] += 1\n end\n uniqueValues = Set.new freqs.select {|ele| ele != 0}\n uniqueValues = uniqueValues.to_a.sort\n return \"NO\" if uniqueValues.length > 2\n return \"YES\" if uniqueValues.length == 1 || (count(freqs, uniqueValues[0]) == 1 && (uniqueValues[1] - uniqueValues[0] == 1 || uniqueValues[0] == 1)) || (count(freqs, uniqueValues[1]) == 1 && (uniqueValues[1] - uniqueValues[0] == 1 || uniqueValues[1] == 1)) \n return \"NO\"\nend",
"title": ""
},
{
"docid": "d84f5e9cd98bdd3e70ffe1526e548374",
"score": "0.677937",
"text": "def repeating_letters?(str)\n # your code goes here\n str.each_char do |ch|\n if str.downcase.count(ch) > 1\n return true\n end\n end\n false\nend",
"title": ""
},
{
"docid": "cd11b30668ccc668307b6659ff632992",
"score": "0.6777171",
"text": "def bonus_anagram?(str1, str2)\n counts = Hash.new(0)\n\n str1.chars.each { |letter| counts[letter] += 1 }\n str2.chars.each { |letter| counts[letter] -= 1 }\n\n counts.values.all? { |value| value == 0 }\nend",
"title": ""
},
{
"docid": "d6d081f7a1382200fb89999f22debe90",
"score": "0.6764806",
"text": "def is_valid(s)\n char_frequency = {}\n s.split('').each do |char|\n if char_frequency.key?(char)\n char_frequency[char] = char_frequency[char] += 1\n else\n char_frequency[char] = 1\n end\n end\n\n frequency = char_frequency.values\n \n if frequency.uniq.size == 1\n 'YES'\n elsif frequency.uniq.size == 2\n occurances = {}\n frequency.each do |f|\n if occurances.key?(f)\n occurances[f] = occurances[f] += 1\n else\n occurances[f] = 1\n end\n end\n if occurances.keys.count > 2\n 'NO'\n else\n if occurances.select{|k,v| k == 1 && v == 1}.size == 1\n 'YES'\n elsif occurances.values.include?(1) && (occurances.keys.max - occurances.keys.min) == 1\n 'YES'\n else\n 'NO'\n end\n end\n else\n 'NO'\n end\nend",
"title": ""
},
{
"docid": "a4dcf9354a569d76ee78e462b2cd02ed",
"score": "0.67635775",
"text": "def count_code(string) # return the number of times 'co'+any_char+'e' appears\n return string.scan(/co.e/).length #easy way with regex\nend",
"title": ""
},
{
"docid": "af32b096ab41d4d628168ae4828b0b84",
"score": "0.674283",
"text": "def duplicate_count(str)\n arr = str.downcase.chars\n counts = {}\n arr.each do |char|\n if counts.include?(char)\n counts[char] += 1\n else\n counts[char] = 1\n end\n end\n output = 0\n counts.each_value do |num|\n output += 1 if num > 1\n end\n output\nend",
"title": ""
},
{
"docid": "fefa7cf678d69600ff99a6c8110201e5",
"score": "0.6728334",
"text": "def double_letter_count(string)\n count = 0\n\n string.each_char.with_index do |char, idx|\n if char == string[idx + 1]\n count += 1\n end \n end\n\n return count\nend",
"title": ""
},
{
"docid": "c1f21dc3892962b28b597795f6c9bdb6",
"score": "0.67261714",
"text": "def duplicate_count(text)\n return 0 if text == \"\"\n arr = text.downcase.split('')\n return arr.select{|e| arr.count(e) > 1}.uniq.length\nend",
"title": ""
},
{
"docid": "d27e811ecbbb1e9f6432ea74534d6913",
"score": "0.6718854",
"text": "def g_happy(string) # if all g's are next to g's, return true\n return string.scan(/gg/).length == string.scan(/g./).length\nend",
"title": ""
},
{
"docid": "830772986d77de244e1f2e90e311a468",
"score": "0.671593",
"text": "def double_letter_count(string)\r\n repeats = 0\r\n oldChar = ''\r\n string.each_char do |char|\r\n if oldChar == char\r\n repeats += 1\r\n end\r\n oldChar = char\r\n end\r\n return repeats\r\nend",
"title": ""
},
{
"docid": "cd0976b7107788704dfef06859803bba",
"score": "0.6713454",
"text": "def anagram_check(init_string, test_string)\n init_string = init_string.split(\" \").map(&:downcase).join(\"\")\n test_string = init_string.split(\" \").map(&:downcase).join(\"\")\n\n return false unless init_string.size == test_string.size\n\n init_or = 0\n test_or = 0\n\n (init_string.size).times do |i|\n init_or ^= init_string[i].ord\n test_or ^= test_string[i].ord\n end\n\n init_or == test_or\nend",
"title": ""
},
{
"docid": "600de11425417026f55530a97c26e6d9",
"score": "0.6709937",
"text": "def lov(x,y)\n a = x.strip\n b = y.strip \n t = a.size + b.size \n c = a.count(b)\n s = t / c\n puts \"The total characters: #{t}\"\n puts \"Common characters: #{c}\"\n puts \"Total characters (#{t}) divided by common (#{c}) equals:\"\nend",
"title": ""
},
{
"docid": "8151f7644ec0baeac0c8d502b5e27f91",
"score": "0.67076916",
"text": "def custom_count(string, search_characters)\n str = string.chars\n searched = search_characters.chars\n p str\n p searched\n count = 0\n str.each do |item|\n if searched.include?(item)\n count = count + 1\n end\n end\n count\nend",
"title": ""
},
{
"docid": "3fe27321d9c9b2cda1b37baef94d8edb",
"score": "0.67058885",
"text": "def getCount(inputStr)\n inputStr.chars.count{|letter| letter=~/[aeiou]/}\nend",
"title": ""
},
{
"docid": "fdf59f861f46596a36df3411f1b8d1b9",
"score": "0.670476",
"text": "def count_code(str)\n times = 0\n str.size.times do |n|\n if n != (str.size - 1) && n != (str.size - 2) && n != (str.size - 3) && str[n] == \"c\" && str[n + 1] == \"o\" && str[n + 3] == \"e\"\n times += 1\n end\n end\n return times\nend",
"title": ""
},
{
"docid": "3c2d005ff6fea5a2287a0f483cb4a0f2",
"score": "0.66938436",
"text": "def fifth_anagram?(string1, string2) # Time: O(n) * O(n) * O(n) => O(n) Space = O(1)\n count = Hash.new(0)\n string1.split(\"\").each {|char1| count[char1]+=1}\n string2.split(\"\").each {|char2| count[char2]-=1}\n count.all? {|k,v| v.zero?}\nend",
"title": ""
},
{
"docid": "33064b53a5af2a2b0f714e43b5a327b2",
"score": "0.66925746",
"text": "def custom_count(string, search_characters)\n count = 0\n\n # string.each_char do |char|\n # if search_characters.include?(char)\n # count += 1\n # end\n # end\n # count\n \n string.each_char {|char| count += 1 if search_characters.include?(char) }\n count\nend",
"title": ""
},
{
"docid": "26344794c487b1d63d42b8231722de5a",
"score": "0.66894996",
"text": "def fourth_anagram?(string1, string2)\n chars_hash = Hash.new(0)\n string1.chars.each do |chr|\n chars_hash[chr] += 1\n end\n\n string2.chars.each do |chr|\n chars_hash[chr] -= 1\n end\n\n chars_hash.values.all? {|count| count == 0}\nend",
"title": ""
},
{
"docid": "4ce4e967eec4ae51cce027e594f23660",
"score": "0.6687117",
"text": "def count_string(string, characters)\n i = 0\n size = characters.length\n hits = 0\n while i < string.length - size + 1\n if string[i,size] == characters\n hits += 1\n end\n i += 1\n end\n return hits\nend",
"title": ""
},
{
"docid": "80ec2651d1fea0a21b76a6b4ebfd419e",
"score": "0.66826856",
"text": "def double_letter_count(string)\n\tcount = 0\t\n \t(0...string.length).each do |i|\n \tif string[i] == string[i-1]\n \t\tcount += 1\n end\n end\n \treturn count\nend",
"title": ""
},
{
"docid": "01a7465d4506e469294be89b9549a5a4",
"score": "0.66807836",
"text": "def co_ecount(str)\n times = 0\n (str.length - 3).times do |i|\n if str[i] == \"c\" && str[i+1] == \"o\" && str[i+3] == \"e\"\n times += 1\n end\n end\n return times\nend",
"title": ""
},
{
"docid": "d1206b88616f46445e1423dee91a2e85",
"score": "0.6667198",
"text": "def anagram_countcompare? (s1,s2)\n s1_charcount = {}\n s1.chars do |char|\n if s1_charcount.key? char\n s1_charcount[char] += 1\n else\n s1_charcount[char] = 1\n end\n end\n \n s2_charcount = {}\n s2.chars do |char|\n if s2_charcount.key? char\n s2_charcount[char] += 1\n else\n s2_charcount[char] = 1\n end\n end\n\n return false if s1_charcount.keys.size != s2_charcount.keys.size\n s1_charcount.keys do |s1_char|\n return false if not s2_charcount.key? s1_char\n return false if not s2_charcount[s1_char] == s1_charcount[s1_char]\n end\n true\n end",
"title": ""
},
{
"docid": "b59a533a5b11a59be7bed39bd4baf435",
"score": "0.666435",
"text": "def fourth_anagram?(str1, str2)\n str1_counts = Hash.new(0)\n str2_counts = Hash.new(0)\n\n str1.chars.each { |letter| str1_counts[letter] += 1 }\n str2.chars.each { |letter| str2_counts[letter] += 1 }\n\n str1_counts == str2_counts\nend",
"title": ""
},
{
"docid": "a0bfdc377e2ea29a9278889a2295598c",
"score": "0.66608155",
"text": "def bonus_anagram?(str1, str2)\r\n hash = Hash.new(0)\r\n str1.each_char { |char| hash[char] += 1 }\r\n str2.each_char do |char|\r\n if hash.has_key?(char) && hash[char] > 0\r\n hash[char] -= 1\r\n else\r\n return false\r\n end\r\n end\r\n true\r\nend",
"title": ""
},
{
"docid": "b7830751a0f8cf3b792c73227a0b9adb",
"score": "0.6657758",
"text": "def unique_chars?(string)\n hash = Hash.new(0)\n string.each_char do |char|\n hash[char] +=1\n end\n # hash.select { |key, value| block } returns an array with key,value pairs\n array = hash.select { |key,value| value > 1}\n if array.length > 0\n return false\n else\n return true\n end\n\nend",
"title": ""
},
{
"docid": "7de31f4f1d4c19d19073f3f56457c3c6",
"score": "0.66533244",
"text": "def custom_count(string, search_characters)\n # Return the number of total times that\n # the search character are in the string\n\n # word = string.count(\"#{search_characters}\")\n # word\n count = 0\n word = string.downcase\n word.each_char do |char|\n if search_characters.include?(char)\n count += 1\n end\n end\n count\nend",
"title": ""
},
{
"docid": "eacbb6568e98cf47c15940c9adae3e5e",
"score": "0.6653001",
"text": "def count_vowels (string)\n\n # Downcase for case insensitivity, get vowels, drop non-unique, count\n return string.downcase.scan(/[aeiou]/).uniq.count\n\nend",
"title": ""
},
{
"docid": "eec7e94205135e829e9283b4765ac4c6",
"score": "0.66518766",
"text": "def fourth_anagram?(string_1, string_2)\n characters_1 = Hash.new(0)\n characters_2 = Hash.new(0)\n string_1.chars.each { |ch| characters_1[ch] += 1 }\n string_2.chars.each { |ch| characters_2[ch] += 1 }\n characters_1 == characters_2\nend",
"title": ""
},
{
"docid": "876324e2a46b0d2261e5d060181b7c3e",
"score": "0.66407996",
"text": "def getCount(input_str)\n regex = /[aeiou]/\n input_str.split('').select { |char| char if char =~ regex }.count\nend",
"title": ""
},
{
"docid": "900bf70b73e0d819b265e1cf5d42b011",
"score": "0.66308427",
"text": "def fourth_anagram?(str_1, str_2)\n str_1_hash = Hash.new(0)\n str_2_hash = Hash.new(0)\n str_1.each_char { |char| str_1_hash[char] += 1 }\n str_2.each_char { |char| str_2_hash[char] += 1 }\n str_1_hash == str_2_hash\nend",
"title": ""
},
{
"docid": "99045c5e79f5b492398e3849a63008f4",
"score": "0.66281354",
"text": "def anagramV?(str1, str2)\n count_hash = Hash.new(0)\n \n str1.each_char do |char|\n count_hash[char] += 1\n end\n\n str2.each_char do |char|\n count_hash[char] -= 1\n end\n \n count_hash.values.all?(0)\nend",
"title": ""
},
{
"docid": "8ecbe9fea0441777e53fcf73398e1f91",
"score": "0.66273594",
"text": "def custom_count(string, search_chars)\n count = 0\n string.each_char { |chr|\n count += 1 if search_chars.include?(chr)\n }\n count\nend",
"title": ""
},
{
"docid": "85ed2cfa119c01ceca2c6cf7eee119d3",
"score": "0.66251135",
"text": "def compare_strings(string1, string2)\n\n\tcount = 0\n\tstring1.chars.each_index do |i|\n\t\tcount += 1 if string1[i] != string2[i]\n\tend\n\n\treturn count == 1\n\nend",
"title": ""
},
{
"docid": "7a441331a352d1217eb8421e5774de8e",
"score": "0.6622874",
"text": "def is_isogram(string)\n #your code here\n string.downcase.chars.uniq == string.downcase.chars\nend",
"title": ""
},
{
"docid": "8e3f7100ac0c4e75a6e1ea9e7e9b5701",
"score": "0.6622497",
"text": "def fourth_anagram?(str1, str2)\n count1 = Hash.new(0)\n \n\n str1.each_char{|char| count1[char] += 1}\n str2.each_char{|char| count1[char] -= 1}\n\n count1.values.all?{|value| value == 0}\nend",
"title": ""
},
{
"docid": "c13fe25131eda54561a37124ce0d7809",
"score": "0.662217",
"text": "def fith_anagram?(str1, str2)\n hash = Hash.new(0)\n \n str1.each_char { |char| hash[char] += 1 }\n str2.each_char { |char| hash[char] += 1 }\n \n hash.values.all? { |v| v > 1 }\nend",
"title": ""
},
{
"docid": "11d4af78efdc1762b0b2210b13b9b336",
"score": "0.6621415",
"text": "def isogram string\n x = 0 \n \n while x < string.length\n y = x + 1\n while y < string.length\n if string[x] == string[y]\n return false\n end\n y = y + 1\n end\n x = x + 1\n end\n \n true\nend",
"title": ""
},
{
"docid": "ad6f8e2b2aef0bb18c7c669deb3bbfb2",
"score": "0.66211987",
"text": "def duplicate_count(text)\n text.downcase.chars.sort.join.scan(/(\\w)\\1{1,}/).size\nend",
"title": ""
},
{
"docid": "6541c40fa85b784738c663655c97ffb1",
"score": "0.66137904",
"text": "def fourth_anagram?(str1, str2)\n char_count = Hash.new(0)\n str1.each_char do |el|\n char_count[el] += 1\n end\n str2.each_char do |el|\n if char_count[el] == 0\n return false\n else\n char_count[el] -= 1\n end\n end\n str1.length == str2.length\nend",
"title": ""
},
{
"docid": "26c067e9f03039c715dab5ae54f6acf6",
"score": "0.66114724",
"text": "def jewels_and_stones(j,s)\n\n if (s == nil || s.length < 1 || j == nil || j.length < 1)\n return 0\n end\n\n hash = Hash.new\n\n j.each_char do |char|\n hash[char] = 1\n end\n\n count = 0\n s.each_char do |char|\n if (hash[s[char]] == 1)\n count = count + 1\n end\n end\n return count\n\nend",
"title": ""
},
{
"docid": "13a302502e0b69f8e1018674bfd31327",
"score": "0.6607562",
"text": "def matching_characters(str)\n matching_letters = Hash.new([])\n unique_chars_count = 0\n str.each_char.with_index do |letter, idx|\n matching_letters[letter] += [idx] if str.count(letter) > 1\n end\n matching_letters.each do |letter, indices|\n current_count = str[indices.first + 1...indices.last].chars.uniq.size\n unique_chars_count = current_count if current_count > unique_chars_count\n end\n unique_chars_count\nend",
"title": ""
},
{
"docid": "f37a06473e6db6dbc4e44c506db1010b",
"score": "0.6604398",
"text": "def duplicate_count(text)\n arr = text.downcase.split(\"\")\n arr.uniq.count { |n| arr.count(n) > 1 }\nend",
"title": ""
},
{
"docid": "501cf1723e2a3fdc233d0ca12c83f96a",
"score": "0.6602162",
"text": "def fourth_anagram?(word_1, word_2) #O(n)\n count1 = Hash.new(0) \n word_1.each_char { |char| count1[char] += 1 }\n\n count2 = Hash.new(0) \n word_2.each_char { |char| count2[char] += 1 }\n\n count1 == count2\nend",
"title": ""
},
{
"docid": "e9f4131959de3354a7c5c48db9759735",
"score": "0.66016895",
"text": "def valid(str)\n direction = Hash.new(0)\n str.each_char do |ch|\n direction[ch] += 1\n end\n if (direction['n'] == direction['s'] && direction['e'] == direction['w'])\n print true\n else\n print false\n end\n\n\nend",
"title": ""
},
{
"docid": "93cc7c8c364ef56887b72893bcc4eddd",
"score": "0.65981233",
"text": "def g_happy(str)\n i = 0\n count = 0\n str.size.times do |letter|\n if str[letter] == \"g\"\n if str[letter] != str[i + 1]\n if str[letter] != str[i - 1]\n return false\n end\n end\n else\n count += 1\n end\n i += 1\n end\n if count == str.size\n return false\n else\n return true\n end\nend",
"title": ""
},
{
"docid": "93cc7c8c364ef56887b72893bcc4eddd",
"score": "0.65981233",
"text": "def g_happy(str)\n i = 0\n count = 0\n str.size.times do |letter|\n if str[letter] == \"g\"\n if str[letter] != str[i + 1]\n if str[letter] != str[i - 1]\n return false\n end\n end\n else\n count += 1\n end\n i += 1\n end\n if count == str.size\n return false\n else\n return true\n end\nend",
"title": ""
},
{
"docid": "b9dad90ec3c641f7069f92c939d36893",
"score": "0.6596242",
"text": "def costum_count(string, search_characters)\n # Return the number of total times that\n # the search characters are in the string\n count = 0\n string.each_char { |chr| count += 1 if search_characters.include?(chr) }\n count\nend",
"title": ""
},
{
"docid": "f3dc105ad39b048df18018e0fec423f7",
"score": "0.65955764",
"text": "def duplicate_count(text)\n i = 0\n newtext = text.downcase.each_char.to_a\n store = []\n\n while i < newtext.length\n char = newtext[i]\n pos = newtext.index(newtext[i])\n my_slice = newtext[(pos + 1)..(newtext.length - 1)]\n if my_slice.include?(char)\n store.push(char)\n end\n i += 1\n end\n return store.uniq.count\nend",
"title": ""
},
{
"docid": "07eaa1d6043fa77a4979ede0348da910",
"score": "0.6594797",
"text": "def fourth_anagram?(string1, string2)\n str1_hash = Hash.new(0)\n str2_hash = Hash.new(0)\n\n string1.chars.each do |char|\n str1_hash[char] += 1\n end\n string2.chars.each do |char|\n str2_hash[char] += 1\n end\n\n str1_hash == str2_hash\nend",
"title": ""
},
{
"docid": "077c2cbc50c9069a52a6acf15542468b",
"score": "0.65917426",
"text": "def is_anagram(s, t)\n s_count = Hash.new(0)\n t_count = Hash.new(0)\n \n s.each_char do |ch|\n s_count[ch] += 1\n end\n \n t.each_char do |ch|\n t_count[ch] += 1\n end\n \n t.each_char do |ch|\n return false if s_count[ch] != t_count[ch]\n end\n \n s.each_char do |ch|\n return false if s_count[ch] != t_count[ch]\n end\n \n true\nend",
"title": ""
},
{
"docid": "14029d25a22b7c653c38dd560aece5b4",
"score": "0.6591286",
"text": "def count_char(string, character)\n i = 0\n output = 0\n while i < string.length\n if character == string[i]\n output += 1\n end\n i += 1\n end\n return output\nend",
"title": ""
}
] |
80b425160aac95fed11d2613853e693f | make cell lists, each of which should contain unique numbers in a solved grid | [
{
"docid": "8a9197dab031e6ec86ff948ec9c63cf7",
"score": "0.630679",
"text": "def make_cell_lists\n @cellLists = []\n add_row_cell_lists\n add_column_cell_lists\n add_block_cell_lists\n end",
"title": ""
}
] | [
{
"docid": "add27b67f7785250a8089d3cade909e9",
"score": "0.73106915",
"text": "def unique_cells; end",
"title": ""
},
{
"docid": "30d2b6f185a5207327c5f519a60590da",
"score": "0.6954772",
"text": "def solution_grid\n\t\t\t\tArray.new(1) { Array.new(1) { Array.new(4) { Cell.new} } }\n\t\t\tend",
"title": ""
},
{
"docid": "bb68f99553df94accf35568d06ca1be1",
"score": "0.69380754",
"text": "def gen_grid(rows, columns)\n grid = []\n \n i = 1\n \n rows.times do \n row = []\n columns.times do \n row << i\n i += 1\n end\n grid << row\n end\n \n return grid\nend",
"title": ""
},
{
"docid": "1bde20ff1fafa95b3ac648d26c12d74d",
"score": "0.69087595",
"text": "def create_graph(num_grid)\r\n cell_grid = []\r\n\r\n num_grid.each_with_index do |row, y|\r\n cells = []\r\n # Create each cell and include coords\r\n row.each_with_index do |num, x|\r\n cell = Cell.new(num)\r\n cell.coords = [x, y]\r\n cells.push(cell)\r\n end\r\n cell_grid.push(cells)\r\n end\r\n\r\n # Put each cell's right and down neighbors\r\n cell_grid.each_with_index do |cell_row, y|\r\n cell_row.each_with_index do |cell, x|\r\n x != cell_row.length - 1 ? cell.right = cell_grid[y][x + 1] : nil\r\n y != cell_grid.length - 1 ? cell.down = cell_grid[y + 1][x] : nil\r\n end\r\n end\r\n # return the cell_grid\r\n cell_grid\r\nend",
"title": ""
},
{
"docid": "0d861d1073ab572dbd9944d50e80b467",
"score": "0.6862414",
"text": "def find_possible_cell_numbers(row, col, sodoku)\n possible_nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n\n used_nums = []\n used_nums << find_row_numbers(row, sodoku)\n used_nums << find_col_numbers(col, sodoku)\n used_nums << find_box_numbers(row, col, sodoku)\n used_nums.flatten!.uniq!\n\n used_nums.each { |num| possible_nums.include?(num) ? possible_nums.delete(num) : nil }\n\n return possible_nums\nend",
"title": ""
},
{
"docid": "75d4e3d4929f712346be796015310a47",
"score": "0.6811362",
"text": "def create_grid\n # array with all allowed columns\n cache = (1..7).map{|i| Array.new(3) {|j| i[j]}.reverse! }\n rowcounter = [0,0,0]\n\n # step through each colum, choosing a random valid column from cache\n # deletes all rows from cache that lead to invalid solutions\n 0.upto(8) do |column|\n $thegrid[column] = cache[ rand(cache.length) ].clone\n\n # number of values uses so far per row\n rowcounter = rowcounter.zip($thegrid[column]).map!{|i,j| i+j}\n\n # test constraints and delete invalid columns from later selection\n 0.upto(2) do |count|\n cache.delete_if {|x| x[count] == 1} if rowcounter[count] == 5\n cache.delete_if {|x| x[count] == 0} if 8 - column == 5 - rowcounter[count]\n end\n\n total = rowcounter.inject{|sum, n| sum + n}\n cache.delete_if {|x| total + x.inject{|sum, n| sum + n} > 8 + column }\n end\nend",
"title": ""
},
{
"docid": "4fcc3b186799a256e09845552aae9ac5",
"score": "0.6775887",
"text": "def grid(n, m)\n res = []\n inner = []\n\n (0...m).each { inner << nil }\n (0...n).each { res << inner.clone } \n\n res\nend",
"title": ""
},
{
"docid": "919881f1453879a979f2d93e35912529",
"score": "0.6669432",
"text": "def create_starting_grid()\n grid_values = []\n for a in 1..9\n for b in 1..9\n point_value = [a, b, \"S\"]\n grid_values << point_value \n end\n end\n return grid_values\n end",
"title": ""
},
{
"docid": "5f856246c557f61e278b3c29c62aeb4e",
"score": "0.66432744",
"text": "def grid_product\n\tinitial_grid = ['08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08',\n\t\t\t\t\t'49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00',\n\t \t\t\t\t'81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65',\n\t \t\t\t\t'52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91',\n\t \t\t\t\t'22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80',\n\t\t\t\t\t'24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50',\n\t\t\t\t\t'32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70',\n\t\t\t\t\t'67 26 20 68 02 62 12 20 95 63 94 39 63 08 40 91 66 49 94 21',\t\n\t\t\t\t\t'24 55 58 05 66 73 99 26 97 17 78 78 96 83 14 88 34 89 63 72',\n\t\t\t\t\t'21 36 23 09 75 00 76 44 20 45 35 14 00 61 33 97 34 31 33 95',\n\t\t\t\t\t'78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92',\t\n\t\t\t\t\t'16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57',\n\t\t\t\t\t'86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58',\n\t\t\t\t\t'19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40',\n\t\t\t\t\t'04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66',\n\t\t\t\t\t'88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69',\n\t\t\t\t\t'04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36',\n\t\t\t\t\t'20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16',\n\t\t\t\t\t'20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54',\n\t\t\t\t\t'01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48']\n\tnumber_grid = []\n\tinitial_grid.each do |num_string|\n\t\tnumber_grid.push(num_string.split(' '))\n\tend\n\n\tx = 0\n\ty = 0\n\tlast_largest_product = 0\n\n\twhile (x < number_grid.length)\n\t\ty = 0\n\t\twhile (y < number_grid[x].length)\n\t\t\tif (y <= (number_grid[x].length - 4))\n\t\t\t\thorizontal = [number_grid[x][y],\n\t\t\t\t\t\t \t number_grid[x][y + 1],\n\t\t\t\t\t\t \t number_grid[x][y + 2],\n\t\t\t\t\t\t number_grid[x][y + 3]]\n\t\t\t\tlast_largest_product = get_larger(get_product(horizontal), last_largest_product)\n\t\t\telse \n\t\t\t\thorizontal = []\n\t\t\tend\n\t\t\t\n\t\t\tif (x <= (number_grid.length - 4))\n\t\t\t\tvertical = [number_grid[x][y],\n\t\t\t\t\t\t \tnumber_grid[x + 1][y],\n\t\t\t\t\t\t \tnumber_grid[x + 2][y],\n\t\t\t\t\t\t number_grid[x + 3][y]]\n\t\t\t\tlast_largest_product = get_larger(get_product(vertical), last_largest_product)\n\t\t\telse\n\t\t\t\tvertical = []\n\t\t\tend\n\n\t\t\tif ((x >= 3) && (y <= (number_grid[x].length - 4)))\n\t\t\t\tdiag_up = [number_grid[x][y],\n\t\t\t\t\t\t number_grid[x-1][y+1],\n\t\t\t\t\t\t number_grid[x-2][y+2],\n\t\t\t\t\t\t number_grid[x-3][y+3]]\n\t\t\t\tlast_largest_product = get_larger(get_product(diag_up), last_largest_product)\n\t\t\telse\n\t\t\t\tdiag_up = []\n\t\t\tend\n\n\t\t\tif ((x <= (number_grid.length - 4)) && (y <= (number_grid[x].length - 4)))\n\t\t\t\tdiag_down = [number_grid[x][y],\n\t\t\t\t\t\t number_grid[x+1][y+1],\n\t\t\t\t\t\t number_grid[x+2][y+2],\n\t\t\t\t\t\t number_grid[x+3][y+3]]\n\t\t\t\tlast_largest_product = get_larger(get_product(diag_down), last_largest_product)\n\t\t\telse\n\t\t\t\tdiag_down = []\n\t\t\tend\n\n\t\t\ty +=1\n\t\tend\n\t\tx += 1\n\tend\n \treturn last_largest_product\nend",
"title": ""
},
{
"docid": "840fae376317a867c4fbc5aca3a3b561",
"score": "0.663259",
"text": "def generate_grid\n grid = []\n @y.times do\n row = []\n @x.times do\n row << Node.new(@id.resume)\n end\n grid << row\n end\n grid\n end",
"title": ""
},
{
"docid": "3aff123f290ef835e2f6dc8041df0766",
"score": "0.6625491",
"text": "def generate_cells!\n @grid = Array.new(@height) do |i|\n Array.new(@width) do |j|\n Cell.new(i-1, j-1)\n end\n end\n end",
"title": ""
},
{
"docid": "e952eb1d8f4863c6b1f83c6c6bd554d1",
"score": "0.6621671",
"text": "def gen_seat_grid()\n grid = []\n for i in (0..127)\n arr = [\"_\"] * 8\n grid.append(arr)\n end\n return grid\nend",
"title": ""
},
{
"docid": "2bdc992b03149e3de3ce737c89487965",
"score": "0.660324",
"text": "def scan_subgrids!(candidates, puzzle)\n=begin\n \n Sub-grid numbering scheme\n _ _ _ _ _ _ _ _ \n | | | |\n | 1 | 2 | 3 |\n |_ _ _|_ _ _|_ _ _|\n | | | |\n | 4 | 5 | 6 |\n |_ _ _|_ _ _|_ _ _| \n | | | |\n | 7 | 8 | 9 |\n |_ _ _|_ _ _|_ _ _|\n\n=end\n\n #define each subgrid\n subgrids = Array.new(9) {Array.new}\n\n (0..2).each do |row|\n (0..2).each{|col| subgrids[0] << puzzle[row][col]} #grid 1\n (3..5).each{|col| subgrids[1] << puzzle[row][col]} #grid 2\n (6..8).each{|col| subgrids[2] << puzzle[row][col]} #grid 3\n end\n\n (3..5).each do |row|\n (0..2).each{|col| subgrids[3] << puzzle[row][col]} #grid 4\n (3..5).each{|col| subgrids[4] << puzzle[row][col]} #grid 5\n (6..8).each{|col| subgrids[5] << puzzle[row][col]} #grid 6\n end\n\n (6..8).each do |row|\n (0..2).each{|col| subgrids[6] << puzzle[row][col]} #grid 7\n (3..5).each{|col| subgrids[7] << puzzle[row][col]} #grid 8\n (6..8).each{|col| subgrids[8] << puzzle[row][col]} #grid 9\n end\n\n #scan each sub-grid and delete values that aren't possible\n (0..8).each do |row|\n (0..8).each do |col|\n unless candidates[\"#{row},#{col}\"] == nil\n if row.between?(0,2) && col.between?(0,2) #grid 1\n candidates[\"#{row},#{col}\"].delete_if{|value| subgrids[0].include?(value)} \n elsif row.between?(0,2) && col.between?(3,5) #grid 2\n candidates[\"#{row},#{col}\"].delete_if{|value| subgrids[1].include?(value)}\n elsif row.between?(0,2) && col.between?(6,8) #grid 3\n candidates[\"#{row},#{col}\"].delete_if{|value| subgrids[2].include?(value)}\n elsif row.between?(3,5) && col.between?(0,2) #grid 4\n candidates[\"#{row},#{col}\"].delete_if{|value| subgrids[3].include?(value)}\n elsif row.between?(3,5) && col.between?(3,5) #grid 5\n candidates[\"#{row},#{col}\"].delete_if{|value| subgrids[4].include?(value)}\n elsif row.between?(3,5) && col.between?(6,8) #grid 6\n candidates[\"#{row},#{col}\"].delete_if{|value| subgrids[5].include?(value)}\n elsif row.between?(6,8) && col.between?(0,2) #grid 7\n candidates[\"#{row},#{col}\"].delete_if{|value| subgrids[6].include?(value)}\n elsif row.between?(6,8) && col.between?(3,5) #grid 8\n candidates[\"#{row},#{col}\"].delete_if{|value| subgrids[7].include?(value)}\n else #grid 9\n candidates[\"#{row},#{col}\"].delete_if{|value| subgrids[8].include?(value)}\n end\n end\n end\n end\n candidates\nend",
"title": ""
},
{
"docid": "d93ffc90049cef5d2e5ef60df078273e",
"score": "0.6603207",
"text": "def create_starting_grid()\n grid_values = []\n for a in 1..9\n for b in 1..9\n point_value = [a, b, \"S\"]\n grid_values << point_value \n end\n end\n return grid_values\nend",
"title": ""
},
{
"docid": "d93ffc90049cef5d2e5ef60df078273e",
"score": "0.6603207",
"text": "def create_starting_grid()\n grid_values = []\n for a in 1..9\n for b in 1..9\n point_value = [a, b, \"S\"]\n grid_values << point_value \n end\n end\n return grid_values\nend",
"title": ""
},
{
"docid": "1382a60807e4f6ed97af2f3bb235e9a7",
"score": "0.6562847",
"text": "def create_graph(grid)\r\n cell_grid = []\r\n grid.each do |row|\r\n cells = []\r\n row.each do |element|\r\n cell = Cell.new(element)\r\n cells.push(cell)\r\n end\r\n cell_grid.push(cells)\r\n end\r\n\r\n cell_grid.each_with_index do |cell_row, row|\r\n cell_row.each_with_index do |cell, col|\r\n row == 0 ? nil : cell.surroundings.push(cell_grid[row - 1][col])\r\n col == cell_row.size - 1 ? nil : cell.surroundings.push(cell_grid[row][col + 1])\r\n col == 0 ? nil : cell.surroundings.push(cell_grid[row][col - 1])\r\n row == cell_grid.size - 1 ? nil : cell.surroundings.push(cell_grid[row + 1][col])\r\n end\r\n end\r\n cell_grid\r\nend",
"title": ""
},
{
"docid": "0affac263a825f764107ac373209deef",
"score": "0.6546607",
"text": "def generation\n new_grid = Array.new(@grid_size)\n each_cell do |i,row,col|\n living_neighbors = 0\n if row > 0\n if col > 0\n living_neighbors += 1 if living?(row-1, col-1)\n living_neighbors += 1 if living?(row, col-1)\n if row < @rows\n living_neighbors += 1 if living?(row+1, col-1)\n end\n end\n living_neighbors += 1 if living?(row-1, col)\n if col < @cols\n living_neighbors += 1 if living?(row-1, col+1)\n living_neighbors += 1 if living?(row, col+1)\n if row < @rows\n living_neighbors += 1 if living?(row+1, col+1)\n end\n end\n end\n new_grid[i] = ((living_neighbors == 2 or living_neighbors == 3) ? true : false)\n end\n @cells = new_grid\n end",
"title": ""
},
{
"docid": "1059f67e576ac5a1eaf9a45986e3d678",
"score": "0.65384424",
"text": "def build_grid\n\t# create 300x300 grid\n\tgrid = Array.new(301) {Array.new(301, 0)}\n\n\t# loop through rows\n\t(1..300).each do | r |\n\t\t# loop through columns\n\t\t(1..300).each do | c |\n\t\t\t# get power level for every cell\n\t\t\tgrid[r][c] = cell_power_level(r, c)\n\t\tend\n\tend\n\n\tgrid\nend",
"title": ""
},
{
"docid": "ab7f81cd8667a109307ce646c1e24e83",
"score": "0.6526305",
"text": "def create_graph(grid)\n cell_grid = []\n grid.each do |row|\n cells = []\n row.each do |element|\n cell = Cell.new(element)\n cells.push(cell)\n end\n cell_grid.push(cells)\n end\n\n cell_grid.each_with_index do |cell_row, i|\n \n cell_row.each_with_index do |cell, j|\n i == 0 ? nil : cell.surroundings.push(cell_grid[i-1][j])\n j == 0 ? nil : cell.surroundings.push(cell_grid[i][j-1])\n i == cell_grid.size - 1 ? nil : cell.surroundings.push(cell_grid[i+1][j])\n j == cell_row.size - 1 ? nil : cell.surroundings.push(cell_grid[i][j+1])\n end\n\n end\n cell_grid\nend",
"title": ""
},
{
"docid": "79cfea6f79a7add67b2ee090afe2c411",
"score": "0.65183765",
"text": "def build_grid\n tiles = tile_stack.shuffle\n grid = Array.new(5) { Array.new(5) }\n grid.each_with_index do |row, jdx|\n row.each_with_index do |el, idx|\n case [idx, jdx]\n when [0, 0]\n when [0, 4]\n when [4, 0]\n when [4, 4]\n when [2, 2]\n when [0, 2]\n grid[jdx][idx] = Tile.new(:barracks, idx, jdx)\n when [4, 2]\n grid[jdx][idx] = Tile.new(:barracks, idx, jdx)\n else\n grid[jdx][idx] = Tile.new(tiles.pop, idx, jdx)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "09ca7347afff489169c3d5a47c8c59c6",
"score": "0.6515435",
"text": "def uniqueLocalCells(board, x, y, xblks, yblks)\n\t\tcells=Array.new();\n\n\n\t\t#collumn cells\n\t\tfor posY in 0...board[0].length()\n\t\t\tcellUniqueness=true;\n\t\t\tif cells.length()>0\n\t\t\t\tcells.each do |currentCell|\n\t\t\t\t\tif currentCell[:x]==x and currentCell[:y]==posY\n\t\t\t\t\t\tcellUniqueness=false;\n\t\t\t\t\t\t#break;\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tif cellUniqueness#add it if it is unique\n\t\t\t\tnewCellEntry=Array.new(1);\n\t\t\t\tif board[x][posY].is_a?(Array)\n\t\t\t\t\tnewCellEntry[0]={:x=>x, :y=>posY, :values=>board[x][posY].dup()};\n\t\t\t\telse\n\t\t\t\t\tnewCellEntry[0]={:x=>x, :y=>posY, :values=>board[x][posY]};\n\t\t\t\tend\n\t\t\t\tcells.concat(newCellEntry);\n\t\t\tend\n\t\tend\n\n\t\t#row cells\n\t\tfor posX in 0...board.length()\n\t\t\tcellUniqueness=true;\n\t\t\tif cells.length()>0\n\t\t\t\tcells.each do |currentCell|\n\t\t\t\t\tif currentCell[:x]==posX and currentCell[:y]==y\n\t\t\t\t\t\tcellUniqueness=false;\n\t\t\t\t\t\t#break;\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tif cellUniqueness#add it if it is unique\n\t\t\t\tnewCellEntry=Array.new(1);\n\t\t\t\tif board[posX][y].is_a?(Array)\n\t\t\t\t\tnewCellEntry[0]={:x=>posX, :y=>y, :values=>board[posX][y].dup()};\n\t\t\t\telse\n\t\t\t\t\tnewCellEntry[0]={:x=>posX, :y=>y, :values=>board[posX][y]};\n\t\t\t\tend\n\t\t\t\tcells.concat(newCellEntry);\n\t\t\tend\n\t\tend\n\n\n\n\n\n\t\t#block group cells\n\n\t\t#TODO: figure out size of block groups in general (square root of width and height?) and finish this section\n\t\tblockXsize=Math.sqrt(board.length());\n\t\tblockYsize=Math.sqrt(board[0].length()); # x = 3 y = 2 6\n\t\tblockXsize=(board.length()/xblks).floor(); #Xsize = 6/3 = 2\n\t\tblockYsize=(board[0].length()/yblks).floor();\t# 6/2 = 3\n\t\t#blockXsize = xblks\n\t\t#blockYsize = yblks\n\t\tblockXnumber=(x/blockXsize).floor();\n\t\tblockYnumber=(y/blockYsize).floor();\n\t\txStartingPos=(blockXnumber*blockXsize).floor();#index starts at 0\n\t\tyStartingPos=(blockYnumber*blockYsize).floor();\n\n\t\tfor posX in xStartingPos...(xStartingPos+blockXsize)\n\t\t\tfor posY in yStartingPos...(yStartingPos+blockYsize)\n\t\t\tcellUniqueness=true;\n\t\t\t\tif cells.length()>0\n\t\t\t\t\tcells.each do |currentCell|\n\t\t\t\t\t\tif currentCell[:x]==posX and currentCell[:y]==posY\n\t\t\t\t\t\t\tcellUniqueness=false;\n\t\t\t\t\t\t\t#break;\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif cellUniqueness#add it if it is unique\n\t\t\t\t\tnewCellEntry=Array.new();\n\t\t\t\t\tif board[posX][posY].is_a?(Array)\n\t\t\t\t\t\tnewCellEntry[0]={:x=>posX, :y=>posY, :values=>board[posX][posY].dup()};\n\t\t\t\t\telse\n\t\t\t\t\t\tnewCellEntry[0]={:x=>posX, :y=>posY, :values=>board[posX][posY]};\n\t\t\t\t\tend\n\t\t\t\t\tcells.concat(newCellEntry);\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn cells;\n\tend",
"title": ""
},
{
"docid": "e496856f4cc2a89aa6b074e8d6be758a",
"score": "0.6466506",
"text": "def guesses_grid\n\t\t\t\tArray.new(12) { Array.new(4) { Cell.new } }\n\t\t\tend",
"title": ""
},
{
"docid": "78f19f8796f3c0a6b86681c7cc6ee97c",
"score": "0.6446758",
"text": "def free_cells\r\n result = []\r\n @m.each_with_index do |c,row,col|\r\n next if c != :empty\r\n next if ship_around? row,col\r\n result << [row, col]\r\n end\r\n result\r\n end",
"title": ""
},
{
"docid": "21b0df87d4066db710a306386c75283f",
"score": "0.6441793",
"text": "def generate_grid\n GridModelContracts.pre_generate_grid(self)\n grid = []\n (0..@y).each { |y|\n row = []\n (0..@x).each { |x|\n row.push(0)\n }\n grid.push(row)\n }\n return grid\n end",
"title": ""
},
{
"docid": "c46e95013c822c6c03dbb776f5d06d4b",
"score": "0.64350766",
"text": "def generate_puzzle_grid(n, valid)\r\n used = []\r\n grid = Array.new(n) {|i| Array.new(n, 0)}\r\n inner_grids = Array.new(n) {|index| (1..n).to_a}\r\n rows = Array.new(n) {|index| (1..n).to_a}\r\n columns = Array.new(n) {|index| (1..n).to_a}\r\n divisor = Math.sqrt(n).to_i\r\n \r\n count = 0\r\n num_wanted = rand(10) + 25\r\n pos = nil\r\n while count < num_wanted\r\n y = rand(n)\r\n x = rand(n)\r\n while used.include?(Point.new(x, y))\r\n y = rand(n)\r\n x = rand(n)\r\n end\r\n used << Point.new(x, y)\r\n #would use sample, but JRuby doens't like it and won't run in 1.9 mode\r\n #val = rows[y] & columns[x] & inner_grids[x / divisor + divisor * (y / divisor)].sample\r\n pos = rows[y] & columns[x] & inner_grids[x / divisor + divisor * (y / divisor)]\r\n val = pos[rand(pos.size)]\r\n inner_grids[x / divisor + divisor * (y / divisor)].delete(val)\r\n rows[y].delete(val)\r\n columns[x].delete(val)\r\n grid[y][x] = val\r\n count += 1\r\n end\r\n \r\n #in ruby 1.8, clone isn't a deep copy, so we just clone ourselves.\r\n clone = []\r\n grid.each do |row|\r\n new_row = []\r\n row.each do |col|\r\n new_row << col\r\n end\r\n clone << new_row\r\n end\r\n \r\n if !solve(Puzzle.new(clone))\r\n grid = generate_puzzle_grid(n, valid)\r\n end\r\n return grid\r\nend",
"title": ""
},
{
"docid": "81c25d83ca877d6aec710b981340d5d3",
"score": "0.64276075",
"text": "def build_grid\n @coord_map.each do |x|\n @coord[x] = []\n @coord_map.each do |y|\n @coord[x][y] = \" \"\n end\n end\n end",
"title": ""
},
{
"docid": "cdebc626eef74e298a12eea0445471ae",
"score": "0.6415498",
"text": "def populate_array\n\t\t@filled_cells.each do |c|\n\t\t\tx = c[:x]\n\t\t\ty = c[:y]\n\t\t\t@puzzle_array[y][x] = 1\n\t\tend\n\tend",
"title": ""
},
{
"docid": "0b741d4bbf1a955d986fa82a383da136",
"score": "0.6409055",
"text": "def create_grid(z)\n\t\t\n\t\tmy_array =[]\n\t\tmy_grid = []\n\t\tfill = 1.to_s * z\n\t\t\n\t\t(0..z - 1).each do |y|\n\t\t\t\n\t\t\tmy_array[y] = fill\n\t\tend\n\t\t(0..z - 1).each do |x|\n\t\t\t\n\t\t\tmy_grid[x] = my_array[x].split(\"\")\n\t\tend\n\t\treturn my_grid\n\tend",
"title": ""
},
{
"docid": "d15f23839d05c5057b04c7b7a8f151e8",
"score": "0.6385216",
"text": "def create_grid(size)\r\n numbers = [*1..size**2]\r\n grid = Array.new(size) {Array.new(size)}\r\n\r\n 0.upto(size) do |j|\r\n (size-(j+1)).downto(j) do |i| \r\n \t grid [j][i] = numbers.pop\r\n end\r\n (j+1).upto(size-(j+1)) do |i| \r\n grid [i][j] = numbers.pop\r\n end\r\n\r\n (j+1).upto(size-(j+1)) do |i|\r\n grid[size-(j+1)][i] = numbers.pop\r\n end\r\n\r\n (size-(j+2)).downto(j+1) do |i|\r\n grid[i][size-(j+1)] = numbers.pop\r\n end\r\n end\r\n\r\n grid\r\nend",
"title": ""
},
{
"docid": "c960101e347a01126e6fb3031f2f28ec",
"score": "0.63795686",
"text": "def find_potential_cells\n cells_to_check = Array.new(@cells)\n @cells.each do |c|\n neighbors = cells_neighbors c\n neighbors.each do |n|\n cells_to_check << n\n end\n end\n cells_to_check.uniq\n end",
"title": ""
},
{
"docid": "3e7d5b767e798f2c46f40035c738ce56",
"score": "0.63757336",
"text": "def build_candidates(puzzle)\n candidates = {}\n (0..8).each do |row|\n (0..8).each do |col|\n candidates.merge!({\"#{row},#{col}\" => Array(1..9)})\n end\n end\n candidates.delete_if do |key,value|\n row, col = key.split(\",\").map(&:to_i)\n puzzle[row][col] != 0\n end\nend",
"title": ""
},
{
"docid": "e9adcdf91b64444cb2d191eb34064774",
"score": "0.63723767",
"text": "def problem11\n grid = [ [ 8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8 ],\n [ 49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0 ],\n [ 81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88, 30, 3, 49, 13, 36, 65 ],\n [ 52, 70, 95, 23, 4, 60, 11, 42, 69, 24, 68, 56, 1, 32, 56, 71, 37, 2, 36, 91 ],\n [ 22, 31, 16, 71, 51, 67, 63, 89, 41, 92, 36, 54, 22, 40, 40, 28, 66, 33, 13, 80 ],\n [ 24, 47, 32, 60, 99, 3, 45, 2, 44, 75, 33, 53, 78, 36, 84, 20, 35, 17, 12, 50 ],\n [ 32, 98, 81, 28, 64, 23, 67, 10, 26, 38, 40, 67, 59, 54, 70, 66, 18, 38, 64, 70 ],\n [ 67, 26, 20, 68, 2, 62, 12, 20, 95, 63, 94, 39, 63, 8, 40, 91, 66, 49, 94, 21 ],\n [ 24, 55, 58, 5, 66, 73, 99, 26, 97, 17, 78, 78, 96, 83, 14, 88, 34, 89, 63, 72 ],\n [ 21, 36, 23, 9, 75, 0, 76, 44, 20, 45, 35, 14, 0, 61, 33, 97, 34, 31, 33, 95 ],\n [ 78, 17, 53, 28, 22, 75, 31, 67, 15, 94, 3, 80, 4, 62, 16, 14, 9, 53, 56, 92 ],\n [ 16, 39, 5, 42, 96, 35, 31, 47, 55, 58, 88, 24, 0, 17, 54, 24, 36, 29, 85, 57 ],\n [ 86, 56, 0, 48, 35, 71, 89, 7, 5, 44, 44, 37, 44, 60, 21, 58, 51, 54, 17, 58 ],\n [ 19, 80, 81, 68, 5, 94, 47, 69, 28, 73, 92, 13, 86, 52, 17, 77, 4, 89, 55, 40 ],\n [ 4, 52, 8, 83, 97, 35, 99, 16, 7, 97, 57, 32, 16, 26, 26, 79, 33, 27, 98, 66 ],\n [ 88, 36, 68, 87, 57, 62, 20, 72, 3, 46, 33, 67, 46, 55, 12, 32, 63, 93, 53, 69 ],\n [ 4, 42, 16, 73, 38, 25, 39, 11, 24, 94, 72, 18, 8, 46, 29, 32, 40, 62, 76, 36 ],\n [ 20, 69, 36, 41, 72, 30, 23, 88, 34, 62, 99, 69, 82, 67, 59, 85, 74, 4, 36, 16 ],\n [ 20, 73, 35, 29, 78, 31, 90, 1, 74, 31, 49, 71, 48, 86, 81, 16, 23, 57, 5, 54 ],\n [ 1, 70, 54, 71, 83, 51, 54, 69, 16, 92, 33, 48, 61, 43, 52, 1, 89, 19, 67, 48 ] ]\n\n high = 0\n 0.upto(grid.count - 1) do |row|\n 0.upto(grid[row].count - 1) do |col|\n #right horizontal product\n product = grid[row][col].to_i * grid[row][(col + 1) % 20].to_i * grid[row][(col + 2) % 20].to_i * grid[row][(col + 3) % 20].to_i\n high = product if product > high\n\n #left horizontal product\n product = grid[row][col].to_i * grid[row][(col - 1) % 20].to_i * grid[row][(col - 2) % 20].to_i * grid[row][(col - 3) % 20].to_i\n high = product if product > high\n\n #lower vertical product\n product = grid[row][col].to_i * grid[(row + 1) % 20][col].to_i * grid[(row + 2) % 20][col].to_i * grid[(row + 3) % 20][col].to_i\n high = product if product > high\n\n #upper vertical product\n product = grid[row][col].to_i * grid[(row - 1) % 20][col].to_i * grid[(row - 2) % 20][col].to_i * grid[(row - 3) % 20][col].to_i\n high = product if product > high\n\n #lower right diagonal product\n product = grid[row][col].to_i * grid[(row + 1) % 20][(col + 1) % 20].to_i * grid[(row + 2) % 20][(col + 2) % 20].to_i * grid[(row + 3) % 20][(col + 3) % 20].to_i\n high = product if product > high\n\n #upper left diagonal\n product = grid[row][col].to_i * grid[(row - 1) % 20][(col - 1) % 20].to_i * grid[(row - 2) % 20][(col - 2) % 20].to_i * grid[(row - 3) % 20][(col - 3) % 20].to_i\n high = product if product > high\n\n #lower left diagonal\n product = grid[row][col].to_i * grid[(row + 1) % 20][(col - 1) % 20].to_i * grid[(row + 2) % 20][(col - 2) % 20].to_i * grid[(row + 3) % 20][(col - 3) % 20].to_i\n high = product if product > high\n\n #upper right diagonal\n product = grid[row][col].to_i * grid[(row - 1) % 20][(col + 1) % 20].to_i * grid[(row - 2) % 20][(col + 2) % 20].to_i * grid[(row - 3) % 20][(col + 3) % 20].to_i\n high = product if product > high\n end\n end\n \n high\nend",
"title": ""
},
{
"docid": "0bfeea6d965c59d10644f50223692e60",
"score": "0.6364828",
"text": "def make_grid \n \tslots = []\n \tfor h in 0...6 \n \t\tslots[h] = []\n \t for w in 0...7\n \t \tslots[h][w] = \"| \"\n \t end\n \tend\n \t@slots = slots\n end",
"title": ""
},
{
"docid": "f393ddd2a8fea43752223863e1c76731",
"score": "0.6349442",
"text": "def grid(n, m)\n arr = []\n n.times do |e1|\n innerarr = []\n m.times do |e2|\n innerarr.push(nil)\n end\n arr.push(innerarr)\n end\n arr\nend",
"title": ""
},
{
"docid": "a3f16d214faaacc4a2c29239778f356a",
"score": "0.6339011",
"text": "def put_numbers\n (0..9).each do |row|\n (0..9).each do |column|\n tile = tile_array[row][column]\n if tile.has_mine != true\n index = (row.to_s + column.to_s).to_i\n\t \n n = index-10\n s = index+10\n w = index-1\n e = index+1\n ne = index-9\n sw = index+9\n nw = index-11\n se = index+11\n\n if row == 0 && column == 0\n neighbors = [e,se,s]\n elsif row == 0 && column == 9\n neighbors = [w,sw,s]\n elsif row == 9 && column == 0\n neighbors = [n,ne,e]\n elsif row == 9 && column == 9\n neighbors = [w,nw,n]\n elsif row == 0 && (1..8) === column \n neighbors = [w,sw,s,se,e]\n elsif row == 9 && (1..8) === column\n neighbors = [w,nw,n,ne,e]\n elsif (1..8) === row && column == 0\n neighbors = [n,ne,e,se,s]\n elsif (1..8) === row && column == 9\n neighbors = [w,nw,n,sw,s]\n else\n neighbors = [n,ne,e,se,s,sw,w,nw]\n end\n\n if count_neighboring_mines(neighbors) == 0\n tile.hidden_symbol = \" \"\n else\n num_neighboring_mines = count_neighboring_mines(neighbors).to_s\n tile.hidden_symbol = num_neighboring_mines\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "4020adcf7fa79376ffefb73397ec3ee7",
"score": "0.6330596",
"text": "def build_grid\n @board.grid.map.with_index do |row, i|\n build_row(row, i)\n end\n end",
"title": ""
},
{
"docid": "a97db3d48f71f7a6c229184eef70ece1",
"score": "0.63222885",
"text": "def possible_numbers_for_cell(i,j)\n return [] if @board[j][i] != '-'\n possible_numbers = []\n (1..9).each do |x|\n num = x.to_s\n subsquare = is_possible_in_subsquare(i,j,num)\n row = is_possible_in_row(i,j,num)\n column = is_possible_in_column(i,j,num)\n possible_numbers << x if subsquare && row && column\n end\n possible_numbers\n end",
"title": ""
},
{
"docid": "d5a49bdd8fe7769408f7c316ca890ea2",
"score": "0.63117886",
"text": "def grid\n rows = []\n columns = []\n cells = []\n # @grid = Array.new(row){Array.new(column) } -removed to implement a clearer way to define cell from rows and columns\n @grid = Array.new(rows) do |row|\n Array.new(columns) do |column|\n #Create the 2 arrays. After we create an array of columns, we create a cell passing in a column and row. The cell is a product of row and column.\n cell = Cell.new(column, row)\n #We will need to be able to shovel a cell into an array of cells in the game.\n cells << cell\n cell\n end\n end\n end",
"title": ""
},
{
"docid": "4b61f2a94d6eefac32d6cb5989852493",
"score": "0.6309478",
"text": "def convert_grid(cellGrid)\n\n\t\tgrid = Array.new(@lines.size()) do\n\t\t\tArray.new(@clns.size()) do\n\t\t\t\t0\n\t\t\tend\n\t\tend\n\t\t(0...@lines.size()).each do |i|\n\t\t\t(0...@clns.size()).each do |j|\n\t\t\t\tgrid[i][j]=1 if cellGrid.cellPosition(i, j).state==Cell::CELL_BLACK\n\t\t\t\tgrid[i][j]=0 if cellGrid.cellPosition(i, j).state==Cell::CELL_WHITE\n\t\t\t\tgrid[i][j]=-1 if cellGrid.cellPosition(i, j).state==Cell::CELL_CROSSED\n\t\t\tend\n\t\tend\n\t\treturn grid\n\tend",
"title": ""
},
{
"docid": "9a7040e205600b0b9108f4b40dcf953d",
"score": "0.63090557",
"text": "def cells\n @cells ||= []\n if @cells.empty?\n (0..n_y-1).each do |j|\n (0..n_x-1).each do |i|\n @cells << pdf.grid(j,i)\n end\n end\n end\n @cells\n end",
"title": ""
},
{
"docid": "f8ecc5748d61a8645ac9f90666b7b01e",
"score": "0.6281871",
"text": "def grid\n @cells.each_slice(5).to_a\n end",
"title": ""
},
{
"docid": "00b0728837c55cb7b5f47bc7f1821978",
"score": "0.6281846",
"text": "def subgrids()\n sz.times.reduce([]) do |ac, i; ri, ci|\n ri = (i / s_sz) * s_sz\n ci = (i * s_sz) % sz\n ac.append((ri ... ri + s_sz).reduce([]) do |acc, j|\n acc.append(g[j][ci ... ci + s_sz])\n end)\n end\n end",
"title": ""
},
{
"docid": "9242695d6caf6967095efd18631ab4a4",
"score": "0.6262663",
"text": "def build_new_grid\n Array.new(20) { Array.new(25) { '▢' } }\n end",
"title": ""
},
{
"docid": "d0779b1eab850527ece9a3187eb8cca1",
"score": "0.6258939",
"text": "def ajusta_grid(lista, qtd_col)\n grid = []\n grid_line = []\n count = 0\n\n lista.each do |item|\n # monta a grid_line\n if count < qtd_col\n grid_line << item\n count += 1\n end\n\n # Armazena grid_line em grid\n if count == qtd_col\n grid << grid_line.map(&:clone)\n grid_line = []\n count = 0\n end\n end\n\n grid << grid_line.map(&:clone) if grid_line.size\n end",
"title": ""
},
{
"docid": "e43ccaa559311d6932784ec2942f495c",
"score": "0.6257888",
"text": "def hidden_ships_grid\n newGrid = Array.new(@n){Array.new(@n)}\n\n @grid.each_with_index do |subArr, idx1|\n subArr.each_with_index do |ele, idx2|\n if ele == :S \n newGrid[idx1][idx2] = :-\n else\n newGrid[idx1][idx2] = ele\n end\n end\n end\n\n return newGrid\n end",
"title": ""
},
{
"docid": "0d4c50d777cdf6ed07a42e64b9387a2e",
"score": "0.6257657",
"text": "def cells\n positions = []\n width.times do |i| # 0 -> 5\n height.times do |j| # 0 -> 4\n positions << [\n top_pad + j,\n left_pad + i,\n ]\n end\n end\n positions\n end",
"title": ""
},
{
"docid": "0acbcf5821b27ffb57666c52a33f8b32",
"score": "0.62523025",
"text": "def add_row_cell_lists\n (0..8).each do |row_index| \n cellList = SudokuCellList.new\n (0..8).each do |column_index|\n cellList << cell_at_pos(row_index,column_index)\n end\n @cellLists << cellList\n end\n end",
"title": ""
},
{
"docid": "2c6b9927d6036a69a3cd82b8f8b2df81",
"score": "0.62301326",
"text": "def fill_number(grids)\n grids.each_with_index do |rows, r|\n rows.each_with_index do |grid, c|\n pos = [r, c]\n self[pos] = surrouding_bomb(pos) if grid == \" \" && surrouding_bomb(pos) != 0\n end\n end\n end",
"title": ""
},
{
"docid": "971363a1f6ac763fca815d5605aecb5c",
"score": "0.62282115",
"text": "def generate_flagged_grid(map_grid)\n flagged_grid = []\n map_grid.each_with_index do |row, y|\n temp = []\n row.each_with_index do |cell, x|\n cell.nil? ? temp << Node.new(1,[x,y],[@end_x, @end_y]) : temp << Node.new(0,[x,y],[@end_x, @end_y])\n end\n flagged_grid << temp\n end\n flagged_grid\n end",
"title": ""
},
{
"docid": "d85916257ea42db817d4d21f896305aa",
"score": "0.6225307",
"text": "def figure_out_cell_numbers\n @board.each do |row|\n row.each do |cell|\n cell.calculate_neighboring_mines(@board, @size)\n end\n end\n\n end",
"title": ""
},
{
"docid": "0e755c08f014feb1bc75f382ee429357",
"score": "0.6213148",
"text": "def generate_cell_data(grid_width, grid_height)\n\t@cells_arr = []\n\t\tletter = \"a\"\n grid_width.times do \t\t\n number = 1 \t\t\n grid_height.times do \t\n @cells_arr.push(instance_variable_set(\"@\" + letter + number.to_s, [\n letter + number.to_s,\" \"]))\n number = number.next\n end\n letter = letter.next\n end\t\t\n\tend",
"title": ""
},
{
"docid": "0a53718a4b5a8c4aba4984f8fef57926",
"score": "0.6194391",
"text": "def uniq_cols\n uniq_ints = (1..9).to_a \n (0..8).each do |col|\n cols = []\n (0..8).each do |row|\n cols << @grid[row][col].value \n end \n return false if cols.sum != 45\n return false if (cols.sort == uniq_ints) == false\n end\n \n return true \n end",
"title": ""
},
{
"docid": "2a9d0c5ce69133d5273d5fac844bb0a5",
"score": "0.6189644",
"text": "def possibility_array_gen\n @board.each do |mini|\n mini.each do |minirow|\n minirow.map do |cell|\n if cell.include?(\"-\")\n cell.replace([1,2,3,4,5,6,7,8,9])\n elsif cell[0].is_a? String\n cell[0] = cell[0].to_i\n end\n end\n end\n end\n @board\n # @board.each { |mini| p mini }\n end",
"title": ""
},
{
"docid": "6b2635fe5f8eae7b320f77ce35d31a80",
"score": "0.61854583",
"text": "def gen_tiles\n @grid.each_with_index do |row, row_id|\n row.each_with_index do |tile, col_id|\n value = count_bombs([row_id, col_id])\n @grid[row_id][col_id] = Tile.new(false, value) if !tile\n end\n end\n end",
"title": ""
},
{
"docid": "3c6ff870ea18471a8de4567c2c513605",
"score": "0.6177311",
"text": "def create_number_sets\n horizontal_ary = Array.new\n five_ary = Array.new\n @@ranges. each do |range|\n five_uniq_values = false\n while !five_uniq_values\n 5.times {five_ary << rand(range) }\n five_ary.uniq!\n if five_ary.length == 5\n horizontal_ary << five_ary\n five_uniq_values = true\n end\n five_ary = []\n end\n end\n horizontal_ary\n end",
"title": ""
},
{
"docid": "c9747062f004351638068c20a950d8d2",
"score": "0.616595",
"text": "def problem_96\n # convert an array of 81 numbers into an array of 81 arrays with\n # nil or 1-9 in each slot\n def import(su)\n h = Array.new(9) { |i| Array.new }\n v = Array.new(9) { |i| Array.new }\n s = Array.new(9) { |i| Array.new }\n ret = su.map { |i| (i == 0) ? [nil] : [i] }\n nines = Array.new(81)\n ret.each_with_index do |obj,i|\n x,y = i % 9, i / 9\n n = x / 3 + (y/3*3)\n #puts obj.inspect\n h[y] << obj\n v[x] << obj\n s[n] << obj\n #puts h[y].inspect\n #puts \"#{h[0].inspect} #{v[0].inspect} #{s[0].inspect}\"\n nines[i] = [h[y],v[x],s[n]]\n end\n [ret,nines]\n end\n\n def solve(grid,nines)\n # What values are possible in the passed 'nines' entry\n numbers = (1..9).to_a\n possible = lambda do |n|\n numbers - (n[0] + n[1] + n[2]).flatten\n end\n\n loop do\n empty = []\n grid.each_with_index do |g,i|\n empty << [i, g ,possible.call(nines[i])] if g[0] == nil\n end\n return grid if empty.length == 0\n\n # unable to solve?\n return false if empty.index {|e| e[2].length == 0}\n\n j = empty.select {|e| e[2].length == 1}\n if j.length >= 1\n j.each do |i,g,pos|\n # Make sure the last setting did not make the problem unsolvable\n return false if possible.call(nines[i]) != pos\n # Set the grid array value to the solutuon\n g[0] = pos[0]\n end\n else\n # Unable to solve right now, we need to recurse\n m = empty.min {|a,b| a[2].length <=> b[2].length }\n # We try each possible solution for the smallest set of guesses\n #puts \"try each of #{m[2].inspect}\"\n save = grid.map { |v| v[0] || 0 }\n m[2].each do |try|\n save[m[0]] = try\n #puts \"try #{try} at (#{m[0]%9},#{m[0]/9})\"\n ret = solve(*import(save))\n return ret if ret\n end\n return false\n end\n end\n end\n\n # Set to false to try sudokus that only have 17 initial entries\n # but can all be solved by logic. It takes 4m42s\n if true \n # first entry is nul\n data = open(\"sudoku.txt\").read.split(/Grid \\d*/)\n data.shift\n sudokus = data.map do |a|\n import(a.gsub(/\\D+/,\"\").split(//).map(&:to_i))\n end\n else\n sudokus = []\n data = open(\"sudoku17.txt\").each do |line|\n sudokus << import(line.chomp.split(//).map(&:to_i))\n end\n end\n\n puts \"start\"\n\n sudoku_number = 1\n sum = 0\n sudokus.each do |grid,nines|\n if ret = solve(grid,nines)\n n = ret[0][0] * 100 + ret[1][0] * 10 + ret[2][0]\n puts \"SOLVED #{sudoku_number} => #{n}\"\n sum += n\n else\n puts \"UNABLE TO SOLVE #{sudoku_number}\"\n end\n sudoku_number += 1\n end\n sum\nend",
"title": ""
},
{
"docid": "2404f195c85a68bd9c6508e8e52d7672",
"score": "0.61651516",
"text": "def populateCandidates()\n\t\t@grid.each do |index|\n\t\t\tindex.candidates.clear\n\t\t\tif (index.value == 0)\n\t\t\t\t(1..9).each do |num|\n\t\t\t\t\tif (isValid(num, index))\n\t\t\t\t\t\tindex.candidates.push(num)\n\t\t\t\t\tend\t\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "3ab4bb9540dfd407489de3c1bb1fd584",
"score": "0.6158645",
"text": "def populate_board\n mines = Set.new\n\n until mines.length == @mines_num\n row = (0...@row_num).to_a.sample\n col = (0...@col_num).to_a.sample\n mines.add([row, col])\n end\n\n # updates each neighbor of a mine\n mines.each do |mine|\n self[mine] = Tile.new(\"mine\")\n neighbors(mine).each { |neighbor| increment_val(neighbor) }\n end\n end",
"title": ""
},
{
"docid": "2c3dd91fbd96510c282d144f2489ee1a",
"score": "0.6148313",
"text": "def create_grid\n for row in 0..@num #Iterating over the row\n for col in 0..@num #Iterating over the column\n val = fetch_char \t #assigning character\n @counter += 1 \n @arr[row][col] = val\n print_grid(val, col)\n end \n end\n end",
"title": ""
},
{
"docid": "7d7c913f0f8fa3d601700d20a97f78cc",
"score": "0.6139431",
"text": "def candidates\n possible_candidates = []\n @neighbour_cells.flatten.each{ |cell|\n possible_candidates << cell.value \n }\n existing_candidates = (1..9).to_a - possible_candidates.uniq\n end",
"title": ""
},
{
"docid": "3f5ced1c6d1d089f7110e62afa714234",
"score": "0.6132968",
"text": "def fill_grid\n $thegrid.each_with_index do |line, i|\n start = (i==0) ? 1 : i*10\n stop = (i==8) ? 90 : ((i+1)*10 - 1)\n count = line.inject {|sum, n| sum + n }\n\n line.each_with_index do |n, j|\n if n > 0 then\n $thegrid[i][j] = rand(stop - start - count + 2) + start\n start = $thegrid[i][j] + 1 #increasing numbers\n count -= 1\n end\n end\n end\nend",
"title": ""
},
{
"docid": "5da2af05f3437df1f79d6653638d9524",
"score": "0.6120977",
"text": "def add_block_cell_lists\n (0..8).each do |block_index| \n cellList = SudokuCellList.new\n [0,1,2].each do |row_index|\n [0,1,2].each do |column_index|\n row = (block_index / 3) * 3 + row_index\n column = (block_index % 3) * 3 + column_index\n cellList << cell_at_pos(row,column) \n end\n end\n @cellLists << cellList\n end\n end",
"title": ""
},
{
"docid": "8c4d22b664357025a63e8e66b5baec51",
"score": "0.61209553",
"text": "def fill_dummy_mine\n return @mine.map{|row| ['x'] * row.size}\n end",
"title": ""
},
{
"docid": "93e66f29f3f386fdd933a0b3c738056b",
"score": "0.6109696",
"text": "def build_grid_and_claims(input, x_coordinates, y_coordinates, grid) \n for j in (x_coordinates.min..x_coordinates.max)\n for k in (y_coordinates.min..y_coordinates.max)\n # distance calculated easily because Manhattan distance\n # use i and input transposed to calc distances from every \n distances = []\n for i in (0...x_coordinates.length)\n distances << (x_coordinates[i]-j).abs + (y_coordinates[i]-k).abs\n end\n # arr.find_index(distance.min) == arr.rindex(distance.min) checks if one min dist\n # set grid entry : grid[[x, y]] = [origin_x, origin_y] || \" . \"\n if distances.find_index(distances.min) == distances.rindex(distances.min)\n grid[[j, k]] = input[distances.find_index(distances.min)].dup\n else\n grid[[j, k]] = \" . \"\n end\n end\n end\n # puts \"\\ngrid\\n\"\n # grid.each { |coord, claim| puts \"#{coord} claimed by #{claim}\" }\n puts \"\\ngrid length\"; print grid.length\nend",
"title": ""
},
{
"docid": "edfb8b8cdc9ef89f71380d7e92517bee",
"score": "0.6102978",
"text": "def livings_cell\n (0..@number_cells).each do\n @board[rand(@board_size - 1)][rand(@board_size - 1)] = 1\n end\n # @board[1][1] = 1\n # @board[1][2] = 1\n # @board[2][1] = 1\n # @board[2][3] = 1\n # @board[3][2] = 1\n end",
"title": ""
},
{
"docid": "a8bf236b3f3517e17fe9833b8d2eb2c8",
"score": "0.60987836",
"text": "def generate_grids\n return if @all_patterns.size > 0\n\n # all 9 bit patterns which have 5 bits set\n patts = []\n (0..4).each do |b1|\n (b1+1..5).each do |b2|\n (b2+1..6).each do |b3|\n (b3+1..7).each do |b4|\n (b4+1..8).each do |b5|\n patts << ((1<<b1)|(1<<b2)|(1<<b3)|(1<<b4)|(1<<b5))\n end\n end\n end\n end\n end\n raise \"Sanity error\" if patts.size != 126\n\n # try all combinations of three row patterns\n patts.each do |p1|\n patts.each do |p2|\n pp = p1 | p2\n patts.each do |p3|\n next unless pp | p3 == 0x1ff\n p = ((p1 << 18) | (p2 << 9) | p3)\n @all_patterns << p\n\n # Now index this pattern by category\n cat = p1.to_s(2).to_i(32) +\n p2.to_s(2).to_i(32) +\n p3.to_s(2).to_i(32)\n @cats[cat] ||= []\n @cats[cat] << p\n end\n end\n end\n end",
"title": ""
},
{
"docid": "7e2eb48be478e9104ee824320200f2bb",
"score": "0.6090262",
"text": "def board_regions(board)\n checkable = []\n columns = []\n 9.times {|x| columns << []}\n board.each do |row| \n checkable << row\n 9.times do |column_element|\n columns[column_element] << row[column_element]\n end\n end\n columns.each {|column| checkable << column}\n 3.times do |x|\n 3.times do |y|\n checkable << board[3 * x][(3*y)..(3 * y + 2)] + board[3 * x + 1][(3*y)..(3 * y + 2)] + board[3 * x + 2][(3*y)..(3 * y + 2)]\n end\n end\n p checkable\nend",
"title": ""
},
{
"docid": "60850d0ea24d49635a55dcb4dd575e35",
"score": "0.60819554",
"text": "def resolve_cells\n orig_uniq_str = unique_str\n cells.each do |cell|\n resolve_cell(cell)\n end\n orig_uniq_str != unique_str\n end",
"title": ""
},
{
"docid": "8d85f4f46ecd6ec952f6a809735f15b8",
"score": "0.60764146",
"text": "def new_grid\n indices = (0...81).to_a\n bomb_positions = indices.sample(10)\n\n i = -1\n bomb_count = 0\n\n Array.new(9) do\n Array.new(9) do\n i += 1\n if bomb_count < 10 && bomb_positions.include?(i)\n bomb_count += 1\n Tile.new(self, true)\n else\n Tile.new(self, false)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "480318781a0c0fba26e94551ecb8ec59",
"score": "0.60747814",
"text": "def cell_possibilities(index, board_array)\n cell_location_index_array= cell_location(index, board_array)\n solved_cell_index_array = cell_location_index_array.keep_if {|i| board_array[i] != \"-\"}\n\n solved_cell_values_array = []\n solved_cell_index_array.each do |i|\n solved_cell_values_array.push(board_array[i])\n end\n\n options = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n solved_cell_values_array.each do |value|\n options.delete_if{|number| number==value}\n end\n options\n end",
"title": ""
},
{
"docid": "3d7f64846ca0438952fd1dd1850a95f0",
"score": "0.60721",
"text": "def valid_sudoku(table)\n # assume that the input must always be 9x9 table\n subgrid_hash = {}\n \n 9.times do |i|\n rows_hash = {}\n columns_hash = {}\n \n 9.times do |j|\n row_value = table[i][j]\n column_value = table[j][i]\n \n if row_value != \".\"\n return false if rows_hash[row_value]\n rows_hash[row_value] = 1\n \n # we could have checked subgrid using either row or column values\n # doesn't matter as long as we're consistent\n # subgrid is indexed as an array of i/3 and j/3 values or [i/3, j/3]\n \n # does your subgrid currently exist\n if subgrid_hash[[i/3, j/3]]\n return false if subgrid_hash[[i/3, j/3]][row_value]\n subgrid_hash[[i/3, j/3]][row_value] = 1\n else\n # if your subgrid does not exist, create it\n subgrid_hash[[i/3, j/3]]= {}\n # then place the actual 1-9 value inside and set the frequency as 1\n subgrid_hash[[i/3, j/3]][row_value] = 1\n end\n end\n \n if column_value != \".\"\n return false if columns_hash[column_value]\n columns_hash[column_value] = 1\n end\n end\n end\n \n return true\nend",
"title": ""
},
{
"docid": "55f6cb6b2db66a3bd9aa8f5e703167ba",
"score": "0.60667527",
"text": "def createNumbers(cells, solution, lineOffset, columnOffset, isHorizontal)\n\n\t\tisHorizontal ? offset = lineOffset : offset = columnOffset\n\t\ti = 0\n\t\tsolution.each do |n|\n\t\t\tj = 0\n\t\t\tn = n.reverse.fill(n.size..offset - 1){ nil }\n\t\t\tn.reverse.each do |m|\n\t\t\t\taddNumber(m, isHorizontal, lineOffset, columnOffset, i, j, cells)\n\t\t\t\tj+= 1\n\t\t\tend\n\t\t\ti+= 1\n\t\tend\n\n\t\treturn self\n\tend",
"title": ""
},
{
"docid": "c2effc0a2c576a6110541e9f96580162",
"score": "0.6064684",
"text": "def cell_possibilities row, col\n # Set subtraction FOOOO! It reeks elegance.\n return (AllDigits - (row_digits(row) + col_digits(col) + square_digits(row, col)))\n end",
"title": ""
},
{
"docid": "3b697962804693289093639192125a03",
"score": "0.6063428",
"text": "def grid(serial_number, size = 300)\n (1..size).map do |y|\n (1..size).map do |x|\n power_level(serial_number, [x, y])\n end\n end\nend",
"title": ""
},
{
"docid": "3ec341bf5bd43bf1c4d28377272c9ce1",
"score": "0.6062378",
"text": "def populate\n (0..9).each do |row|\n (0..9).each do |column|\n add_tile(row, column)\n end\n end\t\n end",
"title": ""
},
{
"docid": "0323d4cb6655edbfe79a47be9cc77580",
"score": "0.60609305",
"text": "def candidates grid\n\t\t# grid = get_grid_from grid_object\n\t\tneighbours_values = get_values_of_neighbours_from grid\n\t\t(1..9).to_a - neighbours_values\n\tend",
"title": ""
},
{
"docid": "78355f3465413a3e70c520adc08941e9",
"score": "0.6055704",
"text": "def uniq_rows\n uniq_ints = (1..9).to_a\n @grid.each do |subArr| \n rows = []\n subArr.each do |tiles|\n rows << tiles.value\n end\n return false if rows.sum != 45\n return false if (rows.sort == uniq_ints) == false\n end \n \n return true \n end",
"title": ""
},
{
"docid": "024cfd09067a74e58bdfbf6520dedde6",
"score": "0.6052148",
"text": "def assign_hashes_to_board\n 4.times.with_index do |index|\n @rows << { 'A' + (index + 1).to_s => Space.new }\n @rows << { 'B' + (index + 1).to_s => Space.new }\n @rows << { 'C' + (index + 1).to_s => Space.new }\n @rows << { 'D' + (index + 1).to_s => Space.new }\n end\n @rows\n end",
"title": ""
},
{
"docid": "66e6543c5a8ec52a576d26e58d820858",
"score": "0.6049211",
"text": "def make_grid\n @grid = [] \n @first_stops = Set.new\n @trip_order.each.with_index do |trip_id, col|\n stoppings = @trips[trip_id].sort_by {|stopping| stopping[:stop_sequence]} # x[1] is values\n next_grid_row = 0\n stoppings.each_with_index do |stopping, i|\n stop_id = stopping[:stop_id]\n # method in lib/time_formatter.rb\n time = format_and_flag_time stopping[:arrival_time]\n add_next_arrival(stop_id, stopping[:arrival_time], stopping[:trip_id])\n pos = stopping[:stop_sequence]\n if i == 0 && !@first_stops.include?( stopping[:stop_name] )\n @first_stops << stopping[:stop_name]\n end\n stop_row = @grid.detect {|x| x.is_a?(Hash) && x[:stop][:stop_id] == stop_id}\n if stop_row\n stop_row[:times][col] = time\n next_grid_row = @grid.index(stop_row) + 1\n else\n values = Array.new(@trips.size)\n values[col] = time\n stop_data = {\n stop_id: stop_id,\n name: stopping[:stop_name]\n }\n stop_row = {:stop => stop_data, :times => values}\n @grid.insert(next_grid_row, stop_row)\n next_grid_row += 1\n end\n end\n end\n end",
"title": ""
},
{
"docid": "77a30f5622e15c5f60133ae261ae82a1",
"score": "0.60338104",
"text": "def uniq_sq()\n uniq_ints = (1..9).to_a \n (0..8).each do |i|\n x = (i / 3) * 3\n y = (i % 3) * 3\n sq = []\n (x...x + 3).each do |row|\n (y...y + 3).each do |col|\n sq << @grid[row][col].value\n end\n end\n return false if sq.sum != 45\n return false if (sq.sort == uniq_ints) == false\n end\n\n return true \n end",
"title": ""
},
{
"docid": "d76f1eb8cfece3c51527b6d1317372e9",
"score": "0.60305065",
"text": "def randomize\n @cells = []\n 0.upto(width) do\n @cells << Array.new(3) { rand(256) }\n end\n end",
"title": ""
},
{
"docid": "1cf4d708f6cc93dd54ce67d9233c0ba6",
"score": "0.6028955",
"text": "def make_map_grid\n\t\tgrid = [nil] * 64\n\t\tlocations.each do |l|\n\t\t\tgrid[8 * l.posx + l.posy] = l\n\t\tend\n\t\tgrid\n\tend",
"title": ""
},
{
"docid": "04446e3172e7483a4d486c0dec5e9d8a",
"score": "0.6027408",
"text": "def build_game_cells\n ARRAY_SIZE.times do |row|\n ARRAY_SIZE.times do |column|\n self.cells.create(row: row, column: column)\n end\n end\n end",
"title": ""
},
{
"docid": "1766b5debc13e8f094df87195bc69da8",
"score": "0.60166556",
"text": "def valid_numbers(r,c, board)\n numbers = Set.new((1..board.length).to_a)\n\n #Check Row\n (0..board[0].length - 1).each do |col|\n if board[r][col] != 0\n numbers.delete board[r][col]\n end\n end\n\n #Check Column\n if !numbers.empty?\n (0..board.length - 1).each do |row|\n if board[row][c] != 0\n numbers.delete board[row][c]\n end\n end\n end\n\n #Check Grid\n if !numbers.empty?\n region_size = Math.sqrt(board.length).to_i\n\n r_multiplier = (r / 3)\n c_multiplier = (c / 3)\n (0...region_size).each do |row|\n (0...region_size).each do |col|\n if board[row + (r_multiplier * region_size) ][col + (c_multiplier * region_size)] != 0\n numbers.delete board[row + (r_multiplier * region_size) ][col + (c_multiplier * region_size)]\n end\n end\n end\n\n end\n\n numbers.to_a\nend",
"title": ""
},
{
"docid": "b291bdeb3f0e76e65b24cb08f1357821",
"score": "0.601609",
"text": "def incomig_cells(i,j)\n s = []\n if not @removed.include?([ [i, j-1], [i,j] ])\n insert = [ [i, j-1], @costs[i][j-1] +\n @operation_cost.call(:insert, @costs.row_labels[i]) ]\n s << insert\n end\n if not @removed.include?([ [i-1,j], [i,j] ])\n delete = [ [i-1, j], @costs[i-1][j] +\n @operation_cost.call(:delete, @costs.col_labels[i]) ]\n s << delete\n end\n if not @removed.include?([ [i-1, j-1], [i,j] ])\n substitute = [ [i-1, j-1], @costs[i-1][j-1] +\n @operation_cost.call(:substitute,\n [@costs.col_labels[i-1],\n @costs.row_labels[j-1]]) ]\n s << substitute\n end\n s\n end",
"title": ""
},
{
"docid": "8604caa755061c30ccabe1a8fe45ced2",
"score": "0.60102725",
"text": "def create_table \n @grid = []\n @k_capacity.times do |row| \n @grid << []\n (@num_items+1).times {|col| @grid[row] << 0 }\n end\n end",
"title": ""
},
{
"docid": "0e5df8ff5f6b69fbd4c19f1bd1e5698d",
"score": "0.60097325",
"text": "def coordinates_for_new_cells\n cells.map do |cell|\n count = neighbor_count_for_cell(cell)\n if cell.alive?\n cell.coordinates if count == 2 || count == 3\n else\n cell.coordinates if count == 3\n end\n end.compact\n end",
"title": ""
},
{
"docid": "ae5d37af4bd24df911b017d37b539fe8",
"score": "0.6009344",
"text": "def problem67\n rows = [[59],[73,41],[52,40,9],[26,53,6,34],[10,51,87,86,81],[61,95,66,57,25,68],[90,81,80,38,92,67,73],[30,28,51,76,81,18,75,44],[84,14,95,87,62,81,17,78,58],[21,46,71,58,2,79,62,39,31,9],[56,34,35,53,78,31,81,18,90,93,15],[78,53,4,21,84,93,32,13,97,11,37,51],[45,3,81,79,5,18,78,86,13,30,63,99,95],[39,87,96,28,3,38,42,17,82,87,58,7,22,57],[6,17,51,17,7,93,9,7,75,97,95,78,87,8,53],[67,66,59,60,88,99,94,65,55,77,55,34,27,53,78,28],[76,40,41,4,87,16,9,42,75,69,23,97,30,60,10,79,87],[12,10,44,26,21,36,32,84,98,60,13,12,36,16,63,31,91,35],[70,39,6,5,55,27,38,48,28,22,34,35,62,62,15,14,94,89,86],[66,56,68,84,96,21,34,34,34,81,62,40,65,54,62,5,98,3,2,60],[38,89,46,37,99,54,34,53,36,14,70,26,2,90,45,13,31,61,83,73,47],[36,10,63,96,60,49,41,5,37,42,14,58,84,93,96,17,9,43,5,43,6,59],[66,57,87,57,61,28,37,51,84,73,79,15,39,95,88,87,43,39,11,86,77,74,18],[54,42,5,79,30,49,99,73,46,37,50,2,45,9,54,52,27,95,27,65,19,45,26,45],[71,39,17,78,76,29,52,90,18,99,78,19,35,62,71,19,23,65,93,85,49,33,75,9,2],[33,24,47,61,60,55,32,88,57,55,91,54,46,57,7,77,98,52,80,99,24,25,46,78,79,5],[92,9,13,55,10,67,26,78,76,82,63,49,51,31,24,68,5,57,7,54,69,21,67,43,17,63,12],[24,59,6,8,98,74,66,26,61,60,13,3,9,9,24,30,71,8,88,70,72,70,29,90,11,82,41,34],[66,82,67,4,36,60,92,77,91,85,62,49,59,61,30,90,29,94,26,41,89,4,53,22,83,41,9,74,90],[48,28,26,37,28,52,77,26,51,32,18,98,79,36,62,13,17,8,19,54,89,29,73,68,42,14,8,16,70,37],[37,60,69,70,72,71,9,59,13,60,38,13,57,36,9,30,43,89,30,39,15,2,44,73,5,73,26,63,56,86,12],[55,55,85,50,62,99,84,77,28,85,3,21,27,22,19,26,82,69,54,4,13,7,85,14,1,15,70,59,89,95,10,19],[4,9,31,92,91,38,92,86,98,75,21,5,64,42,62,84,36,20,73,42,21,23,22,51,51,79,25,45,85,53,3,43,22],[75,63,2,49,14,12,89,14,60,78,92,16,44,82,38,30,72,11,46,52,90,27,8,65,78,3,85,41,57,79,39,52,33,48],[78,27,56,56,39,13,19,43,86,72,58,95,39,7,4,34,21,98,39,15,39,84,89,69,84,46,37,57,59,35,59,50,26,15,93],[42,89,36,27,78,91,24,11,17,41,5,94,7,69,51,96,3,96,47,90,90,45,91,20,50,56,10,32,36,49,4,53,85,92,25,65],[52,9,61,30,61,97,66,21,96,92,98,90,6,34,96,60,32,69,68,33,75,84,18,31,71,50,84,63,3,3,19,11,28,42,75,45,45],[61,31,61,68,96,34,49,39,5,71,76,59,62,67,6,47,96,99,34,21,32,47,52,7,71,60,42,72,94,56,82,83,84,40,94,87,82,46],[1,20,60,14,17,38,26,78,66,81,45,95,18,51,98,81,48,16,53,88,37,52,69,95,72,93,22,34,98,20,54,27,73,61,56,63,60,34,63],[93,42,94,83,47,61,27,51,79,79,45,1,44,73,31,70,83,42,88,25,53,51,30,15,65,94,80,44,61,84,12,77,2,62,2,65,94,42,14,94],[32,73,9,67,68,29,74,98,10,19,85,48,38,31,85,67,53,93,93,77,47,67,39,72,94,53,18,43,77,40,78,32,29,59,24,6,2,83,50,60,66],[32,1,44,30,16,51,15,81,98,15,10,62,86,79,50,62,45,60,70,38,31,85,65,61,64,6,69,84,14,22,56,43,9,48,66,69,83,91,60,40,36,61],[92,48,22,99,15,95,64,43,1,16,94,2,99,19,17,69,11,58,97,56,89,31,77,45,67,96,12,73,8,20,36,47,81,44,50,64,68,85,40,81,85,52,9],[91,35,92,45,32,84,62,15,19,64,21,66,6,1,52,80,62,59,12,25,88,28,91,50,40,16,22,99,92,79,87,51,21,77,74,77,7,42,38,42,74,83,2,5],[46,19,77,66,24,18,5,32,2,84,31,99,92,58,96,72,91,36,62,99,55,29,53,42,12,37,26,58,89,50,66,19,82,75,12,48,24,87,91,85,2,7,3,76,86],[99,98,84,93,7,17,33,61,92,20,66,60,24,66,40,30,67,5,37,29,24,96,3,27,70,62,13,4,45,47,59,88,43,20,66,15,46,92,30,4,71,66,78,70,53,99],[67,60,38,6,88,4,17,72,10,99,71,7,42,25,54,5,26,64,91,50,45,71,6,30,67,48,69,82,8,56,80,67,18,46,66,63,1,20,8,80,47,7,91,16,3,79,87],[18,54,78,49,80,48,77,40,68,23,60,88,58,80,33,57,11,69,55,53,64,2,94,49,60,92,16,35,81,21,82,96,25,24,96,18,2,5,49,3,50,77,6,32,84,27,18,38],[68,1,50,4,3,21,42,94,53,24,89,5,92,26,52,36,68,11,85,1,4,42,2,45,15,6,50,4,53,73,25,74,81,88,98,21,67,84,79,97,99,20,95,4,40,46,2,58,87],[94,10,2,78,88,52,21,3,88,60,6,53,49,71,20,91,12,65,7,49,21,22,11,41,58,99,36,16,9,48,17,24,52,36,23,15,72,16,84,56,2,99,43,76,81,71,29,39,49,17],[64,39,59,84,86,16,17,66,3,9,43,6,64,18,63,29,68,6,23,7,87,14,26,35,17,12,98,41,53,64,78,18,98,27,28,84,80,67,75,62,10,11,76,90,54,10,5,54,41,39,66],[43,83,18,37,32,31,52,29,95,47,8,76,35,11,4,53,35,43,34,10,52,57,12,36,20,39,40,55,78,44,7,31,38,26,8,15,56,88,86,1,52,62,10,24,32,5,60,65,53,28,57,99],[3,50,3,52,7,73,49,92,66,80,1,46,8,67,25,36,73,93,7,42,25,53,13,96,76,83,87,90,54,89,78,22,78,91,73,51,69,9,79,94,83,53,9,40,69,62,10,79,49,47,3,81,30],[71,54,73,33,51,76,59,54,79,37,56,45,84,17,62,21,98,69,41,95,65,24,39,37,62,3,24,48,54,64,46,82,71,78,33,67,9,16,96,68,52,74,79,68,32,21,13,78,96,60,9,69,20,36],[73,26,21,44,46,38,17,83,65,98,7,23,52,46,61,97,33,13,60,31,70,15,36,77,31,58,56,93,75,68,21,36,69,53,90,75,25,82,39,50,65,94,29,30,11,33,11,13,96,2,56,47,7,49,2],[76,46,73,30,10,20,60,70,14,56,34,26,37,39,48,24,55,76,84,91,39,86,95,61,50,14,53,93,64,67,37,31,10,84,42,70,48,20,10,72,60,61,84,79,69,65,99,73,89,25,85,48,92,56,97,16],[3,14,80,27,22,30,44,27,67,75,79,32,51,54,81,29,65,14,19,4,13,82,4,91,43,40,12,52,29,99,7,76,60,25,1,7,61,71,37,92,40,47,99,66,57,1,43,44,22,40,53,53,9,69,26,81,7],[49,80,56,90,93,87,47,13,75,28,87,23,72,79,32,18,27,20,28,10,37,59,21,18,70,4,79,96,3,31,45,71,81,6,14,18,17,5,31,50,92,79,23,47,9,39,47,91,43,54,69,47,42,95,62,46,32,85],[37,18,62,85,87,28,64,5,77,51,47,26,30,65,5,70,65,75,59,80,42,52,25,20,44,10,92,17,71,95,52,14,77,13,24,55,11,65,26,91,1,30,63,15,49,48,41,17,67,47,3,68,20,90,98,32,4,40,68],[90,51,58,60,6,55,23,68,5,19,76,94,82,36,96,43,38,90,87,28,33,83,5,17,70,83,96,93,6,4,78,47,80,6,23,84,75,23,87,72,99,14,50,98,92,38,90,64,61,58,76,94,36,66,87,80,51,35,61,38],[57,95,64,6,53,36,82,51,40,33,47,14,7,98,78,65,39,58,53,6,50,53,4,69,40,68,36,69,75,78,75,60,3,32,39,24,74,47,26,90,13,40,44,71,90,76,51,24,36,50,25,45,70,80,61,80,61,43,90,64,11],[18,29,86,56,68,42,79,10,42,44,30,12,96,18,23,18,52,59,2,99,67,46,60,86,43,38,55,17,44,93,42,21,55,14,47,34,55,16,49,24,23,29,96,51,55,10,46,53,27,92,27,46,63,57,30,65,43,27,21,20,24,83],[81,72,93,19,69,52,48,1,13,83,92,69,20,48,69,59,20,62,5,42,28,89,90,99,32,72,84,17,8,87,36,3,60,31,36,36,81,26,97,36,48,54,56,56,27,16,91,8,23,11,87,99,33,47,2,14,44,73,70,99,43,35,33],[90,56,61,86,56,12,70,59,63,32,1,15,81,47,71,76,95,32,65,80,54,70,34,51,40,45,33,4,64,55,78,68,88,47,31,47,68,87,3,84,23,44,89,72,35,8,31,76,63,26,90,85,96,67,65,91,19,14,17,86,4,71,32,95],[37,13,4,22,64,37,37,28,56,62,86,33,7,37,10,44,52,82,52,6,19,52,57,75,90,26,91,24,6,21,14,67,76,30,46,14,35,89,89,41,3,64,56,97,87,63,22,34,3,79,17,45,11,53,25,56,96,61,23,18,63,31,37,37,47],[77,23,26,70,72,76,77,4,28,64,71,69,14,85,96,54,95,48,6,62,99,83,86,77,97,75,71,66,30,19,57,90,33,1,60,61,14,12,90,99,32,77,56,41,18,14,87,49,10,14,90,64,18,50,21,74,14,16,88,5,45,73,82,47,74,44],[22,97,41,13,34,31,54,61,56,94,3,24,59,27,98,77,4,9,37,40,12,26,87,9,71,70,7,18,64,57,80,21,12,71,83,94,60,39,73,79,73,19,97,32,64,29,41,7,48,84,85,67,12,74,95,20,24,52,41,67,56,61,29,93,35,72,69],[72,23,63,66,1,11,7,30,52,56,95,16,65,26,83,90,50,74,60,18,16,48,43,77,37,11,99,98,30,94,91,26,62,73,45,12,87,73,47,27,1,88,66,99,21,41,95,80,2,53,23,32,61,48,32,43,43,83,14,66,95,91,19,81,80,67,25,88],[8,62,32,18,92,14,83,71,37,96,11,83,39,99,5,16,23,27,10,67,2,25,44,11,55,31,46,64,41,56,44,74,26,81,51,31,45,85,87,9,81,95,22,28,76,69,46,48,64,87,67,76,27,89,31,11,74,16,62,3,60,94,42,47,9,34,94,93,72],[56,18,90,18,42,17,42,32,14,86,6,53,33,95,99,35,29,15,44,20,49,59,25,54,34,59,84,21,23,54,35,90,78,16,93,13,37,88,54,19,86,67,68,55,66,84,65,42,98,37,87,56,33,28,58,38,28,38,66,27,52,21,81,15,8,22,97,32,85,27],[91,53,40,28,13,34,91,25,1,63,50,37,22,49,71,58,32,28,30,18,68,94,23,83,63,62,94,76,80,41,90,22,82,52,29,12,18,56,10,8,35,14,37,57,23,65,67,40,72,39,93,39,70,89,40,34,7,46,94,22,20,5,53,64,56,30,5,56,61,88,27],[23,95,11,12,37,69,68,24,66,10,87,70,43,50,75,7,62,41,83,58,95,93,89,79,45,39,2,22,5,22,95,43,62,11,68,29,17,40,26,44,25,71,87,16,70,85,19,25,59,94,90,41,41,80,61,70,55,60,84,33,95,76,42,63,15,9,3,40,38,12,3,32],[9,84,56,80,61,55,85,97,16,94,82,94,98,57,84,30,84,48,93,90,71,5,95,90,73,17,30,98,40,64,65,89,7,79,9,19,56,36,42,30,23,69,73,72,7,5,27,61,24,31,43,48,71,84,21,28,26,65,65,59,65,74,77,20,10,81,61,84,95,8,52,23,70],[47,81,28,9,98,51,67,64,35,51,59,36,92,82,77,65,80,24,72,53,22,7,27,10,21,28,30,22,48,82,80,48,56,20,14,43,18,25,50,95,90,31,77,8,9,48,44,80,90,22,93,45,82,17,13,96,25,26,8,73,34,99,6,49,24,6,83,51,40,14,15,10,25,1],[54,25,10,81,30,64,24,74,75,80,36,75,82,60,22,69,72,91,45,67,3,62,79,54,89,74,44,83,64,96,66,73,44,30,74,50,37,5,9,97,70,1,60,46,37,91,39,75,75,18,58,52,72,78,51,81,86,52,8,97,1,46,43,66,98,62,81,18,70,93,73,8,32,46,34],[96,80,82,7,59,71,92,53,19,20,88,66,3,26,26,10,24,27,50,82,94,73,63,8,51,33,22,45,19,13,58,33,90,15,22,50,36,13,55,6,35,47,82,52,33,61,36,27,28,46,98,14,73,20,73,32,16,26,80,53,47,66,76,38,94,45,2,1,22,52,47,96,64,58,52,39],[88,46,23,39,74,63,81,64,20,90,33,33,76,55,58,26,10,46,42,26,74,74,12,83,32,43,9,2,73,55,86,54,85,34,28,23,29,79,91,62,47,41,82,87,99,22,48,90,20,5,96,75,95,4,43,28,81,39,81,1,28,42,78,25,39,77,90,57,58,98,17,36,73,22,63,74,51],[29,39,74,94,95,78,64,24,38,86,63,87,93,6,70,92,22,16,80,64,29,52,20,27,23,50,14,13,87,15,72,96,81,22,8,49,72,30,70,24,79,31,16,64,59,21,89,34,96,91,48,76,43,53,88,1,57,80,23,81,90,79,58,1,80,87,17,99,86,90,72,63,32,69,14,28,88,69],[37,17,71,95,56,93,71,35,43,45,4,98,92,94,84,96,11,30,31,27,31,60,92,3,48,5,98,91,86,94,35,90,90,8,48,19,33,28,68,37,59,26,65,96,50,68,22,7,9,49,34,31,77,49,43,6,75,17,81,87,61,79,52,26,27,72,29,50,7,98,86,1,17,10,46,64,24,18,56],[51,30,25,94,88,85,79,91,40,33,63,84,49,67,98,92,15,26,75,19,82,5,18,78,65,93,61,48,91,43,59,41,70,51,22,15,92,81,67,91,46,98,11,11,65,31,66,10,98,65,83,21,5,56,5,98,73,67,46,74,69,34,8,30,5,52,7,98,32,95,30,94,65,50,24,63,28,81,99,57],[19,23,61,36,9,89,71,98,65,17,30,29,89,26,79,74,94,11,44,48,97,54,81,55,39,66,69,45,28,47,13,86,15,76,74,70,84,32,36,33,79,20,78,14,41,47,89,28,81,5,99,66,81,86,38,26,6,25,13,60,54,55,23,53,27,5,89,25,23,11,13,54,59,54,56,34,16,24,53,44,6],[13,40,57,72,21,15,60,8,4,19,11,98,34,45,9,97,86,71,3,15,56,19,15,44,97,31,90,4,87,87,76,8,12,30,24,62,84,28,12,85,82,53,99,52,13,94,6,65,97,86,9,50,94,68,69,74,30,67,87,94,63,7,78,27,80,36,69,41,6,92,32,78,37,82,30,5,18,87,99,72,19,99],[44,20,55,77,69,91,27,31,28,81,80,27,2,7,97,23,95,98,12,25,75,29,47,71,7,47,78,39,41,59,27,76,13,15,66,61,68,35,69,86,16,53,67,63,99,85,41,56,8,28,33,40,94,76,90,85,31,70,24,65,84,65,99,82,19,25,54,37,21,46,33,2,52,99,51,33,26,4,87,2,8,18,96],[54,42,61,45,91,6,64,79,80,82,32,16,83,63,42,49,19,78,65,97,40,42,14,61,49,34,4,18,25,98,59,30,82,72,26,88,54,36,21,75,3,88,99,53,46,51,55,78,22,94,34,40,68,87,84,25,30,76,25,8,92,84,42,61,40,38,9,99,40,23,29,39,46,55,10,90,35,84,56,70,63,23,91,39],[52,92,3,71,89,7,9,37,68,66,58,20,44,92,51,56,13,71,79,99,26,37,2,6,16,67,36,52,58,16,79,73,56,60,59,27,44,77,94,82,20,50,98,33,9,87,94,37,40,83,64,83,58,85,17,76,53,2,83,52,22,27,39,20,48,92,45,21,9,42,24,23,12,37,52,28,50,78,79,20,86,62,73,20,59],[54,96,80,15,91,90,99,70,10,9,58,90,93,50,81,99,54,38,36,10,30,11,35,84,16,45,82,18,11,97,36,43,96,79,97,65,40,48,23,19,17,31,64,52,65,65,37,32,65,76,99,79,34,65,79,27,55,33,3,1,33,27,61,28,66,8,4,70,49,46,48,83,1,45,19,96,13,81,14,21,31,79,93,85,50,5],[92,92,48,84,59,98,31,53,23,27,15,22,79,95,24,76,5,79,16,93,97,89,38,89,42,83,2,88,94,95,82,21,1,97,48,39,31,78,9,65,50,56,97,61,1,7,65,27,21,23,14,15,80,97,44,78,49,35,33,45,81,74,34,5,31,57,9,38,94,7,69,54,69,32,65,68,46,68,78,90,24,28,49,51,45,86,35],[41,63,89,76,87,31,86,9,46,14,87,82,22,29,47,16,13,10,70,72,82,95,48,64,58,43,13,75,42,69,21,12,67,13,64,85,58,23,98,9,37,76,5,22,31,12,66,50,29,99,86,72,45,25,10,28,19,6,90,43,29,31,67,79,46,25,74,14,97,35,76,37,65,46,23,82,6,22,30,76,93,66,94,17,96,13,20,72],[63,40,78,8,52,9,90,41,70,28,36,14,46,44,85,96,24,52,58,15,87,37,5,98,99,39,13,61,76,38,44,99,83,74,90,22,53,80,56,98,30,51,63,39,44,30,91,91,4,22,27,73,17,35,53,18,35,45,54,56,27,78,48,13,69,36,44,38,71,25,30,56,15,22,73,43,32,69,59,25,93,83,45,11,34,94,44,39,92],[12,36,56,88,13,96,16,12,55,54,11,47,19,78,17,17,68,81,77,51,42,55,99,85,66,27,81,79,93,42,65,61,69,74,14,1,18,56,12,1,58,37,91,22,42,66,83,25,19,4,96,41,25,45,18,69,96,88,36,93,10,12,98,32,44,83,83,4,72,91,4,27,73,7,34,37,71,60,59,31,1,54,54,44,96,93,83,36,4,45],[30,18,22,20,42,96,65,79,17,41,55,69,94,81,29,80,91,31,85,25,47,26,43,49,2,99,34,67,99,76,16,14,15,93,8,32,99,44,61,77,67,50,43,55,87,55,53,72,17,46,62,25,50,99,73,5,93,48,17,31,70,80,59,9,44,59,45,13,74,66,58,94,87,73,16,14,85,38,74,99,64,23,79,28,71,42,20,37,82,31,23],[51,96,39,65,46,71,56,13,29,68,53,86,45,33,51,49,12,91,21,21,76,85,2,17,98,15,46,12,60,21,88,30,92,83,44,59,42,50,27,88,46,86,94,73,45,54,23,24,14,10,94,21,20,34,23,51,4,83,99,75,90,63,60,16,22,33,83,70,11,32,10,50,29,30,83,46,11,5,31,17,86,42,49,1,44,63,28,60,7,78,95,40],[44,61,89,59,4,49,51,27,69,71,46,76,44,4,9,34,56,39,15,6,94,91,75,90,65,27,56,23,74,6,23,33,36,69,14,39,5,34,35,57,33,22,76,46,56,10,61,65,98,9,16,69,4,62,65,18,99,76,49,18,72,66,73,83,82,40,76,31,89,91,27,88,17,35,41,35,32,51,32,67,52,68,74,85,80,57,7,11,62,66,47,22,67],[65,37,19,97,26,17,16,24,24,17,50,37,64,82,24,36,32,11,68,34,69,31,32,89,79,93,96,68,49,90,14,23,4,4,67,99,81,74,70,74,36,96,68,9,64,39,88,35,54,89,96,58,66,27,88,97,32,14,6,35,78,20,71,6,85,66,57,2,58,91,72,5,29,56,73,48,86,52,9,93,22,57,79,42,12,1,31,68,17,59,63,76,7,77],[73,81,14,13,17,20,11,9,1,83,8,85,91,70,84,63,62,77,37,7,47,1,59,95,39,69,39,21,99,9,87,2,97,16,92,36,74,71,90,66,33,73,73,75,52,91,11,12,26,53,5,26,26,48,61,50,90,65,1,87,42,47,74,35,22,73,24,26,56,70,52,5,48,41,31,18,83,27,21,39,80,85,26,8,44,2,71,7,63,22,5,52,19,8,20],[17,25,21,11,72,93,33,49,64,23,53,82,3,13,91,65,85,2,40,5,42,31,77,42,5,36,6,54,4,58,7,76,87,83,25,57,66,12,74,33,85,37,74,32,20,69,3,97,91,68,82,44,19,14,89,28,85,85,80,53,34,87,58,98,88,78,48,65,98,40,11,57,10,67,70,81,60,79,74,72,97,59,79,47,30,20,54,80,89,91,14,5,33,36,79,39],[60,85,59,39,60,7,57,76,77,92,6,35,15,72,23,41,45,52,95,18,64,79,86,53,56,31,69,11,91,31,84,50,44,82,22,81,41,40,30,42,30,91,48,94,74,76,64,58,74,25,96,57,14,19,3,99,28,83,15,75,99,1,89,85,79,50,3,95,32,67,44,8,7,41,62,64,29,20,14,76,26,55,48,71,69,66,19,72,44,25,14,1,48,74,12,98,7],[64,66,84,24,18,16,27,48,20,14,47,69,30,86,48,40,23,16,61,21,51,50,26,47,35,33,91,28,78,64,43,68,4,79,51,8,19,60,52,95,6,68,46,86,35,97,27,58,4,65,30,58,99,12,12,75,91,39,50,31,42,64,70,4,46,7,98,73,98,93,37,89,77,91,64,71,64,65,66,21,78,62,81,74,42,20,83,70,73,95,78,45,92,27,34,53,71,15],[30,11,85,31,34,71,13,48,5,14,44,3,19,67,23,73,19,57,6,90,94,72,57,69,81,62,59,68,88,57,55,69,49,13,7,87,97,80,89,5,71,5,5,26,38,40,16,62,45,99,18,38,98,24,21,26,62,74,69,4,85,57,77,35,58,67,91,79,79,57,86,28,66,34,72,51,76,78,36,95,63,90,8,78,47,63,45,31,22,70,52,48,79,94,15,77,61,67,68],[23,33,44,81,80,92,93,75,94,88,23,61,39,76,22,3,28,94,32,6,49,65,41,34,18,23,8,47,62,60,3,63,33,13,80,52,31,54,73,43,70,26,16,69,57,87,83,31,3,93,70,81,47,95,77,44,29,68,39,51,56,59,63,7,25,70,7,77,43,53,64,3,94,42,95,39,18,1,66,21,16,97,20,50,90,16,70,10,95,69,29,6,25,61,41,26,15,59,63,35]]\n\n maximumPathFromTopToBottomOfTriangle rows\n\nend",
"title": ""
},
{
"docid": "7e7d9dd0faecfc9cddcca07c8de519bb",
"score": "0.60068125",
"text": "def get_possible_numbers(x,y)\n numbers = (1..9).to_a\n if @rows[x][y] != 0\n return false\n else\n for digit in @rows[x] do \n # if digit.integer?\n repeated = digit\n # end\n numbers.delete(repeated)\n end\n for col_digit in (0..8) do\n # byebug\n if numbers.include?(@rows[col_digit][y])\n numbers.delete(@rows[col_digit][y])\n # byebug\n else nil\n end\n end\n end\n row_start = (x/3)*3\n col_start = (y/3)*3\n small_board = @rows[row_start..(row_start+3)]\n small_board.each_with_index do |row, index|\n small_board[index] = row[col_start..(col_start+3)]\n end\n small_board.each do |row|\n row.each do |col|\n numbers.delete(col)\n end\n end\n return numbers\n end",
"title": ""
},
{
"docid": "37500ffcdaabec7c053e446a956b8736",
"score": "0.600659",
"text": "def fill_grid grid\n if !solved? # if not yet solved\n empty = grid.find_index {|i| i == 0} # get first empty \n nums = row_nums(empty) & col_nums(empty) & reg_nums(empty) # get poss. digits for empty\n @first_e = empty if @first_e == -1\n\n # iterate recursively through all empties and all possible digits for each empty\n # this tries all possible options, backtracking if the next square has no possible numbers\n nums.each_with_index do |num, index|\n grid[empty] = num # put number in empty\n \n # update @puzzle, because methods that get possible digits use @puzzle\n @puzzle.clear\n grid.each_slice(9) {|row| @puzzle << row}\n \n fill_grid grid # recursive call\n if !solved?\n # if not solved after last number entered, previous entries are wrong\n # setting empty to 0 will force method to backtrack and recur again w/ diff. combination\n if index == nums.size-1\n grid[empty] = 0\n # if we are back at the first empty cell and have exhausted all possible values, then the puzzle has no solution\n if @first_e == empty\n @errorm = \"This puzzle has no solution.\"\n abort \"Invalid input\"\n end\n end\n else\n return # solution found; exit method\n end\n end # end nums block\n end # end if\n end",
"title": ""
},
{
"docid": "646f8715ba018c4f8e425acfd60f9b35",
"score": "0.60023797",
"text": "def grid\n\t\t# def self.position_with_value\n\t\t# \t@positions\n\t\t# end\n\t\tpositions = {}\n\t\t1.upto(self.size) do |n|\n\t\t\tpositions[\"#{n}\"] = \" \"\n\t\tend\n\t\tpositions\n\tend",
"title": ""
},
{
"docid": "d89044f06ca4198989e2c2fb26d4ca46",
"score": "0.6000702",
"text": "def make_b width=30, height=10, state=RANDOM, specials = []\n\n array = []\n\n height.times do |i|\n mini = []\n prev = nil\n index = i - 1\n\n\n # (1) create a new cell touching the previous,\n # (1.1) add the cell directly above to touch as well if it exists\n # (2) add that cell to mini\n # (3) add that cell to the touch of previous\n # (4) set previous to the current cell\n width.times do |q|\n\n curr= make_cell q, i, state, specials\n\n # if index is 0 or higher, then this isn't the first row, which means\n # that a cell exists derectly above this one. Both should be added to\n # each others touch\n aboves index, array, curr, q\n\n\n mini << curr\n if prev\n mutual_add curr, prev\n end\n prev = curr\n end\n array << mini\n end\n\n array\nend",
"title": ""
},
{
"docid": "c6ff799eb18927476d232525044ae890",
"score": "0.6000335",
"text": "def get_cell(puzzle, y, x)\n ((1..9).to_a.map { |digit| digit.to_s }) - (puzzle[(((y / 3) * 3)..(((y / 3) * 3) + 2))].map do |col|\n col[(((x / 3) * 3)..(((x / 3) * 3) + 2))]\n end\n ).flatten\nend",
"title": ""
},
{
"docid": "4c0f09bc54085aee2eafbfb9ac2819bd",
"score": "0.5996334",
"text": "def generate_grid\n # TODO: generate random grid of letters\n grid = []\n 10.times { grid << ('a'..'z').to_a[rand(26)] }\n grid\n end",
"title": ""
},
{
"docid": "25f6190bf158a20a8968b2d0aaecea9f",
"score": "0.59952813",
"text": "def generateCells\n @canvas.delete('all')\n\n # Size of a given cell in pixels\n cellSize = @canvasSize / @size\n\n @cells = []\n @size.times do |x|\n @cells.push []\n @size.times do |y|\n tempState = rand(3)\n # Simple check to increase the probability that a cell starts dead\n if (tempState == 2 || tempState == 3)\n tempState = 0\n end\n c = Cell.new(x, y, tempState, @canvas, cellSize)\n @cells[x].push c\n # end\n end\n end\n end",
"title": ""
},
{
"docid": "d3a68f75bbb50dcfc6b8d8ae0719ef9d",
"score": "0.59945387",
"text": "def generate_empty_grid\n @grid = Array.new(7) { [nil] * 6 }\n end",
"title": ""
},
{
"docid": "e74aa3494855f4fda23ce26cdd5d28dc",
"score": "0.59891593",
"text": "def complete_sudoku\n return {\n 1 => 1,\n 2 => 1,\n 3 => 1,\n 4 => 1,\n 5 => 1,\n 6 => 1,\n 7 => 1,\n 8 => 1,\n 9 => 1\n }\nend",
"title": ""
},
{
"docid": "42fc8eaf9a809cceccc6c2cb9651f878",
"score": "0.5983103",
"text": "def clean_grid\n @grid = Array.new(8) { Array.new(8, ' ') }\n end",
"title": ""
},
{
"docid": "059030463ed86adebca8d3f57ad168d7",
"score": "0.5981553",
"text": "def generate\n prime_numbers.inject([]) do |row_acc, row_prime|\n row_acc << prime_numbers.inject([]) do |col_acc, col_prime|\n col_acc << col_prime * row_prime\n end\n end\n end",
"title": ""
},
{
"docid": "61068fa9f895d85522e45addd84c7131",
"score": "0.5981332",
"text": "def unassigned_cells\n\t\tto_a.reject { |cell| cell.number }\n\tend",
"title": ""
}
] |
7bb15a400a99eb5e1983c94ddef8c65d | produce multiple XML elements with text specified as hash also produce multiple XML elements with attributes lowlevel function Usage: ov.xml_mix() | [
{
"docid": "83e473db222c4d45e7d7f8a7682d71f0",
"score": "0.6415845",
"text": "def xml_mix(name, child, attr, elem)\n\t\t\txml = REXML::Element.new(name)\n\t\t\tchild.keys.each do |k|\n\t\t\t\txml.add_element(k)\n\t\t\t\txml.elements[k].text = child[k]\n\t\t\tend\n\t\t\telem.keys.each do |k|\n\t\t\t\txml.add_element(k)\n\t\t\t\txml.elements[k].attributes[attr] = elem[k]\n\t\t\tend\n\t\t\treturn xml\n\t\tend",
"title": ""
}
] | [
{
"docid": "57d818c52b2ed097bd73333728beb365",
"score": "0.61492026",
"text": "def buildTags(xml, tags, hash)\n tags.each do |t|\n text = hash[t]\n xml.method_missing t, text if text\n end\n end",
"title": ""
},
{
"docid": "f029a310e0c30b7b820bfc4729fb4723",
"score": "0.60663694",
"text": "def iterate_with_xml(hash)\n xml = Builder::XmlMarkup.new\n attributes = hash[:attributes!] || {}\n hash_without_attributes = hash.except(:attributes!)\n\n order(hash_without_attributes).each do |key|\n node_attr = attributes[key] || {}\n # node_attr must be kind of ActiveSupport::HashWithIndifferentAccess\n node_attr = node_attr.map { |k, v| [k.to_s, v] }.to_h\n node_value = hash[key].respond_to?(:keys) ? hash[key].clone : hash[key]\n\n if node_value.respond_to?(:keys)\n explicit_keys = node_value.keys.select { |k| explicit_attribute?(k) }\n explicit_attr = {}\n explicit_keys.each { |k| explicit_attr[k.to_s[1..]] = node_value[k] }\n node_attr.merge!(explicit_attr)\n explicit_keys.each { |k| node_value.delete(k) }\n\n tmp_node_value = node_value.delete(:content!)\n node_value = tmp_node_value unless tmp_node_value.nil?\n node_value = \"\" if node_value.respond_to?(:empty?) && node_value.empty?\n end\n\n yield xml, key, node_value, node_attr\n end\n\n xml.target!\n end",
"title": ""
},
{
"docid": "0f5a37fcd4fb596be59d2aaba014a030",
"score": "0.605553",
"text": "def hash_xml(xml, params)\n params.each do |key, value|\n xml = xml_key_value(key, value, xml)\n end\n xml\n end",
"title": ""
},
{
"docid": "0f5a37fcd4fb596be59d2aaba014a030",
"score": "0.605553",
"text": "def hash_xml(xml, params)\n params.each do |key, value|\n xml = xml_key_value(key, value, xml)\n end\n xml\n end",
"title": ""
},
{
"docid": "cdc4c82aa0227a83cfc03e75ed6dfc5b",
"score": "0.5780164",
"text": "def hash_to_xml(xml, hash)\n hash.each do |key, value|\n element = camelize(key)\n if value.is_a?(Hash)\n xml.send element do |x|\n hash_to_xml(x, value)\n end\n elsif value.is_a?(Array)\n value.each do |v|\n xml.send element do |x|\n hash_to_xml(x, v)\n end\n end\n else\n xml.send element, value\n end\n end\n end",
"title": ""
},
{
"docid": "cdc4c82aa0227a83cfc03e75ed6dfc5b",
"score": "0.5780164",
"text": "def hash_to_xml(xml, hash)\n hash.each do |key, value|\n element = camelize(key)\n if value.is_a?(Hash)\n xml.send element do |x|\n hash_to_xml(x, value)\n end\n elsif value.is_a?(Array)\n value.each do |v|\n xml.send element do |x|\n hash_to_xml(x, v)\n end\n end\n else\n xml.send element, value\n end\n end\n end",
"title": ""
},
{
"docid": "4628683133ef3d576ab2743c900dfc93",
"score": "0.57208633",
"text": "def generate_xmlhash\n self.xmlhash = Digest::SHA256.hexdigest(self.xml)\n end",
"title": ""
},
{
"docid": "8243b12d0879de82f0bf56c3d488ec2d",
"score": "0.56464446",
"text": "def build_xml(hash, options = {})\n iterate_with_xml hash do |xml, key, value, attributes|\n self_closing = key.to_s[-1, 1] == \"/\"\n escape_xml = key.to_s[-1, 1] != \"!\"\n xml_key = XMLKey.create key, options\n\n if :content! === key\n xml << XMLValue.create(value, escape_xml, options)\n elsif ::Array === value\n xml << Array.build_xml(value, xml_key, escape_xml, attributes, options.merge(self_closing: self_closing))\n elsif ::Hash === value\n xml.tag!(xml_key, attributes) { xml << build_xml(value, options) }\n elsif self_closing\n xml.tag!(xml_key, attributes)\n elsif NilClass === value\n xml.tag!(xml_key, \"xsi:nil\" => \"true\")\n else\n xml.tag!(xml_key, attributes) { xml << XMLValue.create(value, escape_xml, options) }\n end\n end\n end",
"title": ""
},
{
"docid": "166eecf77b3e75f4efbc3f8a1afdf066",
"score": "0.5627328",
"text": "def xml_template(params)\n xml_str = \"<product>\"\n params.each do |key,value|\n xml_str += \"<#{key}>#{value}</#{key}>\"\n end\n xml_str += \"</product>\"\n xml_str\n end",
"title": ""
},
{
"docid": "9044892670dee4bb1b91380e65da8f08",
"score": "0.551411",
"text": "def xml(ele, attr = {})\n \"<#{ele}#{attr.keys.map{|k| \" #{k}=\\\"#{attr[k]}\\\"\"}.join}>\" + # Element opening tag with attributes.\n (block_given? ? yield : \"\") + # Element contents.\n \"</#{ele}>\" # Element closing tag.\nend",
"title": ""
},
{
"docid": "f1d671c1b63f8ee95cf5d30c47df599b",
"score": "0.5496484",
"text": "def hash_to_xml(hash)\n xml = hash.inject(\"\") { |s, (k, v)|\n s + \"<key>#{k}</key>\\n<value>\\n#{elem_to_xml(v)}\\n</value>\"\n }\n \"<map>\\n#{xml}\\n</map>\"\n end",
"title": ""
},
{
"docid": "f1d671c1b63f8ee95cf5d30c47df599b",
"score": "0.5496484",
"text": "def hash_to_xml(hash)\n xml = hash.inject(\"\") { |s, (k, v)|\n s + \"<key>#{k}</key>\\n<value>\\n#{elem_to_xml(v)}\\n</value>\"\n }\n \"<map>\\n#{xml}\\n</map>\"\n end",
"title": ""
},
{
"docid": "fb5989aff479afd6949938cb098732f4",
"score": "0.54950684",
"text": "def merge_texts!(hash, element); end",
"title": ""
},
{
"docid": "6173d4987bbb3db57929bb2d74aee44f",
"score": "0.5460134",
"text": "def xml_template\n build_xml( hash_template )\n end",
"title": ""
},
{
"docid": "9c16b42c06fbaea236ef92c9211fe18b",
"score": "0.54234874",
"text": "def query_xml(hash)\n Nokogiri::XML::Builder.new do |x|\n x.union do\n %w{node way}.each do |t|\n x.query(type: t) do\n hash.each do |k,v|\n options = {k: k}\n if v.is_a? String\n options[:v] = v\n end\n x.send(:'has-kv', options)\n end\n end\n end\n x.recurse(type: 'way-node') # include all nodes in a given way\n end\n end.doc.root.to_s\n end",
"title": ""
},
{
"docid": "7cab0f87b082d77d773aeca9b983ed74",
"score": "0.5416526",
"text": "def hash_to_xml(xml, hash)\n hash.each do |key, value|\n if key == :address\n xml.Address {\n value[:address][0..1].each do |address_line|\n xml.StreetLines address_line\n end\n xml.City value[:city]\n xml.StateOrProvinceCode value[:state]\n xml.PostalCode value[:postal_code]\n xml.CountryCode value[:country_code]\n }\n elsif value.is_a?(Hash)\n xml.send \"#{camelize(key.to_s)}\" do |x|\n hash_to_xml(x, value)\n end\n elsif value.is_a?(Array)\n node = key\n value.each do |v|\n xml.send \"#{camelize(node.to_s)}\" do |x|\n hash_to_xml(x, v)\n end\n end\n else\n xml.send \"#{camelize(key.to_s)}\", value unless key.is_a?(Hash)\n end\n end\n end",
"title": ""
},
{
"docid": "e4b981afc41824a389985a542d0378fa",
"score": "0.5411941",
"text": "def generate_xml\n generate_xml_properties\n engine = Haml::Engine.new(\"\n%entry\n %category{:term => 'filter'}\n %title Mail Filter\n %content\n#{generate_haml_properties 1}\n\", :attr_wrapper => '\"')\n engine.render(self)\n end",
"title": ""
},
{
"docid": "9fae4d948189057f86b1b55f11531343",
"score": "0.5391069",
"text": "def pack(hash, root='opt')\n XmlSimple.xml_out(hash, noattr: true, rootname: root).strip!\n end",
"title": ""
},
{
"docid": "6a4a4cfea4e82a613dbf163364aa49db",
"score": "0.53144765",
"text": "def hash_to_xml_node(name,hash,doc)\n node = Nokogiri::XML::Node.new(name,doc)\n\n # if hash contains resourceType\n # create a child node with the name==resourceType\n # fill that, and place the child under the above `node`\n if hash['resourceType']\n child_name = hash['resourceType']\n hash.delete('resourceType')\n child = hash_to_xml_node(child_name, hash, doc)\n node.add_child(child)\n return node\n end\n\n hash.each do |key,value|\n next if(['extension','modifierExtension'].include?(name) && key=='url')\n next if(key == 'id' && !FHIR::RESOURCES.include?(name))\n if value.is_a?(Hash)\n node.add_child(hash_to_xml_node(key,value,doc))\n elsif value.is_a?(Array)\n value.each do |v|\n if v.is_a?(Hash)\n node.add_child(hash_to_xml_node(key,v,doc))\n else\n child = Nokogiri::XML::Node.new(key,doc)\n child.set_attribute('value',v)\n node.add_child(child)\n end\n end\n else\n child = Nokogiri::XML::Node.new(key,doc)\n if(name=='text' && key=='div')\n child.set_attribute('xmlns','http://www.w3.org/1999/xhtml')\n html = value.strip\n if html.start_with?('<div') && html.end_with?('</div>')\n html = html[html.index('>')+1..-7]\n end\n child.inner_html = html\n else\n child.set_attribute('value',value)\n end\n node.add_child(child)\n end\n end\n node.set_attribute('url', hash['url']) if ['extension','modifierExtension'].include?(name)\n node.set_attribute('id', hash['id']) if hash['id'] && !FHIR::RESOURCES.include?(name)\n node\n end",
"title": ""
},
{
"docid": "674fd093761238caa56bdf5d52461f1a",
"score": "0.5270729",
"text": "def build_from_hash( xml_builder, hash )\n # Loop XML schema for element key to get its child sequence\n hash.each do | key, value |\n if value.is_a? String or value.is_a? Float or value.is_a? Integer\n xml_builder.send( key, value )\n elsif value.is_a? Hash\n xml_builder.send( key ) { build_from_hash( xml_builder, value ) }\n elsif value.is_a? Array\n build_from_array( xml_builder, key, value )\n end\n \n end\n \n xml_builder\n end",
"title": ""
},
{
"docid": "be56c0b956b1bcc6fe63ccbca1829aab",
"score": "0.52477276",
"text": "def hash_to_xml_b(h)\n #puts \"Starting hash #{h.inspect}\"\n standard_keys = [:value,:text,:children,:required,:type, :attributes] #standard keys are keys that are not new elements, i.e. - instance variables of the element\n standard_keys_s = standard_keys\n standard_keys_s.map { |x| x.to_s}\n child_att_keys = [:children,:attributes]\n child_att_keys_s = child_att_keys\n child_att_keys_s.map { |x| x.to_s }\n #get keys\n #puts \"#{h}\"\n h.keys.each do |master_key|\n current_key = master_key\n #puts \"Current key #{current_key}\"\n if(current_key.to_s == \"HVACSystemType\" or current_key.to_s == \"HVACSystem\")\n #puts \"Working on hash #{h[current_key]}\"\n end\n if(standard_keys.include?(current_key))\n #THIS SHOULD NEVER HAPPEN\n #puts \"key of hash passed in is not a class definition. Seeing a standard\"\n elsif(current_key.to_s == \"Audits\")\n #puts \"Pass 1\"\n firstelement = Element.new(current_key.to_s)\n self.xmlDoc.add_element(firstelement)\n #puts \"Root: \" + xmlDoc.root.name\n self.mostRecentElement = firstelement \n hash_to_xml_b(h[current_key][:children]) #relies on a known structure for audits...no attributes expected #TODO add ID if desired\n else\n #puts \"Pass 2\"\n if (h[current_key].keys & [\"required\",\"value\"]).empty? #set intersection here assures we follwing the standard required, value, pattern i.e. it should be \":Audit\" => :required, :value, etc.\n #go down into the :value, whose only key should be the same (this is the fast forward point)\n if(h[current_key].has_key?(:type))\n self.hasType = true\n self.typeSub = current_key #this is for downstream children\n #puts \"Contains a type. Will replace downstream children with #{current_key}\"\n end\n if(not h[current_key][:value].is_a?(Array))\n if(h[current_key][:value].keys[0]) == current_key #first match\n #puts \"Fast Forward Match as expected\"\n #this is new, build the element right now\n if(self.hasType)\n #puts \"Has a type.\"\n #puts \"Making element #{self.typeSub}\"\n newelement = Element.new(self.typeSub)\n self.mostRecentElement.add_element(newelement)\n self.mostRecentElement = newelement\n\n #self.hasType = false\n #self.typeSub = \"\"\n else\n #puts \"Making element #{current_key.to_s}\"\n newelement = Element.new(current_key.to_s)\n self.mostRecentElement.add_element(newelement)\n self.mostRecentElement = newelement\n #puts \"Made normal element #{current_key}\"\n end\n #fast forward into this object\n inner = h[current_key][:value][current_key] #puts me one nest in, at { :children :attributes}\n #puts \"Inner is #{inner}\"\n child_keys = inner.keys\n #puts child_keys\n if(child_keys.include?(:text))\n self.mostRecentElement.text = inner[:text]\n end\n if(child_keys.include?(:attributes))\n #make the attributes right away on the elment created a few lines above\n attr_hash = inner[:attributes]\n good_hash = make_rexml_att_hash(attr_hash)\n #puts good_hash\n self.mostRecentElement.add_attributes(good_hash)\n \n end\n\n if(child_keys.include?(:children))\n hash_to_xml_b(inner[:children])\n self.mostRecentElement = self.mostRecentElement.parent\n else\n #puts \"No remaining children.\"\n self.mostRecentElement = self.mostRecentElement.parent\n end\n \n end\n else\n #it is an array\n #puts \"Array, working on value array\"\n h[current_key][:value].each do |elArr|\n current_key = elArr.keys[0] #we are assuming here that the key is of the not standard variety\n #puts \"Current key: #{current_key}\"\n #puts \"Base type: #{self.baseType}\"\n #puts elArr\n if(self.hasType)\n self.baseType = current_key.to_s\n #puts \"Array item is a type, will use #{self.typeSub}\"\n newelement = Element.new(self.typeSub.to_s)\n self.mostRecentElement.add_element(newelement)\n self.mostRecentElement = newelement\n child_keys = elArr[current_key].keys\n #puts \"Child keys #{child_keys}\"\n if(child_keys.include?(:attributes))\n #puts \"Array item has attributes\"\n #make the attributes right away on the elment created a few lines above\n attr_hash = elArr[current_key][:attributes]\n good_hash = make_rexml_att_hash(attr_hash)\n #puts good_hash\n self.mostRecentElement.add_attributes(good_hash)\n end\n self.hasType = false #this is important and is required for nested structures to properly serialize from nested hashes\n else\n if (current_key.to_s == \"HVACSystemType\")\n #puts \"Array Item May or May not be a type.\"\n #puts current_key\n end\n if(current_key.to_s == self.baseType.to_s)\n #puts \"Using #{self.typeSub.to_s}\"\n newelement = Element.new(self.typeSub.to_s)\n else\n #puts \"#{current_key.to_s} Didnt match basetype #{self.baseType.to_s}\"\n if(current_key.to_s == \"HVACSystemType\")\n newelement = Element.new(\"HVACSystem\") #TODO: Improve\n else\n newelement = Element.new(current_key.to_s)\n end\n end\n self.mostRecentElement.add_element(newelement)\n self.mostRecentElement = newelement\n child_keys = elArr[current_key].keys\n if(child_keys.include?(:attributes))\n #puts \"Array item has attributes\"\n #make the attributes right away on the elment created a few lines above\n attr_hash = elArr[current_key][:attributes]\n #puts attr_hash\n good_hash = make_rexml_att_hash(attr_hash)\n #puts good_hash\n self.mostRecentElement.add_attributes(good_hash)\n end\n\n end\n if(child_keys.include?(:text))\n self.mostRecentElement.text = elArr[current_key][:text]\n end\n if(child_keys.include?(:children))\n self.hasType = false\n #self.typeSub = \"\"\n hash_to_xml_b(elArr[current_key][:children])\n self.mostRecentElement = self.mostRecentElement.parent\n else\n #puts \"No remaining children.\"\n #self.hasType = false\n #self.typeSub = \"\" \n self.mostRecentElement = self.mostRecentElement.parent\n end\n end\n #puts \"Ending array for loop\"\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "48e02c70c7209e12c9959ad2687b22ff",
"score": "0.521865",
"text": "def iterate_with_xml(array, key, attributes, options, &block)\n xml = Builder::XmlMarkup.new\n unwrap = unwrap?(options.fetch(:unwrap, false), key)\n\n if unwrap\n xml.tag!(key, attributes) { iterate_array(xml, array, attributes, &block) }\n else\n iterate_array(xml, array, attributes, &block)\n end\n\n xml.target!\n end",
"title": ""
},
{
"docid": "cf6f55fd73105b39e298d0735538b901",
"score": "0.52128494",
"text": "def initialize(*specs)\n raise \"No XML spec files.\" if specs.empty?\n xml=get_root(specs.shift)\n specs.each { |s| xml_merge(xml, get_root(s)) }\n @used_by=Hash.new{ |h,k| h[k]=[] }\n super(xml, nil)\n end",
"title": ""
},
{
"docid": "8518a45239b3cff9397adaa34006e77c",
"score": "0.5203676",
"text": "def each_xml\n self.class.attribute_tags_names.each do |tag, names|\n set = names.each_with_object({}) { |name, set| set[name.camelcase(:lower)] = send(name) }\n set.delete_if { |name, value| value == nil }\n if not set.empty?\n elt = REXML::Element.new(tag)\n elt.add_attributes(set)\n yield elt\n end\n end\n self.class.property_names.each do |name|\n if (value = send(name)) != nil\n elt = REXML::Element.new('apps:property')\n elt.add_attributes('name' => name.camelcase(:lower), 'value' => value)\n yield elt\n end\n end\n end",
"title": ""
},
{
"docid": "7984222889b3c8983bd7a128b88122c9",
"score": "0.52003735",
"text": "def xml_vars_for_hash(builder, hash)\n hash.each do |k,v|\n if v.is_a?(Hash)\n builder.var(:key => k.to_s) { |b| xml_vars_for_hash(b, v) }\n else\n builder.var(v.to_s, :key => k.to_s)\n end\n end\n end",
"title": ""
},
{
"docid": "4f9fcc18d317085a63b655bb70ca979e",
"score": "0.51841515",
"text": "def build\n xml.instruct!(\n :xml,\n :version => '1.0',\n :encoding => 'UTF-8',\n :standalone => 'yes'\n )\n\n xml.KAF('xml:lang' => language, 'version' => version) do |node|\n node.raw(original_text)\n end\n end",
"title": ""
},
{
"docid": "791f206ff1c4ed0f367fd15fd90497de",
"score": "0.5159152",
"text": "def build_xml(xml)\n attrs = attributes\n text = attrs.delete(ATNA::Utils::XmlBuilder::Base::TEXT_KEY)\n\n xml.send(element_name, text, attrs) do\n sorted_children.each do |element|\n element.to_xml(xml)\n end\n end\n end",
"title": ""
},
{
"docid": "b085b062ba8d9a2e270669c59e268c09",
"score": "0.51221246",
"text": "def hash_to_xml(hash)\n hash.map do |k, v|\n text = (v.is_a? Hash) ? hash_to_xml(v) : v\n # It removes the digits at the end of each \"DonationItem\" hash key\n xml_elem = (v.is_a? Hash) ? k.to_s.gsub(/(\\d)/, \"\") : k\n \"<%s>%s</%s>\" % [xml_elem, text, xml_elem]\n end.join\n end",
"title": ""
},
{
"docid": "f4c622803b535bf63697173f3fe84559",
"score": "0.51209307",
"text": "def hash_to_xml_node(name, hash, doc)\n node = Nokogiri::XML::Node.new(name, doc)\n\n # if hash contains resourceType\n # create a child node with the name==resourceType\n # fill that, and place the child under the above `node`\n if hash['resourceType'] && hash['resourceType'].is_a?(String) && name != 'instance'\n child_name = hash['resourceType']\n hash.delete('resourceType')\n child = hash_to_xml_node(child_name, hash, doc)\n node.add_child(child)\n return node\n end\n\n hash.each do |key, value|\n next if %w[extension modifierExtension].include?(name) && key == 'url'\n next if key == 'id' && !FHIR::RESOURCES.include?(name)\n if value.is_a?(Hash)\n node.add_child(hash_to_xml_node(key, value, doc))\n elsif value.is_a?(Array)\n value.each do |v|\n if v.is_a?(Hash)\n node.add_child(hash_to_xml_node(key, v, doc))\n else\n child = Nokogiri::XML::Node.new(key, doc)\n child.set_attribute('value', v)\n node.add_child(child)\n end\n end\n else\n child = Nokogiri::XML::Node.new(key, doc)\n if name == 'text' && key == 'div'\n child.set_attribute('xmlns', 'http://www.w3.org/1999/xhtml')\n html = value.strip\n if html.start_with?('<div') && html.end_with?('</div>')\n html = html[html.index('>') + 1..-7]\n end\n child.inner_html = html\n else\n child.set_attribute('value', value)\n end\n node.add_child(child)\n end\n end\n node.set_attribute('url', hash['url']) if %w[extension modifierExtension].include?(name)\n node.set_attribute('id', hash['id']) if hash['id'] && !FHIR::RESOURCES.include?(name)\n node\n end",
"title": ""
},
{
"docid": "e2f4eb3a6ee3b5f178583eef7b6680b5",
"score": "0.50586987",
"text": "def xml_hash(xml)\n nori = Nori.new(strip_namespaces: true, :convert_tags_to => lambda { |tag| tag.snakecase.to_sym })\n nori.parse(xml)\n end",
"title": ""
},
{
"docid": "48973fad1a2c1fa8307ec8182055df1d",
"score": "0.50503504",
"text": "def build_xml_from(hash, namespace = nil)\n doc = Nokogiri::XML::Document.new\n doc.encoding = \"UTF-8\"\n\n root_key = hash.keys.first\n root = Nokogiri::XML::Element.new root_key.to_s, doc\n root[\"xmlns\"] = namespace if namespace\n\n doc << root\n\n build_body root, hash[root_key]\n\n doc.to_s\n end",
"title": ""
},
{
"docid": "73bae5bef0345f31bb8974c5a76dc125",
"score": "0.502183",
"text": "def test_xml_templates_are_unmodified\n sha1 = OpenSSL::Digest::SHA1.new\n\n get_user_info_template = File.read(\n \"#{@xml_templates_path}/get_user_info.xml\"\n )\n\n download_file_list_template = File.read(\n \"#{@xml_templates_path}/download_file_list.xml\"\n )\n\n download_file_template = File.read(\n \"#{@xml_templates_path}/download_file.xml\"\n )\n\n upload_file_template = File.read(\n \"#{@xml_templates_path}/upload_file.xml\"\n )\n\n get_user_info_digest = Base64.encode64(\n sha1.digest(get_user_info_template)\n ).strip\n\n sha1.reset\n\n download_file_list_digest = Base64.encode64(\n sha1.digest(download_file_list_template)\n ).strip\n\n sha1.reset\n\n download_file_digest = sha1.digest(download_file_template)\n\n sha1.reset\n\n upload_file_digest = sha1.digest(upload_file_template)\n\n assert_equal get_user_info_digest, \"LW5J5R7SnPFPurAa2pM7weTWL1Y=\"\n\n assert_equal download_file_list_digest.strip,\n \"th8mrSmKhsMvxn4OMvUv9JjIL7Q=\"\n\n assert_equal Base64.encode64(download_file_digest).strip,\n \"lY+8u+BhXlQmUyQiOiXcUfCUikc=\"\n\n assert_equal Base64.encode64(upload_file_digest).strip,\n \"zRQTrNHkq4OLSX3u3ogxU05RJsI=\"\n end",
"title": ""
},
{
"docid": "ab0f24fa05ce2638c3d6c239c39dbb7c",
"score": "0.5020157",
"text": "def call\n %Q(\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <FictionBook xmlns=\"http://www.gribuser.ru/xml/fictionbook/2.0\" xmlns:l=\"http://www.w3.org/1999/xlink\">\n <description>\n <title-info>\n <book-title>#{title}</book-title>\n <coverpage>#{coverpage}</coverpage>\n </title-info>\n </description>\n <body>\n #{ xml_title(title) }\n #{ xml_sections_str }\n #{ xml_binary_data }\n </body>\n </FictionBook>\n )\n end",
"title": ""
},
{
"docid": "b1a9f3785c8359be8926af17f5d51133",
"score": "0.5012351",
"text": "def property_xml(xml)\n props = properties.keys.map(&method(:send)).compact\n return if props.none?(&:render?)\n\n props.each { |prop| prop.to_xml(xml) }\n end",
"title": ""
},
{
"docid": "574309a3a30a9f43d78fd8fd0c99ed13",
"score": "0.49975827",
"text": "def call\n with_outer_tag = Hash.from_xml(data)\n with_inner_tag = with_outer_tag&.values&.first\n without_inner_tag = with_inner_tag&.values&.first&.compact || []\n without_inner_tag = [without_inner_tag] if without_inner_tag.is_a?(Hash)\n without_inner_tag\n end",
"title": ""
},
{
"docid": "ae62f94a9f2dee94d5ee7757f7390551",
"score": "0.4979402",
"text": "def weixin_xml\n template_xml = <<Text\n<item>\n <Title><![CDATA[#{title}]]></Title>\n <Description><![CDATA[#{description}]]></Description>\n <PicUrl><![CDATA[#{pic_url}]]></PicUrl>\n <Url><![CDATA[#{url}]]></Url>\n</item> \nText\n end",
"title": ""
},
{
"docid": "b385e27a0d59ce8393c7d20fc78f1790",
"score": "0.49718246",
"text": "def emit(attributes, node)\n attributes.each do |k,v|\n child_node = REXML::Element.new(k.to_s, node)\n (v.respond_to? 'each_key') ? emit(v, child_node) : child_node.add_text(v.to_s)\n end\n end",
"title": ""
},
{
"docid": "31ca13b9fa07bb5b532ef9f696bf22ad",
"score": "0.49404398",
"text": "def initialize(node, *args)\n @element = if node.is_a?(REXML::Element)\n node\n else \n REXML::Element.new(node) \n end\n \n @child_nodes = {}\n \n if attributes = args.last.is_a?(Hash) ? args.pop : nil\n attributes.each { |k,v| @element.add_attribute(k.to_s, v.to_xml_value) }\n end\n \n if !args[0].nil?\n @element.text = args[0].to_xml_value\n end\n\n if block_given? \n yield self \n end\n end",
"title": ""
},
{
"docid": "7e662666e7fe874b3e3c20bef2fcc0d0",
"score": "0.4935108",
"text": "def shared_strings\n Builder::XmlMarkup.new.sst(:xmlns => \"http://schemas.openxmlformats.org/spreadsheetml/2006/main\") do |xsst|\n @ss.keys.each do |str|\n xsst.si do |xsi|\n xsi.t(str)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "a88e9a66c55675b22c6eabf94d37f896",
"score": "0.4924384",
"text": "def parse_xml(txt_or_hash)\n tree = txt_or_hash.kind_of?(Hash) ? txt_or_hash : Hash.from_xml(txt_or_hash).with_indifferent_access\n\n messages = ((tree || {})[:messages] || {})[:message]\n messages = [messages] if messages.class <= Hash\n\n (messages || []).each do |elem|\n next if elem.kind_of? String\n\n msg = self.new\n msg.from = elem[:from]\n msg.to = elem[:to]\n msg.body = elem[:text]\n msg.guid = elem[:id] if elem[:id].present?\n msg.timestamp = Time.parse(elem[:when]) if elem[:when] rescue nil\n\n properties = elem[:property]\n if properties.present?\n properties = [properties] if properties.class <= Hash\n properties.each do |prop|\n if prop[:name] == 'token'\n msg.token = prop[:value]\n else\n msg.custom_attributes.store_multivalue prop[:name], prop[:value]\n end\n end\n end\n\n yield msg\n end\n end",
"title": ""
},
{
"docid": "79ee8ed580009757df0c3e55f6028e9c",
"score": "0.48665616",
"text": "def _hashToXml(request)\n data = ''\n request.each do |key, value|\n if value != ''\n # Open Tag\n data = data + \"<#{key}>\"\n # Check whether value is still a hash\n if value.class == Hash\n value = _hashToXml(value)\n end\n # Add data\n data = data + \"#{value}\"\n # Close Tag\n data = data + \"</#{key}>\"\n end\n end\n return data\n end",
"title": ""
},
{
"docid": "513dbbe16e2d4f0b5b67a5ed175a9907",
"score": "0.48480406",
"text": "def xml_elems(root, elems)\n\t\t\txml = REXML::Element.new(root)\n\t\t\telems.each do |key, val|\n\t\t\t\te = xml.add_element(key)\n\t\t\t\te.text = val\n\t\t\tend\n\t\t\treturn xml.to_s\n\t\tend",
"title": ""
},
{
"docid": "f89393f12df14777288349acd8d8a809",
"score": "0.48421103",
"text": "def create_typed_attributes_from_xml(attributes)\n filter_attributes_for(attributes, xml_typed_entities) do |name, options|\n item = attributes.delete(name) # attributes[:sum]\n item = options[:class].from_xml_attributes(item) # Sum.from_xml_attributes\n # DISCUSS: we could also run a hook here.\n attributes[name] = item\n end\n end",
"title": ""
},
{
"docid": "4429dfe993caed5dff66b92aa0aade50",
"score": "0.48393396",
"text": "def create_typed_attributes_from_xml(attributes)\n filter_attributes_for(attributes, self.class.xml_typed_entities) do |name, options|\n item = attributes.delete(name) # attributes[:sum]\n item = options[:class].from_xml_attributes(item) # Sum.from_xml_attributes\n # DISCUSS: we could also run a hook here.\n attributes[name] = item\n end\n end",
"title": ""
},
{
"docid": "2be6ca1b2a0c3089e35d74894e356a6a",
"score": "0.48226836",
"text": "def xml_merge(to,from)\n from.elements.each { |from_child|\n tag,name = from_child.name, from_child.attributes[\"name\"]\n to_child=to.elements[\"./#{tag}[@name='#{name}']\"]\n to_child ? xml_merge(to_child, from_child) : to.add(from_child.deep_clone) }\n end",
"title": ""
},
{
"docid": "60b01e7dffc5b8c9200324bc9e2f862a",
"score": "0.48176584",
"text": "def to_xml\n Hash::XML.to_xml(self)\n end",
"title": ""
},
{
"docid": "6825291bcf8bb3f60b5dad5c29f982d3",
"score": "0.48041317",
"text": "def convert_to_xml_attributes(hash)\n result = {}\n hash.each do |k, v|\n key = k.to_s.gsub('_', '-').to_sym\n result[key] = v\n end\n result\n end",
"title": ""
},
{
"docid": "d03b1363737089fb50ddf9018ff9c711",
"score": "0.47913745",
"text": "def xml(results)\n xml = Builder::XmlMarkup.new( :indent => 2)\n xml.instruct!\n xml.document do |d|\n d.head do |h|\n h.style '.longDescriptionLayout { max-width: 1280; }'\n end\n d.searchTemplate do |f|\n f.searchField('Enter Zipcode', :keyboardType => 'numberPad', :id => 'zipcode')\n f.collectionList do |col|\n col.shelf do |sh|\n sh.header do |h|\n h.title 'Results'\n end\n sh.section do |sec|\n results.each do |result|\n if result[:movie]\n blob = {title: \"UMC Bootcamps\",\n subtitle: \"no workout is the same\",\n description: \"\",\n artworkImageURL: \"\",\n contentRatingDomain: \"movie\",\n contentRatingRanking: 400,\n url: \"https://s3.amazonaws.com/gympasstv/umc/640/prog.m3u8\" }\n sec.lockup(:class => 'play', :data => blob.to_json) do |lck|\n lck.img(:src => result[:img], :width => 500, :height => 281)\n lck.title result[:title]\n end\n elsif result[:link]\n sec.lockup(:class => 'link', :data => result[:link]) do |lck|\n lck.img(:src => result[:img], :width => 500, :height => 281)\n lck.title result[:title]\n end\n else\n sec.lockup do |lck|\n lck.img(:src => result[:img], :width => 350, :height => 520)\n lck.title result[:title]\n end\n end\n end\n end\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "904fb8a6913da4be6a31038d278eb101",
"score": "0.4783227",
"text": "def to_xml\n pairs = []\n\n [:version, :encoding, :standalone].each do |getter|\n value = send(getter)\n\n pairs << %Q{#{getter}=\"#{value}\"} if value\n end\n\n return \"<?xml #{pairs.join(' ')} ?>\"\n end",
"title": ""
},
{
"docid": "904fb8a6913da4be6a31038d278eb101",
"score": "0.4783227",
"text": "def to_xml\n pairs = []\n\n [:version, :encoding, :standalone].each do |getter|\n value = send(getter)\n\n pairs << %Q{#{getter}=\"#{value}\"} if value\n end\n\n return \"<?xml #{pairs.join(' ')} ?>\"\n end",
"title": ""
},
{
"docid": "70eb23d3eace6ac2f508a6d9d8a55a32",
"score": "0.47705862",
"text": "def _to_xml!(*args)\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\"+\n \"#{_to_xml(*args)}\"\n end",
"title": ""
},
{
"docid": "119b097bcafd7dd7eb78cc3bd1d3348c",
"score": "0.47652358",
"text": "def build_xml(data)\r\n run_xml = build_run_xml(data)\r\n gpx_xml = build_gpx_xml(data)\r\n return run_xml, gpx_xml\r\n end",
"title": ""
},
{
"docid": "50cde67c990f1881e3682c0957b71dc5",
"score": "0.4765124",
"text": "def from_xml(xml)\n Hash::XML.from_xml(self, xml)\n end",
"title": ""
},
{
"docid": "b919ada230df34282d416d4b641bafec",
"score": "0.47621787",
"text": "def initialize(xml_hash)\n @xml_hash = xml_hash\n end",
"title": ""
},
{
"docid": "9dd4fe3c09fe33048abe1d41e4e63de6",
"score": "0.47621202",
"text": "def from_xml(xml)\n self.assign_with(Hash.new.from_xml(xml))\n end",
"title": ""
},
{
"docid": "476c041e7ed6db954053779c8d88156e",
"score": "0.47616014",
"text": "def generatexml()\n merge(generatexml: 'true')\n end",
"title": ""
},
{
"docid": "476c041e7ed6db954053779c8d88156e",
"score": "0.47616014",
"text": "def generatexml()\n merge(generatexml: 'true')\n end",
"title": ""
},
{
"docid": "fff6de2091a26d21b7a1903d6925d548",
"score": "0.47577882",
"text": "def build_dif( dif_hash = data_hash )\n unless dif_hash.nil?\n #dif_hash = sync_with_template( dif_hash, hash_template )\n # screws dta set citation\n build_xml( dif_hash )\n else\n raise ArgumentError, \"No data provided\"\n end\n end",
"title": ""
},
{
"docid": "9c46be6037c9490dbad71c57adc2cc36",
"score": "0.47573793",
"text": "def to_xml\n @other_xml ||= Gyoku.xml(hash)\n\n xml = \"\"\n\n if ws_addressing?\n xml += Gyoku.xml wsa_element(\"Action\", action).merge!(hash)\n xml += Gyoku.xml wsa_element(\"MessageID\", message_id).merge!(hash)\n xml += Gyoku.xml wsa_element(\"ReplyTo\", reply_to, \"Address\").merge!(hash)\n xml += Gyoku.xml wsa_element(\"To\", to).merge!(hash)\n end\n\n xml + @other_xml\n end",
"title": ""
},
{
"docid": "ccb254aad2fb5e400650c0082f5f063e",
"score": "0.47570425",
"text": "def build_xml\n struct = to_struct\n binding.pry\n Nokogiri::XML::Builder.new do |xml|\n xml.manuscript(url: struct.url) {\n xml.title struct.title\n xml.shelfmark struct.shelfmark\n xml.quires {\n struct.quires.each do |q|\n xml.quire(n: q.n) {\n q.units.each do |u|\n xml.unit {\n u.leaves.each do |leaf|\n xml.leaf leaf.to_h\n end\n } # xml.unit\n end\n } # xml.quire\n end\n } # xml.quires\n } # xml.manuscript\n end\n end",
"title": ""
},
{
"docid": "5da4f1ec9b875e69faf53ed43b6815a8",
"score": "0.47551137",
"text": "def _gestalt_build_tag(name, attr = {}, text = [])\n @out << \"<#{name}\"\n @out << attr.map{|k,v| %[ #{k}=\"#{_gestalt_escape_entities(v)}\"] }.join\n if text != [] or block_given?\n @out << \">\"\n @out << _gestalt_escape_entities([text].join)\n if block_given?\n text = yield\n @out << text.to_str if text != @out and text.respond_to?(:to_str)\n end\n @out << \"</#{name}>\"\n else\n @out << ' />'\n end\n end",
"title": ""
},
{
"docid": "b284e37052dd8f542e7e61d03dee3360",
"score": "0.47517985",
"text": "def generate_normalized_xml( xml_or_hash )\n xml = nil\n if xml_or_hash.is_a?( Hash )\n hash = xml_or_hash\n raise 'error' if hash.keys.size != 1\n root = hash.keys.first\n xml = hash[root].to_xml( root: root )\n end\n\n normalize_xml( xml )\n end",
"title": ""
},
{
"docid": "fb12a7a4cad877efb914a4b4fc88808e",
"score": "0.47515061",
"text": "def xml_fragment(*args, &block); end",
"title": ""
},
{
"docid": "fb12a7a4cad877efb914a4b4fc88808e",
"score": "0.47515061",
"text": "def xml_fragment(*args, &block); end",
"title": ""
},
{
"docid": "fb12a7a4cad877efb914a4b4fc88808e",
"score": "0.47515061",
"text": "def xml_fragment(*args, &block); end",
"title": ""
},
{
"docid": "4cbbf0f019ace83a67b823db76732f20",
"score": "0.474975",
"text": "def to_xml\n\n xml = REXML::Element.new('track')\n \n ELEMENTS.each do |element|\n # TODO Sure there is a nicer way to do evaluate this condition...\n unless eval('@' + element.downcase + '.nil?')\n el = REXML::Element.new(element)\n el.add_text( eval('@' + element.downcase) )\n xml.add_element(el)\n end \n end\n\n ATTRIBUTE_AND_ELEMENT.each do |ae|\n # TODO Sure there is a nicer way to do evaluate this condition...\n unless eval('@' + ae.downcase + '_rel.nil? && @'+ ae.downcase + '_content.nil?')\n el = REXML::Element.new(ae.downcase)\n el.add_attribute('rel', eval('@' + ae.downcase + '_rel') )\n el.add_text( eval('@' + ae.downcase + '_content') )\n xml.add_element(el)\n end \n end\n\n xml.to_s\n \n end",
"title": ""
},
{
"docid": "4a961707f2619dd966427546057961f3",
"score": "0.47477168",
"text": "def render_users_xml(userlist)\n builder do |xml|\n xml.instruct!\n xml.users do\n userlist.each do |user|\n xml.user :id => user.id do\n xml.username user.username\n xml.displayname user.displayname\n xml.headendID user.headendID\n @sections = get_sections_for_user(user.id)\n @sections.each do |section|\n xml.section :id => section.id do\n xml.userId section.userId\n xml.title section.title\n xml.shows section.shows\n xml.actors section.actors\n end\n end\n end\n end\n end\n end\nend",
"title": ""
},
{
"docid": "751be9478056cc19ca91a4809dc089f7",
"score": "0.4743575",
"text": "def import_hash hashtree\n\tLogger.send(\"warn\",\"[Tetrawin] Start XML(hash) import\")\n\t@result[:description] << \"[Tetrawin] Start XML(hash) import\"\n # Create and list new goods\n hashtree[\"BIEN\"].each { |b|\n import_bien b\n }\n\t\n\tLogger.send(\"warn\",\"[Tetrawin] End XML import\")\n\t@result[:description] << \"[Tetrawin] End XML import\"\n return true\n end",
"title": ""
},
{
"docid": "19f268fad85c4e671d019a799ef14666",
"score": "0.4739845",
"text": "def writeXml(node,treeHash)\n die(\"writeXml: Node #{node} is not a REXML::Element\") unless (node.class.to_s == \"REXML::Element\")\n die(\"writeXml: Hash #{treeHash} is not a Hash\") unless (treeHash.class.to_s == \"Hash\")\n tag=\"\"\n text=\"\"\n attributes=Hash.new()\n grandChildren=Hash.new()\n #------------------------------\n # Uebergabe-Hash analysieren und Wertelisten aufbauen\n #------------------------------\n treeHash.each{ |key,value|\n case key\n when TAG then tag=value\n when TEXT then text=value\n else \n if(key.match(/child/))\n die(\"writeXml: Hash #{value} for key #{key} is not a Hash\") unless (value.class.to_s == \"Hash\")\n grandChildren[key]=value\n else\n die(\"writeXml: Hash-key #{key} is not a String\") unless (key.class.to_s == \"String\")\n die(\"writeXml: Hash-Value #{value} for key #{key} is not a String\") unless (value.class.to_s == \"String\")\n attributes[key]=value\n end\n end\n }\n #------------------------------\n # Kind-Element schreiben ...\n #------------------------------\n die(\"writeXml: Missing Tag for XML-Tree\") unless (tag != \"\")\n child=node.add_element(tag,attributes)\n child.text=text unless (text == \"\")\n #------------------------------\n # ... und Enkel ebenfalls rekursiv schreiben\n #------------------------------\n grandChildren.each{ |key,hash|\n writeXml(child,hash) # hash wurde oben bereits als Typ Hash verifiziert\n }\n return child\n end",
"title": ""
},
{
"docid": "63cd4c3011f0e4eeafbeccc333c73297",
"score": "0.47373715",
"text": "def create_all_nodes(combo_list)\n #find all tags\n depth = 0\n #For each element in the combo list \n #(which has both tags and text)\n #check if its a tag...if yes, create node\n combo_list.each do |tag|\n if tag.match(TAG_OPEN_REGEX)\n @nodes_array << set_attributes(create_new_node(tag, depth))\n #create a new node for the tag w/attributes\n #pass the new node to set_tag_attributes method\n #returns a new node with all attributes\n #set tag depth\n depth += 1\n else\n #else should be grabbing the text tags\n @nodes_array << create_new_node(tag, depth)\n depth -=1 \n end \n end\n end",
"title": ""
},
{
"docid": "0be869cb2f7a54488bcd21f65e7039dc",
"score": "0.4723555",
"text": "def xml_tag(opts={})\n \"<?xml\" + opts.map{ |k,v| %| #{k}=#{v.inspect}| }.join(\"\") + \" ?>\"\n end",
"title": ""
},
{
"docid": "b78a766bb12848eaddee5fffd6e72aae",
"score": "0.47229093",
"text": "def import_hash hashtree\n\tLogger.send(\"warn\",\"[Adaptimmo] Start XML(hash) import\")\n\t@result[:description] << \"[Adaptimmo] Start XML(hash) import\"\n\n # Create and list new goods\n hashtree[\"adapt_xml\"][\"annonce\"].each { |b|\n import_bien b\n }\n\t\n\tLogger.send(\"warn\",\"[Adaptimmo] End XML import\")\n\t@result[:description] << \"[Adaptimmo] End XML import\"\n return true\n end",
"title": ""
},
{
"docid": "29ec33908b2327c146ce96295cff68cb",
"score": "0.47205913",
"text": "def run_xml(xml)\n if (self.instance_values.keys & INLINE_STYLES).size > 0\n xml.r {\n xml.rPr {\n xml.rFont(:val=>@font_name) if @font_name\n xml.charset(:val=>@charset) if @charset\n xml.family(:val=>@family) if @family\n xml.b(:val=>@b) if @b\n xml.i(:val=>@i) if @i\n xml.strike(:val=>@strike) if @strike\n xml.outline(:val=>@outline) if @outline\n xml.shadow(:val=>@shadow) if @shadow\n xml.condense(:val=>@condense) if @condense\n xml.extend(:val=>@extend) if @extend\n @color.to_xml(xml) if @color\n xml.sz(:val=>@sz) if @sz\n xml.u(:val=>@u) if @u\n # :baseline, :subscript, :superscript\n xml.vertAlign(:val=>@vertAlign) if @vertAlign\n # :none, major, :minor\n xml.scheme(:val=>@scheme) if @scheme\n }\n xml.t @value.to_s\n }\n else\n xml.t @value.to_s\n end\n end",
"title": ""
},
{
"docid": "4e8b415280fc7e565351f5f57dff4249",
"score": "0.47193888",
"text": "def xml\n obj = {}\n seqOb = Sequence.where('sequenceName' => params[:sequenceName]).to_a[0]\n obj['gameName'] = seqOb['gameName']\n obj['levels'] = seqOb['levels']\n obj['sequenceName'] = seqOb['sequenceName']\n render :xml => \"<hash>\"+ create_xml(obj, '')+ \"</hash>\\n\"\n end",
"title": ""
},
{
"docid": "1d415d9e3a0776ea2399373d491f78e1",
"score": "0.471775",
"text": "def xml_data\n @xml = @job.xml\n 2.times { clean_xml }\n @xml.gsub!(/<\\?xml version=\"1.0\" encoding=\"utf-8\"\\?>/,'')\n return \"<gubs>#{@xml}</gubs>\"\n end",
"title": ""
},
{
"docid": "7590e6e88c66e2fa58856125117ec6a2",
"score": "0.47148764",
"text": "def get_attrs(doc)\n attrs = {}\n a1 = get_attrs_by_xpath(doc, \"//*[@id='content']/p2\") ; #puts a1; puts \"-----1\";\n a2 = get_attrs_by_xpath(doc, \"//*[@id='content']/p\") ; #puts a2; puts \"-----2\";\n a3 = get_attrs_by_xpath(doc, \"//*[@id='content']\") ; #puts a3; puts \"-----3\";\n \n attrs.merge!(a2) if a2\n attrs.merge!(a3) if a3\n attrs.merge!(a1) if a1 # NOTE: /p2 is targetted node for data collecting, better formatted than other nodes\n attrs\n \n \nend",
"title": ""
},
{
"docid": "ee4f8c285868755a46b8125a1e0d9864",
"score": "0.4707139",
"text": "def parse_xml(text)\n hash = XmlSimple.xml_in(text,'KeepRoot'=>true,'ContentKey'=>CONTENT_KEY)\n if @verbose\n puts \"XmlSimple parsed as:\"\n puts JSON.pretty_generate(hash)\n end\n\n hash2 = {}\n hash.each do |key,inner_list|\n hash2 = inner_list[0]\n hash2['!'] = key\n end\n rewrite_value_from_xml(hash2)\n end",
"title": ""
},
{
"docid": "aa0245fae4195bed2193bb12b1554340",
"score": "0.47054496",
"text": "def xml(co_elem) \n meta = {\"container\"=>co_elem.add_element(\"ctx:\"+@label)}\n\n if @metadata.length > 0 or @format\n meta[\"metadata-by-val\"] = meta[\"container\"].add_element(\"ctx:metadata-by-val\")\n if @format \n meta[\"format\"] = meta[\"container\"].add_element(\"ctx:format\")\n meta[\"format\"].text = \"info:ofi/fmt:xml:xsd:\"+@format\n end\n if @metadata.length > 0\n meta[\"metadata\"] = meta[\"metadata-by-val\"].add_element(\"ctx:metadata\")\n @metadata.each do |k,v|\n (Array === v ? v : [v]).each {|val|\n meta[k] = meta[\"metadata\"].add_element(\"ctx:\"+k)\n meta[k].text = val\n }\n end\n end\n end\n if @reference[\"format\"] \n meta[\"metadata-by-ref\"] = meta[\"container\"].add_element(\"ctx:metadata-by-ref\")\n meta[\"ref_format\"] = meta[\"metadata-by-ref\"].add_element(\"ctx:format\")\n meta[\"ref_format\"].text = @reference[\"format\"]\n meta[\"ref_loc\"] = meta[\"metadata-by-ref\"].add_element(\"ctx:location\")\n meta[\"ref_loc\"].text = @reference[\"location\"] \n end\n \n @identifiers.each do |id|\n # Yes, meta[\"identifier\"] will get over-written if there's more than\n # one identifier. But I dont' think this meta hash is used for much\n # I don't think it's a problem. -JR \n meta[\"identifier\"] = meta[\"container\"].add_element(\"ctx:identifier\")\n meta[\"identifier\"].text = id\n end\n if @private_data\n meta[\"private-data\"] = meta[\"container\"].add_element(\"ctx:private-data\")\n meta[\"private-data\"].text = @private_data\n end \n return co_elem\n end",
"title": ""
},
{
"docid": "1613a086c8b87a2639c642340f91c325",
"score": "0.4693561",
"text": "def start_tag(name, hash)\n hash.inject(\"<#{name}\"){|s,(k,v)| s << \" #{k}='#{v}'\" }\n end",
"title": ""
},
{
"docid": "60cf1d6684fb7ec8f7c52703b7f14e33",
"score": "0.46919057",
"text": "def initialize(hash={}, &block)\n @xmlns = XMLNS\n @xmlns_xsi = XMLNS_XSI\n @xsi_schema_location = xsi_schema_location\n @pepxml_version = PEPXML_VERSION\n merge!(hash, &block)\n end",
"title": ""
},
{
"docid": "f8bfc15d138103faab04448ba2e181c8",
"score": "0.46884608",
"text": "def scanXml(xml)\n setId(xml.attribute(\"id\").to_s) ;\n setFromToNode(xml.attribute(\"from\").to_s,\n xml.attribute(\"to\").to_s) ;\n setLength(xml.attribute(\"length\").to_s.to_f) ;\n setWidth(xml.attribute(\"width\").to_s.to_f) ;\n xml.each_element(\"tag\"){|elm|\n addTag(elm.texts.join()) ;\n }\n return self ;\n end",
"title": ""
},
{
"docid": "ef45706d462742869b762e2adabe13fb",
"score": "0.46821547",
"text": "def test_flatten\r\n xx = Ziya::Components::ChartGridH.new\r\n xx.thickness = 1\r\n xx.color = \"ff00ff\"\r\n xx.alpha = 10\r\n xx.type = \"solid\"\r\n\r\n xml = Builder::XmlMarkup.new\r\n xx.flatten( xml )\r\n result = xml.to_s\r\n check_results( result.gsub( /<to_s\\/>/, ''), \r\n File.join( File.expand_path( \".\" ), \"/test/xmls/chart_grid_h.xml\" ) )\r\n end",
"title": ""
},
{
"docid": "ce99e94e3b9380964d280675976d689e",
"score": "0.46795556",
"text": "def to_xml(xml=Builder::XmlMarkup.new)\n xml.tag!('saml:EncryptedAttribute') {\n xml.tag!('xenc:EncryptedData', encrypted_data)\n encrypted_keys.each { |key| xml << key.to_xml }\n }\n end",
"title": ""
},
{
"docid": "ca2d52fa5539614f5193f43c0213a621",
"score": "0.46791357",
"text": "def test_match\n # two nodes with same name\n node1 = XML::Node.new( 'nexml' )\n node2 = XML::Node.new( 'nexml' )\n\n # same attributes\n node1.attributes = { :version => '0.9', :generator => 'bioruby' }\n node2.attributes = { :generator => 'bioruby', :version => '0.9' }\n\n # childe nodes for node1\n child11 = XML::Node.new( 'otus' )\n child12 = XML::Node.new( 'otus' )\n child11.attributes = { :id => 'taxa1', :label => 'Taxa 1' }\n child12.attributes = { :id => 'taxa2', :label => 'Taxa 2' }\n\n # childe nodes for node2\n child21 = XML::Node.new( 'otus' )\n child22 = XML::Node.new( 'otus' )\n child21.attributes = { :id => 'taxa1', :label => 'Taxa 1' }\n child22.attributes = { :id => 'taxa2', :label => 'Taxa 2' }\n\n # same children\n node1 << child11\n node1 << child12\n node2 << child22\n node2 << child21\n\n assert match?( node1, node2 )\n end",
"title": ""
},
{
"docid": "43e5dcefae49ea3d7fef9037f3a57960",
"score": "0.4678275",
"text": "def xml(name)\n puts \">> Beginning #{name}\"\n\n parsed = ActiveSupport::XmlMini.parse(File.read(\"unify/#{name}.xml\"))\n\n Array.wrap(parsed['mixer'][name]['row']).each do |line|\n yield handle_line(line)\n end\n end",
"title": ""
},
{
"docid": "18d02ad372e281c54658f5c34d52a885",
"score": "0.46706888",
"text": "def flatten( xml )\r\n xml.series_switch( switch )\r\n end",
"title": ""
},
{
"docid": "dc9a6d75cd9b3e2e9f9ccbc75c4dafbd",
"score": "0.46705675",
"text": "def method_missing(sym, *args, &block)\n text = nil\n attrs = nil\n sym = \"#{sym}:#{args.shift}\" if args.first.kind_of?(Symbol)\n args.each do |arg|\n case arg\n when Hash\n attrs ||= {}\n attrs.merge!(arg)\n else\n text ||= ''\n text << arg.to_s\n end\n end\n if block\n unless text.nil?\n raise ArgumentError, \"XmlMarkup cannot mix a text argument with a block\"\n end\n _indent\n _start_tag(sym, attrs)\n _newline\n _nested_structures(block)\n _indent\n _end_tag(sym)\n _newline\n elsif text.nil?\n _indent\n _start_tag(sym, attrs)\n _newline\n else\n _indent\n _start_tag(sym, attrs)\n text! text\n _end_tag(sym)\n _newline\n end\n @target\n end",
"title": ""
},
{
"docid": "491276e9a102b7d6340a8498f98ebaa1",
"score": "0.46705285",
"text": "def _add_snippets_to_base_xml(snippets)\n uuids = []\n\n xml_builder = Nokogiri::XML::Builder.new do |xml|\n xml.snippets {\n snippets.each do |s|\n uuid = SecureRandom.uuid.upcase\n uuids << uuid\n \n xml.dict {\n xml.key 'abbreviation'\n xml.string s[0]\n xml.key 'abbreviationMode'\n xml.integer '0'\n xml.key 'creationDate'\n xml.date Time.now.utc.iso8601\n xml.key 'flags'\n xml.integer '0'\n xml.key 'label'\n xml.string\n xml.key 'modificationDate'\n xml.date Time.now.utc.iso8601\n xml.key 'plainText'\n xml.string s[1]\n xml.key 'snippetType'\n xml.integer '0'\n xml.key 'useCount'\n xml.integer '0'\n xml.key 'uuidString'\n xml.string uuid\n }\n end\n }\n end\n \n @snippet_xml.xpath(\"/*/*/array[preceding-sibling::key[1] = 'snippetsTE2']\")[0].add_child(xml_builder.doc.root.children.to_xml)\n uuids\n end",
"title": ""
},
{
"docid": "b639c78585e77cc436aca5a3bff8e3fc",
"score": "0.46695104",
"text": "def xml_ele(name, child={})\n\t\t\txml = REXML::Element.new(name)\n\t\t\tchild.keys.each do |k|\n\t\t\t\txml.add_element(k)\n\t\t\t\txml.elements[k].text = child[k]\n\t\t\tend\n\t\t\treturn xml\n\t\tend",
"title": ""
},
{
"docid": "2646ad43f39f72f036c0f9e01801efd2",
"score": "0.4667656",
"text": "def replace(words, topics)\n\t\tn = words.length\n\n\t\t# copy XML content\n\t\txml = String.new(@content)\n\n\t\t# for each word and theme, replace\n\t\tn.times { |i|\n\n\t\t\t# change words\n\t\t\tnew_word = words[i]\n\t\t\told_word = \"WORD\" + (i+1).to_s\n\t\t\txml.gsub!(old_word,new_word)\n\n\t\t\t# change topics\n\t\t\tnew_topic = topics[i]\n\t\t\told_topic = \"TOPIC\" + (i+1).to_s\n\t\t\txml.gsub!(old_topic,new_topic)\n\t\t}\n\t\txml\t\t\n\tend",
"title": ""
},
{
"docid": "de68826c0a058add18e6e26af993552a",
"score": "0.46547797",
"text": "def to_xml(*args)\n map { |x| x.to_xml(*args) }.join\n end",
"title": ""
},
{
"docid": "d57cac7237932e8d0525a400616932a8",
"score": "0.46546817",
"text": "def generate_xml(objects)\n \txml = Builder::XmlMarkup.new\n objects.each do |o|\n generate_object(xml, o)\n end\n xml.xml\n end",
"title": ""
},
{
"docid": "2149146cfcc73f2993c09401f444bad4",
"score": "0.46544307",
"text": "def to_xml_text\n self.dup\n end",
"title": ""
},
{
"docid": "9b6ba6def3982f977f17b1feb86ef119",
"score": "0.46512482",
"text": "def fill_into_xml(xml, options={:mapping=>:_default})\n self.class.all_xml_mapping_nodes(:mapping=>options[:mapping]).each do |node|\n node.obj_to_xml self,xml\n end\n end",
"title": ""
},
{
"docid": "e6a52fb6d69095010506c15661429070",
"score": "0.46487233",
"text": "def xml2hash(xml)\n return XmlSimple.xml_in(xml, { 'KeyAttr' => 'name' })\nend",
"title": ""
},
{
"docid": "9d317111cc5b8902c3af23af15308859",
"score": "0.46481156",
"text": "def populate(xml, instance)\n data = nil\n unless array\n child = xml.elements[1, name]\n data = child.text if child && child.text\n else\n xpath = (wrapper ? \"#{wrapper}/#{name}\" : \"#{name}\")\n data = []\n xml.each_element(xpath) do |e|\n if e.text\n data << e.text.strip.to_latin \n end\n end\n\n end\n instance.instance_variable_set(\"@#{accessor}\", data) if data\n instance\n end",
"title": ""
},
{
"docid": "f2d02604a90d9a3d88d4bf6084c4ae46",
"score": "0.46471155",
"text": "def manage_with_xml! xml, &block\n doc = Hpricot::XML(xml)\n data = MissedCode.as_hash doc\n stt = (Time.mktime(1970, 1, 1) + 3.hours) + data[:date].to_i(16)\n sentt = data[:t]\n sentt = (sentt.nil? ? stt : (Time.mktime(1970, 1, 1) + 3.hours) + data[:t].to_i(16))\n cinfo = CollectedInfo.new(\n :submission_id => self.id,\n :time_sent => sentt,\n :vht_code => data[:vc],\n :start_date => stt,\n :end_date => stt + 7.days,\n :male_children => data[:male].to_i,\n :female_children => data[:fem].to_i,\n :positive_rdt => data[:rdtp].to_i,\n :negative_rdt => data[:rdtn].to_i,\n :diarrhoea => data[:diar].to_i,\n :fast_breathing => data[:fastb].to_i,\n :fever => data[:fever].to_i,\n :danger_sign => data[:danger].to_i,\n :treated_within_24_hrs => data[:treated].to_i,\n :treated_with_ors => data[:ors].to_i,\n :treated_with_zinc12 => data[:zinc12].to_i,\n :treated_with_zinc1 => data[:zinc].to_i,\n :treated_with_amoxi_red => data[:amoxr].to_i,\n :treated_with_amoxi_green => data[:amoxg].to_i,\n :treated_with_coartem_yellow => data[:coary].to_i,\n :treated_with_coartem_blue => data[:coarb].to_i,\n :treated_with_rectal_artus_1 => data[:recart].to_i,\n :referred => data[:ref].to_i,\n :died => data[:death].to_i,\n :male_newborns => data[:mnew].to_i,\n :female_newborns => data[:fnew].to_i,\n :home_visits_day_1 => data[:hv1].to_i,\n :home_visits_day_3 => data[:hv3].to_i,\n :home_visits_day_7 => data[:hv7].to_i,\n :newborns_with_danger_sign => data[:newbdanger].to_i,\n :newborns_referred => data[:newbref].to_i,\n :newborns_yellow_MUAC => data[:yellow].to_i,\n :newborns_red_MUAC => data[:red].to_i,\n :rectal_artus_balance => data[:recartbal].to_i,\n :ors_balance => data[:orsbal].to_i,\n :zinc_balance => data[:zincbal].to_i,\n :yellow_ACT_balance => data[:yactbal].to_i,\n :blue_ACT_balance => data[:bactbal].to_i,\n :red_amoxi_balance => data[:ramoxbal].to_i,\n :green_amoxi_balance => data[:gamoxbal].to_i,\n :rdt_balance => data[:rdtbal].to_i,\n :gloves_left_mt5 => data[:glvbal] == 'MT5'\n )\n su = SystemUser.find_by_code(data[:vc])\n su.last_contribution = Time.now\n UserTag.where(['name = ? AND system_user_id = ?', 'dormant', su.id]).each do |ut|\n ut.delete\n end\n su.save\n cinfo.save\n block.call(cinfo) if block\n end",
"title": ""
},
{
"docid": "2279fba1c639fcfbf3d638531a8d499c",
"score": "0.4643498",
"text": "def initialize(xml)\n @raw_xml = xml\n # HACK, FIXME \n @hash = XmlSimple.xml_in xml.gsub(\"
\",\"\\n\")\n parse\n end",
"title": ""
},
{
"docid": "f3627541ebbcbf1054bf1d3621f58c75",
"score": "0.46329704",
"text": "def process_element(element, context, attributes, characters)\n data = {:element => element, :context => context, :attributes => attributes, :characters => characters}\n key = data[:context] && (data[:context] << data[:element]).compact.join(':')\n self[key] ||= []\n self[key] << data\n end",
"title": ""
},
{
"docid": "57ef076e3f9bad27362e70062ad7f7f6",
"score": "0.46288532",
"text": "def hash\n super +\n @blank_template.hash +\n @root_tag.hash\n end",
"title": ""
}
] |
ecd9b30dcd92722ef6ea9749eefc5c9b | Returns the full name of a patient. | [
{
"docid": "5854335c9af1eb0d3a79f18902d2bb0e",
"score": "0.8179544",
"text": "def full_name(patient)\n return unless patient\n\n if patient.family_name.blank? && patient.animal_type.present?\n return [patient.given_name,\n patient.middle_name,\n \"(#{animal_species_name(patient.animal_type)})\"].join(' ').squish\n end\n\n [patient.given_name,\n patient.middle_name,\n patient.family_name,\n patient.family_name2,\n patient.partner_name].join(' ').squish\n end",
"title": ""
}
] | [
{
"docid": "acfe4d6a5811a8c69c5e4b4138324911",
"score": "0.821073",
"text": "def name\n name = PersonName.where(person_id: patient.id)\\\n .order(:date_created)\\\n .first\n\n given_name = na\n\n \"#{name.given_name} #{name.family_name}\"\n end",
"title": ""
},
{
"docid": "950f9e6ab610de0b29b39d7396fab77a",
"score": "0.80817556",
"text": "def augmented_name_for(_patient)\n name\n end",
"title": ""
},
{
"docid": "5da60ecd6f1d75bf29367ea107215251",
"score": "0.77644557",
"text": "def patient_name\n patient_id, qualifier = @eob.patient_id_and_qualifier\n patient_name_details = [ 'NM1', 'QC', '1', captured_or_blank_patient_last_name(@eob.patient_last_name),\n captured_or_blank_patient_first_name(@eob.patient_first_name), @eob.patient_middle_initial.to_s.strip,\n '', @eob.patient_suffix, qualifier, patient_id].trim_segment\n return nil if patient_name_details == [ 'NM1', 'QC', '1']\n patient_name_details.join(@element_seperator)\n end",
"title": ""
},
{
"docid": "40f2e3ddcffdfc1540e468626545b74a",
"score": "0.7708825",
"text": "def get_full_name\n if self.patient_id.nil? || (self.patient_id == 0)\n get_date_schedule()\n else\n self.patient.get_full_name\n end\n end",
"title": ""
},
{
"docid": "74cb44d25eb94307f4f07a5d0182ff9a",
"score": "0.7523164",
"text": "def full_name\n name\n end",
"title": ""
},
{
"docid": "45341d4773c74230b929cc1593c81ead",
"score": "0.7516747",
"text": "def full_name()\n @name.to_s\n end",
"title": ""
},
{
"docid": "d0bb0af2fc7e8ed4a81c66c490771ae8",
"score": "0.73390055",
"text": "def patient_name\n patient_id, qualifier = eob.patient_id_and_qualifier\n patient_name_elements = []\n patient_name_elements << 'NM1'\n patient_name_elements << 'QC'\n patient_name_elements << '1'\n patient_name_elements << eob.patient_last_name.to_s.strip\n patient_name_elements << eob.patient_first_name.to_s.strip\n patient_name_elements << eob.patient_middle_initial.to_s.strip\n patient_name_elements << ''\n patient_name_elements << eob.patient_suffix\n patient_name_elements << qualifier\n patient_name_elements << patient_id\n patient_name_elements = Output835.trim_segment(patient_name_elements)\n patient_name_elements.join(@element_seperator)\n end",
"title": ""
},
{
"docid": "d6341e87ea048ba9c8c2bce6a93c1d81",
"score": "0.7327032",
"text": "def patient_name\n member_id, qualifier = eob.member_id_and_qualifier\n patient_name_elements = []\n patient_name_elements << 'NM1'\n patient_name_elements << 'QC'\n patient_name_elements << '1'\n patient_name_elements << eob.patient_last_name\n patient_name_elements << eob.patient_first_name\n patient_name_elements << eob.patient_middle_initial\n patient_name_elements << ''\n patient_name_elements << eob.patient_suffix\n patient_name_elements << qualifier\n patient_name_elements << member_id\n patient_name_elements = Output835.trim_segment(patient_name_elements)\n patient_name_elements.join(@element_seperator)\n end",
"title": ""
},
{
"docid": "c12da280e03bf2fff8a010563f463f2e",
"score": "0.72496206",
"text": "def get_full_name()\n self.name.to_s\n end",
"title": ""
},
{
"docid": "c12da280e03bf2fff8a010563f463f2e",
"score": "0.72496206",
"text": "def get_full_name()\n self.name.to_s\n end",
"title": ""
},
{
"docid": "d74883eee6470794527b0010a62ec463",
"score": "0.72011447",
"text": "def get_full_name\n self.name.to_s\n end",
"title": ""
},
{
"docid": "410165254c3ed36a892d24844dde74ab",
"score": "0.7176714",
"text": "def full_name\n name\n end",
"title": ""
},
{
"docid": "7a1ba894d0727e2246577ae910787df4",
"score": "0.7130932",
"text": "def full_name\n self.name\n end",
"title": ""
},
{
"docid": "7a1ba894d0727e2246577ae910787df4",
"score": "0.7130932",
"text": "def full_name\n self.name\n end",
"title": ""
},
{
"docid": "6420827963266f7ee2bd06194c862350",
"score": "0.71221733",
"text": "def full_name\n return \"#{@first_name} #{@last_name}\"\n end",
"title": ""
},
{
"docid": "6420827963266f7ee2bd06194c862350",
"score": "0.71221733",
"text": "def full_name\n return \"#{@first_name} #{@last_name}\"\n end",
"title": ""
},
{
"docid": "2d9cf9f8395936161944eaf33a50c0f6",
"score": "0.7117717",
"text": "def full_name\n\t\treturn self.salutation.to_s + \" \" + self.last_name.to_s + \" \" + self.first_name.to_s\n end",
"title": ""
},
{
"docid": "46cd901b4c0199cd08a14b3e6a84218e",
"score": "0.70822537",
"text": "def full_name\n \"#{first_name} #{last_name}\"\n end",
"title": ""
},
{
"docid": "46cd901b4c0199cd08a14b3e6a84218e",
"score": "0.70822537",
"text": "def full_name\n \"#{first_name} #{last_name}\"\n end",
"title": ""
},
{
"docid": "46cd901b4c0199cd08a14b3e6a84218e",
"score": "0.70822537",
"text": "def full_name\n \"#{first_name} #{last_name}\"\n end",
"title": ""
},
{
"docid": "df86bc9e2ea6435af22ccb46dcb19771",
"score": "0.7071247",
"text": "def full_name\n get_full_name\n end",
"title": ""
},
{
"docid": "f33ee9f7cff1b61dcfa77793e1756de0",
"score": "0.7067828",
"text": "def get_verbose_name\n if self.patient_id.nil? || (self.patient_id == 0)\n get_receipt_header()\n else\n self.patient.get_full_name.upcase + ' ' + get_receipt_header()\n end\n end",
"title": ""
},
{
"docid": "6508acf265f71ff0b77c14bce28e787a",
"score": "0.70571876",
"text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "2e74370365da55fe8b37347d5d6b721b",
"score": "0.70559955",
"text": "def to_s\n full_name\n end",
"title": ""
},
{
"docid": "4e7812732d8c6f545fd352fe78771079",
"score": "0.70433676",
"text": "def to_s\n full_name\n end",
"title": ""
},
{
"docid": "979ed28111a42878b06ffdbc7603fbac",
"score": "0.7025504",
"text": "def short_name\r\n return \"#{first_name[0].chr}. #{last_name}\"\r\n end",
"title": ""
},
{
"docid": "0d9c45ba3d276ebd64a84ceb19aa54fd",
"score": "0.70173013",
"text": "def get_full_name\n \"#{get_meeting_session_name} #{get_event_name}\"\n end",
"title": ""
},
{
"docid": "01afe4dd451743d5906f5d0bf77d4b23",
"score": "0.69961596",
"text": "def full_name\n return Contact.generate_full_name self.first_name, self.middel_name, self.last_name\n end",
"title": ""
},
{
"docid": "9978cd12577338007fa4bbc1b2eb8257",
"score": "0.6962272",
"text": "def short_name\n full_name = \"\"\n if name.present?\n full_name = name\n else\n full_name = \"#{self.first_name ? self.first_name.downcase.capitalize : \"\"} #{self.last_name ? \"#{self.last_name.first.upcase}.\" : \"\"}\"\n end\n\n full_name\n end",
"title": ""
},
{
"docid": "e8335213c7a46ffabffb1b8dce153b3e",
"score": "0.6960566",
"text": "def full_name\n '(unknown)'\n end",
"title": ""
},
{
"docid": "51847fba5db5ff6c092e233a6a0d719a",
"score": "0.6956523",
"text": "def full_name\n \"#{@first} #{@last}\"\n end",
"title": ""
},
{
"docid": "ea61806b729517973fa59fe9cff31bd5",
"score": "0.69384",
"text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "ea61806b729517973fa59fe9cff31bd5",
"score": "0.69384",
"text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "ea61806b729517973fa59fe9cff31bd5",
"score": "0.69384",
"text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "1f8ef0f6aa786ca335ecf10fef1b94b5",
"score": "0.6920663",
"text": "def full_name\n # TODO: update method -> \"${name}, ${last_name}\"\n name\n end",
"title": ""
},
{
"docid": "27a9c2ffcebf4688540de6cceeae0322",
"score": "0.6917762",
"text": "def full_name()\n name + ' ' + last_name\n end",
"title": ""
},
{
"docid": "12f89dc1bf3074ff099009ba8f0d1532",
"score": "0.6916237",
"text": "def full_name\n \"#{nombre} #{apellidos}\"\n end",
"title": ""
},
{
"docid": "0dedbb00bbfe824c8864b2108354807b",
"score": "0.6911222",
"text": "def fullname\n name\n end",
"title": ""
},
{
"docid": "7245cfa44348de98497d957bf9e86f29",
"score": "0.69089156",
"text": "def fullname\n \"#{first_name} #{last_name}\"\n end",
"title": ""
},
{
"docid": "b47eabdfde3c0bb154f12aa36c2a6184",
"score": "0.69060075",
"text": "def get_full_name\n \"#{name} (#{description})\"\n end",
"title": ""
},
{
"docid": "23f6e24a828d41c215f2aa8a722b1b92",
"score": "0.690568",
"text": "def full_name\n \"#{first_name} #{last_name}\"\n end",
"title": ""
},
{
"docid": "f8164855015290c24d43a4bd32c391ed",
"score": "0.68994975",
"text": "def to_s\n informal_full_name\n end",
"title": ""
},
{
"docid": "55bc1a6ab2a2987addec8a3612d7a97f",
"score": "0.6898245",
"text": "def full_name\n \"#{@first_name} #{@last_name}\"\n end",
"title": ""
},
{
"docid": "6f13df53444fe4e52d19d746bc2d5008",
"score": "0.6890014",
"text": "def full_name\n \"#{first_name} #{last_name}\"\n end",
"title": ""
},
{
"docid": "95f3aee0bc462f98fada08651ca76025",
"score": "0.6879472",
"text": "def full_name\n\t\t\"#{self.first_name} #{self.last_name}\"\n\tend",
"title": ""
},
{
"docid": "409aa8de6a56dbd7701fa44512005905",
"score": "0.6875639",
"text": "def full_name\n \"#{firstname} #{lastname}\".strip\n end",
"title": ""
},
{
"docid": "70e527dca646146a1dc7f311ebd2e72f",
"score": "0.687545",
"text": "def full_name\n self.to_s\n end",
"title": ""
},
{
"docid": "4ba7d7bb3031b7ce5394677efbfcd1d2",
"score": "0.6870527",
"text": "def get_full_name\n self.title.to_s\n end",
"title": ""
},
{
"docid": "42c8fe9442be2c88d5460889b0c6f88c",
"score": "0.6868314",
"text": "def to_s\n full_name\n end",
"title": ""
},
{
"docid": "42c8fe9442be2c88d5460889b0c6f88c",
"score": "0.6868314",
"text": "def to_s\n full_name\n end",
"title": ""
},
{
"docid": "42c8fe9442be2c88d5460889b0c6f88c",
"score": "0.6868314",
"text": "def to_s\n full_name\n end",
"title": ""
},
{
"docid": "0661c905df85bdc7b5fe36d282101484",
"score": "0.6866498",
"text": "def full_name\n return first_name + \" \" + last_name\n end",
"title": ""
},
{
"docid": "0661c905df85bdc7b5fe36d282101484",
"score": "0.6866498",
"text": "def full_name\n return first_name + \" \" + last_name\n end",
"title": ""
},
{
"docid": "143f30a1830563d6412bb7e41be52518",
"score": "0.6855458",
"text": "def name\n full_name\n end",
"title": ""
},
{
"docid": "1b3b86f0a6ffaf0d4fc5db8dd5abb238",
"score": "0.6854859",
"text": "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend",
"title": ""
},
{
"docid": "1b3b86f0a6ffaf0d4fc5db8dd5abb238",
"score": "0.6854859",
"text": "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend",
"title": ""
},
{
"docid": "1b3b86f0a6ffaf0d4fc5db8dd5abb238",
"score": "0.6854859",
"text": "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend",
"title": ""
},
{
"docid": "1b3b86f0a6ffaf0d4fc5db8dd5abb238",
"score": "0.6854859",
"text": "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend",
"title": ""
},
{
"docid": "1b3b86f0a6ffaf0d4fc5db8dd5abb238",
"score": "0.6854859",
"text": "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend",
"title": ""
},
{
"docid": "1b3b86f0a6ffaf0d4fc5db8dd5abb238",
"score": "0.6854859",
"text": "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend",
"title": ""
},
{
"docid": "671081fd56ef2f8dc4a6292f2c723b79",
"score": "0.68511003",
"text": "def full_name\n \"#{first_name}\" \" #{last_name}\"\n end",
"title": ""
},
{
"docid": "85cc242f56aafae332f20fa9fb0ce5a6",
"score": "0.6848827",
"text": "def get_full_name\n description\n end",
"title": ""
},
{
"docid": "27cc0f9ffb5711902cadcd908138c0bc",
"score": "0.68467236",
"text": "def full_name\n\n parent ? \"#{parent.name} (#{name})\" : name\n end",
"title": ""
},
{
"docid": "b88617f1a81a7bf6d54b6cd9c2444723",
"score": "0.68457276",
"text": "def name\n if person\n person.name\n else\n \"\"\n end\n end",
"title": ""
},
{
"docid": "13056415ca5f00b5110fe61f57636d27",
"score": "0.6842262",
"text": "def department_full_name\n return department_extra.fixed_name if department_extra && !department_extra.fixed_name.blank?\n dept_full_nm.strip.titleize.gsub(\"Of\", \"of\")\n end",
"title": ""
},
{
"docid": "7a1dd39fd91b21b046346b19b5c2d13e",
"score": "0.6838833",
"text": "def patients_name\n self.pets.map {|p| p.name}\n end",
"title": ""
},
{
"docid": "7a58bfd128374d5614a8a9568ea1c258",
"score": "0.68252",
"text": "def full_name\n \"#{@first_name} #{last_name}\"\n end",
"title": ""
},
{
"docid": "9c577ec35428d4ce472c09dbc261cc30",
"score": "0.68216616",
"text": "def display_name\n full_name.join(\" \")\n end",
"title": ""
},
{
"docid": "d1b4a6c2e001e0849cc3643b2a65fd77",
"score": "0.68186074",
"text": "def full_name\n get_attribute(Yoti::Attribute::FULL_NAME)\n end",
"title": ""
},
{
"docid": "35c007d0b5b86a69f017de1c76d3f786",
"score": "0.681463",
"text": "def full_name\n return \"#{make.name} #{name}\"\n end",
"title": ""
},
{
"docid": "0417603542f6758a7e6c2f756639b319",
"score": "0.68115366",
"text": "def show_full_name\n name\n end",
"title": ""
},
{
"docid": "b9ec5613b3a52abfeaf1a1be96a3e648",
"score": "0.68032986",
"text": "def full_name\n \t\"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "71b4e2a67a36c2fc7ecba5b07c2f88b8",
"score": "0.68000716",
"text": "def get_full_name\n description.to_s\n end",
"title": ""
},
{
"docid": "590d59b706015096fd8d0ed30978046a",
"score": "0.67962825",
"text": "def full_name\n \"#{self.name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "2a7b63f2a75680855a7bfb5378d2fe41",
"score": "0.6784588",
"text": "def name\n name_str = \"#{first_name} #{last_name}\".strip\n if name_str.length < 1\n name_str = email\n end\n if name_str.length < 1\n name_str = \"Person utan namn (id #{id})\"\n end\n name_str\n end",
"title": ""
},
{
"docid": "0a3a6206c8f50de26e9a76e4ae7ddb0c",
"score": "0.67777306",
"text": "def full_name\n @full_name ||= calculate_full_name\n end",
"title": ""
},
{
"docid": "3b9bcf954ddc4a9a82822919014b4df9",
"score": "0.6768799",
"text": "def full_name\n \"#{first_name} #{last_name}\"\n end",
"title": ""
},
{
"docid": "49e5ed609369402424e4e3e26895ffb9",
"score": "0.67655534",
"text": "def full_name\n @first_name + ' ' + @last_name\n end",
"title": ""
},
{
"docid": "92bf7928f7d7ca0df961ce452deb196a",
"score": "0.67643416",
"text": "def fullname\n return @first_name.capitalize + \" \" + @surname.capitalize\n end",
"title": ""
},
{
"docid": "7260b050224d3b2a1e9c968fa1371f91",
"score": "0.6757666",
"text": "def full_name \n name = \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "7313e5ab8b9bac311ab53fe8c7904676",
"score": "0.67572194",
"text": "def full_name\n @full_name ||= \"#{parent_name}#{pretty_name}\"\n end",
"title": ""
},
{
"docid": "3765ec4ac3549faf531e4dadb0ec4cdb",
"score": "0.6752452",
"text": "def full_name\n full_name = \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "c8ac62d1ef748770850408e4fd5c86f8",
"score": "0.67501837",
"text": "def full_name\n self.first_name + \" \" + self.last_name\n end",
"title": ""
},
{
"docid": "8aa047da97d128bcfe9845314d96531a",
"score": "0.6749996",
"text": "def full_name\n return self.fname + \" \" + self.lname;\n end",
"title": ""
},
{
"docid": "ce49e4b1964e0e7b96964d62053e4bbe",
"score": "0.6749788",
"text": "def full_name\n \t\"#{first_name} #{last_name}\"\n end",
"title": ""
},
{
"docid": "3ec3f935005eddb544ca82474d2b9b2b",
"score": "0.6743796",
"text": "def eob_patient_name\n str = \"\" #initialize in case the fileds are blank\n str += self.patient_last_name.upcase if !self.patient_last_name.blank?\n str += \", \"\n str += self.patient_first_name.upcase if !self.patient_first_name.blank?\n return str\n end",
"title": ""
},
{
"docid": "baff953a2c3e576a25cd808691b6015e",
"score": "0.6740437",
"text": "def full_name_apellido_paterno\n self.apellido_paterno.to_s + \" \" + self.apellido_materno.to_s + \" \" + self.nombre.to_s\n end",
"title": ""
},
{
"docid": "6c4cd2697a57b8d7e3b3752df922df71",
"score": "0.6739022",
"text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "6c4cd2697a57b8d7e3b3752df922df71",
"score": "0.6739022",
"text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "6c4cd2697a57b8d7e3b3752df922df71",
"score": "0.6739022",
"text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "6c4cd2697a57b8d7e3b3752df922df71",
"score": "0.6739022",
"text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "6c4cd2697a57b8d7e3b3752df922df71",
"score": "0.6739022",
"text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "6c4cd2697a57b8d7e3b3752df922df71",
"score": "0.6739022",
"text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "6c4cd2697a57b8d7e3b3752df922df71",
"score": "0.6739022",
"text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "6c4cd2697a57b8d7e3b3752df922df71",
"score": "0.6739022",
"text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "6c4cd2697a57b8d7e3b3752df922df71",
"score": "0.6739022",
"text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "6c4cd2697a57b8d7e3b3752df922df71",
"score": "0.6739022",
"text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "6c4cd2697a57b8d7e3b3752df922df71",
"score": "0.6739022",
"text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "6c4cd2697a57b8d7e3b3752df922df71",
"score": "0.6739022",
"text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
},
{
"docid": "6c4cd2697a57b8d7e3b3752df922df71",
"score": "0.6739022",
"text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end",
"title": ""
}
] |
a51f4e290268729f508af0c8a8d03c89 | Delete a record by its primary key from data | [
{
"docid": "1d58a58b12a057b261ae4f8675774c74",
"score": "0.6959314",
"text": "def delete_by_primary_key(primary_key)\n query = \"DELETE FROM `#{@table_name}` WHERE \"+build_where({@primary_key => primary_key})\n\n begin\n queryresult = @mysql.query(query)\n rescue Exception => e\n @log.error(\"#{e}\")\n return false\n end\n\n expire_table_cache(get_all_related_tables)\n true\n end",
"title": ""
}
] | [
{
"docid": "7fd70428740c70438e41ee46874b7099",
"score": "0.7575023",
"text": "def delete_record *rid\n db.delete_record rid\n end",
"title": ""
},
{
"docid": "18eabf26b1c7709e81b9725921afe154",
"score": "0.7436668",
"text": "def delete record\n db_name = database_name_for(record)\n coll_name = collection_name_for(record)\n case\n when id = id_for(record)\n pointer = \"/#{db_name}/#{coll_name}/#{id}\"\n res = collection_for(record).remove({:_id => id})\n if res[\"err\"]\n log.error(res[\"err\"])\n else\n log.debug(\"Deleted #{pointer}\")\n end\n when query = delete_query_for(record)\n pointer = \"/#{db_name}/#{coll_name}\"\n res = collection_for(record).remove(query)\n if res[\"err\"]\n log.error(res[\"err\"])\n else\n log.debug(\"Deleted #{res['n']} records from #{pointer}\")\n end\n end\n end",
"title": ""
},
{
"docid": "0d4c15092caed44ddb2c8e7fd11df4e1",
"score": "0.7310485",
"text": "def delete(record_id)\n CONNECTION.execute(\"DELETE FROM #{get_table_name} WHERE id = #{record_id}\")\n end",
"title": ""
},
{
"docid": "519c20edd8ce1ad83e15fa0ddb9b07f1",
"score": "0.71894354",
"text": "def delete(record)\n record.del\n end",
"title": ""
},
{
"docid": "538bc1048cdf97e5ad9a419aa809cf6f",
"score": "0.7055394",
"text": "def delete\n @record = Record.find(params[:id])\n end",
"title": ""
},
{
"docid": "4a00519d128ff6cedea29aed796803d4",
"score": "0.70500034",
"text": "def delete\n raise \"'id' is not set.\" if @id == nil\n sql = \"DELETE FROM #{table} WHERE id=#{@id}\"\n Database.transaction(sql)\n @log.debug \"Record[#{self}] is deleted from Table[#{table}]\"\n end",
"title": ""
},
{
"docid": "a3be13cde4d69235a4a8b93d4300b5e5",
"score": "0.70185834",
"text": "def delete (table_name, record_id)\n DATABASE.execute(\"DELETE FROM #{table_name} WHERE id = #{record_id}\")\n end",
"title": ""
},
{
"docid": "d7e91d326e3a0c9543429d5b4a176dee",
"score": "0.6936641",
"text": "def delete(model)\n id = model.primary_key_value\n store.delete(id, table: table_name)\n end",
"title": ""
},
{
"docid": "4321af1deeda8ac33a4c0b05de565789",
"score": "0.69259906",
"text": "def delete(key)\n in_transaction_wr\n @table.delete key\n end",
"title": ""
},
{
"docid": "3aa28575c2e2aef2f0d68c4197b245cf",
"score": "0.69231576",
"text": "def delete\n\n DB.execute(\"DELETE FROM #{table_name} WHERE id = #{@id};\")\n end",
"title": ""
},
{
"docid": "da0f358d498bc5205b4f2bd2c5e0cd71",
"score": "0.69085026",
"text": "def delete_record(id)\n if ok_to_delete?(id)\n CONNECTION.execute(\"DELETE FROM #{table_name} WHERE id = #{id};\")\n else\n false\n end\n end",
"title": ""
},
{
"docid": "652c312e0e3949757609507fe8b29cb5",
"score": "0.68994194",
"text": "def delete\n DATABASE.execute(\"DELETE from students WHERE id = #{id}\")\n end",
"title": ""
},
{
"docid": "c9d47602dc4d5406e36fbaf48f36efeb",
"score": "0.6890759",
"text": "def delete\n FC::DB.query(\"DELETE FROM #{self.class.table_name} WHERE id=#{@id.to_i}\") if @id\n end",
"title": ""
},
{
"docid": "9e90e0d80e9c3c568d143bb92282da21",
"score": "0.6889241",
"text": "def delete\n binding.pry\n DATABASE.execute(\"DELETE FROM contents WHERE id = #{id}\")\n end",
"title": ""
},
{
"docid": "e386f6e6de2314a5d77894e8caf29f45",
"score": "0.68846214",
"text": "def delete\n DATABASE.execute(\"DELETE FROM students WHERE id = #{@id}\")\n end",
"title": ""
},
{
"docid": "4e924ce68eb29281c2caaaf9d4c044c7",
"score": "0.6862645",
"text": "def delete(resource)\n unless id = @mappings[:id][:get].call(resource)\n raise ArgumentError, \"Attempted to delete a record without an ID\"\n end\n\n raw.delete(id)\n end",
"title": ""
},
{
"docid": "05d393f1de8e903a63cf7dfdbef98e96",
"score": "0.6846715",
"text": "def delete key\n\t\tdata = @data_base.delete key\n\t\tupdate_database\n\t\tdata\n\tend",
"title": ""
},
{
"docid": "3ce9d77304b23b0f30356fb16ae56255",
"score": "0.68352526",
"text": "def delete(thing)\n if thing.is_a? Integer\n @index = @index.delete_if {|idx| idx.r_id == thing }\n @records = @records.delete_if {|idx, data| idx == thing }\n else\n if thing.respond_to?(:r_id)\n r_id = thing.r_id\n @index = @index.delete_if {|idx| idx.r_id == r_id }\n @records = @records.delete_if {|idx, data| data == thing}\n end\n end\n res_index = @header.resource_index\n res_index.number_of_records = @index.length\n @header.resource_index = res_index\n end",
"title": ""
},
{
"docid": "7abbe9ab509717f167ebd06db10185a7",
"score": "0.68242896",
"text": "def delete\n DB.exec(\"DELETE FROM line WHERE id = #{self.id};\")\n end",
"title": ""
},
{
"docid": "0dc39ac330c582c99d9b1a13597a25be",
"score": "0.678581",
"text": "def delete(key)\n @table.delete(key)\n end",
"title": ""
},
{
"docid": "8121d141e03d901b8e8437213c8f6012",
"score": "0.6780446",
"text": "def delete()\n sql = \"DELETE from customers WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n# => Deleting customer record, nothing to return\n end",
"title": ""
},
{
"docid": "013595a5e7b7723abc965cf9ec6c2592",
"score": "0.6774778",
"text": "def delete(id)\n @conn.exec(\"DELETE FROM students WHERE id = '#{id}'\")\nend",
"title": ""
},
{
"docid": "a050db80a567a3c8c69e675f3df148dd",
"score": "0.6761618",
"text": "def delete\n CONNECTION.execute(\"DELETE FROM '#{tablename}' WHERE id = ?;\", @id)\n \"Deleted.\"\n end",
"title": ""
},
{
"docid": "d63dd762ff04e7f746d764cc6e2282ca",
"score": "0.6760015",
"text": "def delete(id)\n @conn.exec(\"DELETE FROM students WHERE id = '#{id}';\")\nend",
"title": ""
},
{
"docid": "fbba2a372bafddcfff208cb0cd4b71da",
"score": "0.6759152",
"text": "def delete(id)\n @conn.exec(\"DELETE FROM students WHERE id = '#{id}';\")\n puts \"Your record has been deleted\"\nend",
"title": ""
},
{
"docid": "aedabe20c0f93e98e3b35d78ab57cd35",
"score": "0.6755643",
"text": "def delete(key)\n result = @rarray.get(key)\n if result\n @rarray.delete(result)\n store\n else\n raise ArgumentError,'Cannot delete - no matching id', caller \n end\n end",
"title": ""
},
{
"docid": "41d72f17d16278c75e196350919335a6",
"score": "0.67486566",
"text": "def delete(id)\n @conn.exec(\"DELETE FROM students WHERE id = '#{id}';\");\nend",
"title": ""
},
{
"docid": "7d85d3c19dbdc5e483654fa216106912",
"score": "0.6727236",
"text": "def _delete_without_checking\n if sql = (m = model).fast_instance_delete_sql\n sql = sql.dup\n ds = use_server(m.dataset)\n ds.literal_append(sql, pk)\n ds.with_sql_delete(sql)\n else\n _delete_dataset.delete \n end\n end",
"title": ""
},
{
"docid": "7d85d3c19dbdc5e483654fa216106912",
"score": "0.6727236",
"text": "def _delete_without_checking\n if sql = (m = model).fast_instance_delete_sql\n sql = sql.dup\n ds = use_server(m.dataset)\n ds.literal_append(sql, pk)\n ds.with_sql_delete(sql)\n else\n _delete_dataset.delete \n end\n end",
"title": ""
},
{
"docid": "e44bdbe9cb6ec363e8cd940936624722",
"score": "0.672456",
"text": "def delete_row(row_id); rest_delete(\"#{link('rows')}/#{row_id}\"); nil; end",
"title": ""
},
{
"docid": "f17e575ee1a918331748bcdd6cdde5f0",
"score": "0.6720578",
"text": "def delete(id_or_array)\n delete_by(primary_key => id_or_array)\n end",
"title": ""
},
{
"docid": "b5a5877eebe4de0dab20081a2dbd6a59",
"score": "0.6701403",
"text": "def delete_row(id)\n table_name = self.to_s.pluralize.underscore\n DATABASE.execute(\"DELETE FROM #{table_name} WHERE id = #{id}\")\n end",
"title": ""
},
{
"docid": "971e50c99301e34e1e6091de66f53e72",
"score": "0.67003644",
"text": "def delete!(key)\n @table.delete(key.to_sym)\n end",
"title": ""
},
{
"docid": "d8d135e1e20e413f6fdf47c2d015b7ea",
"score": "0.66947305",
"text": "def delete()\n sql = \"DELETE FROM transactions\n WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\nend",
"title": ""
},
{
"docid": "51a7cf277c0b077b54cb4c062763c33c",
"score": "0.66874266",
"text": "def delete\n sql = \"DELETE FROM tickets WHERE id = $1\"\n values = [id]\n SqlRunner.run(sql, values)\n end",
"title": ""
},
{
"docid": "3702b5cd9a1e22f75a47716273188d60",
"score": "0.6679563",
"text": "def delete_row(key)\n hbase.deleteAllRow(table_name, key)\n end",
"title": ""
},
{
"docid": "2d2eeddce6eee3996225667bf4027d4f",
"score": "0.6660462",
"text": "def delete(id)\n read_or_die(id)\n\n sql, vals = sql_delete(id_fld => id)\n execute sql_subst(sql, *vals.map{|v| quote v})\n\n self\n\n rescue => e\n handle_error(e)\n end",
"title": ""
},
{
"docid": "ae65b312392efc28800372d1e7f78388",
"score": "0.6643342",
"text": "def delete_record!(record)\n record.public_send(inventory_collection.delete_method)\n inventory_collection.store_deleted_records(record)\n end",
"title": ""
},
{
"docid": "ff16b7b4acbdb72e0fb275ca5dd08454",
"score": "0.6607276",
"text": "def delete(key)\n db.delete(key)\n end",
"title": ""
},
{
"docid": "645939402620cdde55012f2d50145d1e",
"score": "0.656509",
"text": "def delete()\n\n db = PG.connect({dbname: \"pizza_shop\", host: \"localhost\"})\n sql = \"DELETE FROM pizza_orders WHERE id = $1\"\n values = [@id]\n db.prepare(\"Delete\", sql)\n db.exec_prepared(\"Delete\", values)\n db.close\n\n end",
"title": ""
},
{
"docid": "8f5526e5505da0f6fc948165a3dd1f38",
"score": "0.6560931",
"text": "def delete(key)\n @db.delete(key.to_s.downcase)\n end",
"title": ""
},
{
"docid": "c5cec3ea3949085cb5dd7bbd48a73cab",
"score": "0.6553855",
"text": "def delete _key\n store.transaction() { |s| s.delete(prepare_key(_key)) }\n end",
"title": ""
},
{
"docid": "246827228c623e500510e8c4a435ed35",
"score": "0.6542852",
"text": "def delete\n fail 'Can not delete an unsaved model object' if @_pkey_id.nil?\n\n query = \"DELETE FROM #{@_table} WHERE #{@_pkey} = #{@_pkey_id}\"\n\n Taupe::Database.exec query\n\n Taupe::Cache.delete @_cache_key unless @_cache_key.nil?\n end",
"title": ""
},
{
"docid": "ab0321c8bbfbbbf699558f63ea7bafd0",
"score": "0.6534338",
"text": "def delete()\n sql = \"DELETE FROM stock_items WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n end",
"title": ""
},
{
"docid": "1de37b463108e8ea42c1f26f21c100de",
"score": "0.6529252",
"text": "def del(key)\n response = db.delete_item(@table_name, {'HashKeyElement' => {'S' => key}})\n true\n end",
"title": ""
},
{
"docid": "b1297e7d755428691016183d26e5b0e7",
"score": "0.65134686",
"text": "def delete_row lb # {{{\n index = lb.current_index\n id = lb.list[lb.current_index].first\n lb.list().delete_at(index)\n lb.touch\n ret = @db.execute(\"UPDATE #{@tablename} SET status = ? WHERE rowid = ?\", [ \"x\", id ])\nend",
"title": ""
},
{
"docid": "1e83ab36435ce4bc5d878a3db3d5e4d1",
"score": "0.6512451",
"text": "def delete()\n sql = \"DELETE FROM tickets WHERE id=#{@id};\"\n SqlRunner.run(sql)\n end",
"title": ""
},
{
"docid": "507b68f4b33d331c60c69dcdf4facd71",
"score": "0.6511003",
"text": "def delete(id)\n record = find(id)\n return unless record\n\n delete_from_file(@file, record)\n @records = read_file(@file)\n end",
"title": ""
},
{
"docid": "ff9964e17da5a8647922ef1bde2d537d",
"score": "0.6498834",
"text": "def delete_record(table, values)\n delete table_delete_query(table, values)\n end",
"title": ""
},
{
"docid": "3162108f017ae61eeced89248561c7de",
"score": "0.64986473",
"text": "def delete\n # Figure out the table's name from the object we're calling the method on.\n table_name = self.class.to_s.pluralize.underscore\n CONNECTION.execute(\"DELETE FROM #{table_name} WHERE id = #{@id};\") # need to see if this one will work, if not look up.\n end",
"title": ""
},
{
"docid": "b34957b2cd42f42f84f07ff38c18547b",
"score": "0.64977187",
"text": "def delete_entry(params)\n dd = DBDeleter.new(params)\n dd.delete\n end",
"title": ""
},
{
"docid": "5353fb025b5b9042e9f87f50197972b3",
"score": "0.6476795",
"text": "def delete(key)\n @data.delete(key).tap {\n save if autosave?\n }\n end",
"title": ""
},
{
"docid": "afb8d1aa67305f891d6abcfaabe9c783",
"score": "0.6476422",
"text": "def delete_data(key)\n @data.delete(key)\n end",
"title": ""
},
{
"docid": "466f36be6b72a1b6081cf962c80b4eda",
"score": "0.6443573",
"text": "def delete\n table = self.class.to_s.pluralize.underscore\n\n DATABASE.execute(\"DELETE FROM #{table} WHERE id = #{@id};\")\n end",
"title": ""
},
{
"docid": "da2568b15a375ff7eabece12234196e0",
"score": "0.64395386",
"text": "def delete\n sql = 'DELETE FROM members WHERE id = $1'\n values = [@id]\n SqlRunner.run(sql, values)\nend",
"title": ""
},
{
"docid": "1ff389848f2a5fa51b27a119233b9122",
"score": "0.6423451",
"text": "def delete key\n slot = _find_slot(key)\n return nil if !@data[slot]\n value = @data[slot+1]\n @data[slot] = DELETED\n @data[slot+1] = nil\n\n # Unlink record\n n = @data[slot+2]\n prev = @data[slot+3]\n if prev\n @data[prev+2] = n\n end\n if n\n @data[n+3] = prev\n end\n if @first == slot\n @first = n\n end\n if @last == slot\n @last = prev\n end\n\n # FIXME: It fails without this, which indicates a bug.\n #@length -= 1\n value\n end",
"title": ""
},
{
"docid": "fa071f546253338165e47a9e4f6b2330",
"score": "0.64170086",
"text": "def destroy\n DB.execute <<SQL\nDELETE FROM #{self.class.table}\nWHERE id = #{@hash['id']}\nSQL\n end",
"title": ""
},
{
"docid": "e545957dbfe86658ba6acf06f37c2537",
"score": "0.64080906",
"text": "def delete(id)\n results = connection.exec_params('DELETE FROM contacts WHERE id=$1;', [id]) \n end",
"title": ""
},
{
"docid": "eb7b7dd0631e8951a06f45f74160ca99",
"score": "0.64031506",
"text": "def delete()\n db = PG.connect({ dbname: 'Music_Collection', host: 'localhost'})\n sql = \n \"\n DELETE FROM Music_Collection where id = #{@id};\n \"\n db.exec(sql)\n db.close()\nend",
"title": ""
},
{
"docid": "14e66e8f4ca253e56ca3a4f17c8abedd",
"score": "0.63982797",
"text": "def prepared_delete\n # SEQUEL5: Remove\n cached_prepared_statement(:fixed, :delete){prepare_statement(filter(prepared_statement_key_array(primary_key)), :delete)}\n end",
"title": ""
},
{
"docid": "4a092d16dad1f8c7e27390e3c3158f01",
"score": "0.6397385",
"text": "def delete_record(mid, rid)\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_delete_record\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n url_get_records = url_get_records.gsub '{mid}', mid.to_s\n url_get_records = url_get_records.gsub '{rid}', rid.to_s\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'delete'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n end",
"title": ""
},
{
"docid": "6bb7c9bb3d4d7c185c98f4f0b26f4633",
"score": "0.63927823",
"text": "def delete key\n rv = self[key]\n self.removeField key\n return rv\n end",
"title": ""
},
{
"docid": "a3b1345f40fefebd6eb6e988643d9047",
"score": "0.6375478",
"text": "def delete()\n db = PG connect( {dbname: 'bounty_hunter',\n host: 'localhost'\n })\n sql = 'DELETE from bounty_hunter'\n db.prepare('delete_one', sql)\n db.exec_prepared('delete_one', value)\n db.close()\nend",
"title": ""
},
{
"docid": "86220d3b1d84d8c58682b9bdca45d381",
"score": "0.6366933",
"text": "def delete(key); end",
"title": ""
},
{
"docid": "86220d3b1d84d8c58682b9bdca45d381",
"score": "0.6366933",
"text": "def delete(key); end",
"title": ""
},
{
"docid": "86220d3b1d84d8c58682b9bdca45d381",
"score": "0.6366933",
"text": "def delete(key); end",
"title": ""
},
{
"docid": "86220d3b1d84d8c58682b9bdca45d381",
"score": "0.6366933",
"text": "def delete(key); end",
"title": ""
},
{
"docid": "86220d3b1d84d8c58682b9bdca45d381",
"score": "0.6366933",
"text": "def delete(key); end",
"title": ""
},
{
"docid": "43263f5436c6a251797fea210e40c26d",
"score": "0.6364711",
"text": "def delete_entry(db, id)\r\n\tdb.execute(\"DELETE FROM games WHERE id=?\", id)\r\n\tputs \"Entry deleted.\"\r\nend",
"title": ""
},
{
"docid": "bf0837814cd0ccc486da481aa9a1c91f",
"score": "0.6357984",
"text": "def delete_one()\n #connect to db\n db = PG.connect({ dbname: \"bounty_hunters\", host: \"localhost\" })\n #write SQL statement string\n sql = \"DELETE FROM bounties WHERE id = $1\"\n #make values array - in this case it only needs one value\n values = [@id]\n #prepare statemnt\n db.prepare(\"delete_one\", sql)\n #run prepared statement\n db.exec_prepared(\"delete_one\", values)\n #close db link\n db.close()\n end",
"title": ""
},
{
"docid": "abb3c28017ff3566486d83d640aef027",
"score": "0.6357257",
"text": "def delete_row(hash)\n raise ORM::TableError, \"Something went wrong.\" unless hash[:id].present?\n\n result_table = table.delete_if { |e| e[:id] == hash[:id] }\n File.write(@table_path, JSON.generate(result_table))\n end",
"title": ""
},
{
"docid": "395970478b042cac93f21b7602b8767a",
"score": "0.6354741",
"text": "def deleteDataId(data_of, id)\n url_data = stringGetUrlPath(data_of)\n url_request = \"#{url_data}/#{id}\"\n puts \">>>>>> delete #{data_of} with id:#{id}\"\n deleteData(url_request)\n end",
"title": ""
},
{
"docid": "5f32ef48f43a9713da36d03611edc9c8",
"score": "0.63479847",
"text": "def delete\n sql = \"DELETE FROM albums WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\nend",
"title": ""
},
{
"docid": "568aea9d8e5d440a2d2ce6c273868750",
"score": "0.63251126",
"text": "def deleteOperation\n\t\tputs \"Enter which record do you want to delete (Product Id)\"\n\t\tpro_id = gets.chomp.to_i\n\t\tbegin\n\t\t\tresult = @statement.executeUpdate(\"delete from products where proid = #{pro_id}\")\n\t\t\tif result\n\t\t\t\tputs \"Record deleted successfully\"\n\t\t\telse\n\t\t\t\tputs \"Record doesnot deleted\"\n\t\t\tend\n\t\trescue Exception => e\n\t\t\tputs e.message\n\t\tend\n\t\t@connection.close\n\t\t@statement.close\n\tend",
"title": ""
},
{
"docid": "a4de2aeb888483f93bda6b45bb6efaa8",
"score": "0.6322404",
"text": "def delete_record(rec_label)\n record = records.find { |r| r.label == rec_label }\n return unless record\n\n File.delete(record.path)\n records.delete(record)\n end",
"title": ""
},
{
"docid": "37ac6468488be7eec94ba8bed004acaf",
"score": "0.6308216",
"text": "def delete_field(key)\n @table.delete(key.to_sym)\n end",
"title": ""
},
{
"docid": "dee2ea7ff8385c2db2cd8b2a15e8e70b",
"score": "0.6303191",
"text": "def delete_entry(key, options) # :nodoc:\n @data.where(key: key).delete\n rescue Sequel::Error => e\n logger.error(\"Sequel::Error (#{e}): #{e.message}\") if logger\n false\n end",
"title": ""
},
{
"docid": "125e54027ddff88925cf118787ff8738",
"score": "0.62860185",
"text": "def delete(class_or_classname, record_id)\n clazz = find_or_materialize(class_or_classname)\n http_delete(\"/services/data/v#{self.version}/sobjects/#{clazz.sobject_name}/#{record_id}\")\n end",
"title": ""
},
{
"docid": "2f09b1bc18309831d672d8a2ac1eaa20",
"score": "0.6280338",
"text": "def delete(key)\n\n end",
"title": ""
},
{
"docid": "b87d3e86b633b54a9074dae3f2a5e2e7",
"score": "0.62697315",
"text": "def remove_record(record_id)\n @records.delete(record_id)\n end",
"title": ""
},
{
"docid": "632b6c6658bcdb79b4a3b7afad6b0572",
"score": "0.6268484",
"text": "def remove_record(record)\n atoms = condense_record(record)\n load_atoms(atoms)\n atoms.each do |a|\n @atoms[a].remove_record(record.id) if @atoms.has_key?(a)\n @records_size -= 1\n #p \"removing #{record.id} from #{a}\"\n end\n end",
"title": ""
},
{
"docid": "42b872c02c98e72b367e4455b0cf4683",
"score": "0.6267368",
"text": "def delete; raise ActiveRecord::ReadOnlyRecord; end",
"title": ""
},
{
"docid": "a502a93c7b6f1a9d4824712389f62e0d",
"score": "0.6266875",
"text": "def delete() # EXTENSION\n sql = \"DELETE FROM films WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\nend",
"title": ""
},
{
"docid": "23a1cabeecb9f9b68ea4378d64f1b076",
"score": "0.6262244",
"text": "def delete_outdated_record(original_record)\n ETL::Engine.logger.debug \"deleting old row\"\n \n q = \"DELETE FROM #{dimension_table} WHERE #{primary_key} = #{original_record[primary_key]}\"\n connection.delete(q)\n end",
"title": ""
},
{
"docid": "9078a5f4fb8c5d262b18650f8f30e0ff",
"score": "0.6260459",
"text": "def delete_listing(db, id)\n\tdb.execute(\"DELETE FROM cars WHERE id=?\", [id])\nend",
"title": ""
},
{
"docid": "87f6a5f6948ebf081f957ec051b4b907",
"score": "0.6257268",
"text": "def destroy_existing(id, params={})\n request(params.merge(:_method => :delete, :_path => build_request_path(params.merge(primary_key => id)))) do |parsed_data, response|\n new(parse(parsed_data[:data]).merge(:_destroyed => true))\n end\n end",
"title": ""
},
{
"docid": "7407303f45cbe76e16d48f1621288da6",
"score": "0.62323254",
"text": "def delete_from_table(db,id,table_name)\n db.execute(\"DELETE FROM #{table_name} WHERE #{table_name}.id =#{id}\")\nend",
"title": ""
},
{
"docid": "804859c7e2129292558decba737c5864",
"score": "0.62318933",
"text": "def delete\n RecordsSearch.where(search_id:self[:id]).delete\n super\n end",
"title": ""
},
{
"docid": "41aad203f02d7ec0c1625f907461c248",
"score": "0.62176585",
"text": "def delete() #DELETE film1.delete (removes 1 film)\n sql = \"DELETE FROM films WHERE id = $1;\"\n values = [@id]\n SqlRunner.run(sql, values)\n end",
"title": ""
},
{
"docid": "69b0b6ed6479fa8871db0778eb6d0392",
"score": "0.6205704",
"text": "def delete(oid)\n end",
"title": ""
},
{
"docid": "c47210efb494708c12f524649f946d76",
"score": "0.6205048",
"text": "def delete(values = {})\n o = new(values.merge(deleted: true))\n ds = self.class.dataset(o.context, no_finalize: true)\n p = ds.where(ds.last_record_id => record_id,\n ds.last_branch_path => o.branch_path)\n .order(Sequel.qualify(ds.opts[:last_joined_table], :depth),\n Sequel.qualify(ds.versioned_table, :version).desc).first\n raise VersionedError, \"Delete without existing record\" unless p\n raise VersionedError, \"Delete with existing deleted record\" if p.deleted\n o.save\n end",
"title": ""
},
{
"docid": "35dfa9d835410223b91fee8041e69fbb",
"score": "0.61983746",
"text": "def db_deleter(database, id)\n database.execute(\"DELETE FROM wine_cellar where id=#{id}\")\nend",
"title": ""
},
{
"docid": "a96f0b19f79e2bcebab17e786f9fa0dc",
"score": "0.61952746",
"text": "def delete \n orientdb.delete_record self \nend",
"title": ""
},
{
"docid": "a64440d9091ae808728f94a87fd809bf",
"score": "0.61948323",
"text": "def delete(id)\n @conn.execute(*@builder.delete(id))\n end",
"title": ""
},
{
"docid": "d114b6e71b518f309c23c434fcd9e0ec",
"score": "0.6194337",
"text": "def delete(*args)\n dataset.delete(*args)\n self\n end",
"title": ""
},
{
"docid": "007b0b2906e4f3e3d37d4149b6ce0b0e",
"score": "0.61938965",
"text": "def delete\n CONNECTION.execute(\"DELETE FROM users WHERE id = #{self.id};\")\n end",
"title": ""
},
{
"docid": "2a4b0d24cea34ec36fafa7d28966c2e2",
"score": "0.619015",
"text": "def delete(key)\r\n if record = touch(key)\r\n @store.delete(key)\r\n @head = @tail = nil if @store.length.zero?\r\n record[:value]\r\n end\r\n end",
"title": ""
},
{
"docid": "23b487bb8e5e215d00e2db72729ffa17",
"score": "0.6185378",
"text": "def destroyRecord(id)\n item = Todo.find(id)\n item.destroy\nend",
"title": ""
},
{
"docid": "79f6c1dc625b7028742c1da69decc7cf",
"score": "0.6181075",
"text": "def delete\n \n end",
"title": ""
},
{
"docid": "2e13220ee607ee17192b616e3221e58d",
"score": "0.6180355",
"text": "def delete(key)\n data.delete(key)\n @deleted_hash[key] = nil\n end",
"title": ""
}
] |
4f1fb28f10ffb322ba46b674c2ee69c5 | checks to see if a value has been set for the `version_limit` config option, and if so enforces it | [
{
"docid": "ef7f3ed694800d8386b560301775bd7c",
"score": "0.64490634",
"text": "def enforce_version_limit!\n return unless PaperTrail.config.version_limit.is_a? Numeric\n previous_versions = sibling_versions.not_creates\n return unless previous_versions.size > PaperTrail.config.version_limit\n excess_previous_versions = previous_versions - previous_versions.last(PaperTrail.config.version_limit)\n excess_previous_versions.map(&:destroy)\n end",
"title": ""
}
] | [
{
"docid": "29bddc2d5928a9de0f7ea55ca10d9ca6",
"score": "0.6416929",
"text": "def should_be_limited?\n options[:limit] || (options[:limit].is_a?(Integer) && options[:limit].positive?)\n end",
"title": ""
},
{
"docid": "b957778c4afefe165b532e652af57afa",
"score": "0.6368169",
"text": "def check_for_limit_or_offset_vulnerability options\n return false if rails_version.nil? or rails_version >= \"2.1.1\" or not hash?(options)\n\n return true if hash_access(options, :limit) or hash_access(options, :offset)\n\n false\n end",
"title": ""
},
{
"docid": "fd1fc7f3b5125c293ee06b4624a090ad",
"score": "0.63025093",
"text": "def check_for_limit_or_offset_vulnerability options\n return false if @rails_version.nil? or @rails_version >= \"2.1.1\" or not hash? options\n\n if hash_access(options, :limit) or hash_access(options, :offset)\n return true\n end\n\n false\n end",
"title": ""
},
{
"docid": "abc0492601f5b2c1a0ff02bf7cd95f4c",
"score": "0.62884116",
"text": "def enforce_version_limit!\n limit = version_limit\n return unless limit.is_a? Numeric\n previous_versions = sibling_versions.not_creates.\n order(self.class.timestamp_sort_order(\"asc\"))\n return unless previous_versions.size > limit\n excess_versions = previous_versions - previous_versions.last(limit)\n excess_versions.map(&:destroy)\n end",
"title": ""
},
{
"docid": "e99eb9a6ef2882a421d9f68d8455b36d",
"score": "0.61945313",
"text": "def package_settings_validate(value)\n debug \"package_settings_validate(#{value}): no-op\"\n true\n end",
"title": ""
},
{
"docid": "6dd491f214a775b063c680ac9f4c8ef8",
"score": "0.60826963",
"text": "def version_limit\n klass = item.class\n if limit_option?(klass)\n klass.paper_trail_options[:limit]\n elsif base_class_limit_option?(klass)\n klass.base_class.paper_trail_options[:limit]\n else\n PaperTrail.config.version_limit\n end\n end",
"title": ""
},
{
"docid": "0c526d92d967c01c2e45ffed132ea37f",
"score": "0.60449016",
"text": "def effective_version_threshold\n version_threshold || course.version_threshold\n end",
"title": ""
},
{
"docid": "1efb1fd8819f884c0506a4f918580d32",
"score": "0.60263246",
"text": "def settings_limit\n if Setting.count >= 1\n errors.add(:base, I18n.t(:setings_limit, scope:'activerecord.errors.models.setting'))\n end\n end",
"title": ""
},
{
"docid": "a2f2b9a5277bf2260c91ec18262bb5d0",
"score": "0.6016323",
"text": "def set_RevisionLimit(value)\n set_input(\"RevisionLimit\", value)\n end",
"title": ""
},
{
"docid": "227f7d508e0ba9e1db8024877d22240d",
"score": "0.5998643",
"text": "def validate_limit_param(limit)\n # Just give the limit of the request if there is no facet_klass\n return limit unless search.facet_klass.respond_to?(:available_limits)\n\n if search.facet_klass.limits_for_form.include?(limit.to_i)\n limit.to_i\n else\n _default_ = search.facet_klass.available_limits.select{|x| x.fetch(:default, false) }.first\n # If default does not exist, select the first\n _default_ = search.facet_klass.available_limits.first unless _default_\n _default_.fetch(:value, nil)\n end\n rescue\n nil\n end",
"title": ""
},
{
"docid": "499a47f880155cd793baa31ebde5cee4",
"score": "0.5992104",
"text": "def validate_version\n if @version.blank?\n errors.add(:version, \"version can't be blank\")\n elsif @version != '2.0.2'\n errors.add(:version, \"version '#{@version}' is not supported. Supported version is '2.0.2'\")\n end\n end",
"title": ""
},
{
"docid": "29205b0a79592e8698b9ad4634b642fd",
"score": "0.59195644",
"text": "def set_RevisionLimit(value)\n set_input(\"RevisionLimit\", value)\n end",
"title": ""
},
{
"docid": "2bcaac558b25c86316eb763871703eb1",
"score": "0.58866864",
"text": "def check_limit_per_source\n attr_name = self.attribute_name.downcase\n if self.new_record? and Annotations::Config::limits_per_source.has_key?(attr_name)\n options = Annotations::Config::limits_per_source[attr_name]\n max = options[0]\n can_replace = options[1]\n \n unless (found_annotatable = Annotation.find_annotatable(self.annotatable_type, self.annotatable_id)).nil?\n anns = found_annotatable.annotations_with_attribute_and_by_source(attr_name, self.source)\n \n if anns.length >= max\n self.errors[:base] << \"The limit has been reached for annotations with this attribute and by this source.\"\n return false\n else\n return true\n end\n else\n return true\n end\n else\n return true\n end\n end",
"title": ""
},
{
"docid": "582c01bbeea746e82412e2cd4995c351",
"score": "0.5882941",
"text": "def check_limit_per_source\n attr_name = self.attribute_name.downcase\n if self.new_record? and Annotations::Config::limits_per_source.has_key?(attr_name)\n options = Annotations::Config::limits_per_source[attr_name]\n max = options[0]\n can_replace = options[1]\n \n unless (found_annotatable = Annotation.find_annotatable(self.annotatable_type, self.annotatable_id)).nil?\n anns = found_annotatable.annotations_with_attribute_and_by_source(attr_name, self.source)\n \n if anns.length >= max\n self.errors.add_to_base(\"The limit has been reached for annotations with this attribute and by this source.\")\n return false\n else\n return true\n end\n else\n return true\n end\n else\n return true\n end\n end",
"title": ""
},
{
"docid": "b332517e97e902d20ab6efa91d28fabd",
"score": "0.58103806",
"text": "def limits\n @@limits ||= load_config(limits_config)\n end",
"title": ""
},
{
"docid": "bd333c6efff5e26b2c05dc3867917def",
"score": "0.57404745",
"text": "def guard_max_value_with_raise(key, value)\n return if value.bytesize <= @options[:value_max_bytes]\n \n message = \"Value for #{key} over max size: #{@options[:value_max_bytes]} <= #{value.bytesize}\"\n raise Dalli::ValueOverMaxSize, message\n end",
"title": ""
},
{
"docid": "9414aaf3f30312cbff65d1de55b777e0",
"score": "0.5721867",
"text": "def fix_available?\n fixed_in.any? { |v| v.version != Package::MAX_VERSION }\n end",
"title": ""
},
{
"docid": "0d045d9e8bb8305c8b3b7648cb28cfb8",
"score": "0.57165325",
"text": "def _require_min_api_version(version)\n actual_version = @_resource_root.version\n version = [version, _api_version].max\n if actual_version < version\n raise \"API version #{version} is required but #{actual_version} is in use.\"\n end\n end",
"title": ""
},
{
"docid": "0d045d9e8bb8305c8b3b7648cb28cfb8",
"score": "0.57165325",
"text": "def _require_min_api_version(version)\n actual_version = @_resource_root.version\n version = [version, _api_version].max\n if actual_version < version\n raise \"API version #{version} is required but #{actual_version} is in use.\"\n end\n end",
"title": ""
},
{
"docid": "e857ea161b28c6eb8f774b179b7eaac7",
"score": "0.56937647",
"text": "def validate!\n REQUIRED_CONFIGURATION.each do |name|\n raise \"`#{name}` is a required configuration option, but was not given a value.\" if send(\"#{name}\").nil?\n end\n true\n end",
"title": ""
},
{
"docid": "e857ea161b28c6eb8f774b179b7eaac7",
"score": "0.56937647",
"text": "def validate!\n REQUIRED_CONFIGURATION.each do |name|\n raise \"`#{name}` is a required configuration option, but was not given a value.\" if send(\"#{name}\").nil?\n end\n true\n end",
"title": ""
},
{
"docid": "2b1d731ee1743a9fe34f2c001510c694",
"score": "0.5691602",
"text": "def should_be_limited?; end",
"title": ""
},
{
"docid": "2b1d731ee1743a9fe34f2c001510c694",
"score": "0.5691602",
"text": "def should_be_limited?; end",
"title": ""
},
{
"docid": "fbf28ee53eb4f9a022446d2af972c86e",
"score": "0.56793827",
"text": "def validate_organization_soft_limits\n owner = @organization.owner\n if @user_params[PARAM_SOFT_GEOCODING_LIMIT] == 'true' && !owner.soft_geocoding_limit\n @custom_errors[:soft_geocoding_limit] = [\"Owner can't assign soft geocoding limit\"]\n end\n if @user_params[PARAM_SOFT_HERE_ISOLINES_LIMIT] == 'true' && !owner.soft_here_isolines_limit\n @custom_errors[:soft_here_isolines_limit] = [\"Owner can't assign soft here isolines limit\"]\n end\n if @user_params[PARAM_SOFT_TWITTER_DATASOURCE_LIMIT] == 'true' && !owner.soft_twitter_datasource_limit\n @custom_errors[:soft_twitter_datasource_limit] = [\"Owner can't assign soft twitter datasource limit\"]\n end\n if @user_params[PARAM_SOFT_MAPZEN_ROUTING_LIMIT] == 'true' && !owner.soft_mapzen_routing_limit\n @custom_errors[:soft_mapzen_routing_limit] = [\"Owner can't assign soft mapzen routing limit\"]\n end\n end",
"title": ""
},
{
"docid": "68d7889af306ea65a5eea7ca40f50267",
"score": "0.56006205",
"text": "def version_penalty?\n effective_version_threshold > -1 && effective_version_penalty.value.to_d != 0.0.to_d\n end",
"title": ""
},
{
"docid": "f2fa6af4ba5662466ee39fe47115cbc1",
"score": "0.5599536",
"text": "def check_version(version, config_file)\n if version.nil?\n # This is not hiera2 compatible\n @diagnostics.accept(Issues::MISSING_VERSION, config_file)\n return false\n end\n unless version >= 2\n @diagnostics.accept(Issues::WRONG_VERSION, config_file, :expected => 2, :actual => version)\n return false\n end\n unless version == 2\n # it may have a sane subset, hence a different error (configured as warning)\n @diagnostics.accept(Issues::LATER_VERSION, config_file, :expected => 2, :actual => version)\n end\n return true\n end",
"title": ""
},
{
"docid": "f9ac7e6490e8bee2ed63e0a080231d76",
"score": "0.559558",
"text": "def os_maximum_version=(value)\n @os_maximum_version = value\n end",
"title": ""
},
{
"docid": "f9ac7e6490e8bee2ed63e0a080231d76",
"score": "0.559558",
"text": "def os_maximum_version=(value)\n @os_maximum_version = value\n end",
"title": ""
},
{
"docid": "f9ac7e6490e8bee2ed63e0a080231d76",
"score": "0.559558",
"text": "def os_maximum_version=(value)\n @os_maximum_version = value\n end",
"title": ""
},
{
"docid": "f9ac7e6490e8bee2ed63e0a080231d76",
"score": "0.559558",
"text": "def os_maximum_version=(value)\n @os_maximum_version = value\n end",
"title": ""
},
{
"docid": "f9ac7e6490e8bee2ed63e0a080231d76",
"score": "0.559558",
"text": "def os_maximum_version=(value)\n @os_maximum_version = value\n end",
"title": ""
},
{
"docid": "f9ac7e6490e8bee2ed63e0a080231d76",
"score": "0.559558",
"text": "def os_maximum_version=(value)\n @os_maximum_version = value\n end",
"title": ""
},
{
"docid": "1f036070d2edf2a16ede08830f2ecf12",
"score": "0.5590734",
"text": "def limit_is_a_non_negative_integer\n value_is_a_non_negative_integer(target: :limit, value: limit)\n end",
"title": ""
},
{
"docid": "8d34cc27561686f4e94b6265ee2294ff",
"score": "0.5590183",
"text": "def version_guard(version)\n if version.to_f <= options[:api_version].to_f\n yield\n else\n raise APIVersionError, \"You must set an `api_version` of at least #{version} \" \\\n \"to use this feature in the Salesforce API. Set the \" \\\n \"`api_version` option when configuring the client - \" \\\n \"see https://github.com/ejholmes/restforce/blob/master\" \\\n \"/README.md#api-versions\"\n end\n end",
"title": ""
},
{
"docid": "26b8347a68e5c6478661cb76dab6a92e",
"score": "0.5580861",
"text": "def set_limit(opts)\n opts = check_params(opts,[:limits])\n super(opts)\n end",
"title": ""
},
{
"docid": "26b8347a68e5c6478661cb76dab6a92e",
"score": "0.5580687",
"text": "def set_limit(opts)\n opts = check_params(opts,[:limits])\n super(opts)\n end",
"title": ""
},
{
"docid": "26b8347a68e5c6478661cb76dab6a92e",
"score": "0.5580687",
"text": "def set_limit(opts)\n opts = check_params(opts,[:limits])\n super(opts)\n end",
"title": ""
},
{
"docid": "781ff8576c26e5eda22a9f1a71c50683",
"score": "0.5567012",
"text": "def check_unknown_options?(config); end",
"title": ""
},
{
"docid": "97841e3af0043829bc66c2a0c30dbacb",
"score": "0.5563508",
"text": "def limited?\n !!application_limit\n end",
"title": ""
},
{
"docid": "18343e64341800a92ac7a97c801d69b3",
"score": "0.5562906",
"text": "def max_bad_records= val\n @gapi.configuration.load.update! max_bad_records: val\n end",
"title": ""
},
{
"docid": "efa13de40edd2764069ff182ee3d8f2f",
"score": "0.5543782",
"text": "def too_long_value?\n @value.size > max_value_length\n end",
"title": ""
},
{
"docid": "0c0edaba57aa2eed4d9f6f3cc8e5e4aa",
"score": "0.55428326",
"text": "def validator\n true if !exceeds_queries_limit &&\n !exceeds_columns_limit &&\n !exceeds_values_contains_limit\n end",
"title": ""
},
{
"docid": "41e9294ac0a01cf471ae102a14d8b122",
"score": "0.553919",
"text": "def client_version_above?(v, options={})\n ((client_version <=> v) >= 0) || (client_version.empty? && options[:unknown])\n end",
"title": ""
},
{
"docid": "07224b1be9ab36d76b18dd35582a5c36",
"score": "0.55386",
"text": "def minimum_version=(version)\n if version > 0.1\n throw \"This version of Makeconf is too old. Please upgrade to version #{version} or newer\"\n end\n end",
"title": ""
},
{
"docid": "e87976e8c14fade2103c0510501d598e",
"score": "0.55245674",
"text": "def validate_version\n unless version =~ /\\d+.\\d+.\\d+/\n Chef::Log.fatal(\"The version must be in X.Y.Z format. Passed value: #{version}\")\n raise\n end\nend",
"title": ""
},
{
"docid": "93c83da65278704d342abbc59a40115c",
"score": "0.55184263",
"text": "def check_size(maximum_components)\n raise \"Malformed version #{self}: too many version components\" if self[maximum_components]\n end",
"title": ""
},
{
"docid": "cf7a5dbffad2801da93c11cacaf05163",
"score": "0.5497623",
"text": "def allow_unlimited_length=(value)\n @allow_unlimited_length = value\n end",
"title": ""
},
{
"docid": "067aaf121ecc9532c3906c5d852df2d6",
"score": "0.5496113",
"text": "def check_schema_maxLength(value)\n _check_type(:maxLength, value, Integer)\n raise_path_less_error \"Invalid value for maxLength, a non negative value is expected\" if value.negative?\n end",
"title": ""
},
{
"docid": "48edf39e4f1eb7c5f7b9cb9ea2fa161e",
"score": "0.54864335",
"text": "def max_set_version\n options[:max_set_version]\n end",
"title": ""
},
{
"docid": "f83f98649fed1cf090ef199c38190777",
"score": "0.5485463",
"text": "def limit_value\n @limit_value ||= original_params.fetch(:limit, DEFAULT_LIMIT_VALUE).to_i\n end",
"title": ""
},
{
"docid": "b3ca20d47dc239cca8064baee508f614",
"score": "0.5473188",
"text": "def vote_limit\n return nil if component_settings.vote_limit.zero?\n\n component_settings.vote_limit\n end",
"title": ""
},
{
"docid": "28813b58272fab89e637ea748b79b70d",
"score": "0.5471211",
"text": "def sanitize_limit\n return unless limit = params[:limit]\n if limit.to_i.to_s != limit.to_s || limit.to_i < 1\n params.delete(:limit)\n elsif limit.to_i > 100\n params[:limit] = \"100\"\n end\n nil\n end",
"title": ""
},
{
"docid": "1e35d8f86c7e374df6396fbc46d0ffe9",
"score": "0.5470913",
"text": "def limit=(value)\n options.limit = value\n end",
"title": ""
},
{
"docid": "c21e1a0d7de3fc565428f57e4503f806",
"score": "0.5463575",
"text": "def minimum_required_app_version=(value)\n @minimum_required_app_version = value\n end",
"title": ""
},
{
"docid": "67b1f05a4f873950969db57618e8d61a",
"score": "0.54583114",
"text": "def set_availability_dependency(opts)\n opts = check_params(opts,[:values])\n super(opts)\n end",
"title": ""
},
{
"docid": "3e81fe59ec1d678c4aba2241af75d27d",
"score": "0.54556346",
"text": "def check_option_range\n\t\t\t@log.error(\"Plase implement check_option_range on nalserver \")\n\t\tend",
"title": ""
},
{
"docid": "4d98e8b12580bb7d8fdcb67217a0fc5f",
"score": "0.54544634",
"text": "def check_for_rate_limits\n rate_limit_remaining < 10\n end",
"title": ""
},
{
"docid": "c552ec22e82ec302711b24414b1bdc63",
"score": "0.54540634",
"text": "def validate_version\n unless new_resource.version =~ /\\d+.\\d+.\\d+/\n Chef::Log.fatal(\"The version must be in X.Y.Z format. Passed value: #{new_resource.version}\")\n raise\n end\n end",
"title": ""
},
{
"docid": "b9645909ec0c731e91965cae9e2fd804",
"score": "0.5452393",
"text": "def configure_flags_threshold\n\t\tinput = params[:valuee].to_i\n\t\tif input == 0\n\t\t\tflash[:not_entering_numbers] = \"Please enter a valid number. $red\"\n\t\t\tredirect_to '/admin_settings'\n\t\t\treturn\n\t\telse\n\t\t\tAdmin_Settings.configure_flags_threshold input\n\t\t\tflash[:changed_settings] = \"Settings Changed Successfully $green\"\n\t\tend\n\t\tredirect_to '/admin_settings'\n\tend",
"title": ""
},
{
"docid": "df91fc831b86a815be8e9d05d4e5b489",
"score": "0.5447607",
"text": "def limit_allow?(amount)\n daily_limit >= amount\n end",
"title": ""
},
{
"docid": "a0631e9ddca956551f379df96ff91b56",
"score": "0.5446916",
"text": "def validate_version\n return if new_resource.version =~ /\\d+.\\d+.\\d+/\n Chef::Log.fatal(\"The version must be in X.Y.Z format. Passed value: #{new_resource.version}\")\n raise\n end",
"title": ""
},
{
"docid": "a6bb6f7ee6baafc6cc025c48c380211a",
"score": "0.5436342",
"text": "def platform_has_valid_version_constraint\n Chef::VersionConstraint.new(version_constraint)\n rescue Chef::Exceptions::InvalidVersionConstraint\n errors.add(\n :version_constraint,\n I18n.t(\n 'api.error_messages.invalid_version_constraint',\n name: name,\n version_constraint: version_constraint\n )\n )\n end",
"title": ""
},
{
"docid": "31b656480de525e458f889585d96110c",
"score": "0.543497",
"text": "def no_version_requested?\n\t @options[:ensure].nil?\n\tend",
"title": ""
},
{
"docid": "2fa3b5f42581ac1ca44dabdffe58174f",
"score": "0.5417472",
"text": "def limit=(value)\n value = value&.to_s\n return if value.blank? # NOTE EARLY EXIT\n\n validate_numericality(value)\n input = value.to_i\n raise if input < 1\n @limit = input\n end",
"title": ""
},
{
"docid": "095c750f92c42b9c9fec1cb98b2dd110",
"score": "0.54125243",
"text": "def arguments_valid?\n (@options.min > @options.max) ? false : true\n end",
"title": ""
},
{
"docid": "ddd3652a81c55e9ef6790273bc92bb52",
"score": "0.5396973",
"text": "def validate_all_app_settings\n if code == \"allocation_precision\"\n unless (value.to_f > 0) && (value.to_f % 1 == 0)\n errors.add(:value, \"Not a positive integer\")\n end\n elsif code == \"fte_hours_per_week\" \n unless (value.to_f > 0) && (value.to_f <= 168)\n errors.add(:value, \"Must be between 0 and 168\")\n end\n elsif code == \"logo\" \n unless value.blank? || value.index(\"http\")\n errors.add(:value, \"Must be a valid external URL\")\n end\n elsif code == \"filter_position\" \n unless value == \"Left\" || value == \"Top\"\n errors.add(:value, \"Must be Left or Top\")\n end\n end\n end",
"title": ""
},
{
"docid": "0c0f3b8c0817224d88a37d6c900253f5",
"score": "0.53874946",
"text": "def limit(value)\n @limit = value\n end",
"title": ""
},
{
"docid": "55ecd8eaf57279717efaf75991765c40",
"score": "0.538317",
"text": "def limit_is_a_non_negative_integer_and_not_null\n value_is_a_non_negative_integer(target: :limit, value: limit, nullable: false)\n end",
"title": ""
},
{
"docid": "6c247e98f98c8da6adaf53589b3549c0",
"score": "0.5381512",
"text": "def check_for_version!(required)\n if required > version\n raise Exception::UnsupportedVersion, required\n end\n end",
"title": ""
},
{
"docid": "39217a175102cd650b6e405dbcef618a",
"score": "0.5380582",
"text": "def limits_config=(path)\n @@limits = nil\n @@limits_config = path\n end",
"title": ""
},
{
"docid": "dc3849c39baf2dc7e5dea3740ea62977",
"score": "0.5378876",
"text": "def check_unknown_options!; end",
"title": ""
},
{
"docid": "1c20e513f182dce3416dda61231cfbc0",
"score": "0.5359735",
"text": "def check_user_limit\n end",
"title": ""
},
{
"docid": "5620c61b2a799d8a676276d1df6360c6",
"score": "0.5355743",
"text": "def validate_value_string_length(value, limit_param_name, limit_param_method)\n if @params.key? limit_param_name\n target_value = @params[limit_param_name]\n unless value.length.send(limit_param_method, target_value)\n raise SwaggerInvalidException.new(\"Value [#{name}] length should be #{limit_param_method} than #{target_value} but is #{value.length} for [#{value}]\")\n end\n end\n end",
"title": ""
},
{
"docid": "3902d1758f2befcad392f44b2f3c3a2a",
"score": "0.5354785",
"text": "def ssl_max_version(version)\n @options[:ssl_max_version] = version\n end",
"title": ""
},
{
"docid": "80a9f79112747f47874d1873d21b6e1a",
"score": "0.5354476",
"text": "def have_limit?(l)\n l.nil? ? false : Kernel.Integer(l) rescue false\n end",
"title": ""
},
{
"docid": "05ef1f1dc3e3759510a39da932075078",
"score": "0.5350355",
"text": "def restrict_jekyll_version(more_than: nil, less_than: nil)\n jekyll_version = Gem::Version.new(Jekyll::VERSION)\n minimum_version = Gem::Version.new(more_than)\n maximum_version = Gem::Version.new(less_than)\n\n return false if !more_than.nil? && jekyll_version < minimum_version\n return false if !less_than.nil? && jekyll_version > maximum_version\n true\nend",
"title": ""
},
{
"docid": "4e343fbfadebbd9176d2f6ac1275f654",
"score": "0.53476214",
"text": "def property_pricing_not_available_for_selected_period?(payload)\n payload[\"API_RESULT_CODE\"] == \"E_LIMIT\"\n end",
"title": ""
},
{
"docid": "a2a5e1a0d1afd9aa5c2f26216330a189",
"score": "0.533966",
"text": "def unsupported_version?(version)\n version < self::MIN_SUPPORTED_VERSION\n end",
"title": ""
},
{
"docid": "306ad6e860a0f172f3428bd9e785a856",
"score": "0.53352344",
"text": "def version?\n @option_config.name == 'version'\n end",
"title": ""
},
{
"docid": "6f20d34a91eb7e20b2ca335fdd2128ef",
"score": "0.53342825",
"text": "def vote_limit_enabled?\n vote_limit.present?\n end",
"title": ""
},
{
"docid": "831ef9fe2c5b45b8f012c8ba5696082d",
"score": "0.5331228",
"text": "def validate_param_value_string_length(value, limit_param_name, limit_param_method)\n if @params.key? limit_param_name\n target_value = @params[limit_param_name]\n unless value.length.send(limit_param_method, target_value)\n raise SwaggerInvalidException.new(\"Parameter [#{name}] length should be #{limit_param_method} than #{target_value} but is #{value.length} for [#{value}]\")\n end\n end\n end",
"title": ""
},
{
"docid": "64645d84aed13865f24e537417ae8707",
"score": "0.5316078",
"text": "def valid_api_version(config, service, name)\n config_api_version = Settings.ems.ems_azure.api_versions[name]\n\n unless cached_resource_provider_service(config).supported?(service.service_name, service.provider)\n return config_api_version\n end\n\n valid_api_versions = cached_resource_provider_service(config).list_api_versions(service.provider, service.service_name)\n\n if valid_api_versions.include?(config_api_version)\n config_api_version\n else\n valid_version_string = valid_api_versions.first\n\n message = \"Invalid api-version setting of '#{config_api_version}' for \" \\\n \"#{service.provider}/#{service.service_name} for EMS #{@ems.name}; \" \\\n \"using '#{valid_version_string}' instead.\"\n\n _log.warn(message)\n valid_version_string\n end\n end",
"title": ""
},
{
"docid": "952daed4509f29431c4a038de4029c38",
"score": "0.5309426",
"text": "def limit=(value)\n @limit = value\n end",
"title": ""
},
{
"docid": "865aab463830c5953ed4d5c1a05c1069",
"score": "0.53065914",
"text": "def set_AllowMajorVersionUpgrade(value)\n set_input(\"AllowMajorVersionUpgrade\", value)\n end",
"title": ""
},
{
"docid": "87c53ff959d4bd1ec2db7fa2ce3ad83b",
"score": "0.53008425",
"text": "def limit ; options.limit ; end",
"title": ""
},
{
"docid": "40b5af994533cd3ac82e0e2d3053a549",
"score": "0.5299994",
"text": "def vcpu_limit=(value)\n @vcpu_limit = value\n end",
"title": ""
},
{
"docid": "065e1857ddc51f9239345df18b4e37d6",
"score": "0.5298559",
"text": "def set_version_to_context(ctx, version, min_version, max_version)\n if MIN_MAX_AVAILABLE\n case\n when min_version.nil? && max_version.nil?\n min_version = METHODS_MAP[version] || version\n max_version = METHODS_MAP[version] || version\n when min_version.nil? && max_version\n raise Fluent::ConfigError, \"When you set max_version, must set min_version together\"\n when min_version && max_version.nil?\n raise Fluent::ConfigError, \"When you set min_version, must set max_version together\"\n else\n min_version = METHODS_MAP[min_version] || min_version\n max_version = METHODS_MAP[max_version] || max_version\n end\n ctx.min_version = min_version\n ctx.max_version = max_version\n else\n ctx.ssl_version = METHODS_MAP[version] || version\n end\n\n ctx\n end",
"title": ""
},
{
"docid": "2abd653e91973b9aa95ada4abb87d00b",
"score": "0.5298445",
"text": "def check_version!\n api_version = bitbucket_server.version\n version = api_version[\"version\"]\n\n output_logger.info(\"Bitbucket Server version is #{version}.\")\n\n if Gem::Version.new(version) < Gem::Version.new(MINIMUM_VERSION)\n if options[:ignore_version_check]\n output_logger.warn(\n \"Ignoring unsupported server version #{version} (minimum supported\" \\\n \" version is #{MINIMUM_VERSION})!\"\n )\n else\n raise BbsExporter::BadVersion.new(version)\n end\n end\n end",
"title": ""
},
{
"docid": "a5d256d6d33b503025cd4729be855c4e",
"score": "0.5297886",
"text": "def limit(limit = nil)\n configure(:limit, limit)\n end",
"title": ""
},
{
"docid": "1df454946d81f80ef19af55f2db69c3f",
"score": "0.52935344",
"text": "def set_limit(params)\n limit = params.fetch(:limit, nil)\n\n Rails.logger.warn(\"Quota limit #{limit} for #{@user} appears to be malformed and so will be set to 0 / unlimited.\") if limit_invalid?(limit)\n\n @limit = limit.to_i\n end",
"title": ""
},
{
"docid": "1df454946d81f80ef19af55f2db69c3f",
"score": "0.52935344",
"text": "def set_limit(params)\n limit = params.fetch(:limit, nil)\n\n Rails.logger.warn(\"Quota limit #{limit} for #{@user} appears to be malformed and so will be set to 0 / unlimited.\") if limit_invalid?(limit)\n\n @limit = limit.to_i\n end",
"title": ""
},
{
"docid": "7f9be7bd12d3cc44c9d88f0fffe91bc6",
"score": "0.528592",
"text": "def set_connection_limit(opts)\n opts = check_params(opts,[:limits])\n super(opts)\n end",
"title": ""
},
{
"docid": "7f9be7bd12d3cc44c9d88f0fffe91bc6",
"score": "0.528592",
"text": "def set_connection_limit(opts)\n opts = check_params(opts,[:limits])\n super(opts)\n end",
"title": ""
},
{
"docid": "40b1e4a1dff4b2ccddafffe5fecfc618",
"score": "0.52747303",
"text": "def limit_to_set?\n prompt.challenge.respond_to?(:limited_to_set) &&\n prompt.challenge.limited_to_set\n end",
"title": ""
},
{
"docid": "7f5cc4c5a37a25cf614ec18e85cea23a",
"score": "0.52738714",
"text": "def test_reject_service_description_option_exceeding_max_bytes\n max_bytes = Fluent::NscaOutput::MAX_SERVICE_DESCRIPTION_BYTES\n config = %[\n #{CONFIG}\n service_description #{'x' * (max_bytes + 1)}\n ]\n assert_raise(Fluent::ConfigError) {\n create_driver(config)\n }\n end",
"title": ""
},
{
"docid": "2bdfa41d1177ee3e2a91335ada426eea",
"score": "0.52698183",
"text": "def limit\n (params[:limit].presence || 20).to_i\n end",
"title": ""
},
{
"docid": "45ab21323e00cc61e493d57c71d28a4d",
"score": "0.5267223",
"text": "def validate_config!\n if !config['image_id'].nil?\n connection.flavors.each do |f|\n if f.name == config['package_id']\n return true\n end\n end\n end\n return false\n end",
"title": ""
},
{
"docid": "ae4d9e8b707e11f88680542c2c893d53",
"score": "0.52578855",
"text": "def limit; @limit ||= 10; end",
"title": ""
},
{
"docid": "aa0d4c0020c8e434e13a9278593f96dd",
"score": "0.52551126",
"text": "def supported_version?(value)\n supported = false\n\n if valid_version?(value)\n major_version = value.split(\".\")[0].to_i\n supported_version = @min_prod_version.split(\".\")[0].to_i\n supported = major_version >= supported_version ? true : false\n end\n\n return supported\n end",
"title": ""
},
{
"docid": "31a1e0bb9f9061e24c49411a13155863",
"score": "0.52527344",
"text": "def cert_limit_adjust\n @cert_limit_adjust ||= 0\n end",
"title": ""
}
] |
fbb63d75adc098dc19d607c454e2498c | Adds framing output to the given parent. | [
{
"docid": "56ebc6f1e27ad2a443d21412c8730854",
"score": "0.6863033",
"text": "def add_frame_output(state, parent, property, output)\n if parent.is_a?(Hash)\n debug(\"frame\") { \"add for property #{property.inspect}: #{output.inspect}\"}\n parent[property] ||= []\n parent[property] << output\n else\n debug(\"frame\") { \"add top-level: #{output.inspect}\"}\n parent << output\n end\n end",
"title": ""
}
] | [
{
"docid": "a3a6ceb2b6cd027957912d6a4029a4ba",
"score": "0.69752634",
"text": "def add_frame_output(parent, property, output)\n if parent.is_a?(Hash)\n parent[property] ||= []\n parent[property] << output\n else\n parent << output\n end\n end",
"title": ""
},
{
"docid": "80d37336a9a929a5563e069058c04925",
"score": "0.6097906",
"text": "def write_via(parent)\n @parent = parent\n context(parent.output, parent.prettyprint, parent.indentation, parent.helpers) do\n content\n end\n end",
"title": ""
},
{
"docid": "db9fc2e573d173fe33a4be000ccc791d",
"score": "0.57641745",
"text": "def write_parent message\n parent.write message\n end",
"title": ""
},
{
"docid": "4e4a02898002a72424690bfce9dfe538",
"score": "0.5710033",
"text": "def add_parent(parent)\n parent.add_content(self)\n end",
"title": ""
},
{
"docid": "121a9c0aa57ce4e269ed5ba20a0dc701",
"score": "0.56526643",
"text": "def _emit_via(parent, options = {}, &block)\n _emit(options.merge(:parent => parent,\n :output => parent.output,\n :helpers => parent.helpers), &block)\n end",
"title": ""
},
{
"docid": "fc99b395c3b2f5489c82809dd41efe45",
"score": "0.5646977",
"text": "def add_parent(parent)\n parent.add_child(self)\n end",
"title": ""
},
{
"docid": "edc5dd2637a53225926d8bf75a969291",
"score": "0.56432873",
"text": "def add_output(signal)\n self.parent.add_output(signal)\n end",
"title": ""
},
{
"docid": "e489fb2800c8f2be060721c874891db6",
"score": "0.5539063",
"text": "def add(child, options = {})\n child.peer.reparent(self)\n \n if child.is_a?(RubyMVC::Views::View) && (a = child.actions)\n child.frame = self\n merge_actions(a)\n end\n end",
"title": ""
},
{
"docid": "cd40740bca83770066a979c1de5b46d2",
"score": "0.55159885",
"text": "def write_parent message\n @parent.write \"#{[Process.pid, message]};;;\"\n end",
"title": ""
},
{
"docid": "4a7a20ffb3afd737f39f31855288bc59",
"score": "0.52493256",
"text": "def with_parent(parent)\n @actor_system = parent\n self\n end",
"title": ""
},
{
"docid": "6cf00ea09acb7d82bb872ae6920d7f09",
"score": "0.52292967",
"text": "def add_parent(parent)\n ActsAsDAG::HelperMethods.link(parent, self)\n end",
"title": ""
},
{
"docid": "86ed1e405ebcff797de7df2fa323b399",
"score": "0.52276725",
"text": "def add(child, options = {})\n child.peer.reparent(self)\n end",
"title": ""
},
{
"docid": "5a241415b4feecffe7356f088945260e",
"score": "0.5192392",
"text": "def add_to_parent(*_)\n @parent.add_child self\n end",
"title": ""
},
{
"docid": "25925be1d18a3c067f183d3402337610",
"score": "0.51474905",
"text": "def register_parent( parent )\n \n @parent = parent\n \n return self\n \n end",
"title": ""
},
{
"docid": "2965f2c9c975de35bdd2daf9162e818e",
"score": "0.51222646",
"text": "def <<(frame)\n add(frame)\n end",
"title": ""
},
{
"docid": "bcea70a046502b9e74eaf3f0f6d7d4df",
"score": "0.5108215",
"text": "def add_child(child)\n child.parent = self\n end",
"title": ""
},
{
"docid": "bcea70a046502b9e74eaf3f0f6d7d4df",
"score": "0.5108215",
"text": "def add_child(child)\n child.parent = self\n end",
"title": ""
},
{
"docid": "bcea70a046502b9e74eaf3f0f6d7d4df",
"score": "0.5108215",
"text": "def add_child(child)\n child.parent = self\n end",
"title": ""
},
{
"docid": "3cda25ceab6502b3056f80e9b0697a9a",
"score": "0.5099314",
"text": "def write( time, level, name, frame, msg )\n\t\tif block_given?\n\t\t\tsuper\n\t\telse\n\t\t\tsuper {|msg| @io.puts(msg) }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "a223acfdeace7ec4c921226c50a6483c",
"score": "0.50911707",
"text": "def attach_to(parent)\n @parent.remove_child(self)\n @parent = parent\n parent.add_child(self)\n self\n end",
"title": ""
},
{
"docid": "6c6ffeb4aaf2c332e41038e60a60a694",
"score": "0.5080302",
"text": "def <<(child)\n conterminate_path\n child.parent = self\n children << child\n end",
"title": ""
},
{
"docid": "aa01b080d3ed06400f12d4f65b23ac74",
"score": "0.5075257",
"text": "def framer; end",
"title": ""
},
{
"docid": "4f8c5224a5a687d814188e83aa154e37",
"score": "0.5064411",
"text": "def attach_to parent\n parent.add self if parent\n end",
"title": ""
},
{
"docid": "7efff6b2bb1624de198d48a2c1158ab8",
"score": "0.50539",
"text": "def attach_and_monitor(parent)\n @parent.remove_child(self)\n @parent = parent\n parent.add_child(self)\n monitor(parent)\n self\n end",
"title": ""
},
{
"docid": "a9e94bafca69a56b35c381dd09579059",
"score": "0.50515616",
"text": "def with_parent(parent)\n @parents.push parent\n yield\n ensure\n @parents.pop\n end",
"title": ""
},
{
"docid": "1ec53b3764211f937d9d4e7f7f1c8442",
"score": "0.5041859",
"text": "def appendChild(child)\n self << child\n case child.nodeName\n when 'SCRIPT'\n Element::Script.process(child)\n when 'FRAME', 'IFRAME'\n child.contentWindow = ownerDocument.defaultView\n end\n child\n end",
"title": ""
},
{
"docid": "9a327c5393fb02350200258c11a4646b",
"score": "0.5034471",
"text": "def attach(parent)\n\t\t\t@graph = parent\n\t\tend",
"title": ""
},
{
"docid": "06e29d79ab2edb147f57669eab528251",
"score": "0.5026688",
"text": "def with_output\n super do |out|\n out.puts header\n @queued_write = []\n yield out\n @queued_write.sort.each do |line|\n out.puts(line)\n end\n end\n end",
"title": ""
},
{
"docid": "499c199f640f446fffeeb1e57d55202a",
"score": "0.50018495",
"text": "def add_content(parent, &block)\n # No Op by default\n end",
"title": ""
},
{
"docid": "cd3e1219e52760cd7b51436a4833488d",
"score": "0.49877527",
"text": "def addChild(child,updateCall=nil,pos=-1)\n \t\t\tshape=child\n \t\t\t@updateCalls << [child,updateCall] if updateCall\n \t\tunless %x{#{child}.shape == null}\n \t\t\t\tshape=child.shape\n \t\t\tchild.plot=self\n \t\t\tchild.graph=@graph\n \t\t\t@graph.add(child)\n \t\tend\n \t\tif pos>=0\n \t\t\t%x{#{@parent}.addChildAt(#{shape},#{pos})}\n \t\telse\n \t\t\t%x{#{@parent}.addChild(#{shape})}\n \t\tend\n \tend",
"title": ""
},
{
"docid": "7778e7e78f0e3b92b8a39d2e8a6d595c",
"score": "0.4984953",
"text": "def addChild(child,updateCall=nil,pos=-1)\n \t\t\tshape=child\n \t\t\t@updateCalls << [child,updateCall] if updateCall\n \t\tunless %x{#{child}.shape == null}\n \t\t\t\tshape=child.shape\n \t\t\tchild.plot=self\n \t\t\tchild.graph=@graph\n \t\t\t@graph.add(child)\n \t\tend\n \t\t#%x{console.log(\"addChild\"+shape)}\n \t\tif pos>=0\n \t\t\t%x{#{@parent}.addChildAt(#{shape},#{pos})}\n \t\telse\n \t\t\t#%x{console.log(\"add child \"+shape)}\n \t\t\t%x{#{@parent}.addChild(#{shape})}\n \t\tend\n \tend",
"title": ""
},
{
"docid": "7778e7e78f0e3b92b8a39d2e8a6d595c",
"score": "0.4984953",
"text": "def addChild(child,updateCall=nil,pos=-1)\n \t\t\tshape=child\n \t\t\t@updateCalls << [child,updateCall] if updateCall\n \t\tunless %x{#{child}.shape == null}\n \t\t\t\tshape=child.shape\n \t\t\tchild.plot=self\n \t\t\tchild.graph=@graph\n \t\t\t@graph.add(child)\n \t\tend\n \t\t#%x{console.log(\"addChild\"+shape)}\n \t\tif pos>=0\n \t\t\t%x{#{@parent}.addChildAt(#{shape},#{pos})}\n \t\telse\n \t\t\t#%x{console.log(\"add child \"+shape)}\n \t\t\t%x{#{@parent}.addChild(#{shape})}\n \t\tend\n \tend",
"title": ""
},
{
"docid": "bd63b4280d0cc08b28d384553e1f9ed8",
"score": "0.49603862",
"text": "def framing; end",
"title": ""
},
{
"docid": "421f5170d9344b297660d439bd43128a",
"score": "0.49520308",
"text": "def add_child(cNode)\n cNode.parent=self\n end",
"title": ""
},
{
"docid": "9a2ee4ed1223353d2c8e06061320c0fc",
"score": "0.49471545",
"text": "def parent_frame; end",
"title": ""
},
{
"docid": "62e9ce0e74c6d577c37a5b8823b40f5d",
"score": "0.49251753",
"text": "def setup_child\n log(:at => \"setup_child\")\n end",
"title": ""
},
{
"docid": "62e9ce0e74c6d577c37a5b8823b40f5d",
"score": "0.49251753",
"text": "def setup_child\n log(:at => \"setup_child\")\n end",
"title": ""
},
{
"docid": "62e9ce0e74c6d577c37a5b8823b40f5d",
"score": "0.49251753",
"text": "def setup_child\n log(:at => \"setup_child\")\n end",
"title": ""
},
{
"docid": "0242502276631b4ee38bce0f563ff00d",
"score": "0.49249214",
"text": "def after_parent(parent)\n run_if_should :after_parent, parent\n end",
"title": ""
},
{
"docid": "bcd369203327f44fbfce090b334e382c",
"score": "0.4908309",
"text": "def parent=(parent) # :nodoc:\n @parent = parent\n end",
"title": ""
},
{
"docid": "bcd369203327f44fbfce090b334e382c",
"score": "0.4908309",
"text": "def parent=(parent) # :nodoc:\n @parent = parent\n end",
"title": ""
},
{
"docid": "8c0577e178ee1e365438d8a6a19e4d13",
"score": "0.48994648",
"text": "def parent=(parent_node)\n parent_node.add_child(self)\n end",
"title": ""
},
{
"docid": "50ccdbce6f74d703475ff991e6aba9da",
"score": "0.48984802",
"text": "def _emit(options = {}, &block)\n @_block = block if block\n @_parent = options[:parent] || parent\n @_helpers = options[:helpers] || parent\n if options[:output]\n # todo: document that either :buffer or :output can be used to specify an output buffer, and deprecate :output\n if options[:output].is_a? Output\n @_output = options[:output]\n else\n @_output = Output.new({:buffer => options[:output]}.merge(options))\n end\n else\n @_output = Output.new(options)\n end\n\n output.widgets << self.class\n send(options[:content_method_name] || :content)\n output\n end",
"title": ""
},
{
"docid": "42ded96749b0998198c338602229a12f",
"score": "0.4892619",
"text": "def setParent(parent)\n @parent = parent\n end",
"title": ""
},
{
"docid": "8660c20ee5a54ef18117073590a95f45",
"score": "0.48886284",
"text": "def renderer\n Asciidoctor.debug \"Section#renderer: Looking for my renderer up in #{@parent}\"\n @parent.renderer\n end",
"title": ""
},
{
"docid": "85ff600ea3ee4274c091282a5324cb3c",
"score": "0.48875797",
"text": "def output(io)\n io << \" start \" << @name << \"\\n\"\n if @parent then\n io << \" parent \" << @parent.name << \"\\n\"\n end\n sortedHash = @hash.sort\n sortedHash.each do |entry|\n io << \" \\\"\" << entry[0] << \"\\\"=\\\"\" << entry[1] << \"\\\"\\n\"\n end\n io << \" end \" << @name << \"\\n\\n\"\n end",
"title": ""
},
{
"docid": "5b056c82c193be7f31861e00e831258b",
"score": "0.48825043",
"text": "def add_parent_object(parent, relation, info = nil)\n relation_graphs[parent].add_child_object(self, relation, info)\n end",
"title": ""
},
{
"docid": "00745484b795ef8ed896c0a8fb8299f5",
"score": "0.48718485",
"text": "def add_child(node)\n node.parent = self\n end",
"title": ""
},
{
"docid": "00745484b795ef8ed896c0a8fb8299f5",
"score": "0.48718485",
"text": "def add_child(node)\n node.parent = self\n end",
"title": ""
},
{
"docid": "00745484b795ef8ed896c0a8fb8299f5",
"score": "0.48718485",
"text": "def add_child(node)\n node.parent = self\n end",
"title": ""
},
{
"docid": "93c722f857a7b2ef64cf4c5ab244f582",
"score": "0.4870838",
"text": "def embed_widget(parent_cell, child_cell)\n parent_cell << child_cell\n # Parents watch themselves for record selects and unselects, and send children into appropriate states.\n parent_cell.respond_to_event :recordSelected, :on => child_cell.name, :with => :_parent_selection, :from => parent_cell.name\n parent_cell.respond_to_event :recordUnselected, :on => child_cell.name, :with => :_parent_unselection, :from => parent_cell.name\n # Parents also watch children for record updates, and update themselves if one occurs.\n parent_cell.respond_to_event :recordUpdated, :on => parent_cell.name, :with => :_child_updated, :from => child_cell.name\n # Children watch themselves for recordChosen events, then send parent into update choice state\n child_cell.respond_to_event :recordChosen, :on => child_cell.name, :with => :_child_choice, :from => child_cell.name\n yield child_cell if block_given?\n return child_cell\n end",
"title": ""
},
{
"docid": "cc3c6b0875673d453e59ddc548247a05",
"score": "0.48517594",
"text": "def parent_layout(layout)\n @view_flow.set(:layout, output_buffer)\n output = render(file: \"layouts/#{layout}\")\n self.output_buffer = ActionView::OutputBuffer.new(output)\n end",
"title": ""
},
{
"docid": "cc3c6b0875673d453e59ddc548247a05",
"score": "0.48517594",
"text": "def parent_layout(layout)\n @view_flow.set(:layout, output_buffer)\n output = render(file: \"layouts/#{layout}\")\n self.output_buffer = ActionView::OutputBuffer.new(output)\n end",
"title": ""
},
{
"docid": "bd8c58f7a13066a3f5e92741ca455ba6",
"score": "0.48516986",
"text": "def wrap_in(parent_xn)\n add_next_sibling(parent_xn)\n parent_xn.add_child(self)\n self\n end",
"title": ""
},
{
"docid": "a7d765c8da6924aee69e0021280e63bb",
"score": "0.48515093",
"text": "def add_child(widget)\n super\n \n widget.application = self\n widget.parent = self\n \n widget\n end",
"title": ""
},
{
"docid": "2fedbedc6e87971745764b86b56eca08",
"score": "0.48498178",
"text": "def add_output(input)\n\t\t@output << input\n\tend",
"title": ""
},
{
"docid": "e887375d6ef8324571d78c33e911d945",
"score": "0.48459163",
"text": "def <<(child)\n child.parent = self\n children << child\n end",
"title": ""
},
{
"docid": "cde94d4473e2cb4d59298a388a37fc0e",
"score": "0.48437762",
"text": "def visit_children(parent)\n with_environment Sass::Environment.new(@environment, parent.options) do\n parent.children = super.flatten\n parent\n end\n end",
"title": ""
},
{
"docid": "4c68ac24bdd032f7668a36dfd7332ae3",
"score": "0.48409516",
"text": "def process(parent, reader_or_target, attributes)\n source = create_source(parent, reader_or_target, attributes)\n\n format = attributes.delete('format') || self.class.default_format\n format = format.to_sym if format.respond_to?(:to_sym)\n\n raise \"Format undefined\" unless format\n\n generator_info = self.class.formats[format]\n\n raise \"#{self.class.name} does not support output format #{format}\" unless generator_info\n\n case generator_info[:type]\n when :image\n create_image_block(parent, source, attributes, format, generator_info)\n when :literal\n create_literal_block(parent, source, attributes, generator_info)\n else\n raise \"Unsupported output format: #{format}\"\n end\n end",
"title": ""
},
{
"docid": "7930adf588feb010a3af7e784728bf7c",
"score": "0.48328456",
"text": "def frame\n super\n end",
"title": ""
},
{
"docid": "eafd6064994804bc776fb0ae35f89ff5",
"score": "0.48140594",
"text": "def render parent\n txt = \"<strong>Download em #{@format}</strong>\"\n\n output = Asciidoctor::ListItem::new parent, \"\"\n anchor = Asciidoctor::Inline::new output, :anchor, txt, INLINE_OPTS\n anchor.target = @url\n\n output << anchor\n end",
"title": ""
},
{
"docid": "78fa14829732a757d5a4d816357aa595",
"score": "0.48137608",
"text": "def add_child\n process_is :running do\n Process.kill('TTIN', pid)\n end\n end",
"title": ""
},
{
"docid": "eb005d90c452c608539878bf37671085",
"score": "0.48124883",
"text": "def addChild(child)\n child.parent = self\n @children.push(child)\n end",
"title": ""
},
{
"docid": "1b34f6ac38ea03b86381e999eb631c14",
"score": "0.48114282",
"text": "def forminit(screen,parent)\n @_vr_handlers={}\n parentinit(screen)\n @parent=parent\n end",
"title": ""
},
{
"docid": "9403a580ae8f28d147fcf487ad4f8427",
"score": "0.47981504",
"text": "def output( &block )\n @framework.output( &block )\n end",
"title": ""
},
{
"docid": "6b6d812cac65ccb83e5415bc94c1aac1",
"score": "0.4797295",
"text": "def parent=(parent)\n @parent = parent\n\n if parent.nil?\n @trace_id = @span_id\n @parent_id = 0\n else\n @trace_id = parent.trace_id\n @parent_id = parent.span_id\n @service ||= parent.service\n @sampled = parent.sampled\n end\n end",
"title": ""
},
{
"docid": "74326064f86f1572c4ccad32785240ea",
"score": "0.47963557",
"text": "def parent=(parent); end",
"title": ""
},
{
"docid": "74326064f86f1572c4ccad32785240ea",
"score": "0.47963557",
"text": "def parent=(parent); end",
"title": ""
},
{
"docid": "74326064f86f1572c4ccad32785240ea",
"score": "0.47963557",
"text": "def parent=(parent); end",
"title": ""
},
{
"docid": "421aea21d88ce655038884f71c94eaec",
"score": "0.47918126",
"text": "def start!\n parent.start!\n end",
"title": ""
},
{
"docid": "95d8b44b90052857b63d6b28266681dd",
"score": "0.4789385",
"text": "def append_child_context(child)\n child.visibility = tracked_visibility\n children << child\n end",
"title": ""
},
{
"docid": "e6cb738f62b2ce347e9e3608540cfbb2",
"score": "0.478873",
"text": "def with_parent(parent); end",
"title": ""
},
{
"docid": "d56ad50ccd28f3def7abb7f84ce7abf7",
"score": "0.4785159",
"text": "def write_to_child_stdin\n return unless input\n\n child_stdin << input\n child_stdin.close # Kick things off\n end",
"title": ""
},
{
"docid": "62f547fcfd5eecf12521056d07c8b595",
"score": "0.4780032",
"text": "def visit_children(parent)\n with_environment Sass::Environment.new(@environment) do\n parent.children = super.flatten\n parent\n end\n end",
"title": ""
},
{
"docid": "2f72d23247a659bedd884847911e138a",
"score": "0.47781417",
"text": "def add_child(child)\n child.parent = self\n @children << child\n self\n end",
"title": ""
},
{
"docid": "92d5268a933bb960835ab77b4c6d9532",
"score": "0.4772375",
"text": "def add_child(child_node)\n # self == parent_node\n child_node.parent = self # child_node.parent=(self)\n end",
"title": ""
},
{
"docid": "20b0b94f65341516e6dfe852163015d1",
"score": "0.47714213",
"text": "def render(parent_hit_index=nil)\n data = WaveData.new\n toneparts.each do |tp|\n data + tp.out(parent_hit_index).out\n end\n files= FileList.new\n files.write data\n files\n end",
"title": ""
},
{
"docid": "7f81a3812d50d4a1d08549eabb198f24",
"score": "0.47705874",
"text": "def pretty_print_buffer\n wrap_frame_with_border(show_buffer)\n end",
"title": ""
},
{
"docid": "d402868808a3c87ee2f787a7bb877fee",
"score": "0.47679037",
"text": "def output(*names)\n self.parent.output(*names)\n end",
"title": ""
},
{
"docid": "1a89bf81290f9698394349c0a00fa84c",
"score": "0.47629687",
"text": "def add_child(child)\n child.parent = self\n @children << child\n nil\n end",
"title": ""
},
{
"docid": "4a633d21af212b8d68ba76df5c077462",
"score": "0.47596893",
"text": "def update_child\n scr_top = 3 # for Pad, if Pad passed as in SplitPane\n scr_left = 1 # for Pad, if Pad passed as in SplitPane\n if @form.window.window_type == :WINDOW\n scr_top = @row + 1\n scr_left = @col + 1\n @child.row(@row+@row_offset)\n @child.col(@col+@col_offset)\n else\n # PAD case\n @child.row(scr_top)\n @child.col(scr_left)\n end\n @child.set_buffering(:target_window => @target_window || @form.window, :form => @form, :bottom => @height-3, :right => @width-3 )\n @child.set_buffering(:screen_top => scr_top, :screen_left => scr_left)\n # lets set the childs ext offsets\n $log.debug \"SCRP #{name} adding (to #{@child.name}) ext_row_off: #{@child.ext_row_offset} += #{@ext_row_offset} +#{@row_offset} \"\n $log.debug \"SCRP adding ext_col_off: #{@child.ext_col_offset} += #{@ext_col_offset} +#{@col_offset} \"\n ## 2010-02-09 18:58 i think we should not put col_offset since the col\n ## of child would take care of that. same for row_offset. XXX \n @child.ext_col_offset += @ext_col_offset + @col + @col_offset - @screen_left # 2010-02-09 19:14 \n # added row and col setting to child RFED16 2010-02-17 00:22 as\n # in splitpane. seems we are not using ext_offsets now ? texta\n # and TV are not. and i've commented off from widget\n\n $log.debug \" #{@child.ext_row_offset} += #{@ext_row_offset} + #{@row} -#{@screen_top} \"\n @child.ext_row_offset += @ext_row_offset + @row + @row_offset - @screen_top \n # adding this since child's ht should not be less. or we have a\n # copywin failure\n @child.height ||= @height\n @child.width ||= @width\n if @child.height < @height\n @child.height = @height\n end\n if @child.width < @width\n @child.width = @width\n end\n\n end",
"title": ""
},
{
"docid": "4833b4fd033fd0f5e80282b10bd6c414",
"score": "0.47540882",
"text": "def process_end()\n o = self.output\n\n o.print(\"\\n]\\n\")\n\n super()\n end",
"title": ""
},
{
"docid": "5394bdd7464b636d3fcd013db1be9b7f",
"score": "0.47500172",
"text": "def added_signal_parent(parent, info) # :nodoc:\n super\n @events[parent] = parent.last\n\n # If the parent is unreachable, check that it has neither been\n # removed, nor it has been emitted\n parent.if_unreachable(cancel_at_emission: true) do |reason, event|\n if @events.has_key?(parent) && @events[parent] == parent.last\n @active = false\n unreachable!(reason || parent)\n end\n end\n end",
"title": ""
},
{
"docid": "9bb21cf3cafbf1cf141b7988898f6a67",
"score": "0.47456622",
"text": "def add_input(signal)\n self.parent.add_input(signal)\n end",
"title": ""
},
{
"docid": "8342c6a67b4f418ea4cd952027ddba3c",
"score": "0.47451013",
"text": "def add_child child\r\n child.parent = self\r\n @children << child\r\n end",
"title": ""
},
{
"docid": "a5891815f9e67c010f252b0731f4eb73",
"score": "0.47450727",
"text": "def add_child_stream(stream)\n update_attribute(:child_stream_id, stream.id)\n end",
"title": ""
},
{
"docid": "9744989d4c30845e7c9db6fc742e8176",
"score": "0.47411504",
"text": "def post_to_parent(payload)\n parent.post(payload)\n end",
"title": ""
},
{
"docid": "59f1912ad3c5c47edad520d38c609f5d",
"score": "0.4738607",
"text": "def framing=(_arg0); end",
"title": ""
},
{
"docid": "ab5c5ce295b919f2bb28d1bbbc5687bf",
"score": "0.47381845",
"text": "def <<(frame)\n super\n clear!(size - 1)\n end",
"title": ""
},
{
"docid": "ab5c5ce295b919f2bb28d1bbbc5687bf",
"score": "0.47381845",
"text": "def <<(frame)\n super\n clear!(size - 1)\n end",
"title": ""
},
{
"docid": "7fa840831c6b19e4daad3810c4faa8fd",
"score": "0.47346023",
"text": "def beginIndexFile(parent = nil)\n indFile = File.new(\"#{currentDir().path}/index.html\", \"w\")\n\n @indexFileStack.push indFile\n indFile.write(\"<html><body>\")\n\n if !parent.nil?\n indFile.write(\"Parent: <a href=\\\"../index.html\\\">#{parent}</a>\")\n end\n indFile.write(\"<ul>\")\n end",
"title": ""
},
{
"docid": "a585629a519e86c9e1f26620c3bad2c7",
"score": "0.47305626",
"text": "def add_child( record )\n @children << record\n record.parent = self\n record\n end",
"title": ""
},
{
"docid": "51845a217cf56febd1ce023954da274c",
"score": "0.4726297",
"text": "def parent!(parent)\n @parent = parent\n self\n end",
"title": ""
},
{
"docid": "e589739fcdf63e52a6b6b63e17c28fe7",
"score": "0.47246382",
"text": "def assimilate(parent, options)\n parentize(parent, options.name); notify; self\n end",
"title": ""
},
{
"docid": "24e11af53b36d7f2feb3802dfb65138d",
"score": "0.4724389",
"text": "def render_screen(parent_window)\n returning(parent_window.subwin(Ncurses.LINES, Ncurses.COLS, 0, 0)) do |screen|\n screen.border(0,0,0,0,0,0,0,0)\n end\n end",
"title": ""
},
{
"docid": "47bcd8dafeff714b1d5d7f027c0e3e8d",
"score": "0.4721045",
"text": "def setup_child\n end",
"title": ""
},
{
"docid": "70c78fcb2c2c7145093fcf5aabe7190e",
"score": "0.47193778",
"text": "def with_parent(parent)\n if parent.is_a?(Sass::Tree::DirectiveNode)\n if MERGEABLE_DIRECTIVES.any? {|klass| parent.is_a?(klass)}\n old_parent_directive = @parent_directives.pop\n end\n @parent_directives.push parent\n end\n\n old_parent, @parent = @parent, parent\n yield\n ensure\n @parent_directives.pop if parent.is_a?(Sass::Tree::DirectiveNode)\n @parent_directives.push old_parent_directive if old_parent_directive\n @parent = old_parent\n end",
"title": ""
},
{
"docid": "8ee0c8cdd5afb7e1b6e604f3d9019fcb",
"score": "0.4717124",
"text": "def draw\n pdf = @parent.send(:pdf)\n\n if defined?(@_component_instance)\n @_component_instance.render_in(pdf, &@_content_block)\n\n elsif defined?(@_content_block)\n @_content_block.call\n end\n end",
"title": ""
},
{
"docid": "3f15c3d1c5ba5c3288cad1320bae9bca",
"score": "0.47135654",
"text": "def assimilate(parent, options)\n parentize(parent, options.name); notify; self\n end",
"title": ""
},
{
"docid": "e56c1db6186d88ac25b5abba16730150",
"score": "0.47014654",
"text": "def add_child(widget)\n widget = super\n widget.parent = self\n widget.application = application\n \n widget\n end",
"title": ""
}
] |
f8c91e60325cb647d59a3ca35bccd507 | Create the singleton getter method to retrieve the tag separator for a given context for all instances of the model. | [
{
"docid": "a7dff2bb9beeaef4897fddf6f9bad7e4",
"score": "0.8268314",
"text": "def define_class_separator_getter(context)\n self.class.class_eval do\n define_method :\"#{context}_separator\" do\n get_tag_separator_for(context)\n end\n end\n end",
"title": ""
}
] | [
{
"docid": "5f1d37be0a60696da5e453a4a4f79569",
"score": "0.8289144",
"text": "def define_class_separator_getter(context)\n self.class.class_eval do\n define_method :\"#{context}_separator\" do\n tag_contexts[context].separator\n end\n end\n end",
"title": ""
},
{
"docid": "39f725bfae128d846c502a0b641ae545",
"score": "0.67461747",
"text": "def define_class_tags_getter(context)\n # retrieve all tags ever created for the model\n self.class.class_eval do\n define_method context do |group_by = nil|\n tags_for(context, group_by)\n end\n end\n end",
"title": ""
},
{
"docid": "9404add11d9926824c70021109fa2c5a",
"score": "0.65342194",
"text": "def tag_string_for(context)\n self.read_attribute(context).join(tag_contexts[context].separator)\n end",
"title": ""
},
{
"docid": "27d9d9893f2a9bfd88941f22ae433ba6",
"score": "0.6273386",
"text": "def tag_list_delimiter\r\n acts_as_taggable_options[:delimiter]\r\n end",
"title": ""
},
{
"docid": "ac2680535c427cf4d96d0a0a5a66c4d4",
"score": "0.5985716",
"text": "def define_class_tagged_with_getter(context)\n self.class.class_eval do\n define_method :\"#{context}_tagged_with\" do |tags|\n tagged_with(context, tags)\n end\n end\n end",
"title": ""
},
{
"docid": "ac2680535c427cf4d96d0a0a5a66c4d4",
"score": "0.5985716",
"text": "def define_class_tagged_with_getter(context)\n self.class.class_eval do\n define_method :\"#{context}_tagged_with\" do |tags|\n tagged_with(context, tags)\n end\n end\n end",
"title": ""
},
{
"docid": "3cea74a293bb0a8054c4f8d3584d19b8",
"score": "0.5970795",
"text": "def define_instance_tag_string_getter(context)\n generated_methods.module_eval do\n re_define_method(\"#{context}_string\") do\n self.tag_string_for(context)\n end\n end\n end",
"title": ""
},
{
"docid": "9b635721f3bb7f965cf4df181708adf5",
"score": "0.5937192",
"text": "def define_taggable_accessors(context)\n define_class_separator_getter(context)\n define_class_tagged_with_getter(context)\n define_instance_tag_string_getter(context)\n define_instance_tag_setter(context)\n end",
"title": ""
},
{
"docid": "9b0ddcbccc358632ed6b1215f62635c5",
"score": "0.577841",
"text": "def define_instance_tag_string_getter(context)\n generated_methods.module_eval do\n re_define_method(\"#{context}_string\") do\n tag_string_for(context)\n end\n\n re_define_method(\"#{context}_string=\") do |value|\n set_tag_string_for(context, value)\n end\n end\n end",
"title": ""
},
{
"docid": "829897c184146ce5d2cd5f3883368c0f",
"score": "0.5721182",
"text": "def tag_delimiter\n \",\"\n end",
"title": ""
},
{
"docid": "812046e185a45fd8ea7163adef5c0cdb",
"score": "0.5673223",
"text": "def tag_string(separator = Taggable.separator)\n tags.collect { |t| t.name }.join(separator)\n end",
"title": ""
},
{
"docid": "b2d133504991ce026fa5e9cbab3bb165",
"score": "0.5582667",
"text": "def define_class_group_by_getter(context)\n self.class.class_eval do\n define_method :\"#{context}_group_by_field\" do\n get_tag_group_by_field_for(context)\n end\n end\n end",
"title": ""
},
{
"docid": "fd94dbdd4d09b45e07a493dcf47eba6f",
"score": "0.5542281",
"text": "def get_tags\n self.tags.split(',')\n end",
"title": ""
},
{
"docid": "ee464301f2036017d5f80dcfcc8c39c4",
"score": "0.54775465",
"text": "def joinTags\n tags = []\n self.tags.each do |tag|\n tags << tag.name\n end\n \n return tags.join(\", \")\n end",
"title": ""
},
{
"docid": "01cdd12ebfa94feca8c596c9172a55f5",
"score": "0.54741085",
"text": "def define_instance_tag_setter(context)\n generated_methods.module_eval do\n alias_method \"#{context}_without_taggable=\", \"#{context}=\"\n re_define_method(\"#{context}=\") do |value|\n value = self.class.format_tags_for(context, value)\n self.send(\"#{context}_without_taggable=\", value)\n end\n #alias_method_chain \"#{context}=\", :taggable\n end\n end",
"title": ""
},
{
"docid": "a6d116c1145eefb87cdfc07ad844d984",
"score": "0.54648393",
"text": "def tag_product\n # object.tags.pluck(:name).join(', ')\n object.tags.map(&:name).join(', ')\n end",
"title": ""
},
{
"docid": "facd6f1f84ef46ab8ae221ebbf3f7e25",
"score": "0.54604524",
"text": "def get_comma_separated_tags\n \treturn tag_list.join(\", \")\n end",
"title": ""
},
{
"docid": "f17ffdb8fd6ac504e32e582f79e917ea",
"score": "0.5401504",
"text": "def define_taggable_accessors(context)\n define_class_tags_getter(context)\n define_class_weighted_tags_getter(context)\n define_class_separator_getter(context)\n define_class_tagged_with_getter(context)\n define_class_group_by_getter(context)\n define_instance_tag_string_getter(context)\n define_instance_tag_setter(context)\n end",
"title": ""
},
{
"docid": "0afd9f1d0daf23b72a443a202d757774",
"score": "0.5395754",
"text": "def tags() \n self[:tags].join(\",\") \n end",
"title": ""
},
{
"docid": "3c6f2c6427cdb65eec1ca97e96d6fe37",
"score": "0.53734857",
"text": "def tag_list_delimiter=(delimiter)\r\n acts_as_taggable_options[:delimiter] = delimiter\r\n end",
"title": ""
},
{
"docid": "089488e6894c433ee1ba2b37d3d3fefa",
"score": "0.53287643",
"text": "def tags() \n self[:tags].join(\",\") \n end",
"title": ""
},
{
"docid": "aab5c9f34226869ffd77a36fae54e4d7",
"score": "0.5317803",
"text": "def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join \", \"\n end",
"title": ""
},
{
"docid": "6736b4dfcf46b79a1a816d48fb177316",
"score": "0.5312081",
"text": "def dynamic_tag_context_attribute(context)\n \"dynamic_tag_context_#{context.singularize}_list\"\n end",
"title": ""
},
{
"docid": "b5a7b2011cad63693ab7ebcfc9f76b27",
"score": "0.5300954",
"text": "def separator; end",
"title": ""
},
{
"docid": "b5a7b2011cad63693ab7ebcfc9f76b27",
"score": "0.5300954",
"text": "def separator; end",
"title": ""
},
{
"docid": "b5a7b2011cad63693ab7ebcfc9f76b27",
"score": "0.5300954",
"text": "def separator; end",
"title": ""
},
{
"docid": "b5a7b2011cad63693ab7ebcfc9f76b27",
"score": "0.5300954",
"text": "def separator; end",
"title": ""
},
{
"docid": "b5a7b2011cad63693ab7ebcfc9f76b27",
"score": "0.5300954",
"text": "def separator; end",
"title": ""
},
{
"docid": "b5a7b2011cad63693ab7ebcfc9f76b27",
"score": "0.5300954",
"text": "def separator; end",
"title": ""
},
{
"docid": "b5a7b2011cad63693ab7ebcfc9f76b27",
"score": "0.5300954",
"text": "def separator; end",
"title": ""
},
{
"docid": "5bed54bdad5c669277f5b44294cd0861",
"score": "0.529263",
"text": "def tag_lister\n\t\ttags.join(\",\")\n\tend",
"title": ""
},
{
"docid": "ed588b0ebe9b9c098dff5b087e3091c5",
"score": "0.52834034",
"text": "def define_class_tags_getter(rule, meth)\n # retrieve all tags ever created for the model\n self.class.class_eval do\n define_method meth do |group = nil|\n tags_for(rule, group)\n end\n end\n end",
"title": ""
},
{
"docid": "aa2e25d9a5024b1bbd3d7c7c73b34a4c",
"score": "0.52820444",
"text": "def define_instance_tag_setter(context)\n generated_methods.module_eval do\n re_define_method(\"#{context}_with_taggable=\") do |value|\n value = self.class.tag_contexts[context].format_tags(value)\n self.send(\"#{context}_without_taggable=\", value)\n end\n alias_method_chain \"#{context}=\", :taggable\n end\n end",
"title": ""
},
{
"docid": "647dfec8cf922bc9e1e3c3cebb7656b0",
"score": "0.52724284",
"text": "def tag_list\n return \"\" if self.tags.nil?\n self.tags.join(\", \")\n end",
"title": ""
},
{
"docid": "2fd28d7d8312ec7eea8fd7544ad4c2a8",
"score": "0.52674335",
"text": "def tags\n t = read_attribute(:tags)\n t.nil? ? \"\" : t.join(', ')\n end",
"title": ""
},
{
"docid": "c73140184c89104362e733cad95d954a",
"score": "0.52356154",
"text": "def tags_list\n self.tags.join(', ')\n end",
"title": ""
},
{
"docid": "3f43bfe5e181cbaca8907adc975324cc",
"score": "0.52182794",
"text": "def separator\n @@default_separator\n end",
"title": ""
},
{
"docid": "f84bc2b801e68f5fde99292ed4f3b8c2",
"score": "0.5204956",
"text": "def tag_string\n tag_list.join(tag_delimiter)\n end",
"title": ""
},
{
"docid": "252b6443ea8b437b54a2091adb37df97",
"score": "0.5197383",
"text": "def tag_list\n self.tags.collect{ |tag|\n tag.name\n }.join(\", \")\n end",
"title": ""
},
{
"docid": "b1b7cc0d4e37fc167e6dbca55d4a7cd4",
"score": "0.5167015",
"text": "def getTagStr\n @taggedTerms.join(' ')\n end",
"title": ""
},
{
"docid": "88b3cab70683aed795c96cb4b869f515",
"score": "0.5165263",
"text": "def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join(\", \")\n end",
"title": ""
},
{
"docid": "e2cdfc98d0961262586858f25e43d2ab",
"score": "0.5149581",
"text": "def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join(\", \")\n end",
"title": ""
},
{
"docid": "e2cdfc98d0961262586858f25e43d2ab",
"score": "0.5149581",
"text": "def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join(\", \")\n end",
"title": ""
},
{
"docid": "8cea2f32b9bfa3915ddba50049d05eaf",
"score": "0.5142318",
"text": "def get_tags\n # self.tags <<< to be un-commented once these models are created\n end",
"title": ""
},
{
"docid": "31b48123622bfff7bdff532ddad7d83e",
"score": "0.5119099",
"text": "def comma_tags\n res = []\n self.tags.each do |tag|\n res.push(tag.name)\n end\n\n res.join(', ')\n end",
"title": ""
},
{
"docid": "0648b6ed988b968f5d2815117e6513c3",
"score": "0.5109383",
"text": "def separator\n @options[:separator]\n end",
"title": ""
},
{
"docid": "ab61c73cb34d8f66fe4064095c66004b",
"score": "0.51001525",
"text": "def tag_list\n self.tags.collect do |tag|\n tag.name\n end.join(\", \")\n end",
"title": ""
},
{
"docid": "d834e03d11f538c23790b6745b67addb",
"score": "0.50993276",
"text": "def tag_list # create tag_list func\n self.tags.collect do |tag| # by using collect iterator on tags objects from our tags db...\n tag.name # and choosing them by name...\n end.join(\", \") # and adding them into string by using join method\n end",
"title": ""
},
{
"docid": "92c545271f1c474b2e057e3a760643cb",
"score": "0.50863546",
"text": "def extract_tags!(context)\n named_tags = context.delete(:named_tags) || {}\n named_tags = named_tags.map { |k, v| [k.to_s, v.to_s] }.to_h\n tags = context.delete(:tags)\n named_tags.merge!(\"tag\" => tags.join(\", \")) { |_, v1, v2| \"#{v1}, #{v2}\" } if tags\n named_tags.map { |k, v| [k[0...32], v[0...256]] }.to_h\n end",
"title": ""
},
{
"docid": "2324070532025eadb4b5d054d7dfe38e",
"score": "0.5085184",
"text": "def tag_list_content_on(context)\n # if (self.is_auto_tag_ownership_enabled?)\n # self.owner_tags_on(self.tag_owner, context).map(&:to_s).join(',').chomp(',')\n # else\n self.tags_on(context).map(&:to_s).join(',').chomp(',')\n # end\n end",
"title": ""
},
{
"docid": "d93566e34a79c407ccd6af24e2b23a97",
"score": "0.5083499",
"text": "def delimiter_tokeniser\n -> delimiter, f, enum { f.(enum).join(delimiter) }.curry\n end",
"title": ""
},
{
"docid": "afffdc4309c6fa488a1bfd6b1007231f",
"score": "0.5083485",
"text": "def sep; end",
"title": ""
},
{
"docid": "afffdc4309c6fa488a1bfd6b1007231f",
"score": "0.5083485",
"text": "def sep; end",
"title": ""
},
{
"docid": "27eef35c726bc905081f701b6b4431a4",
"score": "0.5081155",
"text": "def delimiter()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "27eef35c726bc905081f701b6b4431a4",
"score": "0.5081155",
"text": "def delimiter()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "3fd82aecd60950c133a3bc5c0d8f498e",
"score": "0.5055507",
"text": "def separator; nil; end",
"title": ""
},
{
"docid": "9c38ab2059f07fc89b006e1be399e0a8",
"score": "0.5052981",
"text": "def form_separator_field(f, label)\n content_tag :div, :class => 'form-row form-cell separator-row' do\n content_tag :h3, :class => 'style6 separator' do\n label\n end\n end\n end",
"title": ""
},
{
"docid": "28626f4c14420e236da4cdf4cb52d538",
"score": "0.50427544",
"text": "def default_separator; end",
"title": ""
},
{
"docid": "a884c49b76badeb8db3e2a64574815b3",
"score": "0.5024121",
"text": "def tag_list\n tags.join(\", \")\n end",
"title": ""
},
{
"docid": "4109cc1bb504e797d70032b646a327d3",
"score": "0.5022693",
"text": "def tag_context_list\n ActsAsTaggableOn::Tagging.where(\"taggable_type = '#{self.class.name}'\").select(:context).uniq.map(&:context)\n end",
"title": ""
},
{
"docid": "128e80858804530a38bd2d97e0b76573",
"score": "0.50215775",
"text": "def tag_list\n\t tags.map(&:name).join(', ')\n\tend",
"title": ""
},
{
"docid": "c95b02b333114c6df52501a06b92135d",
"score": "0.50143886",
"text": "def tag_list\n # tags.collect {|t| t.name}.join(\", \")\n tags.join(\", \")\n end",
"title": ""
},
{
"docid": "9bfdb6a46a63c91119bc73906f34e8a8",
"score": "0.50113875",
"text": "def attribute_field_separator\n config[:field_separator] || \".\"\n end",
"title": ""
},
{
"docid": "7156ef0b8ca861e92c11511d504d4f65",
"score": "0.5005742",
"text": "def vertical_separator(options = {})\n separator = options.delete(:seperator) || \" | \"\n content_tag :span, separator, {:class => \"separator\"}.merge(options)\n end",
"title": ""
},
{
"docid": "4e901e4914013dfcf3f639b095eb0a6e",
"score": "0.5002316",
"text": "def tag_list\n\t\tself.tags.collect do |tag|\n\t\t\ttag.name\n\t\tend.join(\", \")\n\tend",
"title": ""
},
{
"docid": "73dd03f8777437c933eb6cce7fcc17dc",
"score": "0.49896538",
"text": "def get_all_tags\n self.tags.map(&:name).join(\", \")\n end",
"title": ""
},
{
"docid": "864defd8cf1ff707d367bc5bbcc5c716",
"score": "0.49844393",
"text": "def tag_list\n tags.join(\", \")\n end",
"title": ""
},
{
"docid": "00174c2232ac968ff2043f0a905a9124",
"score": "0.49798304",
"text": "def field_value_separator\n tag(:br)\n end",
"title": ""
},
{
"docid": "72db95c561e3e6c0a0ffda1600e547d2",
"score": "0.4974613",
"text": "def separator(text); end",
"title": ""
},
{
"docid": "72db95c561e3e6c0a0ffda1600e547d2",
"score": "0.4974613",
"text": "def separator(text); end",
"title": ""
},
{
"docid": "4a19467deb1f0eedff3c4cd6eda791a0",
"score": "0.49676406",
"text": "def tokens\n extract(self.class::FORMAT).split(self.class::SEPARATOR).map(&:strip)\n end",
"title": ""
},
{
"docid": "8c88bc1e4712b579d3ee8923291aece0",
"score": "0.49675727",
"text": "def to_s\n tags = frozen? ? self.dup : self\n tags.send(:clean!)\n\n tags.map do |name|\n name.include?(delimiter) ? \"\\\"#{name}\\\"\" : name\n end.join(delimiter.ends_with?(\" \") ? delimiter : \"#{delimiter} \")\n end",
"title": ""
},
{
"docid": "a1d089c9511e4e3b256a969f2a9681de",
"score": "0.49651632",
"text": "def _get_tag_list(filter=\"tags\")\n self._taggings(filter).map(&:tag).map(&:name).join(',')\n end",
"title": ""
},
{
"docid": "c6413a3c88d0db5e8e40a3792f76fb49",
"score": "0.495676",
"text": "def tags_as_classes\n context.tags.map do |tag|\n tag.name.titlecase.gsub(/\\s+/, '').underscore.downcase\n end.join \" \"\n end",
"title": ""
},
{
"docid": "ba7b543c77b4d0b9becb9c9df45a8116",
"score": "0.49355596",
"text": "def define_class_weighted_tags_getter(context)\n self.class.class_eval do\n define_method :\"#{context}_with_weight\" do |group_by = nil|\n tags_with_weight_for(context, group_by)\n end\n end\n end",
"title": ""
},
{
"docid": "e9be0854a10ee3141578c159a60a85d8",
"score": "0.4932958",
"text": "def tags\n if @item[:tags].nil?\n return ''\n end\n @item[:tags].join(', ')\n end",
"title": ""
},
{
"docid": "4ccd4b4aa301bef6b7b6661d1a837a2c",
"score": "0.4931932",
"text": "def tag_list\n @tag_list ||= tags.collect { |tag| tag.name }.join(\", \")\n end",
"title": ""
},
{
"docid": "80233ec3f8bc2c0dd14dd576af42be74",
"score": "0.49223375",
"text": "def tag_list\n\t \ttags.map(&:name).join(\", \")\n\tend",
"title": ""
},
{
"docid": "7f5e5c29dc66c9bb22465ff50d4b22fc",
"score": "0.49206546",
"text": "def tag_list\n tags.map(&:name).join(', ')\n end",
"title": ""
},
{
"docid": "68421f14e2c7656246da1046f9cdb81d",
"score": "0.4919841",
"text": "def get_tags\n\ttags = self.tags.map do |tag|\n\t\ttag.tag.to_s\n\tend\n end",
"title": ""
},
{
"docid": "c046085d3dcee45cbbbf196f4d2b4771",
"score": "0.4919128",
"text": "def tag_list \n tags.map do |t| \n t.name \n end.join(\", \")\n end",
"title": ""
},
{
"docid": "e84cec30cd6ead7f83ea74bb213c1f13",
"score": "0.4914892",
"text": "def tags\n tags = \"\"\n self.contents.each do |c|\n tags = tags + c.tag + \", \"\n end\n # here we have @existing_tags = \"tag1, tag2, ... , tag23, \" , so we need to take away the last to chars\n tags = tags.chop.chop\n return tags\n end",
"title": ""
},
{
"docid": "7615f8bb6b48e7529d770545561cb0cc",
"score": "0.4910756",
"text": "def tag_names\n self.tags.map { |t| t.name }.join(' ')\n end",
"title": ""
},
{
"docid": "d54c986c0eeb4b6d61126179e0dc48f7",
"score": "0.49103525",
"text": "def sep\n if scope == :class\n namespace && namespace != YARD::Registry.root ? CSEP : NSEP\n else\n ISEP\n end\n end",
"title": ""
},
{
"docid": "aeab23a3be4afa84926a7149dec76c47",
"score": "0.49058157",
"text": "def tag_list\n tags.map(&:name).join(\", \")\n end",
"title": ""
},
{
"docid": "aeab23a3be4afa84926a7149dec76c47",
"score": "0.49058157",
"text": "def tag_list\n tags.map(&:name).join(\", \")\n end",
"title": ""
},
{
"docid": "b7336313a9bfbff1fdc441aebeaa2695",
"score": "0.48866057",
"text": "def tag_values\n tags.map(&value_mapper).join(',')\n end",
"title": ""
},
{
"docid": "f7806f2f232f18d03f1f01d53126e1a9",
"score": "0.48843497",
"text": "def to_s\n tags = frozen? ? dup : self\n tags.send(:clean!)\n\n tags.map do |name|\n d = ActsAsTaggableOn.delimiter\n d = Regexp.new d.join('|') if d.is_a? Array\n name.index(d) ? \"\\\"#{name}\\\"\" : name\n end.join(ActsAsTaggableOn.glue)\n end",
"title": ""
},
{
"docid": "4698b57fbe912b2a76519696f94227a3",
"score": "0.4860627",
"text": "def to_s\n tags = frozen? ? self.dup : self\n tags.send(:clean!)\n\n tags.map do |name|\n d = ActsAsTaggableOn.delimiter\n d = Regexp.new d.join('|') if d.kind_of? Array\n name.index(d) ? \"\\\"#{name}\\\"\" : name\n end.join(ActsAsTaggableOn.glue)\n end",
"title": ""
},
{
"docid": "c2ae87764ae2de77330a332a704637b0",
"score": "0.48601604",
"text": "def inline_tag_list(template)\n @tags.map do |tag_name|\n <<-EOS\n <span class=\"category-#{Tag.category_for(tag_name)}\">\n #{template.link_to(tag_name.tr(\"_\", \" \"), template.posts_path(tags: tag_name))}\n </span>\n EOS\n end.join.html_safe\n end",
"title": ""
},
{
"docid": "a17634d802387f38afb9e1167be1a356",
"score": "0.48575252",
"text": "def to_tags(sub_context)\n Array(sub_context).map { |id|\n tags[id] \n }.compact\n end",
"title": ""
},
{
"docid": "291a4a2324f29ba788c6512efcace358",
"score": "0.484118",
"text": "def separator?; end",
"title": ""
},
{
"docid": "9850a25587495277583b18ba121fbd34",
"score": "0.48390993",
"text": "def separated_group(separator = ' | ', &proc)\n SeparatedGroupBuilder.new(separator, &proc).to_s\n end",
"title": ""
},
{
"docid": "8e6043a7a705921cde2fde0a18179aad",
"score": "0.48377228",
"text": "def tags\n self.new_record? ? '' : Tag.get_friendly_tags(self)\n end",
"title": ""
},
{
"docid": "5c55bbbcbf54b5d36813db0c91e7e0eb",
"score": "0.4831336",
"text": "def separator(value = (not_set = true))\n return options.separator if not_set\n\n options.separator = value\n end",
"title": ""
},
{
"docid": "ec4a1c46d65c20d22afebfa84fec370b",
"score": "0.4829247",
"text": "def get_tags\n tag4take = Tag4Take.where( :take_id => self.id )\n tag4take.collect{ |row| Tag.find(row.tag_id).name }.sort.join(',')\n end",
"title": ""
},
{
"docid": "a4afa4ffe40b42197dc87c5ce57d6244",
"score": "0.48283783",
"text": "def exploded_tags_from(tag)\n tag_parts = tag.split(TAG_PART_DELIMITER)\n\n 1.upto(tag_parts.count).map do |i|\n tag_parts.take(i).join(TAG_PART_DELIMITER)\n end\n end",
"title": ""
},
{
"docid": "e6006aa17ea8792279c78f1c67f2949e",
"score": "0.4826083",
"text": "def separator(value = (not_set = true))\n if not_set\n @separator\n else\n @separator = value\n end\n end",
"title": ""
},
{
"docid": "773f294b6eb15c5a45e792cbcb6c9234",
"score": "0.48207423",
"text": "def tags_full_list\n self.tags.all.map { |t| t.name }.join(', ')\n end",
"title": ""
},
{
"docid": "7bff94a25c37247fd451b6beb30b0701",
"score": "0.4819417",
"text": "def context_tags\n context = Thread.current[:lumberjack_context]\n context.tags if context\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "808d812bbf9896b5b45a1109ffedd8cd",
"score": "0.0",
"text": "def set_provider\n @provider = Provider.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60339177",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60135007",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.59219855",
"text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.589884",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.5889191",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.58780754",
"text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n else\n super\n end\n end",
"title": ""
},
{
"docid": "a80b33627067efa06c6204bee0f5890e",
"score": "0.5863248",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.58094144",
"text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end",
"title": ""
},
{
"docid": "33ff963edc7c4c98d1b90e341e7c5d61",
"score": "0.57375425",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.57285565",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.57149214",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.56900954",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.56665677",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.5651118",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.5648135",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.56357735",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.5627078",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.5608873",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5598699",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.5598419",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.5589822",
"text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.55084664",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.5504379",
"text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.5465574",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.5464707",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.54471064",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.54455084",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.5437386",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.54160327",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.5397424",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.5392518",
"text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "a468b256a999961df3957e843fd9bdf4",
"score": "0.5385411",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.53794575",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.5357573",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.53487605",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.5346655",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.53448105",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.5342072",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.5341318",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.53243506",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.53025913",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.5283114",
"text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end",
"title": ""
},
{
"docid": "1e1e48767a7ac23eb33df770784fec61",
"score": "0.5282289",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.52585614",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.52571374",
"text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "fc88422a7a885bac1df28883547362a7",
"score": "0.52483684",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.5244467",
"text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.5236853",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.52330637",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.52300817",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.522413",
"text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52226824",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.521999",
"text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end",
"title": ""
},
{
"docid": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.5215832",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.5213786",
"text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.52100146",
"text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end",
"title": ""
},
{
"docid": "2aba2d3187e01346918a6557230603c7",
"score": "0.52085197",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.5203262",
"text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.5202406",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.520174",
"text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end",
"title": ""
},
{
"docid": "d56f4ec734e3f3bc1ad913b36ff86130",
"score": "0.5201504",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "7fca702f2da4dbdc9b39e5107a2ab87d",
"score": "0.5191404",
"text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end",
"title": ""
},
{
"docid": "063b82c93b47d702ef6bddadb6f0c76e",
"score": "0.5178325",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.51765746",
"text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.5162045",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.5150735",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.5143402",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.51415485",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.51398855",
"text": "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.51376045",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.51318985",
"text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end",
"title": ""
},
{
"docid": "f2ac709e70364fce188bb24e414340ea",
"score": "0.5115387",
"text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5111866",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.5109771",
"text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.5107364",
"text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend",
"title": ""
},
{
"docid": "f04fd745d027fc758dac7a4ca6440871",
"score": "0.5106081",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.51001656",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.50964546",
"text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end",
"title": ""
},
{
"docid": "076c761e1e84b581a65903c7c253aa62",
"score": "0.5093199",
"text": "def add_callbacks(base); end",
"title": ""
}
] |
56b5c89fa00921603767f24c8e368c08 | The encoding of the values when the type is not `STRING`. | [
{
"docid": "3c85095e361d827bcf7c7b15284aaa83",
"score": "0.0",
"text": "def encoding\n @gapi.encoding\n end",
"title": ""
}
] | [
{
"docid": "e2938098fdd1ace1aa1a13410f56e2b3",
"score": "0.7488941",
"text": "def value_encoding_from_string(str); end",
"title": ""
},
{
"docid": "6c62b5c5011d9a2516d915fafa94285e",
"score": "0.7214447",
"text": "def encoding\n attributes[:encoding]\n end",
"title": ""
},
{
"docid": "6c62b5c5011d9a2516d915fafa94285e",
"score": "0.7214447",
"text": "def encoding\n attributes[:encoding]\n end",
"title": ""
},
{
"docid": "5964c4a6399aa4c4672b6e67e407ac8c",
"score": "0.7206831",
"text": "def encoding\n content_types = self.to_hash[\"content-type\"]\n\n return \"utf-8\" if !content_types\n\n content_types.each do |c_type|\n return $2 if c_type =~ /(^|;\\s?)charset=(.*?)\\s*(;|$)/\n end\n\n \"binary\"\n end",
"title": ""
},
{
"docid": "8a96a72ad8cfac45da9009ce535ad6b5",
"score": "0.71382225",
"text": "def encoded_value; end",
"title": ""
},
{
"docid": "f2ac15a9aac349f398cc91dcbf996e21",
"score": "0.70281637",
"text": "def encoding()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.70230925",
"text": "def encoding; end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.70230925",
"text": "def encoding; end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.70230925",
"text": "def encoding; end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.70230925",
"text": "def encoding; end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.70230925",
"text": "def encoding; end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.70230925",
"text": "def encoding; end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.70230925",
"text": "def encoding; end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.70230925",
"text": "def encoding; end",
"title": ""
},
{
"docid": "cfff56582b6839ecb4a1648c709d5135",
"score": "0.70230925",
"text": "def encoding; end",
"title": ""
},
{
"docid": "8fa2f75b0cf593b706870633f27222ad",
"score": "0.7006317",
"text": "def encoding()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "0ef7041d25729b9f87a0638063a1acee",
"score": "0.69788724",
"text": "def encoding()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "0ef7041d25729b9f87a0638063a1acee",
"score": "0.69788724",
"text": "def encoding()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "0ef7041d25729b9f87a0638063a1acee",
"score": "0.69788724",
"text": "def encoding()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "e908f21a792702f941a2371aa389a2e8",
"score": "0.690653",
"text": "def __ENCODING__\n end",
"title": ""
},
{
"docid": "f653b82bb2052fcf8d6dd1c7491ff4a2",
"score": "0.68748766",
"text": "def charset_encoder; end",
"title": ""
},
{
"docid": "3e70fdbe501df4ea28a7acad529b2000",
"score": "0.68702185",
"text": "def encoding()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "411668db884def13990cbc906f7f4476",
"score": "0.6797857",
"text": "def force_encoding(value)\n case value\n when Time,Date\n value = value.dup if value.frozen?\n value.to_s.force_encoding('UTF-8')\n when String\n value = value.dup if value.frozen?\n value.force_encoding('UTF-8')\n when Array\n value.map{ |v| force_encoding(v) }\n when Hash\n new = {}\n value.each do |k,v|\n k = force_encoding(k)\n v = force_encoding(v)\n new[k] = v\n end\n new\n end\n end",
"title": ""
},
{
"docid": "441fa41ef1f23839aa29146522f3358a",
"score": "0.67890984",
"text": "def can_encode?; end",
"title": ""
},
{
"docid": "5b3035de66dbc52777578433e9c0bf10",
"score": "0.6773083",
"text": "def encoding\n @encoding || 'utf8'\n end",
"title": ""
},
{
"docid": "86280b9ed1d5fae36d706a4c05ef7931",
"score": "0.6770276",
"text": "def data_encoding\n characters.map do |char|\n encoding_for char\n end.join\n end",
"title": ""
},
{
"docid": "d5cc2d80b95d9690bc0d00b3e026e448",
"score": "0.6724635",
"text": "def debug_value_utf8 value\n case value\n when Symbol\n return value.to_s.force_encoding(Encoding::UTF_8)\n when String\n return value.dup.force_encoding(Encoding::UTF_8) if value.is_a? String\n else\n return value\n end\n end",
"title": ""
},
{
"docid": "9db7526ffb7d15340cef708b190aae37",
"score": "0.67005706",
"text": "def encoding\n any_raw_connection.encoding.to_s\n end",
"title": ""
},
{
"docid": "3d9db10c84a2c467f19097a6ea905c87",
"score": "0.66859144",
"text": "def encoding\n @connection.encoding.to_s\n end",
"title": ""
},
{
"docid": "3d9db10c84a2c467f19097a6ea905c87",
"score": "0.66859144",
"text": "def encoding\n @connection.encoding.to_s\n end",
"title": ""
},
{
"docid": "3d9db10c84a2c467f19097a6ea905c87",
"score": "0.66859144",
"text": "def encoding\n @connection.encoding.to_s\n end",
"title": ""
},
{
"docid": "47f5ee3cd6b8d32f4107d485d016bdc5",
"score": "0.6678632",
"text": "def utf8_if_needed(val, val_charset); end",
"title": ""
},
{
"docid": "b187dc389b4d2f15b835b829cd75590e",
"score": "0.66375804",
"text": "def ensure_correct_encoding!(val); end",
"title": ""
},
{
"docid": "b187dc389b4d2f15b835b829cd75590e",
"score": "0.66375804",
"text": "def ensure_correct_encoding!(val); end",
"title": ""
},
{
"docid": "49d83df79708658150045d02c6e43ddc",
"score": "0.66367",
"text": "def content_encoding(value); end",
"title": ""
},
{
"docid": "f033d287e7e6a9e5d869580a1b81833e",
"score": "0.6626783",
"text": "def default_encoding; end",
"title": ""
},
{
"docid": "f033d287e7e6a9e5d869580a1b81833e",
"score": "0.6626783",
"text": "def default_encoding; end",
"title": ""
},
{
"docid": "9fb27a16877d45b379759c5e8909d18a",
"score": "0.66233975",
"text": "def encode(value); end",
"title": ""
},
{
"docid": "9fb27a16877d45b379759c5e8909d18a",
"score": "0.66233975",
"text": "def encode(value); end",
"title": ""
},
{
"docid": "9fb27a16877d45b379759c5e8909d18a",
"score": "0.66233975",
"text": "def encode(value); end",
"title": ""
},
{
"docid": "9fceddb11d97f2946ba042ea7b282efe",
"score": "0.6623133",
"text": "def encoding\n 'UTF-8'\n end",
"title": ""
},
{
"docid": "7ba4752d567789706373b99520061cb1",
"score": "0.6620428",
"text": "def encoding\n #@connection.encoding.to_s\n 'UTF-8'\n end",
"title": ""
},
{
"docid": "493ea840144c43571d9bbe0c05d0b55d",
"score": "0.6588029",
"text": "def encode_data\r\n case data_encoding_type\r\n when :simple\r\n @encoded_data = simple_encode(@data)\r\n when :text\r\n @encoded_data = text_encode(@data)\r\n when :extended\r\n @encoded_data = extended_encode(@data)\r\n end\r\n end",
"title": ""
},
{
"docid": "f88089bc4fddc64034615bc5c4788377",
"score": "0.65652627",
"text": "def show_encoding(str)\n puts \"#{str.inspect} #{str.encoding.name}\"\nend",
"title": ""
},
{
"docid": "5072e95dd69a872f3ea8ee6cb8ca490c",
"score": "0.6564246",
"text": "def type_charset\n out = type.to_s\n out += \";charset=#{charset}\" if charset\n out\n end",
"title": ""
},
{
"docid": "92187e3861250585a640a38ae0399fd8",
"score": "0.6557643",
"text": "def get_encoding(name); end",
"title": ""
},
{
"docid": "95fbc743eccaed482de51715a146a389",
"score": "0.65544564",
"text": "def show_encoding_2(str)\n puts \"#{str.inspect} is #{str.encoding.name}\"\nend",
"title": ""
},
{
"docid": "9dacf919d3212e36f3418e66a0d88123",
"score": "0.6525488",
"text": "def encoding\n e = param(\"ENCODING\")\n\n if e\n if e.length > 1\n raise ::Vcard::InvalidEncodingError, \"multi-valued param 'ENCODING' (#{e})\"\n end\n e = e.first.upcase\n end\n e\n end",
"title": ""
},
{
"docid": "9dacf919d3212e36f3418e66a0d88123",
"score": "0.6525488",
"text": "def encoding\n e = param(\"ENCODING\")\n\n if e\n if e.length > 1\n raise ::Vcard::InvalidEncodingError, \"multi-valued param 'ENCODING' (#{e})\"\n end\n e = e.first.upcase\n end\n e\n end",
"title": ""
},
{
"docid": "9dacf919d3212e36f3418e66a0d88123",
"score": "0.6525488",
"text": "def encoding\n e = param(\"ENCODING\")\n\n if e\n if e.length > 1\n raise ::Vcard::InvalidEncodingError, \"multi-valued param 'ENCODING' (#{e})\"\n end\n e = e.first.upcase\n end\n e\n end",
"title": ""
},
{
"docid": "9dacf919d3212e36f3418e66a0d88123",
"score": "0.6525488",
"text": "def encoding\n e = param(\"ENCODING\")\n\n if e\n if e.length > 1\n raise ::Vcard::InvalidEncodingError, \"multi-valued param 'ENCODING' (#{e})\"\n end\n e = e.first.upcase\n end\n e\n end",
"title": ""
},
{
"docid": "b99d46ac88a15dd1c7d6a4ee4199f834",
"score": "0.6516756",
"text": "def encoding?(value)\n encoding.accept?(value)\n end",
"title": ""
},
{
"docid": "534fbaa3729a219fef33a051caf63673",
"score": "0.6510185",
"text": "def internal_encoding()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "d0431ddfc03ea7a2ac83c3ceb95635bc",
"score": "0.6478519",
"text": "def encoding\r\n @resource[:encoding].nil? ? nil : @resource[:encoding]\r\n end",
"title": ""
},
{
"docid": "8ec68e460fbbd5d819cf9da07fa1e2df",
"score": "0.64771676",
"text": "def content_encoding\n data[:content_encoding]\n end",
"title": ""
},
{
"docid": "8ee7179b0cda07ff8cb9bc67513d1625",
"score": "0.6475684",
"text": "def encoding\n start_encoding+data_encoding+extra_encoding+checksum_encoding+stop_encoding\n end",
"title": ""
},
{
"docid": "bab6253d6c2edc1acc7f7211d87ff748",
"score": "0.64692634",
"text": "def original_encoding\n raw_hash_object['encoding']\n end",
"title": ""
},
{
"docid": "39cad6cf03e4622e478f5be0aa1e8a4f",
"score": "0.6435321",
"text": "def encoded; end",
"title": ""
},
{
"docid": "39cad6cf03e4622e478f5be0aa1e8a4f",
"score": "0.6435321",
"text": "def encoded; end",
"title": ""
},
{
"docid": "73f03fe3fd6460c5aeb4fe5efb5577d1",
"score": "0.64309233",
"text": "def encoded_string(obj)\n obj.to_s.encode(_encoding,\n invalid: :replace,\n undef: :replace)\n end",
"title": ""
},
{
"docid": "ccd553193491f31e014672a6a4d79f85",
"score": "0.64294815",
"text": "def utf8\n self.encode('UTF-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '?')\n end",
"title": ""
},
{
"docid": "5cb0b595aa63cada3e2cf52547b345ef",
"score": "0.64268816",
"text": "def encoding\n return @encoding if @encoding\n @encoding = \"utf-8\" unless headers[\"content-type\"]\n c_type = headers[\"content-type\"] =~ ENCODING_MATCHER\n @encoding = $2 if c_type\n @encoding ||= \"ASCII-8BIT\"\n @encoding = Encoding.find(@encoding) if defined?(Encoding)\n @encoding\n end",
"title": ""
},
{
"docid": "23dc09e4f9d0a823638659dab61091e9",
"score": "0.6417501",
"text": "def encoding_for(char)\n encodings[values[char]]\n end",
"title": ""
},
{
"docid": "28b31694332882d523e292ca0b9e97ac",
"score": "0.6417031",
"text": "def value_type\n 'TEXT'\n end",
"title": ""
},
{
"docid": "3f40eb8a85efec69081f42a268e7dd5c",
"score": "0.6415961",
"text": "def encoding_of(string)\n if RUBY_VERSION[0, 3] == \"1.9\"\n string.encoding.to_s\n else\n $KCODE\n end\n end",
"title": ""
},
{
"docid": "aafa8606cb96df382fa78edb7230d1f3",
"score": "0.6409353",
"text": "def data_encoding_with_extra_encoding\n data_encoding+extra_encoding\n end",
"title": ""
},
{
"docid": "1d33d058e671d8493d535c952c85f447",
"score": "0.64093447",
"text": "def guess_encoding; end",
"title": ""
},
{
"docid": "331a21eb85b355fc90402a09188b54ac",
"score": "0.6380872",
"text": "def encoding_for_mime_type(type)\n encoding = \"BINARY\" if binary_mime_types.any? { |matcher| matcher === type }\n encoding ||= default_external_encoding if respond_to?(:default_external_encoding)\n encoding\n end",
"title": ""
},
{
"docid": "e51cefa6d3bedf5b90a5ff34929ed7ed",
"score": "0.6375957",
"text": "def serialize(val)\n ## use the encoding of the first val were sent unless expicitly set\n if @encoding.nil?\n @encoding = if val.respond_to?(:encoding)\n val.encoding\n else\n 'US-ASCII'\n end\n end\n if val.respond_to?(:encode)\n val.encode(@encoding)\n else\n val\n end\n end",
"title": ""
},
{
"docid": "d6dc95b9ec5e3e81cf6ba6cc294b617b",
"score": "0.63659185",
"text": "def emit_encoding; end",
"title": ""
},
{
"docid": "91c475369f6c4e6887b0bc3b03e5080e",
"score": "0.6362635",
"text": "def serialize_to_string(string='')\n case @@encoding\n when EncodingType::BINARY # primitive format\n serialize_to_string_old(string)\n when EncodingType::HASHMAP # JSON format with key = field.name\n serialize_to_json(:name)\n when EncodingType::TAGMAP # JSON format with key = field.tag\n serialize_to_json(:tag)\n when EncodingType::INDEXED # INDEXED format\n serialize_to_indexed\n else\n raise ArgumentError, \"Invalid encoding type\"\n end\n end",
"title": ""
},
{
"docid": "e54aaaefe59cd61bd4a6c1565368733b",
"score": "0.63602805",
"text": "def which_encoding; end",
"title": ""
},
{
"docid": "0977a7221c0289694e606945dbf18d46",
"score": "0.6348421",
"text": "def internal_encoding= value\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "f49f62734211197465b334e47e2eea6c",
"score": "0.63461864",
"text": "def show_encoding(str)\n puts \"'#{str}' (size #{str.size}) is #{str.encoding.name}\"\nend",
"title": ""
},
{
"docid": "107567e92580834d13cdeb944a781064",
"score": "0.6336174",
"text": "def external_encoding()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "dd8bce46c23296e21312fa85e2d14816",
"score": "0.6333553",
"text": "def encoding\n if options == 0\n @raw_string\n else\n \"(?#{encode_options}:\" + @raw_string + \")\"\n end\n end",
"title": ""
},
{
"docid": "feb49f597c9fd57e69169c123f5ff8a9",
"score": "0.63297635",
"text": "def content_encoding; end",
"title": ""
},
{
"docid": "feb49f597c9fd57e69169c123f5ff8a9",
"score": "0.63297635",
"text": "def content_encoding; end",
"title": ""
},
{
"docid": "feb49f597c9fd57e69169c123f5ff8a9",
"score": "0.63297635",
"text": "def content_encoding; end",
"title": ""
},
{
"docid": "3b8467c8a521d0e76110b6d12b53f17c",
"score": "0.6319677",
"text": "def decode_encode(str, output_type); end",
"title": ""
},
{
"docid": "69818657f86ac51f51f7820f70cdcd2c",
"score": "0.63195705",
"text": "def encoded(transfer_encoding = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "14da9793d7f21b1880c51b54d85a154f",
"score": "0.6291497",
"text": "def cast_type_literal(type)\n (type == String) ? 'CHAR(254)' : super\n end",
"title": ""
},
{
"docid": "60ac988bb5481d90567b791c0afac6e7",
"score": "0.62890327",
"text": "def encoding\n case @options[:encoding]\n when String, Symbol\n Encoding.find(@options[:encoding].to_s)\n when Encoding\n @options[:encoding]\n else\n @options[:encoding] ||= Encoding.find(self.class.format.content_encoding.to_s)\n end\n end",
"title": ""
},
{
"docid": "60ac988bb5481d90567b791c0afac6e7",
"score": "0.62890327",
"text": "def encoding\n case @options[:encoding]\n when String, Symbol\n Encoding.find(@options[:encoding].to_s)\n when Encoding\n @options[:encoding]\n else\n @options[:encoding] ||= Encoding.find(self.class.format.content_encoding.to_s)\n end\n end",
"title": ""
},
{
"docid": "1b5353879675b7ff45d12b1efe3148b7",
"score": "0.6288576",
"text": "def encoding_from_string(str)\n if str.respond_to?(:encoding)\n str.encoding\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "ee219c7cd37f54fc36439c6ff2531835",
"score": "0.62784886",
"text": "def to_native\n case encoding\n when Encoding.boolean then @contents.to_s == \"true\"\n when Encoding.double then @contents.to_s.to_f\n when Encoding.integer then @contents.to_s.to_i\n when Encoding.float then @contents.to_s.to_f\n when Encoding.time then Time.parse(@contents.to_s)\n when Encoding.datetime then DateTime.parse(@contents.to_s)\n when Encoding.date then Date.parse(@contents.to_s)\n when Encoding.duration then Duration.parse(@contents.to_s)\n else @contents.to_s\n end\n end",
"title": ""
},
{
"docid": "91c4ff97994770152dbb30f32e61f606",
"score": "0.6275179",
"text": "def to_utf8\n to_s\n end",
"title": ""
},
{
"docid": "dcbf75004bcd434a91d2ca6989dfd98a",
"score": "0.6266343",
"text": "def runtime_encoding(arr)\n\nend",
"title": ""
},
{
"docid": "2dd7f81cdfdddac6b6a656b8bcc4ae4e",
"score": "0.6265936",
"text": "def text_encoding\n { 1252 => 'CP1252 (WinLatin1)',\n 65001 => 'UTF-8'\n }.fetch(raw_text_encoding)\n end",
"title": ""
},
{
"docid": "f9160df1f75acead5e6da40ca7677ceb",
"score": "0.625122",
"text": "def encode(value)\n value\n end",
"title": ""
},
{
"docid": "264ef5cb87f27f3711839a1d54b713b7",
"score": "0.6247523",
"text": "def best_encoding(values)\n encoding.best_of(values)\n end",
"title": ""
},
{
"docid": "cca283fed13ef7ad6bb30ee3dc0b8888",
"score": "0.6239276",
"text": "def extra_encoding\n return '' unless extra\n change_code_encoding_for(extra) + extra.data_encoding + extra.extra_encoding\n end",
"title": ""
},
{
"docid": "d8028671a68f5200ff478db02076bd70",
"score": "0.6227273",
"text": "def to_utf8\n to_s\n end",
"title": ""
},
{
"docid": "451c5bad12196112216cd6b6ad333291",
"score": "0.62197477",
"text": "def encode_as_utf8(obj)\n if obj.is_a? Hash\n obj.each_pair do |key, val|\n encode_as_utf8(val)\n end\n elsif obj.is_a?(Array)\n obj.each do |val|\n encode_as_utf8(val)\n end\n elsif obj.is_a?(String) && obj.encoding != Encoding::UTF_8\n unless obj.force_encoding(\"UTF-8\").valid_encoding?\n obj.force_encoding(\"ISO-8859-1\").encode!(Encoding::UTF_8, invalid: :replace, undef: :replace)\n end\n end\n end",
"title": ""
},
{
"docid": "bfae4e917d5ce917b1c603458821f839",
"score": "0.6211921",
"text": "def typecast_value(column, value)\n s = super\n if s.is_a?(String) && !s.is_a?(Sequel::SQL::Blob) && (fe = model.forced_encoding)\n s = s.dup if s.frozen?\n s.force_encoding(fe)\n end\n s\n end",
"title": ""
},
{
"docid": "aebb875762d8872bbeb17d671cbaa4a0",
"score": "0.61799216",
"text": "def encoding\n return nil if self.headers[\"Content-Type\"] == nil\n result = self.headers[\"Content-Type\"].scan(\n /^.*? *; *charset=(.*);?/).flatten[0]\n result.strip! if result != nil\n return result\n end",
"title": ""
},
{
"docid": "f2b7d1dd8a3c0fe7fae282ea29549555",
"score": "0.61767447",
"text": "def raw_text_encoding\n @text_encoding ||= @data[28, 4].unpack('N*')[0]\n end",
"title": ""
},
{
"docid": "51110e797c67a5f77e7e2a1e9f54a953",
"score": "0.6172753",
"text": "def encode_as_utf8(obj)\n if obj.is_a? Hash\n obj.each_pair do |key, val|\n encode_as_utf8(val)\n end\n elsif obj.is_a?(Array)\n obj.each do |val|\n encode_as_utf8(val)\n end\n elsif obj.is_a?(String) && obj.encoding != Encoding::UTF_8\n if !obj.force_encoding(\"UTF-8\").valid_encoding?\n obj.force_encoding(\"ISO-8859-1\").encode!(Encoding::UTF_8, :invalid => :replace, :undef => :replace)\n end\n end\n end",
"title": ""
},
{
"docid": "3078523773c2598eafd347f07b9a6426",
"score": "0.61694443",
"text": "def encoding\n @body.encoding\n end",
"title": ""
},
{
"docid": "03c6417546115c4b4bb9a38bfcc3736f",
"score": "0.61691535",
"text": "def is_utf8?; end",
"title": ""
},
{
"docid": "03c6417546115c4b4bb9a38bfcc3736f",
"score": "0.61691535",
"text": "def is_utf8?; end",
"title": ""
}
] |
c0ad316bb9b9f2e21b860a586eb74274 | Initializes a Grid object. | [
{
"docid": "fc065828e761ea6c6f1dff6cbf34d4a2",
"score": "0.0",
"text": "def initialize\n @shows = []\n end",
"title": ""
}
] | [
{
"docid": "3d3d7ee0154ff5b7c6f989c0cdb5cf23",
"score": "0.81725496",
"text": "def initialize(grid)\n @grid = grid\n end",
"title": ""
},
{
"docid": "80305836de7df0afb72bf4965b6dc9f4",
"score": "0.79613096",
"text": "def initialize(grid: default_grid)\n @grid = grid\n end",
"title": ""
},
{
"docid": "056bd23ce8cc4cd6846b493ea1c8e174",
"score": "0.79214513",
"text": "def initialize()\r\n @grid = []\r\n @rows = 0\r\n @cols = 0\r\n end",
"title": ""
},
{
"docid": "056bd23ce8cc4cd6846b493ea1c8e174",
"score": "0.79214513",
"text": "def initialize()\r\n @grid = []\r\n @rows = 0\r\n @cols = 0\r\n end",
"title": ""
},
{
"docid": "15a76365d6ff1be56a9266e318fe1a9e",
"score": "0.7905071",
"text": "def initialize()\n @grid = []\n @rows = 0\n @cols = 0\n end",
"title": ""
},
{
"docid": "6c17392c0d0b8dd56894e1243c75891c",
"score": "0.76920485",
"text": "def initialize(grid = GRID_ROWS)\n self.array = grid\n end",
"title": ""
},
{
"docid": "93dae99d5ffff69730f357bf4c7df3e2",
"score": "0.7675229",
"text": "def initialize(grid = Board.empty_grid)\n @grid = grid\n end",
"title": ""
},
{
"docid": "87fdc111641dae6e0ba12a521e354475",
"score": "0.7600552",
"text": "def initialize(x = 10)\n\t\t@grid = Grid.new(x)\n\tend",
"title": ""
},
{
"docid": "86d0d7a321e7c94df632f2af89a08cb7",
"score": "0.7569412",
"text": "def initialize(grid)\n @position = nil\n @grid = grid\n end",
"title": ""
},
{
"docid": "97b267add89774f382f1e6ced76cf998",
"score": "0.7560297",
"text": "def initialize\r\n @grid = []\r\n @rows = 0\r\n @cols = 0\r\n end",
"title": ""
},
{
"docid": "e17c696eab1198e48bd9d4cfdd2b1811",
"score": "0.7453858",
"text": "def initialize_grid\n plain_grid_matrix = []\n rows.to_i.times do |y|\n cols.to_i.times do |x|\n plain_grid_matrix.push(CELL_EMPTY)\n end\n end\n self.update_attribute('grid', plain_grid_matrix.join(','))\n end",
"title": ""
},
{
"docid": "b9ee88f7ff381ada690b18271caeb188",
"score": "0.73936546",
"text": "def initialize(rows,columns)\n @rows = rows\n @columns = columns\n @grid = set_up\n configure_cells\n end",
"title": ""
},
{
"docid": "bc2653b37eb7ed1b28a06677da5dc045",
"score": "0.73559314",
"text": "def initialize(grid, x, y)\n super(grid)\n @x = x\n @y = y\n end",
"title": ""
},
{
"docid": "bd561e3914f48bc1ceae3b8e1aa819de",
"score": "0.7334166",
"text": "def initialize(params={})\n @grid = params.fetch(:grid, default_grid)\n end",
"title": ""
},
{
"docid": "c6b53bea32d1f5123ef3a1799387e401",
"score": "0.7314657",
"text": "def initialize(grid = default_grid) # initialize with a default grid, specified as 'grid'\n # @cell_count = 100\n # @structure = [[0, 0, 0],[0, 0, 0],[0, 0, 0]]\n @grid = grid # grid = @grid\n end",
"title": ""
},
{
"docid": "6ca6530933fd4dd740c64c3896273425",
"score": "0.7290109",
"text": "def initialize(alive_cells)\n init_grid(alive_cells)\n end",
"title": ""
},
{
"docid": "264f141058e291322ead099b9802ce61",
"score": "0.72721106",
"text": "def initialize\n @grid = [\n [1, 2, 3],\n [4, 5, 6],\n [7, 8, 9]\n ]\n end",
"title": ""
},
{
"docid": "6f11b809faf83b32968a02dfa601132c",
"score": "0.7250881",
"text": "def init_grid!\n @output_space.grid.each_with_position{|n,cord| @grid[get_position(cord.first),get_position(cord.last)] = n}\n end",
"title": ""
},
{
"docid": "d45208a0f9869f65b88a8bc6f2730071",
"score": "0.721151",
"text": "def initialize(height = 20, width = 20)\n @rows, @columns = Array.new(width), Array.new(height)\n @grid = rows.map{|row| columns.map {|column| nil }}\n end",
"title": ""
},
{
"docid": "50d2637a189bd2f9cc709fd30508b345",
"score": "0.72080326",
"text": "def initialize_instructions_grid\n grid_options = options.select { |k,v| %i(start_x start_y).include?(k) }\n args = { height: height, width: width }.merge(grid_options)\n @instructions_grid = grid_klass.new(args)\n end",
"title": ""
},
{
"docid": "8b008ca00965a4d2aac7ffa9e08bea8a",
"score": "0.7182",
"text": "def initialize(grid)\n @grid = grid\n @height = @grid.length\n @width = @grid.map { |row| row.length }.max\n end",
"title": ""
},
{
"docid": "f2a45b51adc62f3539f4374ba87c26ab",
"score": "0.71797025",
"text": "def initialize\n @grid = self.fill_mines(9)\n @size = @grid.length\n end",
"title": ""
},
{
"docid": "b12381814da6964a4e46ece4c5ed6732",
"score": "0.7160958",
"text": "def init_grid\n # remove any existing children from the XAML Grid element\n @board_grid.children.clear\n \n # add column definitions\n @width.times { @board_grid.column_definitions << ColumnDefinition.new }\n \n # add row definitions and blank rows of gems\n @height.times do |row_index| \n @board_grid.row_definitions << RowDefinition.new \n @width.times do |col_index|\n # Create a new Gem control and configure it as blank\n gem_block = Gem.new\n gem_block.hide\n # Position the gem in the Grid control\n Grid.set_row(gem_block, row_index)\n Grid.set_column(gem_block, col_index)\n # Add the Gem to the Grid\n @board_grid.children << gem_block\n end\n end\n end",
"title": ""
},
{
"docid": "bbcec99bffb77f390b4a0cfd5178762a",
"score": "0.7156277",
"text": "def initialize(rows,cols)\n \t@rows = rows\n \t@cols = cols\n @grid = Array.new(@rows) { |i| Array.new(@cols) { |i| 0 }}\n end",
"title": ""
},
{
"docid": "d727b4044513bda7cf41dc6ddb23043a",
"score": "0.7094482",
"text": "def initialize(width, height, initialItem=nil)\n @width = width\n @height = height\n @initialItem = initialItem\n @grid = Array.new(width, nil)\n \n width.times {|i| @grid[i] = Array.new(height, initialItem)}\n end",
"title": ""
},
{
"docid": "7acb0dadb0328f1e8026d8ea0ce9ae42",
"score": "0.70677584",
"text": "def initialize\n @cells = Array.new(Grid.size) { Array.new(Grid.size) }\n Grid.size.times do |row_index|\n Grid.size.times do |column_index|\n coordinates = Coordinates.new(row_index, column_index)\n @cells[row_index][column_index] = Cell.new(coordinates)\n end\n end\n end",
"title": ""
},
{
"docid": "4b1bf2b40f15d11ffb08fe1bb01851d3",
"score": "0.70008284",
"text": "def initialize(x=0, y=0, direction=\"NORTH\")\n @x = x\n @y = y\n @angle = angle_of(direction)\n @grid = Grid.new\n @on_grid = false\n end",
"title": ""
},
{
"docid": "1269004ce8e4eb25717ab3808fbb19cd",
"score": "0.69316745",
"text": "def initialize(grid_size=9)\n @grid = Array.new(grid_size) { Array.new(grid_size) { Tile.new }} \n populate_board\n end",
"title": ""
},
{
"docid": "0470913ce78707ad714abe0c6471743b",
"score": "0.6904129",
"text": "def initialize(x,y,dir,grid)\n @x = x\n @y = y\n @dir = dir\n @grid = grid\n end",
"title": ""
},
{
"docid": "986954847ffed54e6aed33ed23138c69",
"score": "0.6898016",
"text": "def initialize(grid, options = {})\n options = {\n :height => DEFAULT_HEIGHT,\n :width => DEFAULT_WIDTH,\n :buffer_height => SHAPE_BUFFER_HEIGHT\n }.merge(options)\n \n @board_grid = grid\n @height, @width, @buffer_height = options[:height], options[:width], options[:buffer_height]\n \n reset\n end",
"title": ""
},
{
"docid": "bdd3aee676b0ae833308a406fb2c2ab7",
"score": "0.6888141",
"text": "def prepare_grid\n Array.new(rows) do |row|\n Array.new(columns) do |column|\n Cell.new(row: row, column: column)\n end\n end\n end",
"title": ""
},
{
"docid": "70abaea88f9df427369883cebbcb388c",
"score": "0.68818253",
"text": "def initialize grid, x = nil, y = nil\n @grid, @x, @y = grid, x, y\n @type = 'E'\n end",
"title": ""
},
{
"docid": "c4c652e0ad87f7d1c14b5f8d3d6d5468",
"score": "0.67868745",
"text": "def initialize\n\t\t# Taille de la grille\n\t\t@base = 3\n\t\t@size = @base*@base\n\t\t\n\t\t# Création de la grille\n\t\t@grid = Array.new(@size) do |i|\n\t\t\tArray.new(@size) do |j| \n\t\t\t\tCase.new(Position.new(i, j))\n\t\t\tend\n\t\tend\n\n\t\treturn self\n\tend",
"title": ""
},
{
"docid": "e3f912e18083a4d1f0dcb617a361c5f9",
"score": "0.67351073",
"text": "def init_grid(randomize = false)\n Array.new(@height) do |i|\n Array.new(@width) do |j|\n states = [:dead, :live]\n states = states.shuffle if randomize\n Cell.new(i, j, states[0])\n end\n end\n end",
"title": ""
},
{
"docid": "6c791d5d834852ee4e04536e0968defd",
"score": "0.6734899",
"text": "def initialize(size)\n # the last dimension is a cell. it may contain multiple items.\n @grid = Array.new(size) { Array.new(size) { Array.new } }\n @size = size\n end",
"title": ""
},
{
"docid": "f6013990c4239ea1d69bbd0d78fc991e",
"score": "0.6707522",
"text": "def initialize\n @width = -1\n @height = -1\n @grid = Array.new\n @size = -1\n end",
"title": ""
},
{
"docid": "a118ee773800fde7428dd1b8684ff7ac",
"score": "0.6687286",
"text": "def initialize\n\t\t@grid = Board.new\n\t\t@player_1 = Player.new\n\t\t@player_2 = Player.new\n\tend",
"title": ""
},
{
"docid": "0f0f9e26e5e4866166f43a67c378d0b8",
"score": "0.66870195",
"text": "def initialize(width = DEFAULT_WIDTH, height = DEFAULT_HEIGHT)\n @grid = Array.new(width) { Array.new(width) }\n 0.upto(width-1) {|i| 0.upto(height-1) {|j| @grid[i][j] = false}}\n end",
"title": ""
},
{
"docid": "38e449d5578fadc82a939fc10ff64b4b",
"score": "0.6679448",
"text": "def initialize(rows = 3, cols = 3)\n @rows = rows\n @cols = cols\n @cells = []\n\n @cell_grid = Array.new(rows) do |row|\n Array.new(cols) do |col|\n Cell.new(col, row) # NOTE: col is 1st\n end\n end\n\n cell_grid.each do |row|\n row.each do |element|\n cells << element if element.is_a?(Cell)\n end\n end\n end",
"title": ""
},
{
"docid": "4c1f1cab943e0760a821e9dfdf8bec57",
"score": "0.66770697",
"text": "def initialize\n @cell_grid = generate_grid\n @ship_array = initialize_ships\n end",
"title": ""
},
{
"docid": "c234e4ec2f4c29eb14782d53d204427c",
"score": "0.66586226",
"text": "def initialize\n super WIDTH, HEIGHT, false\n self.caption = \"A* Grid\"\n \n ml = MediaLoader.new(self)\n \n # Create the grid where all the game objects will go.\n @grid = GameGrid.new(self, 150, 10, 32, 29, 20)\n \n \n # Wall is special, because it represents a bunch of things that need to be drawn. \n # Probably should figure out a better way to do this\n @wall = Wall.new(ml.load_image(MediaLoader::WALL), @grid)\n \n \n # create the game objects\n @target = Target.new(ml.load_image(MediaLoader::TARGET))\n @grid.add_object(@target)\n @agent = Agent.new(ml.load_image(MediaLoader::AGENT), @target, @wall)\n @grid.add_object(@agent)\n \n \n @keyhandler = KeyHandler.new(self)\n \n @font = Gosu::Font.new(self, Gosu::default_font_name, 16) # Create font with height for displaying debug junk\n \n # Some stuff to draw the Path that I probably need to refactor\n @show_path = true\n @path_helper = PathHelper.new(ml.load_image(MediaLoader::PATH), @grid)\n end",
"title": ""
},
{
"docid": "8e506bc67ab3b220891194da651534b0",
"score": "0.66565734",
"text": "def initialize(window, cols, rows, size)\n @window = window\n @cols = cols\n @rows = rows\n @width = size / cols # width of a node's square\n @height = size / rows # height of a node's square\n @nodes = Grid.build_nodes(window, cols, rows, @width, @height)\n @color = Gosu::Color.argb(0xaad3d3d3)\n end",
"title": ""
},
{
"docid": "d2217ae91c6d2522bdc0cb74cae30939",
"score": "0.664721",
"text": "def initialize\n @grid = Board.set_board(10, 24)\n @tall_bounds = (0...10)\n @wide_bounds = (0...24)\n end",
"title": ""
},
{
"docid": "9070fc66cb8cb78121d45d758af5e3bd",
"score": "0.66327167",
"text": "def initialize(height = 3, width = 3)\n @height = height.to_i\n @width = width.to_i\n @cells = []\n initialize_cells\n end",
"title": ""
},
{
"docid": "040f0d2b01e9a8a7c81394c235e42bcb",
"score": "0.6628681",
"text": "def initialize\n @game_over = false\n @grid = [[' ',' ',' '],\n [' ',' ',' '],\n [' ',' ',' ']]\n end",
"title": ""
},
{
"docid": "2079f9f6a045080bc628ad6cd4f4245e",
"score": "0.6626348",
"text": "def initGtkGrid\n\t\trealGrid = Gtk::Grid.new\n\t\trealGrid.set_column_spacing(Constants::SPACING)\n\t\trealGrid.set_row_spacing(Constants::SPACING)\n\t\t@cellsUiTrans.each_with_index {|row,i|\n\t\t\trow.each_with_index {|cell,j|\n\t\t\t\trealGrid.attach(cell.gtkObject, i+1, j+1, 1, 1)\n\t\t\t}\n\t\t}\n\t\t@gtkObject = Gtk::EventBox.new\n\t\t@gtkObject.add(realGrid)\n\tend",
"title": ""
},
{
"docid": "0e1d45988f400cd5b538d05c786fbba5",
"score": "0.6622676",
"text": "def initialize(input = {})\n @grid = input.fetch(:grid, default_grid) # default value\n # set_default_grid\n end",
"title": ""
},
{
"docid": "7d1393cf0098d45bb3648b47c88338b5",
"score": "0.6622427",
"text": "def initialize(rows = 5, columns = 5)\n @no_rows = rows\n @no_columns = columns\n @cell_neighbours = []\n @grid = Array.new(no_rows) do |row|\n Array.new(no_columns) do |col|\n cell = Cell.new(row, col)\n cell\n end\n end\n end",
"title": ""
},
{
"docid": "8bd236b0b15e3208b52be0e7a494cf78",
"score": "0.6613636",
"text": "def initialize(dimension)\n @dimension = dimension\n @block_width = Math.sqrt(@dimension).to_i\n @grid = []\n @dimension.times do\n row = []\n @dimension.times { row.push(Cell.new(0, @dimension)) }\n @grid.push(row)\n end\n end",
"title": ""
},
{
"docid": "676cf2a9e21cbf480490ea26834d40d5",
"score": "0.6575161",
"text": "def create_grid\n @grid = Array.new(@width) do |x|\n Array.new(@height) do |y|\n {x: x * $board_size + 2, # screen left - border is 2\n y: y * $board_size + 2, # screen bottom\n w: $board_size - 4, # reduce a bit for grid lines - spaces are 4\n h: $board_size - 4,\n r: 192,\n g: 192, # lighter gray than the default background\n b: 192,\n piece: :empty} # see Piece class for values\n end\n end\n end",
"title": ""
},
{
"docid": "5e7c31f0d8023f7c7ea9064f9fa806a1",
"score": "0.6568065",
"text": "def create_grid\n reset_grid!\n\n 0.upto(width - 1) do |row_index|\n 0.upto(height - 1) do |column_index|\n grid[row_index][column_index] =\n Cell.new(board: self, row: row_index, col: column_index)\n end\n end\n end",
"title": ""
},
{
"docid": "7a044c28968637ccbae3683d16364234",
"score": "0.6538579",
"text": "def initialize(x,y,d, grid)\n\t\t@location = {:x => x, :y => y, :d => d}\n\t\t@grid = grid\n\tend",
"title": ""
},
{
"docid": "d86ea14ee2c2869791736dabf51dd975",
"score": "0.65268224",
"text": "def initialize\r\n @grid = Board.new\r\n @player_1 = Player.new\r\n @player_2 = Player.new\r\n @current_turn = 1\r\n end",
"title": ""
},
{
"docid": "5fca593e6fba4129bb3f2e9e3a6d39a0",
"score": "0.6523005",
"text": "def grid_setup\n widths, rows = get_grid_info\n @grid = page.all(:xpath,\n \".//div[contains(@class, 'x-grid-item-container')]\").\n reject { |e| e.text.include?('DataGrid1') }.first\n @gridx = @grid.native.rect.x\n @gridy = @grid.native.rect.y\n height = @grid.native.size.height\n @perr = (height / rows).to_i\n col_preh = widths.each_with_index.map do |c, i|\n [i, [c[:x] + @gridx, c[:width]]]\n end\n @colh = Hash[col_preh]\n end",
"title": ""
},
{
"docid": "f0bb97a578a66831de64dfe1b560bc0d",
"score": "0.65215504",
"text": "def initialize(cols, height, num_to_win)\n @num_cols = cols\n @height = height\n @num_to_win = num_to_win\n @last_disc = nil\n @winner = nil\n @grid = Array.new(height) { Array.new(cols) {} }\n end",
"title": ""
},
{
"docid": "b2438fdb13c4e2322f331efff6dd630d",
"score": "0.64951605",
"text": "def setup_grid #:nodoc:\n Array.new(height) { Array.new(width, 0) }\n end",
"title": ""
},
{
"docid": "48a0f270771678f1c9869ab3e25cc71b",
"score": "0.6485829",
"text": "def initialize dims:\n\t\t\t@dims = dims\n\t\t\t@space = init_space\n\t\t\tinit_cells\n\t\t\traise \"#{self.class} has not implemented a constructor\"\n\t\tend",
"title": ""
},
{
"docid": "4426101ce66176f4f6067c79da4a1a88",
"score": "0.64753103",
"text": "def initialize(rows, columns, vapor_rate)\n # argument checks\n raise ArgumentError, \"rows and columns must be positive\" unless\n rows > 0 && columns > 0\n raise ArgumentError, \"rows and columns must be even\" unless\n rows % 2 == 0 && columns % 2 == 0\n raise ArgumentError, \"vapor rate must be from 0.0 to 1.0\" unless\n vapor_rate >= 0.0 && vapor_rate <= 1.0\n\n # Create the space with the proper vapor ratio.\n @space = Array.new(rows) do\n Array.new(columns) do\n Cell.new(rand <= vapor_rate ? :vapor : :space)\n end\n end\n\n # Put one ice crystal in the middle.\n @space[rows/2][columns/2].contents = :ice\n\n # Create the two Grids by using different offsets.\n @grids = [Grid.new(@space, 0), Grid.new(@space, 1)]\n\n @time = 0\n end",
"title": ""
},
{
"docid": "c0afe6ba0826f8b9b0ed6053b07cb5ec",
"score": "0.64739555",
"text": "def initialize(grid_size)\n @finished = false\n @player_1s_turn = [true, false].sample\n\n @n = grid_size\n @cells_grid = GridOfCells.new(@n)\n end",
"title": ""
},
{
"docid": "c8cebef4e593942d1cc2ece61eee50fd",
"score": "0.64676654",
"text": "def initialize(assets, game, gameScreen)\n\t\tnRow = game.getRows\n\t\tnCol = game.getCols\n\t\t@assets = assets\n\t\t@gameScreen = gameScreen\n\t\t@game = game\n\t\t@countIndicators = @tracer = true\n\t\t# creation of the UI version of the cell\n\t\t@cellsUi = (0...nRow).map { |x|\n\t\t\t(0...nCol).map { |y|\n\t\t\t\tCellUi.new(self, x, y, @assets)\n\t\t\t}\n\t\t}\n\t\t@cellsUiTrans=@cellsUi.transpose\n\n\t\t# creation of the grid itself\n\t\tinitGtkGrid()\n\t\t@gtkObject.signal_connect(\"button_release_event\") { |_, event|\n\t\t\tendDrag()\n\t\t}\n\t\t@gtkObject.signal_connect(\"leave_notify_event\") { |widget, event|\n\t\t\tif event.detail.nick != \"inferior\"\n\t\t\t\tendDrag()\n\t\t\tend\n\t\t}\n\t\t@currentSelection = SelectionUi.new\n\tend",
"title": ""
},
{
"docid": "09dd3b1da61699c58069aa1be523161a",
"score": "0.64303064",
"text": "def initialize(*args)\n set(*args)\n @cell_order = self.class.default_cell_order\n end",
"title": ""
},
{
"docid": "3778798f7b1ae0aebdab8128bb648c77",
"score": "0.6419971",
"text": "def create_grid\n @grid = Array.new(10) {Array.new(10) {Tile.new}}\n @grid_height = @grid.length\n @grid_width = @grid[0].length\n \n @grid[2][3] = Wall.new\n # @grid[2][4] = Invisiblewall.new\n # @grid[2][5] = Invisiblewall.new\n @grid[5][8] = Treasure.new\n @grid[1][7] = Treasure.new\n @grid[5][3] = Catnip.new\n @grid[4][3] = Catnip.new\n @grid[5][4] = Catnip.new\n @grid[4][4] = Catnip.new\n @grid[9][2] = Portal.new 3,2\n end",
"title": ""
},
{
"docid": "8a2a1c0a671d15a8a777101cfcad5c98",
"score": "0.6418468",
"text": "def initialize(goban, grid=nil)\n grid = goban.scoring_grid.convert(goban.grid) if !grid\n @goban = goban\n @grid = grid\n @yx = grid.yx\n @groups = nil\n end",
"title": ""
},
{
"docid": "0d641b3b65d492a2c784881faad56cfc",
"score": "0.6405353",
"text": "def initialize(num_rows, num_cols)\n @num_rows = num_rows\n @num_cols = num_cols\n @go_slower = false\n @cells = Array.new(@num_rows) { |row| Array.new(@num_cols) { |col| GolCell.new(row, col) } }\n end",
"title": ""
},
{
"docid": "fda8b3524e2e7b1fe7205a2a6c97570f",
"score": "0.64003295",
"text": "def initialize x:, y:\n\t\t\t@x, @y = x, y\n\t\t\t@space = init_space\n\t\t\tinit_cells\n\t\tend",
"title": ""
},
{
"docid": "2834e9c47be79674a6aef60ac3c45246",
"score": "0.6375289",
"text": "def genNewGrid(x = 10)\n\t\t@grid = Grid.new(x)\n\tend",
"title": ""
},
{
"docid": "b497fd2d2c59cf0c6a0bc777e662ff0b",
"score": "0.6372262",
"text": "def initialize(nRow, nCol, gridAnswers, withAnswers=false)\n\t\tProcessStatus.send(\"Initialisation de la grille de jeu\")\n\t\t@gridAnswers=gridAnswers\n\t\t@rows = (0..nRow-1).map {|x|\n\t\t\t(0..nCol-1).map { |y|\n\t\t\t\tif @gridAnswers.at(x).at(y)==\"A\"\n\t\t\t\t\tCell.new(state: :tree,frozen: false,row: x,column: y)\n\t\t\t\telsif @gridAnswers.at(x).at(y)==\"T\" && withAnswers\n\t\t\t\t\tCell.new(state: :tent,frozen: false,row: x,column: y)\n\t\t\t\telsif @gridAnswers.at(x).at(y)==\"_\" && withAnswers\n\t\t\t\t\tCell.new(state: :grass,frozen: false,row: x,column: y)\n\t\t\t\telse\n\t\t\t\t\tCell.new(state: :white,frozen: false,row: x,column: y)\n\t\t\t\tend\n\t\t\t}\n\t\t}\n\t\t@cols = @rows.transpose\n\tend",
"title": ""
},
{
"docid": "cf5fb8210fe0a3703e35495b3459db3c",
"score": "0.6370239",
"text": "def initialize(grid)\n @solver = MiniSat::Solver.new\n @grid_vars = []\n grid.each do |row|\n @grid_vars << Array.new(row.length) { @solver.new_var }\n end\n add_constraints_from_grid(grid)\n end",
"title": ""
},
{
"docid": "3b6d19f305f777afe62d64bbb04d30a9",
"score": "0.63684875",
"text": "def initialize(lines, columns, hypothesis=nil)\n\t\t@lines = lines\n\t\t@columns = columns\n\n\t\tif hypothesis != nil then\n\t\t\t@grid = Array.new(lines) do |j|\n\t\t\t\tArray.new(columns) do |i|\n\t\t\t\t\tCell.new(hypothesis, j, i)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "1fb5bbee9849b2e96fe12e036e3fe5e9",
"score": "0.63540196",
"text": "def grid(grid_name)\n MtkGrid.new(self, grid_name)\n end",
"title": ""
},
{
"docid": "eda74f6fc57eb2c69d7706d4789329b8",
"score": "0.6349952",
"text": "def initialize\n\t\t\t@grid = default_grid\n\t\t\t@solution = random_solution\n\t\tend",
"title": ""
},
{
"docid": "2cbf66861b588780370ffac9551b48c4",
"score": "0.6330007",
"text": "def initialize(grid_size)\n @game_state = {invalidmove: 0, victory: 1, draw: 2, continue: 3}\n @grid_size = grid_size < 3 ? 3 : grid_size\n @play_area = generate_grid(@grid_size)\n @area_size = @grid_size ** 2\n @turn = 0\n end",
"title": ""
},
{
"docid": "70fd956705372036cc069d1cc575b253",
"score": "0.63059574",
"text": "def grid_for(rows = [])\n Grid.new(rows: rows)\n end",
"title": ""
},
{
"docid": "d2820daf65ef2e733b1fd10de3cff26d",
"score": "0.62975156",
"text": "def initialize(grid_size, num_bombs) #=> initializing new board object\n @grid_size, @num_bombs = grid_size, num_bombs #=> setting instance variables to parameters passed\n #=> ^^ use these variables to create the board using the generate_board method\n generate_board #=> calling the generate_board method\n end",
"title": ""
},
{
"docid": "1f1d43190ec72d889280b442e94f44a3",
"score": "0.6297144",
"text": "def initialize(grid, prev = nil)\n\t\t@prev = prev\n\t\t@grid = grid\n\t\t@moves = Moves.new()\n\tend",
"title": ""
},
{
"docid": "2169c40e1730e1716c6f5168794b0624",
"score": "0.6296096",
"text": "def initialize(player_number, grid_width, grid_height, character_select, test_run = false)\n @game_prompt = TTY::Prompt.new\n @test_run = test_run\n @character_select = character_select\n @grid = Grid.new(grid_width, grid_height)\n @current_turn_index = 0\n @players = initialize_players(player_number)\n end",
"title": ""
},
{
"docid": "31814a55081b49a031fa4cdc91bf6b6d",
"score": "0.62956",
"text": "def initialize(grid, id, name = nil)\n @grid = grid\n @id = id\n @sortable = true\n # Databaseize stuff\n id_s = id.split('.')\n @db_column = id_s.last\n @db_table = id_s.count == 1 ? @grid.model_class.table_name : id_s[id_s.count - 2].tableize\n @db_fullname = \"`#{@db_table}`.`#{@db_column}`\"\n if name.nil?\n if @grid.model.is_a? ActiveRecord::Relation\n @name = @grid.model.klass.human_attribute_name(@db_column)\n elsif @grid.model.is_a? ActiveRecord::Base\n @name = @grid.model.class.human_attribute_name(@db_column)\n else\n raise \"Grid model must be an ActiveRecord type of object!\"\n end\n else\n @name = name\n end\n # Defaults\n @hidden = @visible = false\n end",
"title": ""
},
{
"docid": "a01b77fe2d07e9147195cef594cff998",
"score": "0.62763286",
"text": "def initialize\n validate_subclass\n\n @player_grid = place_ships\n validate_player_grid\n\n @enemy_grid = Array.new(10) { Array.new(10) } # start off with empty 10x10 grid\n @damage = {} # track player ship damage\n end",
"title": ""
},
{
"docid": "c1753cc0bc53129e7d2409b440b1fec8",
"score": "0.6250494",
"text": "def initialize(size, tile_set)\n @size = size\n @grid = Array.new(size) {Array.new(size)}\n \n @tile_set = tile_set\n @tiles = @tile_set.tiles\n populate\n end",
"title": ""
},
{
"docid": "6fc3e644675d7b5effcaf2e8700db44d",
"score": "0.624525",
"text": "def initialize capacity = nil\n super()\n if capacity.nil? or capacity < 0\n @capacity = nil\n else\n @capacity = capacity\n end\n @grid = Hash.new\n end",
"title": ""
},
{
"docid": "a100d175d00c12d787c70b21cafafd63",
"score": "0.6239293",
"text": "def create_grid\n return if $game_temp.grid != nil\n $game_temp.indicators = []\n $game_temp.fading_indicators = []\n $game_temp.grid = [[],[4]]\n ally = false; i = 0\n while i < (Grid.max_index)\n $game_temp.grid[0].push(GridSelector.new(Grid::GridPlaces[i],nil,@viewport1))\n i+=1#; ally = !ally if i % 4 == 0\n end\n for i in 0...$game_temp.grid[0].size\n if $game_temp.gi_troop[i] != nil\n $game_temp.grid[0][i].set_unit($game_temp.gi_troop[i])\n end\n end\n $game_party.battle_members.each do |member|\n#~ index = $game_party.battle_members.index(member)\n#~ $game_temp.grid[0][$game_system.party_pos[index]].set_unit(member)\n $game_temp.grid[0][member.position].set_unit(member)\n end\n Grid.ally_spaces.each {|pos| $game_temp.grid[0][pos].set_team(true)}\n Grid.enemy_spaces.each {|pos| $game_temp.grid[0][pos].set_team(false)}\n $game_temp.grid_arrow = GridArrow.new(4,@viewport2)\n end",
"title": ""
},
{
"docid": "c15212c232ff0e762cc83a03e7d55ace",
"score": "0.6236017",
"text": "def initialize(grid, file_path = nil)\r\n #file should be a csv\r\n if grid.empty?\r\n @grid = get_grid(file_path)\r\n else\r\n @grid = grid\r\n end\r\n n = @grid.size\r\n \r\n #lists of available values in each related container to a cell\r\n @inner_grids = Array.new(n) {|index| (1..n).to_a}\r\n @rows = Array.new(n) {|index| (1..n).to_a}\r\n @columns = Array.new(n) {|index| (1..n).to_a}\r\n \r\n @blank_locations = Array.new\r\n to_reject = nil\r\n @divisor = Math.sqrt(n).to_i\r\n \r\n 0.upto(n - 1) do |y_val|\r\n 0.upto(n - 1) do |x_val|\r\n to_reject = @grid[y_val][x_val]\r\n if to_reject != 0 then\r\n @inner_grids[x_val / @divisor + @divisor * (y_val / @divisor)].delete(to_reject)\r\n @rows[y_val].delete(to_reject)\r\n @columns[x_val].delete(to_reject)\r\n else\r\n #keep track of blank_locations to be filled\r\n @blank_locations << GridLocation.new(x_val, y_val, n, @inner_grids[x_val / @divisor + @divisor * (y_val / @divisor)], @rows[y_val], @columns[x_val])\r\n end\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "4db3ee6259ebab4a463c25c22f5caf29",
"score": "0.62355244",
"text": "def grid\n @grid ||= ::Mongo::Grid.new(db)\n end",
"title": ""
},
{
"docid": "9e3c05d94cac4c669b810d517ffb5adc",
"score": "0.6209468",
"text": "def initialize(width, start, goal)\n\t\t@grid = Graph.new(width**2)\n\t\t@size = width**2\n\t\t@start = start\n\t\t@goal = goal\n\t\tconnect(width**2)\n\tend",
"title": ""
},
{
"docid": "73c87f43b83cbb8b82fc3307819371ad",
"score": "0.6197347",
"text": "def initialize(name:, image:, grid: nil, tile_grid: nil, scale_x: nil, scale_y: nil, center_x: nil, center_y: nil)\n super name: name, scale_x: scale_x, scale_y: scale_y, center_x: center_x, center_y: center_y\n @image = image\n @tile_grid = grid || tile_grid || open_struct # x y w h count stride\n @tile_grid.x ||= 0\n @tile_grid.y ||= 0\n @tile_grid.w ||= @image.width.to_i\n @tile_grid.h ||= @image.height.to_i\n @tile_grid.count ||= 1\n @tile_grid.stride ||= @tile_grid.count\n @subs = []\n end",
"title": ""
},
{
"docid": "06a0ec3eff2d37c2343eeaac8e719c50",
"score": "0.6194594",
"text": "def default_grid\n Array.new(9) { Array.new(9) { Cell.new } }\n end",
"title": ""
},
{
"docid": "93093b9a66e4659373185010c71191f0",
"score": "0.61867887",
"text": "def tableGrid\n\t@tableGrid ||=TableGrid.new\nend",
"title": ""
},
{
"docid": "874efdd0a2bcb4eb42dafe29816b34d6",
"score": "0.61821985",
"text": "def default_grid\n Array.new(3) { Array.new(3) { Cell.new } }\n end",
"title": ""
},
{
"docid": "3b54e3814d240b74ad36980ca7c1c1a8",
"score": "0.61732376",
"text": "def grid\n @grid ||= [parse_grid, parse_grid]\n end",
"title": ""
},
{
"docid": "0507db221185458547c1c6c43e01eab2",
"score": "0.61696815",
"text": "def initialize(date, user, grid)\n\n @grid_processor = Courts::GridProcessor.new(date, user, grid).run!\n\n @closure_message = @grid_processor.closure_message\n @table = @grid_processor.table\n end",
"title": ""
},
{
"docid": "40873368083c3fcf44185c7b65eec0bf",
"score": "0.61620736",
"text": "def initialize(width, height)\n @rect = Rect.new(width, height)\n @width = width\n @cells = Array.new(width * height, Console.clear_cell)\n end",
"title": ""
},
{
"docid": "72b2825b90961bac4ce53ef29a57d2dc",
"score": "0.6152524",
"text": "def initialize\n\t\t@row1 = \"| | | | | | | |\"\n\t\t@row2 = \"| | | | | | | |\"\n\t\t@row3 = \"| | | | | | | |\"\n\t\t@row4 = \"| | | | | | | |\"\n\t\t@row5 = \"| | | | | | | |\"\n\t\t@row6 = \"| | | | | | | |\"\n\tend",
"title": ""
},
{
"docid": "01b2ae619c2140584d538cd91d3312cf",
"score": "0.6152523",
"text": "def initialize\n @width = 1040.idiv($board_size) # space for menu and scoreboard\n @height = 720.idiv($board_size)\n $args.outputs.static_solids << create_grid\n end",
"title": ""
},
{
"docid": "62258f10bc41b90befff397eebc19290",
"score": "0.6151003",
"text": "def init_space\n\t\t\tArray.new x do |col|\n\t\t\t\tArray.new y do |row|\n\t\t\t\t\tCell.new x: col, y: row\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "0ed3246d727190991b588585b57d9cdf",
"score": "0.61503965",
"text": "def initialize()\n #use #reset to set the cells for a new game\n reset!\n end",
"title": ""
},
{
"docid": "4a7056460e71ef74f78e4e05d0cf03bf",
"score": "0.61491257",
"text": "def initialize_board\n (0...BOARD_SIDE_SIZE).each do |rows| #rows\n column_arr = []\n (1..BOARD_SIDE_SIZE).each do |column|\n column_arr << column + (rows * BOARD_SIDE_SIZE)\n end\n @board_grid[rows] = column_arr\n end\n end",
"title": ""
},
{
"docid": "9d5722ed2990687f987e93c67d144864",
"score": "0.61423737",
"text": "def set_grid\n @grid = Grid.find(params[:id])\n end",
"title": ""
},
{
"docid": "9d5722ed2990687f987e93c67d144864",
"score": "0.61423737",
"text": "def set_grid\n @grid = Grid.find(params[:id])\n end",
"title": ""
},
{
"docid": "b22f4c3914f8d220ffd2628ca5b0b63b",
"score": "0.6138723",
"text": "def initialize(grid)\n @grid = grid\n @hypotheses = [Hypothesis.new(@grid.getCurrentGrid(), :created)]\n @index = 0\n end",
"title": ""
},
{
"docid": "ff44309797205b0d12670581bbede3ac",
"score": "0.6135167",
"text": "def initialize(grid, environment, column_config, active_record_prototype, field_name)\n\n @grid = grid\n\n begin\n @grid.is_popup = nil unless @grid.is_popup # TODO: WHY????\n @html_options = column_config[:html_options]\n\n @env = environment\n @column_config = column_config\n @active_record_prototype = active_record_prototype\n @field_name = field_name\n @column_type = column_config[:field_type]\n\n rescue\n raise MesScada::Error, \"DataGrid: The datagrid column could not be created.\"\n end\n end",
"title": ""
},
{
"docid": "901cf0d3830b00923d1a711183eafe47",
"score": "0.6128935",
"text": "def initialize(rows, cols)\n @row_count = rows\n @column_count = cols\n @cells = Array.new(rows) { Array.new(cols, 0) }\n end",
"title": ""
}
] |
4cb93d045a3dbc77c40993849e58267a | TODO: see if can match widths for edit/view content of posts across tinymce and user display TODO: add last updated timestamp with proper html5 markup to blog posts TODO: increase default size of dialog upload box TODO: look into video embed TODO: get better favicon TODO: make vector/gimp layer version of logo for infisizeing | [
{
"docid": "66bee70e0139e92067d3699ede5bc175",
"score": "0.0",
"text": "def authenticate\n unless logged_in?\n #unauthorized access\n redirect_to root_path, :notice => 'Please login before doing that.'\n end\n end",
"title": ""
}
] | [
{
"docid": "ddc1434583022f0222e8e87f399dee6e",
"score": "0.57588935",
"text": "def layout\n # number of columns = the most we can fit on one row, or 1 if that is \n # too small\n contentWindow.numColumns = [width/Photo::THUMB_SIZE,1].max\n super\n end",
"title": ""
},
{
"docid": "646b7c8a73d37fb563396bb5a436686c",
"score": "0.57208645",
"text": "def preview\n truncate(body, length: Tinyblog.post_preview_length, separator: \"\\n\")\n end",
"title": ""
},
{
"docid": "865a5f51bab7d96f246a5afc42af460b",
"score": "0.5683579",
"text": "def show\n #@post.content = StringParse.md2html(@post.content)\n end",
"title": ""
},
{
"docid": "416d023ecb1c358471bb0b4617c82e00",
"score": "0.55777586",
"text": "def post_preview\n # add the body if we've got it\n body = '' + (check_for_bad_xhtml(params[:post][:body_raw], 'post', params[:post][:text_filter]) if params[:post][:body_raw])\n # add the extended bits if we've got them\n extd = '' + (check_for_bad_xhtml(params[:post][:extended_raw], 'post', params[:post][:text_filter]) if params[:post][:extended_raw])\n # dump it out\n render :text => body + extd, :layout => false\n end",
"title": ""
},
{
"docid": "c9f54b8dcc7cc59b3c2b57321282e7ed",
"score": "0.5566811",
"text": "def new\n @blog_post = @bloggable.blog.posts.new\n render :update do |page|\n page[\"sub-content\"].replace_html :partial => \"new\"\n page << \"#{raw_tiny_mce_init(taz_tiny_mce_options)}\" \n end \n end",
"title": ""
},
{
"docid": "2f7b6f121d769a2a4b287dd62daf4a08",
"score": "0.5525022",
"text": "def display_image\n image.variant resize_to_limit: [Settings.micropost.model.display_img.height,\n Settings.micropost.model.display_img.width]\n end",
"title": ""
},
{
"docid": "be7ecb9e52fbaed686b97bfa25344c65",
"score": "0.5522315",
"text": "def show\n @blogpost = get_blogpost\n @full_length = true\n end",
"title": ""
},
{
"docid": "3a54ac4b3f20db3ff23d411ae55c02f6",
"score": "0.54815376",
"text": "def edit \n @content = {}\n @blog_post.blog_post_contents.each do |content|\n @content[content.id] = content.contentable\n end\n render :update do |page|\n page[\"sub-content\"].replace_html :partial => \"edit\"\n page << \"#{raw_tiny_mce_init(taz_tiny_mce_options)}\"\n end \n end",
"title": ""
},
{
"docid": "ee50e7985734670a050db4cfeccaa8ea",
"score": "0.5474197",
"text": "def show_preview(post_text)\n\n min_chars = 800\n max_chars = 1400\n\n # strip out link tags for this preview\n post_text = sanitize(post_text, tags: %w(p li ol ul div span br pre code h2 h3 h4 h5 h6 img strong))\n\n return post_text if post_text.size < min_chars\n\n # find the first </p> tag over min_chars chars\n # if not found by max_chars chars, stop at max_chars char\n preview_pos = post_text[min_chars..-1].index(\"</p>\")\n num_extra_chars = min_chars + 3\n extra_chars = \"\"\n\n if preview_pos.nil? || preview_pos > max_chars\n # try looking for the first <br> tag\n preview_pos = post_text[min_chars..-1].index(\"<br\")\n num_extra_chars = min_chars + 2\n extra_chars = \">\"\n\n if preview_pos.nil? || preview_pos > max_chars\n # just look for the next closing tag so we don't\n # cut off an html tag in the middle\n preview_pos = post_text[min_chars..-1].index(\">\")\n num_extra_chars = min_chars\n extra_chars = \"...\"\n\n if preview_pos.nil? || preview_pos > max_chars\n preview_pos = max_chars\n num_extra_chars = 0\n extra_chars = \"...\"\n end\n end\n end\n preview = post_text[0..preview_pos+num_extra_chars]+extra_chars\n return preview\n end",
"title": ""
},
{
"docid": "5c3e1a7afddc25d2956054a4e5849526",
"score": "0.547355",
"text": "def preview\n render :text => 'Facebook credentials not sent.' and return if params[:id].nil?\n @page = Page.first(:conditions => { :preview_key => params[:id] })\n render :text => 'Page not found' and return if @page.nil?\n\n # quick and dirty javascript filtering in CSS =(\n render :text => 'Please omit open/close style tags in your CSS' and return unless /(<\\/style)/i.match(@page.css).nil?\n render :text => 'Please remove javascript from your CSS.' and return unless /(<script)/i.match(@page.css).nil?\n \n # allow me to test any code.\n @page.body = Sanitize.clean(@page.body, Sanitize::Config::CUSTOM) unless @page.preview_key == '8b1ca7267a8978bb'\n @to_facebook = (request.post?) ? true : false;\n matches = @page.body.match(/\\[#slider:(\\d+)\\]/)\n @page.body.gsub!(\"[#slider:#{matches[1]}]\", widgets('slider', matches[1]) ) unless matches.nil?\n @page.body.gsub!('[:path]', 'http://grrowth.com/system')\n \n render :template => \"deploy/index.erb\"\n end",
"title": ""
},
{
"docid": "2387b560e7fa723e123a41444cd636a4",
"score": "0.54644156",
"text": "def preview\n \t# get the rich text html output, remove tags, then truncate for preview\n \ttruncate(strip_tags(text_content), :length => 140 )\n end",
"title": ""
},
{
"docid": "79f4208572958decd0a23859349c532c",
"score": "0.5461776",
"text": "def widget_content\n end",
"title": ""
},
{
"docid": "12db9d48648e2f917177ee6c50244f7b",
"score": "0.5440192",
"text": "def save\r\n if params[:id] && request.get?\r\n # Aqui se genera los datos para la view del edit\r\n @post = Post.find(params[:id])\r\n @tags = @post.tag_names\r\n render :action => :edit\r\n elsif params[:id] && request.post?\r\n # Aqui se graba cuando editamos\r\n @po = Post.find(params[:id])\r\n @po.attributes = params[:post]\r\n @po.tag_names = params[:tags]\r\n @po.id = params[:id]\r\n @po.save\r\n redirect_to :action => :list, :id => current_user[:id]\r\n elsif !params[:id] && request.get?\r\n # want to create a new post -- go for it\r\n @post = Post.new\r\n @tags = nil\r\n render :action => :new\r\n elsif request.post?\r\n # post request means something big is going to happen.\r\n # set post variable to the post in question if we're editing, otherwise\r\n # open a new object\r\n id = params[:id]\r\n @post = id ? Post.find(id) : Post.new\r\n # reset all of post's attributes, replacing them with those submitted\r\n # from the form\r\n @post.attributes = params[:post]\r\n # if post has no user_id set, give it the id of the logged in user\r\n @post.user_id ||= current_user[:id]\r\n type = params[:post_type]\r\n @post.content = params[:content] if TYPES[type]\r\n @post.post_type = type_parse(@post.content)\r\n\r\n require 'htmlentities'\r\n coder = HTMLEntities.new\r\n string = @post.content\r\n @post.content = coder.encode(string, :basic)\r\n \r\n content = @post.content\r\n\r\n # POST_TYPE == IMAGE\r\n if @post.post_type == 'image'\r\n capturanombre = \"#{@post.user_id}-#{Time.now}\"\r\n capturanombre = capturanombre.gsub(\" \",\"\")\r\n direcion = \"public/post/#{capturanombre}.jpg\"\r\n if params[:img] == nil\r\n require 'open-uri'\r\n urls = Array.new\r\n @post.content.split.each do |u|\r\n if u.match(/(.png|.jpg|.gif)$/)\r\n urls << u\r\n end\r\n end\r\n open(direcion, \"wb\") do |file|\r\n file << open(urls.first).read\r\n end\r\n else\r\n File.open(direcion, \"wb\") do |file|\r\n file << open(params[:img]).read\r\n end\r\n end\r\n direcion2 = \"/post/#{capturanombre}.jpg\"\r\n @post.content = direcion2\r\n end\r\n\r\n # POST_TYPE == LINK || VIDEO\r\n if @post.post_type == 'link' || @post.post_type == 'video'\r\n require 'metainspector'\r\n require 'iconv'\r\n if @post.post_type == 'link'\r\n urls = Array.new\r\n @post.content.split.each do |u|\r\n if u.match(/(^(http|https):\\/\\/[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(([0-9]{1,5})?\\/.*)?$)/ix)\r\n urls << u\r\n end\r\n end\r\n doc = MetaInspector.new(urls.first)\r\n end\r\n if @post.post_type == 'video'\r\n urls = Array.new\r\n @post.content.split.each do |u|\r\n if u.match(/\\A(http|https):\\/\\/www.youtube.com/)\r\n urls << u\r\n end\r\n end\r\n doc = MetaInspector.new(urls.first)\r\n end\r\n desc = doc.description\r\n @post.title = doc.title\r\n if doc.image\r\n img_path = doc.image\r\n else\r\n img_path = doc.images.first\r\n end\r\n\r\n if img_path != \"\"\r\n require 'open-uri'\r\n capturanombre = \"#{@post.user_id}-#{Time.now.to_a.join}\"\r\n direcion = \"public/post/#{capturanombre}.jpg\"\r\n open(direcion, \"wb\") do |file|\r\n file << open(img_path).read\r\n end\r\n img_url = \"/post/#{capturanombre}.jpg\"\r\n @post.content = desc + \"\\n\" + img_url + \"\\n\" + doc.url + \"\\n\" + doc.host\r\n else\r\n @post.content = desc + \"\\n\" + \"no-img\" + \"\\n\" + doc.url + \"\\n\" + doc.host\r\n end\r\n end\r\n \r\n @post.save \r\n \r\n if @post\r\n # Agregar tags\r\n t11 = Array.new\r\n content.split.each do |t|\r\n if t.first == '#'\r\n t = t.gsub(/^#/,\"\")\r\n t = t.gsub(/[áäà]/i, \"a\")\r\n t = t.gsub(/[éëè]/i, \"e\")\r\n t = t.gsub(/[íïì]/i, \"i\")\r\n t = t.gsub(/[óöò]/i, \"o\")\r\n t = t.gsub(/[úüù]/i, \"u\")\r\n t = t.gsub(/[^a-zA-Z0-9ñÑçÇ\\']/i, \"\")\r\n t11 << t\r\n end\r\n end\r\n\r\n t11.each do |t|\r\n tag = Tag.find_by_name(t) || Tag.new(:name => t)\r\n @post.tags << tag\r\n subs = Subscriptions.where(:resource_id => tag.id, :resource_type => Subscriptions::S_TAG)\r\n subs.each do |sub|\r\n Notification.send_notification(sub.user_id, current_user[:id], Notification::TAG_POST, @post.id, tag.id)\r\n end\r\n end\r\n \r\n # Notificaciones para las menciones\r\n mentions = Array.new\r\n content.split.each do |t|\r\n if t.first == '@'\r\n mentions << t.gsub(/^@/,\"\")\r\n end\r\n end\r\n \r\n interaction = Interaction.new(:post_id => @post.id, :user_id => @post.user_id)\r\n @post.interactions << interaction\r\n mentions.each do |u|\r\n user = User.find_by_name(u)\r\n if user\r\n interaction = Interaction.new(:post_id => @post.id, :user_id => user.id, :int_type => Interaction::I_MENTION)\r\n @post.interactions << interaction\r\n Notification.send_notification(user.id, current_user[:id], Notification::USER, @post.id, @post.user_id)\r\n end\r\n end\r\n Subscriptions.subscribe(current_user[:id], Subscriptions::S_POST, @post.id)\r\n\r\n # save the post - if it fails, send the user back from whence she came\r\n @post.save\r\n end\r\n\r\n if !params[:external] || params[:remote]\r\n respond_to do |format|\r\n format.html { redirect_to post_path }\r\n format.js\r\n end\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "b2e4a931b3cfcdefee5daf8489a5a2db",
"score": "0.5436773",
"text": "def blog_post_to_index\n require 'nokogiri'\n self.custom_fields_basic_attributes.map do |(name, value)|\n if name == \"body\"\n html = Nokogiri.HTML(value)\n content = \"\"\n\n if html.css(\"#table-of-contents\").size != 0\n html.css(\"#table-of-contents\").first.remove\n end\n if html.css(\".readmore-block\").size != 0\n html.css(\".readmore-block\").each do |i|\n i.remove\n end\n end\n if html.css(\".video-block\").size != 0\n html.css(\".video-block\").each do |i|\n i.remove\n end\n end\n if html.css(\".audio-block\").size != 0\n html.css(\".audio-block\").each do |i|\n i.remove\n end\n end\n if html.css(\"ul\").size != 0\n html.css(\"ul\").each do |i|\n i.remove\n end\n end\n if html.css(\".btn-wrap\").size != 0\n html.css(\".btn-wrap\").each do |i|\n i.remove\n end\n end\n\n html.css(\"h2, h3, h4\").each do |i|\n content = \"#{content} #{i.text} \"\n end\n\n html.css(\"p\").each_with_index do |i, index|\n if index > 9\n break\n else\n content = \"#{content} #{i.text} \"\n end\n end\n content\n #truncate_desc(sanitize_search_content(content).downcase.chomp.gsub(/[^0-9A-Za-z ]/, ' ').split(\" \").uniq.select{|w| w.length >= 3}.join(\" \"), 8000)\n\n #text_only = sanitize_search_content(html.inner_html)\n #truncate_desc(text_only.downcase.chomp.gsub(/[^0-9A-Za-z ]/, ' ').split(\" \").uniq.select{|w| w.length >= 3}.join(\" \"), 8000)\n else\n next\n end\n end.compact.join(' ').strip\n end",
"title": ""
},
{
"docid": "92da1a83c822c597d5d71c819cc0df70",
"score": "0.538087",
"text": "def create\n \n #params[:blog_entry][:content] = Sanitize.clean(params[:blog_entry][:content], Sanitize::Config::RELAXED)\n @blog_entry = BlogEntry.new(params[:blog_entry])\n @blog_entry.user_id = current_user.id\n \n params[:tags].split.each do |tag|\n @blog_entry.tags << Tag.find_or_create_by_name(tag)\n end\n \n if @blog_entry.content.index(\"<!-- preview -->\")\n @blog_entry.preview = @blog_entry.content.index(\"<!-- preview -->\")\n end\n\n @blog_entry.save\n respond_to do |format|\n if @blog_entry.save\n format.html { redirect_to @blog_entry, notice: 'Blog entry was successfully created.' }\n format.json { render json: @blog_entry, status: :created, location: @blog_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @blog_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aff69e3899e7ab2d85b334f72b6125f6",
"score": "0.5371444",
"text": "def dynamic_width; end",
"title": ""
},
{
"docid": "aff69e3899e7ab2d85b334f72b6125f6",
"score": "0.5371444",
"text": "def dynamic_width; end",
"title": ""
},
{
"docid": "7a8a6de9d1e8d1b8a763c313ab1badac",
"score": "0.53662914",
"text": "def max_width; end",
"title": ""
},
{
"docid": "7a8a6de9d1e8d1b8a763c313ab1badac",
"score": "0.53662914",
"text": "def max_width; end",
"title": ""
},
{
"docid": "863ed8661db0d2c47eaf6c1215e0fec0",
"score": "0.5355682",
"text": "def main_container_contents\n h1 raw(\" \")\n div_gutter\n widget Views::Users::ShowViewGen.new(:helper_template => @helper_template)\n\n end",
"title": ""
},
{
"docid": "867ae405b291ef476e91b6e9f8d719b5",
"score": "0.53552294",
"text": "def preview\n frm().button(:value=>\"Preview\").click\n PreviewBloggerPost.new(@browser)\n end",
"title": ""
},
{
"docid": "867ae405b291ef476e91b6e9f8d719b5",
"score": "0.53552294",
"text": "def preview\n frm().button(:value=>\"Preview\").click\n PreviewBloggerPost.new(@browser)\n end",
"title": ""
},
{
"docid": "daf39156afdb0163e0e101e62df4bcb9",
"score": "0.53280187",
"text": "def max_width\n end",
"title": ""
},
{
"docid": "ecd077072aeaa0c1c2148bbfdf39c035",
"score": "0.53155214",
"text": "def show\n render :layout => 'frontdoor'\n\n @blog_entries = Blog::Entry.all\n @blog_article = @blog_entry.article\n @recommended_entries = @blog_entry.recommended_entries \n @author = @blog_article.user if @blog_article.present?\n\n @blog_entry_meta_image_url = Blog::Entry.construct_meta_image_url(@blog_entry).to_s\n\"\"\n end",
"title": ""
},
{
"docid": "ebe48bb49ed09a2ae8629108ea18f511",
"score": "0.530115",
"text": "def comment_button_column_size\n return \"small-6\" if @resource.emendation? && manageable_user_groups.empty?\n\n \"small-3\"\n end",
"title": ""
},
{
"docid": "6d1d8212c51dd7801bdd18a84fd05e61",
"score": "0.5298917",
"text": "def create\n @blog_post = BlogPost.new(params[:blog_post])\n @blog_post[:user_id] = current_user.id\n\n ## Textilize the body (to leave in newlines, etc.)\n @blog_post.body = RedCloth.new( ActionController::Base.helpers.sanitize( @blog_post.body ), [:filter_html, :filter_styles, :filter_classes, :filter_ids] ).to_html\n\n ## Set the published_at date/time\n @blog_post.published_at = Time.now\n\n if @blog_post.save\n ## if there is no image attached to the post\n if params[:blog_post][:image].blank?\n flash[:notice] = 'BlogPost was successfully created.' ## don't send to crop page\n redirect_to @blog_post\n ## otherwise send to crop image to make it 3:1 ratio (length:height)\n else\n redirect_to \"/blog_posts/#{@blog_post.id}/crop\"\n end\n else\n ## if save was unsuccessful, take out textilization so that <p>s, etc. are not in text box\n @blog_post.body = Nokogiri::HTML.fragment(@blog_post.body).text\n render :action => \"new\" \n end\n end",
"title": ""
},
{
"docid": "5a2275f9da33f21843de32afd10b09d5",
"score": "0.5289361",
"text": "def atomed_post(text, width)\n markdown(text).gsub( \"<img\", \"<img width=\\\"#{width}\\\"\")\n end",
"title": ""
},
{
"docid": "149f789f71699182b90dc6289d069b03",
"score": "0.52833396",
"text": "def post_edit\n @post = Post.find(params[:id])\n @plink = Post.permalink(@post[0])\n @tags = Tag.find(:all, :order => 'name asc')\n @authors = Author.find(:all, :order => 'name asc')\n @preview = (@post.body ? @post.body : '') + (@post.extended ? @post.extended : '')\n $admin_page_title = 'Editing post'\n @onload = \"document.forms['post_form'].elements['post[title]'].focus()\"\n render :template => 'admin/posts/post_edit'\n end",
"title": ""
},
{
"docid": "58290148dd8f1cfe08d269c31e38f602",
"score": "0.5281988",
"text": "def blog_post_params\n params.require(:blog_post).permit(\n :name,\n :css_classes,\n :content_id,\n :content_type,\n :image_id,\n :carousel_id,\n :image_group_id,\n :medium_id,\n :list_group_id,\n :link_text_id,\n :text_html_flag,\n :body,\n :admin_id,\n :include_admin_handle,\n :include_update_time,\n :include_caption,\n :include_copyright,\n :include_description,\n :position)\n end",
"title": ""
},
{
"docid": "f357afdc2dc6a47c42978180c20ecc9a",
"score": "0.5268598",
"text": "def viewWillLayoutSubviews\n @create_challenge.contentSize = CGSizeMake( (Device.screen.width - 25), (Device.screen.height - 50) )\n @pagination.contentSize = self.view.superview.bounds.size\n end",
"title": ""
},
{
"docid": "955e10fdf652758680093db4e8065259",
"score": "0.5263714",
"text": "def content_preview\n content[0..200]\n end",
"title": ""
},
{
"docid": "e647cca1132ec8c1a294f0bc05b00a62",
"score": "0.5261593",
"text": "def index\n #@banners = BannerImage.includes(:post).order(\"created_at desc\")\n #@first_banner = @banners.first\n #@banners = Post.includes(:banner_images).all\n\n\n @banners = BannerImage.joins(:post)\n @first_banner = @banners.first\n @banner_image = BannerImage.find_all_by_post_id(1,:conditions=>\"image_file_name IS NOT NULL\")\n @first_post = Post.first\n @posts = Post.select(:id).order('id desc').first\n @slide_snacks = Post.get_post(5)\n @first_snack = @slide_snacks.first\n @feature_posts = Post.get_post(3)\n #@recent_posts = Post.get_post(4)\n @recent_posts = Post.all.paginate(page: params[:page], per_page: 4).order(\"created_at desc\");\n @latest_posts = @feature_posts\n # @val = \"This is how I approached the problem in the site I work for. When JavaScript is available, I truncate characters off the end until it fits with an ellipses at the end.\"\n #was using above text to check the content of blog on responsive pages.\n end",
"title": ""
},
{
"docid": "00a94ef2b1ae6feee4192dbea83035c8",
"score": "0.5261557",
"text": "def letter_widgets_content\n letter_widgets.div(:class=>'heading',:text=>'Entry List').parent.parent.parent.parent.parent.parent.parent.parent\n end",
"title": ""
},
{
"docid": "786f9b527bb7e77fd7bf1f81e715062f",
"score": "0.5258007",
"text": "def preview\n # mockup our models for preview.\n @post = Monologue::Post.new post_params\n @post.user_id = monologue_current_user.id\n @post.published_at = Time.zone.now\n # render it exactly as it would display when live.\n render \"/monologue/posts/show\", layout: Monologue::Config.layout || \"/layouts/monologue/application\"\n end",
"title": ""
},
{
"docid": "786f9b527bb7e77fd7bf1f81e715062f",
"score": "0.5258007",
"text": "def preview\n # mockup our models for preview.\n @post = Monologue::Post.new post_params\n @post.user_id = monologue_current_user.id\n @post.published_at = Time.zone.now\n # render it exactly as it would display when live.\n render \"/monologue/posts/show\", layout: Monologue::Config.layout || \"/layouts/monologue/application\"\n end",
"title": ""
},
{
"docid": "0004c90e1d8663942c5dc0bc2332b046",
"score": "0.52551425",
"text": "def show\n \"<div style=\\\"width:100%\\\"><h3>\" + \n @username + \n ' posted at ' + \n @time_of_post.to_s + \n \":</h3>\" + @post_contents + \n \"</div>\"\n end",
"title": ""
},
{
"docid": "bf66367daa643e8bfb21ea6b38945e41",
"score": "0.5252693",
"text": "def load_data_for_preview\n @site = @post.site\n force_locale\n recent_posts\n all_tags\n archive_posts\n end",
"title": ""
},
{
"docid": "eedcd6a52c3057950e5eb3dec5955006",
"score": "0.5246815",
"text": "def dc_image_preview_resized(document, yaml, ignore)\n size = yaml['name'].last\n return '' if document[\"size_#{size}\"].blank?\n\n src = \"/#{dc_get_site.params.dig('dc_image', 'location')}/#{document.id}-#{size}.#{document.img_type}?#{Time.now.to_i}\"\n %(<span class=\"dc-image-preview\"><img src=\"#{src}\"></img></span><div id=\"dc-image-preview\"></div>).html_safe\nend",
"title": ""
},
{
"docid": "0c20e5faebee3afd740a75b243c2301f",
"score": "0.5232982",
"text": "def preview\n # mockup our models for preview.\n @post = Monologue::Post.new post_params\n @post.user_id = monologue_current_user.id\n @post.published_at = Time.zone.now\n # render it exactly as it would display when live.\n load_data_for_preview\n render '/monologue/posts/show',\n layout: @post.site.layout || '/layouts/monologue/application'\n end",
"title": ""
},
{
"docid": "6629816f27557fe36da7035ebaa684bd",
"score": "0.5225264",
"text": "def post_create\n # let's create our new post\n @post = Post.new(params[:post])\n # set custom fields to empty string if they're not set\n @post.custom_field_1 = @post.custom_field_1 || ''\n @post.custom_field_2 = @post.custom_field_2 || ''\n @post.custom_field_3 = @post.custom_field_3 || ''\n # assign our tags\n #TODO : change line below (undefined method `tag' for #<Post:0xb6fa7fc4>)\n #@post.tag((params[:tag_input] ? params[:tag_input].gsub(\"'\", '').gsub(/[^a-zA-Z0-9 ]/, '') : ''), :clear => true)\n if @post.save\n # post was saved successfully\n # do the ping if necessary\n do_ping if params[:ping] == 1\n flash[:notice] = 'Post was created.'\n if Preference.get_setting('RETURN_TO_POST') == 'yes'\n # if they have a pref set as such, return them to the post,\n # rather than the list\n redirect_to Site.full_url + '/admin/posts/edit/' + @post.id.to_s\n else\n redirect_to Site.full_url + '/admin/posts'\n end\n else\n # whoops!\n @tags = Tag.find(:all, :order => 'name asc')\n @authors = Author.find(:all, :order => 'name asc')\n @preview = (@post.body_raw ? @post.body_raw: '') + (@post.extended_raw ? @post.extended_raw : '')\n # remember the update checking if it's there\n @update_checker = session[:update_check_stored] if session[:update_check_stored] != nil\n render :action => 'post_new', :template => 'admin/posts/post_new'\n end\n end",
"title": ""
},
{
"docid": "1e67a3e106367f71ce76c733a2beb8b6",
"score": "0.5200427",
"text": "def update\n @post = Post.find(params[:id])\n @post.member=@current_user\n @post.status = \"\"\n \n# When the page is of \"gallery\" type the text parameter is nil and shall be set to space\n if params[:post_text].nil?\n params[:post_text]= \" \"\n end\n \n respond_to do |format|\n if @post.update_attributes(params[:post]) and \n @post.text_save(params[:post_text][:content])\n flash[:notice] = \"#{@action_success_message}\"\n format.html { redirect_to session[:return_to] }\n # format.html { redirect_to page_document_url(@doc.page,@doc) } \n format.xml { head :ok }\n else\n# In case of error @post will be presented on the screen with all values entered by the user.\n# The content field of the post_text object, however, is not populated, because it is not part of params[:post].\n# Therefore we populate it manually. But first the appropriate post_text object needs to be found.\n @post.text_find_by_language(I18n.locale.to_s).content = params[:post_text][:content]\n format.html { render :action => \"edit\" } \n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5ab6e4f6e2a00ad7665019b25b757977",
"score": "0.51836634",
"text": "def convert_blog_entries\n post_type = PostType.find_by!(slug: 'blog_post')\n\n Entry.order('id asc').each do |item|\n attributes = {\n post_type: post_type,\n created_at: item.created_at,\n updated_at: item.updated_at,\n user: item.user,\n agent: item.agent,\n ip: item.ip,\n deleted: item.deleted?,\n show_owner: item.show_name?,\n view_count: item.view_count,\n publication_time: item.publication_time || item.created_at,\n title: item.title,\n slug: item.slug,\n image_name: item.image_name,\n image_source_name: item.image_author_name,\n image_source_link: item.image_author_link,\n source_name: item.source,\n source_link: item.source_link,\n lead: item.lead,\n body: item.body,\n data: {\n legacy: {\n external_id: item.external_id,\n privacy: item.privacy\n }\n }\n }\n\n unless item.image.blank?\n attributes[:image] = Pathname.new(item.image.path).open\n end\n\n new_item = Post.create!(attributes)\n\n move_comments(item, new_item) if item.comments.any?\n end\n end",
"title": ""
},
{
"docid": "fb9d39c64c288f031112a4b9a8c9a03f",
"score": "0.5181974",
"text": "def maxwidth; end",
"title": ""
},
{
"docid": "26fed63d2239a52c40ef97da983d9328",
"score": "0.51740265",
"text": "def update\n # We should add an editor id here, or a history of editors and contributors\n @post = Post.find(params[:id]) \n respond_to do |format|\n if @post.url_changed? \n @post.thumbnail_url = nil # delete the thumbnail\n end\n\n if @post.update_attributes(params[:post]) \n # After each update, we have to run a series of processes for the post:\n @post.setup # sets up post, and adds delayed jobs (queues delayed job tasks)\n @post.save # here we force a save for the updated attributes called upon by setup\n\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8737a9af9f24db18fac17a77312eb6a3",
"score": "0.51648086",
"text": "def post_update\n # find our post\n @post = Post.find(params[:id])\n # set custom fields to empty string if they're not set\n @post.custom_field_1 = @post.custom_field_1 || ''\n @post.custom_field_2 = @post.custom_field_2 || ''\n @post.custom_field_3 = @post.custom_field_3 || ''\n # assign our tags (clearing old tags)\n #@post.tag((params[:tag_input] ? params[:tag_input].gsub(\"'\", '').gsub(/[^a-zA-Z0-9 ]/, '') : ''), :clear => true)\n if @post.update_attributes(params[:post])\n # post was updated successfully\n flash[:notice] = 'Post was updated.'\n if Preference.get_setting('RETURN_TO_POST') == 'yes'\n # if they have a pref set as such, return them to the post,\n # rather than the list\n redirect_to Site.full_url + '/admin/posts/edit/' + @post.id.to_s\n else\n redirect_to Site.full_url + '/admin/posts'\n end\n else\n # whoops!\n @tags = Tag.find(:all, :order => 'name asc')\n @authors = Author.find(:all, :order => 'name asc')\n @preview = (@post.body_raw ? @post.body_raw: '') + (@post.extended_raw ? @post.extended_raw : '')\n # remember the update checking if it's there\n @update_checker = session[:update_check_stored] if session[:update_check_stored] != nil\n render :action => 'post_edit', :template => 'admin/posts/post_edit'\n end\n end",
"title": ""
},
{
"docid": "7379dab35aea5af40ca3105ff58da31e",
"score": "0.5162777",
"text": "def preview\n # mockup our models for preview.\n @post = Monologue::Post.new(params[:post])\n @post.user_id = monologue_current_user.id\n @revision = @post.posts_revisions.first\n @revision.post = @post\n @revision.published_at = Time.zone.now\n \n # render it exactly as it would display when live.\n render \"/monologue/posts/show\", layout: Monologue.layout || \"/layouts/monologue/application\"\n end",
"title": ""
},
{
"docid": "d35a0fb153ba01dcf5bf6f3ee5e371a3",
"score": "0.51573116",
"text": "def update\n @post = Post.unscoped.find(params[:id])\n @user = @post.user\n\n respond_to do |format|\n if @post.update_attributes(post_params)\n @post.update_poll(params[:poll], params[:choices]) if params[:poll]\n\n format.html { redirect_to user_post_path(@post.user, @post) }\n else\n format.html { ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n home_url \n csrf_meta_tag \n page_title \n if @meta \n @meta.each do |key| \n key[1] \n key[0] \n end \n end \n if @rss_title && @rss_url \n auto_discovery_link_tag(:rss, @rss_url, {:title => @rss_title}) \n end \n stylesheet_link_tag 'community_engine' \n if forum_page? \n unless @feed_icons.blank? \n @feed_icons.each do |feed| \n auto_discovery_link_tag :rss, feed[:url], :title => \"Subscribe to '#{feed[:title]}'\" \n end \n end \n end \n yield :head_css \n \n unless configatron.auth_providers.facebook.key.blank? \n \n end \n link_to configatron.community_name, home_path, :class => 'navbar-brand' \n \n if current_page?(site_clippings_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :clippings.l, site_clippings_path \n \n if params[:controller] == 'events' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :events.l, events_path \n \n if params[:controller] == 'forums' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :forums.l, forums_path \n \n if current_page?(popular_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :popular.l, popular_path \n \n if current_page?(users_path) || (params[:controller] == 'users' && !@user.nil? && @user != current_user) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :people.l, users_path \n \n if @header_tabs.any? \n for tab in @header_tabs \n link_to tab.name, tab.url \n end \n end \n if logged_in? \n if current_user.unread_messages? \n if params[:controller] == 'messages' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n user_messages_path(current_user) \n current_user.unread_message_count \n fa_icon \"envelope inverse\" \n end \n end \n \n \n \n render_jumbotron \n container_title \n \n @page_title = :editing_post.l \n widget :id => 'category_tips' do \n if @post.category \n if !category.nil? && !category.tips.blank? \n category.name \n category.tips \n else \n :we_need_you.l \n :every_person_has_something_to_say.l \n end \n \n else \n if !category.nil? && !category.tips.blank? \n category.name \n category.tips \n else \n :we_need_you.l \n :every_person_has_something_to_say.l \n end \n \n end \n end \n link_to :back.l, manage_user_posts_path(@post.user), :class => 'btn btn-default' \n link_to :show.l, user_post_path(@post.user, @post), :class => 'btn btn-primary' \n link_to :delete.l, user_post_path(@post.user, @post), :method => 'delete', data: { confirm: :are_you_sure.l }, :class => 'btn btn-danger' \n if @post.new_record? \n object = @post \n url = user_posts_path(@user) \n \n else \n object = [@user, @post] \n url = user_post_path(@user, @post) \n \n end \n bootstrap_form_for(object, :url => url, :layout => :horizontal) do |f| \n f.text_field :title, :class => 'col-sm-6' \n f.collection_select(:category_id, Category.all, :id, :name, {}, {}) \n f.text_area :raw_post, :rows => 15, :class => \"rich_text_editor\", :required => false \n f.text_field :tag_list, :autocomplete => \"off\", :label => :tags.l, :help => :optional_keywords_describing_this_post_separated_by_commas.l \n \n f.select :published_as, [[:published.l, 'live'], [:draft.l, 'draft']], :label => :save_post_as.l \n f.form_group :comments_group do \n f.check_box :send_comment_notifications \n end \n f.form_group :submit_group do \n f.primary :save.l \n end \n end \n \n render_widgets \n \n if show_footer_content? \n image_tag 'spinner.gif', :plugin => 'community_engine' \n :loading_recent_content.l \n end \n \n :community_tagline.l \n javascript_include_tag 'community_engine' \n tiny_mce_init_if_needed \n if show_footer_content? \n end \n \n tag_auto_complete_field 'post_tag_list', {:url => { :controller => \"tags\", :action => 'auto_complete_for_tag_name'}, :tokens => [','] } \n\nend\n }\n end\n end\n end",
"title": ""
},
{
"docid": "37e6a2f1856004a56d4c4fb621023b35",
"score": "0.5155662",
"text": "def get_and_set_post_size_dimensions\n\n tempfile = file.queued_for_write[:post_size]\n\n if tempfile\n\n geometry = Paperclip::Geometry.from_file(tempfile)\n\n self.dimensions = \"#{geometry.width.to_i}x#{geometry.height.to_i}\"\n\n end\n\n end",
"title": ""
},
{
"docid": "be37660748024116493f0f39e4047d7a",
"score": "0.5155367",
"text": "def set_values_for_showing\n #If the caption isn't nil or blank, then it must be a video or image\n if @post.caption == nil || @post.caption == \"\"\n @width = @post.image.metadata[:width]\n @height = @post.image.metadata[:height]\n\n #get the aspect ratio of the image for the various cropping rules for showing a post\n @ratio = @width.to_f/@height\n\n #returns image or video, depending on content type\n @type = @post.image.blob.content_type\n\n @postId = @post.id\n #Assigning type \"t\" because the post is not a video or image\n else\n @type = \"t\"\n end\n\n #Need this to generate a form for the votes in showing of post\n @vote = Vote.new\n\n #The displayed score for the post, the actual value is the 'hotness' value associated to a post when voted upon\n @score = @post.votes.upvote.count - @post.votes.downvote.count\n\n puts \"HERE\"\n end",
"title": ""
},
{
"docid": "1f5f8393bd34cb212913bcf453fa1de8",
"score": "0.51532066",
"text": "def post_params\n params.require(:post).permit(:title, :content, :sharewith, :view, :status, :user_id, :thumbnail)\n end",
"title": ""
},
{
"docid": "2450e23562ddaba07fa9e31bd0c6086c",
"score": "0.51485765",
"text": "def show\n\t\t@post = Post.friendly.find(params[:id])\n\t prepare_meta_tags(title: @post.title,\n description: @post.content.truncate(120),\n image: @post.post_image.url(:original),\n og: {\n \t\ttitle: @post.title,\n \t\tdescription: @post.content.truncate(120),\n \t\timage: @post.post_image.url(:original)\n },\n twitter: {\n \t\tdescription: @post.content.truncate(120),\n \t\timage: @post.post_image.url(:original)\n }\n\t\t\t\t)\n\tend",
"title": ""
},
{
"docid": "c66982e9b92187ae09e9fba27b9f91f9",
"score": "0.5145091",
"text": "def preview\n # mockup our models for preview.\n @post = Post::ViewAdapter.new(post_repo.create)\n @post.assign_attributes(params[:post])\n @post.user_id = monologue_current_user.id\n @post.published_at = Time.zone.now\n\n # render it exactly as it would display when live.\n render \"/monologue/posts/show\", layout: Monologue.layout || \"/layouts/monologue/application\"\n end",
"title": ""
},
{
"docid": "47f017042e503332c90b2276cd6eab0b",
"score": "0.51433676",
"text": "def update\n @blog_post = BlogPost.find(params[:id])\n\n ## If blog post has image attached and it is NEW, set 'crops' to true\n ### 'crops' will send admin to the 'crop' page so they can crop the new image\n if !@blog_post.image.nil? && @blog_post.image != params[:blog_post][:image]\n @crops = true\n end\n\n ## Textilize body before parameter update\n params[:blog_post][:body] = RedCloth.new( ActionController::Base.helpers.sanitize( params[:blog_post][:body] ), [:filter_html, :filter_styles, :filter_classes, :filter_ids] ).to_html\n\n if @blog_post.update_attributes(params[:blog_post])\n # if image is old (or non-existant), send to completed blog post page\n if @crops != true\n redirect_to @blog_post\n else # if image is new and should be cropped\n redirect_to \"/blog_posts/#{@blog_post.id}/crop\"\n end\n else\n ## if save was unsuccessful, take out textilization so that <p>s, etc. are not in text box\n @blog_post.body = Nokogiri::HTML.fragment(@blog_post.body).text\n render :action => \"edit\"\n end\n end",
"title": ""
},
{
"docid": "9f7e2a223e572708840099f6719bff3e",
"score": "0.5142077",
"text": "def show\n if params[:post_id]\n @post = current_user.posts.friendly.find(params[:post_id])\n @post.upload\n else\n @post = Post.new\n @post.build_upload\n end\n @suggested_communities = new_suggested_communities.first(2)\n @suggested_connections = new_suggested_connections.first(2)\n @suggested_groups = new_suggested_groups.first(2)\n @posts = @group.posts.order(\"updated_at desc\").paginate(:page => params[:page], :per_page => 5)\n @comment = Comment.new \n end",
"title": ""
},
{
"docid": "1aaa8d916a1d7469777272edf01d7df6",
"score": "0.5125976",
"text": "def post_params\n params.require(:post).permit(:main_title, :main_image_post_url, :main_content, :sub1_image_url, :subtitle_1, :content_1, :sub2_image_url, :subtitle_2, :content_2, :sub3_image_url, :subtitle_3, :content_3, :sub4_image_url, :subtitle_4, :content_4, :sub5_image_url, :subtitle_5, :content_5, :sub6_image_url, :subtitle_6, :content_6, :sub7_image_url, :subtitle_7, :content_7, :sub8_image_url, :subtitle_8, :content_8, :sub9_image_url, :subtitle_9, :content_9, :sub10_image_url, :subtitle_10, :content_10, :author, :category, :user_id)\n end",
"title": ""
},
{
"docid": "798d6fcb5fb66f57ff2893215efead01",
"score": "0.51245886",
"text": "def the_widget(attrs = {}, &block)\n attrs = {qty_truncate: 100, block_right: '', attend_right: true, class: '', photo: false}.merge(attrs)\n photo = ''\n photo = \"<div class='overflow_hidden' style='max-height: 145px; margin-bottom: 10px;'><img style='min-width: 100%; max-width: none;' src='#{object.photo.url}'></div>\" if attrs[:photo]\n link = the_attend_link\n \n \"<form class='#{attrs[:class]} media ujs_block_loading ujs_link_modal cursor_pointer event_media_item' action='#{the_url}' data-remote='true' onclick=\\\"if(!$(window.event.target).is('a')) $(this).submit();\\\" data-modal-title='Event Details'>\n #{photo}\n <div class='media-left text-center nowrap'>\n <div class='text-red'>#{object.start_at.strftime(\"%b\") if object.start_at}</div>\n <div class='num'>#{object.start_at.strftime(\"%d\") if object.start_at}</div>\n </div>\n <div class='media-body'>\n <div class='media-heading'>\n #{object.name}\n </div>\n <div class='small text-gray'>\n #{object.description.truncate(attrs[:qty_truncate])}\n <div class='p_attending'>#{the_attending}</div>\n </div>\n #{block ? h.capture(&block) : ''}\n #{\"<div class='text-center margin_top5'>#{link}</div>\" unless attrs[:attend_right]}\n </div>\n <div class='media-right'>\n #{link if attrs[:attend_right]}\n #{attrs[:block_right]}\n </div>\n </form>\".html_safe\n end",
"title": ""
},
{
"docid": "91868e6da7baaba68ede5b55ca58b497",
"score": "0.51196563",
"text": "def width\n \n end",
"title": ""
},
{
"docid": "97d2daec278179e35ae43110ed28b31f",
"score": "0.51141727",
"text": "def display\n @feed = FeedReader::Base.retrieve(I18n.t('home.views.feed'))\n @link_class = ::Rails.configuration.open_blog_in_popup ? 'in-wide-iframe' : ''\n render if @feed\n end",
"title": ""
},
{
"docid": "2bb2cc7c42c7921a12be8b52394022d9",
"score": "0.511208",
"text": "def content_preview\n \"#{I18n.l(self.created_at.to_date, format: :long)} - #{self.body}\"\n end",
"title": ""
},
{
"docid": "2bb2cc7c42c7921a12be8b52394022d9",
"score": "0.511208",
"text": "def content_preview\n \"#{I18n.l(self.created_at.to_date, format: :long)} - #{self.body}\"\n end",
"title": ""
},
{
"docid": "2bb2cc7c42c7921a12be8b52394022d9",
"score": "0.511208",
"text": "def content_preview\n \"#{I18n.l(self.created_at.to_date, format: :long)} - #{self.body}\"\n end",
"title": ""
},
{
"docid": "aeb3a753509b3a61e7d934c38327a80b",
"score": "0.5109048",
"text": "def post_notification_body(n)\n content_tag(:div, :class => 'row') do\n # left: actor's profile pic\n content_tag(:div, image_tag(n.actor_pic_url, :size => \"50x50\", :title => \"#{n.actor_name} photo\"),\n :class => 'small-2 columns userpic') + \n # center: text of the nofification\n content_tag(:div, :class => \"small-#{n.post_thumbnail_url ? '8' : '10'} columns\") do\n yield \n end +\n # right: eventual post thumbnail \n (content_tag(:div, image_tag(n.post_thumbnail_url, :size => \"50x50\", :title => \"post photo\"), \n :class => 'small-2 columns') if n.post_thumbnail_url)\n end\n end",
"title": ""
},
{
"docid": "ffdab3d02c27f41a1e61c558e61836a0",
"score": "0.5106191",
"text": "def create\n params[:blog][:posted_at] = Time.now\n @blog = Blog.new(params[:blog])\n @blog.user = current_user\n \n respond_to do |format|\n format.html {\n if params[:preview_button] || !@blog.save\n @show_byline = false\n render :action => \"new\"\n else\n flash[:notice] = 'Blog was successfully created.'\n update_twitter_with_new_content(\"New blog post: #{truncate(@blog.title, :length => 100)} #{blog_url(@blog)}\") if params[:post_tweet]\n redirect_to(@blog)\n end\n }\n format.js {\n render :json => {\n :success => params[:blog][:body]\n }\n }\n end\n end",
"title": ""
},
{
"docid": "5d17e52f98027d2525f65afd61bc18fa",
"score": "0.51040494",
"text": "def blog_params\n params.require(:blog).permit(:title, :description, :content, :thumbimg, :mainimg)\n end",
"title": ""
},
{
"docid": "68eca38845ebfaa563bece1b1130aed1",
"score": "0.51017517",
"text": "def standard_edit_cols_mce\n return 60\n end",
"title": ""
},
{
"docid": "e607c5f91ca1775afd2831034867ebc6",
"score": "0.5094847",
"text": "def edit_post_body_content(post, body)\n \t@post = Post.find(post)\n \t@post.body = body\n \t@post.save\n\tend",
"title": ""
},
{
"docid": "919a5aaed87e38498386748271bebdf6",
"score": "0.50896037",
"text": "def content\n self.post_content.content\n end",
"title": ""
},
{
"docid": "50362e7986811167ad0cf0654f59e40e",
"score": "0.50795394",
"text": "def create\n @user = User.find(params[:user_id])\n @post = Post.new(post_params)\n @post.user = @user\n\n respond_to do |format|\n if @post.save\n @post.create_poll(params[:poll], params[:choices]) if params[:poll]\n\n flash[:notice] = @post.category ? :post_created_for_category.l_with_args(:category => @post.category.name.singularize) : :your_post_was_successfully_created.l\n format.html {\n if @post.is_live?\n redirect_to @post.category ? category_path(@post.category) : user_post_path(@user, @post)\n else\n redirect_to manage_user_posts_path(@user)\n end\n }\n format.js\n else\n format.html { ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n home_url \n csrf_meta_tag \n page_title \n if @meta \n @meta.each do |key| \n key[1] \n key[0] \n end \n end \n if @rss_title && @rss_url \n auto_discovery_link_tag(:rss, @rss_url, {:title => @rss_title}) \n end \n stylesheet_link_tag 'community_engine' \n if forum_page? \n unless @feed_icons.blank? \n @feed_icons.each do |feed| \n auto_discovery_link_tag :rss, feed[:url], :title => \"Subscribe to '#{feed[:title]}'\" \n end \n end \n end \n yield :head_css \n \n unless configatron.auth_providers.facebook.key.blank? \n \n end \n link_to configatron.community_name, home_path, :class => 'navbar-brand' \n \n if current_page?(site_clippings_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :clippings.l, site_clippings_path \n \n if params[:controller] == 'events' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :events.l, events_path \n \n if params[:controller] == 'forums' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :forums.l, forums_path \n \n if current_page?(popular_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :popular.l, popular_path \n \n if current_page?(users_path) || (params[:controller] == 'users' && !@user.nil? && @user != current_user) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :people.l, users_path \n \n if @header_tabs.any? \n for tab in @header_tabs \n link_to tab.name, tab.url \n end \n end \n if logged_in? \n if current_user.unread_messages? \n if params[:controller] == 'messages' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n user_messages_path(current_user) \n current_user.unread_message_count \n fa_icon \"envelope inverse\" \n end \n end \n \n \n \n render_jumbotron \n container_title \n \n @page_title = @post.category ? (:new_post_for_category.l :category => @post.category.name) : :new_post.l \n widget :id => 'category_tips' do \n if @post.category \n if !category.nil? && !category.tips.blank? \n category.name \n category.tips \n else \n :we_need_you.l \n :every_person_has_something_to_say.l \n end \n \n else \n if !category.nil? && !category.tips.blank? \n category.name \n category.tips \n else \n :we_need_you.l \n :every_person_has_something_to_say.l \n end \n \n end \n end \n link_to :back.l, manage_user_posts_path(@user), :class => 'btn btn-default' \n if @post.new_record? \n object = @post \n url = user_posts_path(@user) \n \n else \n object = [@user, @post] \n url = user_post_path(@user, @post) \n \n end \n bootstrap_form_for(object, :url => url, :layout => :horizontal) do |f| \n f.text_field :title, :class => 'col-sm-6' \n f.collection_select(:category_id, Category.all, :id, :name, {}, {}) \n f.text_area :raw_post, :rows => 15, :class => \"rich_text_editor\", :required => false \n f.text_field :tag_list, :autocomplete => \"off\", :label => :tags.l, :help => :optional_keywords_describing_this_post_separated_by_commas.l \n \n f.select :published_as, [[:published.l, 'live'], [:draft.l, 'draft']], :label => :save_post_as.l \n f.form_group :comments_group do \n f.check_box :send_comment_notifications \n end \n f.form_group :submit_group do \n f.primary :save.l \n end \n end \n \n render_widgets \n \n if show_footer_content? \n image_tag 'spinner.gif', :plugin => 'community_engine' \n :loading_recent_content.l \n end \n \n :community_tagline.l \n javascript_include_tag 'community_engine' \n tiny_mce_init_if_needed \n if show_footer_content? \n end \n \n tag_auto_complete_field 'post_tag_list', {:url => { :controller => \"tags\", :action => 'auto_complete_for_tag_name'}, :tokens => [','] } \n\nend\n }\n format.js\n end\n end\n end",
"title": ""
},
{
"docid": "6852b152f98b89ee271d1258609770a9",
"score": "0.5076722",
"text": "def content_preview\n self.description\n end",
"title": ""
},
{
"docid": "6852b152f98b89ee271d1258609770a9",
"score": "0.5076722",
"text": "def content_preview\n self.description\n end",
"title": ""
},
{
"docid": "fd155ee56bd15b2ad519672eba901c72",
"score": "0.5069651",
"text": "def update\n @post = @current_user.posts.find(params[:id])\n append = ActionController::Base.helpers.sanitize(params[:append], :attributes => 'abbr alt cite datetime height href name src title width rowspan colspan rel')\n #regex = Regexp.new '((https?:\\/\\/|www\\.)([-\\w\\.]+)+(:\\d+)?(\\/([\\w\\/_\\.]*(\\?\\S+)?)?)?)'\n #append.gsub!(regex, '<a href=\"\\1\" rel=\"nofollow\">\\1</a>')\n if !append.blank?\n params[:post][:body] = \"#{@post.body}<br /><br /><span class='post_edit'>Edit (#{DateTime.now.strftime(\"%x\")}, #{DateTime.now.strftime(\"%l:%M %p\")}): </span><br />#{append}\"\n end\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to([@course, @item, @post], :notice => 'Post was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => 'edit' }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f69236dc44c251f4a01d4d3fd5dff2f9",
"score": "0.50646573",
"text": "def display_control_box\n char_left = 140\n char_text = \"%d character%s left.\"\n\n flow :width => -20, :margin => 10 do\n background gray(0.1), :curve => 10\n\n # Edit-box toggle & refresh links\n image \"media/new_post.png\", :margin => 2 do\n @status_flow.toggle\n end\n image \"media/refresh.png\", :margin => 2 do\n load_tweets 'Refreshing...'\n end\n image \"media/config.png\", :margin => 2 do\n visit '/config'\n end\n\n # Twitter logo\n image \"media/twitter_logo.png\", :left => \"83%\", :margin => 2,\n :click => \"http://twitter.com\"\n\n # Status' edit-box\n @status_flow = flow :width => 1.0, :margin => 8, :hidden => true do\n\n # Edit-box input\n @up_text = edit_box \"What are you doing?\", :width => 1.0, :height => 50 do\n char_left = 140 - @up_text.text.size\n text = char_text % [char_left, (char_left != 1) ? 's' : '']\n @char_count.replace text\n end\n\n stack :width => -20 do\n # Characters left para\n text = char_text % [char_left, (char_left != 1) ? 's' : '']\n @char_count = para text, :stroke => white, :font => \"Verdana\", :size => 8\n end\n\n # Save button\n image \"media/save.png\", :margin => 2 do\n update_status\n end\n end\n end\n end",
"title": ""
},
{
"docid": "ef1d587872dc038c9361d472dbe99e65",
"score": "0.5060038",
"text": "def create\n @content = Content.new(content_params)\n\n if @content.kind == \"twitter\" \n timeline = user_timeline(1)[0]\n\n @content.title = \"Tweet\"\n @content.external_id = timeline.id\n @content.body = timeline.text\n @content.author = timeline.user.screen_name\n\n if timeline.media[0].present?\n @content.image = timeline.media[0][\"media_url\"]\n end\n\n @content.external_link = timeline.url\n if timeline.place.full_name.present?\n @content.location = timeline.place.full_name + \", \" + timeline.place.country_code\n end\n\n elsif @content.kind == \"post\"\n @content.author = current_admin.email\n\n # GEO LOCATION: USE PRECISE LAT LONG IF POSSIBLE, OTHERWISE USE IP CONVERSION\n if cookies[:lat_lng] != nil\n @lat_lng = cookies[:lat_lng].split(\"|\")\n @content.latitude = @lat_lng[0]\n @content.longitude = @lat_lng[1]\n else \n @content.ip = request.remote_ip\n end\n else \n if cookies[:lat_lng] != nil\n @lat_lng = cookies[:lat_lng].split(\"|\")\n @content.latitude = @lat_lng[0]\n @content.longitude = @lat_lng[1]\n else \n @content.ip = request.remote_ip\n end\n end\n\n # SET DATE TIME TO NOW\n @content.created = DateTime.now;\n @content.updated = DateTime.now;\n\n # FOR NOW ALWAYS SET TO TRUE\n @content.has_comments = true;\n @content.is_active = true;\n\n respond_to do |format|\n if @content.save\n format.html { redirect_to @content, notice: 'Content was successfully created.' }\n format.json { render :show, status: :created, location: @content }\n else\n format.html { render :new }\n format.json { render json: @content.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1e3a868f2c889f6e8af1e78f30d1e26e",
"score": "0.5056911",
"text": "def show\n @post.post = @post.post.bbcode_to_html_with_formatting(@imagetag)\n end",
"title": ""
},
{
"docid": "3dbe75eeb53ed98616a05e08e048cd14",
"score": "0.50476664",
"text": "def attachment_markup\n if self.has_image?\n %Q( <div class=\"img_attachment\"><a href=\"#{self.attachment.url}\" style=\"display:block;height:#{self.attachment_height+40}px;width:#{self.attachment_width+40}px;\"><img src=\"#{self.attachment.url(:big)}\" alt=\"#{self.message}\" height=\"#{self.attachment_height}\" width=\"#{self.attachment_width}\" /></a></div> )\n elsif self.has_file?\n %Q( <div class=\"file_attachment\"><a href=\"#{self.attachment.url}\" style=\"display:block;height:100px;\"><img src=\"/images/icons/#{self.attachment_type}_large.jpg\" alt=\"#{self.attachment_type}\" height=\"100\" /></a></div> )\n end\n end",
"title": ""
},
{
"docid": "08f212361d02e69173984fefedc7d83b",
"score": "0.50474024",
"text": "def update\n @post = @current_user.posts.find(params[:id])\n append = ActionController::Base.helpers.sanitize(params[:append], :attributes => Post.html_attributes.sub('class ', ''))\n unless append.blank?\n new_body = \"#{@post.body}<br /><br /><span class='post_edit'>Edit (#{DateTime.now.strftime(\"%x\")}, #{DateTime.now.strftime(\"%l:%M %p\")}): </span><br />#{append}\"\n end\n respond_to do |format|\n if @post.update_attributes(:body => new_body)\n @post.add_tags(params[:tags])\n format.html { redirect_to(course_item_post_path(@post.params), :notice => 'Post was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => 'edit' }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f4425bd978e16b2c571941681380ed68",
"score": "0.50426227",
"text": "def update\n \n # When you draft your board and you want to publish that draft you edit and publish it here. So the form is updated or edited here using metainspector again with the update function\n if @form.update(form_params) \n\n @form.slug = generate_slug(@form)\n @form.secure_id = generate_secure_id(@form)\n @form.update_attributes(slug:@form.slug, secure_id:@form.secure_id)\n\n meta = MetaInspector.new(@form.url1, :allow_non_html_content => true) rescue nil #meta is variable where you input the url in the form and stores it. MetaInspector is a predefined class taken from metainspector gem which fetches all the url information\n if @form.url1.empty?\n @form.update_attributes(content:\"\", title1:\"\", image1:\"\", description1:\"\") rescue nil\n else\n @form.update_attributes(content:meta.content_type, title1:meta.title, image1:meta.images.best, description1:meta.description) rescue nil\n if @form.content == \"application/pdf\" \n @form.update_attributes(title1:\"#{@form.content}\")\n end\n end\n\n\n meta1 = MetaInspector.new(@form.url2, :allow_non_html_content => true) rescue nil\n if @form.url2.empty?\n @form.update_attributes(content2:\"\", title2:\"\", image2:\"\", description2:\"\") rescue nil\n else\n @form.update_attributes(content2:meta1.content_type, title2:meta1.title, image2:meta1.images.best, description2:meta1.description) rescue nil\n if @form.content2 == \"application/pdf\" \n @form.update_attributes(title2:\"#{@form.content2}\")\n end\n end \n\n meta2 = MetaInspector.new(@form.url3, :allow_non_html_content => true) rescue nil\n if @form.url3.empty?\n @form.update_attributes(content3:\"\", title3:\"\", image3:\"\", description3:\"\") rescue nil\n else\n @form.update_attributes(content3:meta2.content_type, title3:meta2.title, image3:meta2.images.best, description3:meta2.description) rescue nil\n if @form.content3 == \"application/pdf\" \n @form.update_attributes(title3:\"#{@form.content3}\")\n end\n end\n \n meta3 = MetaInspector.new(@form.url4, :allow_non_html_content => true) rescue nil\n if @form.url4.empty?\n @form.update_attributes(content4:\"\", titel4:\"\", image4:\"\", description4:\"\") rescue nil\n else\n @form.update_attributes(content4:meta3.content_type, titel4:meta3.title, image4:meta3.images.best, description4:meta3.description) rescue nil\n if @form.content4 == \"application/pdf\" \n @form.update_attributes(titel4:\"#{@form.content4}\")\n end\n end\n\n meta4 = MetaInspector.new(@form.url5, :allow_non_html_content => true) rescue nil\n if @form.url5.empty?\n @form.update_attributes(content5:\"\", title5:\"\", image5:\"\", description5:\"\") rescue nil\n else\n @form.update_attributes(content5:meta4.content_type, title5:meta4.title, image5:meta4.images.best, description5:meta4.description) rescue nil\n if @form.content5 == \"application/pdf\" \n @form.update_attributes(title5:\"#{@form.content5}\")\n end\n end\n\n # @form.update(readtime:meta.meta_tags + meta1.meta_tags + meta2.meta_tags + meta3.meta_tags + meta4.meta_tags) rescue nil \n tags = @form.tag1.to_s.tr('[\"\"]', '').split(',').map(&:to_s) + @form.tag2.to_s.tr('[\"\"]', '').split(',').map(&:to_s) + @form.tag3.to_s.tr('[\"\"]', '').split(',').map(&:to_s) + @form.tag4.to_s.tr('[\"\"]', '').split(',').map(&:to_s) + @form.tag5.to_s.tr('[\"\"]', '').split(',').map(&:to_s) \n @form.update(tag_list: tags.join(',') )\n\n if params[:unspecified]\n @form.update_attributes(unspecified:true)\n elsif params[:easy] \n @form.update_attributes(easy:true)\n elsif params[:involved] \n @form.update_attributes(involved:true)\n elsif params[:advanced] \n @form.update_attributes(advanced:true) \n else\n end\n\n @form.save_social_image # Save social image\n\n if params[:commit] == 'Publish'\n @form.update(:publish => \"true\")\n redirect_to \"/#{current_user.username}/published\" \n\n else params[:commit] == 'Save as Draft'\n @form.update(:publish => \"false\")\n redirect_to \"/#{current_user.username}/drafts\"\n end\n\n else #if this gives an error it will go back to edit page\n\n respond_to do |format|\n format.html { render :edit }\n format.json { render json: @form.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "eda30d50ae73f0a120e4248c24a5424b",
"score": "0.50394446",
"text": "def media_views_settings\n # rubocop:disable Metrics/BlockLength\n unescaped_json do\n {\n 'tabs': [],\n 'tabUrl': '',\n 'mimeTypes': {\n 'image': 'Images'\n },\n 'captions': true,\n 'nonce': {\n 'sendToEditor': 'wp_generated_code' # WP auto generated code\n },\n 'post': {\n 'id': 0, # WP auto generated code\n 'nonce': '', # WP auto generated code\n 'featuredImageId': -1\n },\n 'defaultProps': {\n 'link': 'none',\n 'align': '',\n 'size': ''\n },\n 'attachmentCounts': {\n 'audio': 1,\n 'video': 1\n },\n 'oEmbedProxyUrl': '',\n 'embedExts': %w[mp3 ogg m4a wav mp4 m4v webm ogv flv],\n 'embedMimes': {\n 'mp3': 'audio\\/mpeg',\n 'ogg': 'audio\\/ogg',\n 'm4a': 'audio\\/mpeg',\n 'wav': 'audio\\/wav',\n 'mp4': 'video\\/mp4',\n 'm4v': 'video\\/mp4',\n 'webm': 'video\\/webm',\n 'ogv': 'video\\/ogg',\n 'flv': 'video\\/x-flv'\n },\n 'contentWidth': 525,\n 'months': [],\n 'mediaTrash': 0\n }\n end\n # rubocop:enable Metrics/BlockLength\n end",
"title": ""
},
{
"docid": "9d53cff096d880ee9f85f7b970ce3633",
"score": "0.50373375",
"text": "def update\n @photo = Photo.find(params[:id])\n @user = @photo.user\n @photo.tag_list = params[:tag_list] || ''\n @photo.album_id = photo_params[:album_id]\n\n respond_to do |format|\n if @photo.update_attributes(photo_params)\n format.html { redirect_to user_photo_url(@photo.user, @photo) }\n else\n format.html { ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n home_url \n csrf_meta_tag \n page_title \n if @meta \n @meta.each do |key| \n key[1] \n key[0] \n end \n end \n if @rss_title && @rss_url \n auto_discovery_link_tag(:rss, @rss_url, {:title => @rss_title}) \n end \n stylesheet_link_tag 'community_engine' \n if forum_page? \n unless @feed_icons.blank? \n @feed_icons.each do |feed| \n auto_discovery_link_tag :rss, feed[:url], :title => \"Subscribe to '#{feed[:title]}'\" \n end \n end \n end \n yield :head_css \n \n unless configatron.auth_providers.facebook.key.blank? \n \n end \n link_to configatron.community_name, home_path, :class => 'navbar-brand' \n \n if current_page?(site_clippings_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :clippings.l, site_clippings_path \n \n if params[:controller] == 'events' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :events.l, events_path \n \n if params[:controller] == 'forums' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :forums.l, forums_path \n \n if current_page?(popular_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :popular.l, popular_path \n \n if current_page?(users_path) || (params[:controller] == 'users' && !@user.nil? && @user != current_user) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :people.l, users_path \n \n if @header_tabs.any? \n for tab in @header_tabs \n link_to tab.name, tab.url \n end \n end \n if logged_in? \n if current_user.unread_messages? \n if params[:controller] == 'messages' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n user_messages_path(current_user) \n current_user.unread_message_count \n fa_icon \"envelope inverse\" \n end \n end \n \n \n \n render_jumbotron \n container_title \n \n @page_title= :editing_photo.l \n widget do \n :help.l \n :tags_are_keywords_you_use_to_organize_your_photos.l \n end \n link_to :back.l, user_photos_path(@user), :class => 'btn btn-default' \n link_to :show.l, user_photo_path(@user, @photo), :class => 'btn btn-primary' \n link_to :delete.l, user_photo_path(@user, @photo), :method => :delete, data: { confirm: :are_you_sure_you_want_to_delete_this_photo.l }, :class => 'btn btn-danger' \n if @photo.new_record? \n object = @photo \n url = user_photos_path \n else \n object = [@user, @photo] \n url = user_photo_path(@user, @photo) \n end \n bootstrap_form_for object, :url => url, :layout => :horizontal do |f| \n if @photo.photo_file_name.blank? \n f.file_field :photo \n :megabyte_upload_limit.l(:count => configatron.photo.validation_options.max_size) \n else \n image_tag( @photo.photo.url(:large), :id => 'photo', :class => 'thumbnail' ) \n end \n f.text_field :tag_list, :autocomplete => \"off\", :label => :tags.l, :help => :optional_keywords_describing_this_photo_separated_by_commas.l \n \n f.text_field :name \n f.text_area :description, :rows => 5 \n unless params[:album_id] || current_user.albums.empty? \n f.select(:album_id, current_user.albums.collect {|album| [album.title, album.id ] }, { :include_blank => true }) \n end \n f.form_group :submit_group do \n f.primary :save.l \n end \n end \n \n render_widgets \n \n if show_footer_content? \n image_tag 'spinner.gif', :plugin => 'community_engine' \n :loading_recent_content.l \n end \n \n :community_tagline.l \n javascript_include_tag 'community_engine' \n tiny_mce_init_if_needed \n if show_footer_content? \n end \n \n tag_auto_complete_field 'photo_tag_list', {:url => { :controller => \"tags\", :action => 'auto_complete_for_tag_name'}, :tokens => [','] } \n\nend\n }\n end\n end\n end",
"title": ""
},
{
"docid": "379caae1774f4338725467e723e74f13",
"score": "0.50321066",
"text": "def html_content_edit\n page_path = params[:page_path]\n area = params[:area] \n version = params[:version] || 1\n \t@editor_width=params[:editor_width]\n @editor_height=params[:editor_height]\n @obj_content = HtmlContent.get_by_page_path_and_area(page_path, area, content_language, version) \n\n if @obj_content.nil? && version != 1\n redirect_to :action=>'html_content_edit', :page_path=>page_path, :area=>area, :version=>1\n else \n render :layout=>false\n end \n end",
"title": ""
},
{
"docid": "bdd0f978def08e23ed0a85c17ae9b1e0",
"score": "0.50300395",
"text": "def min_width\n end",
"title": ""
},
{
"docid": "fc4e29b03e97ce55ba9247d32d59dffe",
"score": "0.50295776",
"text": "def markup_editor_area(name, method, options ={}, html_options ={})\n pl_caption = options.delete(:caption)\n pl_caption ||= \"Preview #{method}\"\n\n preview_dom_id = \"#{name}_#{method}_preview\"\n preview_target = \"#{name}_#{method}_preview_target\"\n\n pl_options = {}\n pl_options[:url] = {:controller => '/markup', :action => \"preview_content\", :object => name, :control => method}\n pl_options[:with] = \"Form.serializeElements([$('#{name}_#{method}')])\"\n pl_options[:complete] = \"Element.show('#{name}_#{method}_preview'); \"\n pl_options[:update] = preview_target\n pl_options.merge!(options)\n\n editor_opts = {:class => 'markup-editor'}.merge(html_options)\n #links\n markup_link = link_to('Textile Markup reference', \"#{ActionController::Base.asset_host}/textile_reference.html\",\n :popup => ['Textile markup reference',\n 'height=400,width=520,location=0,status=0,menubar=0,resizable=1,scrollbars=1'])\n preview_link = link_to_remote(pl_caption, pl_options)\n\n links = content_tag('div', markup_link + ' | ' + preview_link, {:class => 'markup-area-link'})\n #preview cntainer\n preview_close_link = link_to_function('Close preview', \" Effect.toggle( $('#{preview_dom_id}'),'blind')\")\n preview_target = content_tag('div', ' ', :id => \"#{preview_dom_id}_target\", :class => 'markup-preview')\n preview = content_tag('div', preview_target << \"<div id='preview_link'>#{preview_close_link}</div>\", :id => \"#{preview_dom_id}\", :style => 'display: none;')\n #render all\n content_tag('div', text_area(name, method, editor_opts) << links << preview , :id => \"#{name}_#{method}_editor\")\n end",
"title": ""
},
{
"docid": "3d58a34cf87c9d6b3383999734c42a3e",
"score": "0.50265986",
"text": "def format_post(post)\n # Look at \"post-info.png\" for details on what's in the post array\n title = post['title']\n score = post['score']\n author = post['author']\n url = post['url']\n # preview = post['preview']['images'][0]['source']['url']\n \"`#{CGI.unescapeHTML(title)}`, Score: `#{score}`, By `u/#{author}`, @ #{url}\"\nend",
"title": ""
},
{
"docid": "43ece825474005c0bdbbcdad3491f8d2",
"score": "0.50259227",
"text": "def editorial_markup\r\n\t\r\n\tend",
"title": ""
},
{
"docid": "50b0b0f2ad5ce1c3bed054c89c0505b4",
"score": "0.50246245",
"text": "def show\n @post = Post.find(params[:id])\n\n @is_admin = current_admin_user\n\n if params[:content] != nil && @is_admin != nil\n mercury_post = @post\n mercury_post.title = params[:content][:post_title][:value]\n mercury_post.content = params[:content][:post_content][:value]\n mercury_post.sub_title = params[:content][:post_sub_title][:value] if params[:content][:post_sub_title] != nil\n \n if params[:content][:post_publish][:value] != nil\n publish = params[:content][:post_publish][:value].chomp\n if publish.downcase == \"true\" \n mercury_post.publish = true\n else\n mercury_post.publish = false\n end\n end \n mercury_post.save!\n render text: \"\"\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end\n end",
"title": ""
},
{
"docid": "e07ff0d7a8456b8216ed7723f6f2deda",
"score": "0.50231797",
"text": "def user_post_size(user)\n pluralize(number_with_delimiter(user.posts.size), 'post')\n end",
"title": ""
},
{
"docid": "4498508bf483f44a871bfceae700c1aa",
"score": "0.50198025",
"text": "def edit\n return render_403 unless editable?\n if @page.new_record?\n if params[:parent].present?\n @page.parent = @page.wiki.find_page(params[:parent].to_s)\n end\n end\n\n @content = @page.content_for_version(params[:version])\n @content ||= WikiContent.new(:page => @page)\n @content.text = initial_page_content(@page) if @content.text.blank?\n # don't keep previous comment\n @content.comments = nil\n\n # To prevent StaleObjectError exception when reverting to a previous version\n @content.version = @page.content.version if @page.content\n\n @text = @content.text\n if params[:section].present? && Redmine::WikiFormatting.supports_section_edit?\n @section = params[:section].to_i\n @text, @section_hash = Redmine::WikiFormatting.formatter.new(@text).get_section(@section)\n render_404 if @text.blank?\n end\n \n current_language \n html_title \n Redmine::Info.app_name \n csrf_meta_tag \n favicon \n stylesheet_link_tag 'jquery/jquery-ui-1.11.0', 'application', 'responsive', :media => 'all' \n stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' \n javascript_heads \n heads_for_theme \n call_hook :view_layouts_base_html_head \n yield :header_tags \n body_css_classes \n call_hook :view_layouts_base_body_top \n if User.current.logged? || !Setting.login_required? \n form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do \n hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope \n label_tag 'flyout-search', '⚲'.html_safe, :class => 'search-magnifier search-magnifier--flyout' \n text_field_tag 'q', @question, :id => 'flyout-search', :class => 'small js-search-input', :placeholder => l(:label_search) \n end \n end \n if User.current.logged? \n if !Setting.gravatar_enabled? \n end \n if Setting.gravatar_enabled? \n link_to(avatar(User.current, :size => \"80\"), user_path(User.current)) \n end \n link_to_user(User.current, :format => :username) \n end \n if display_main_menu?(@project) \n l(:label_project) \n end \n l(:label_general) \n l(:label_profile) \n render_menu :account_menu \n content_tag('div', \"#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}\".html_safe, :id => 'loggedas') if User.current.logged? \n render_menu :top_menu if User.current.logged? || !Setting.login_required? \n if User.current.logged? || !Setting.login_required? \n form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do \n hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope \n link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project}, :accesskey => accesskey(:search) \n text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) \n end \n render_project_jump_box \n end \n page_header_title \n if display_main_menu?(@project) \n render_main_menu(@project) \n end \n sidebar_content? ? '' : 'nosidebar' \n yield :sidebar \n view_layouts_base_sidebar_hook_response \n render_flash_messages \n yield \n call_hook :view_layouts_base_content \n l(:label_loading) \n link_to Redmine::Info.app_name, Redmine::Info.url \n call_hook :view_layouts_base_body_bottom \n\n wiki_page_breadcrumb(@page) \n @page.pretty_title \n form_for @content, :as => :content,\n :url => {:action => 'update', :id => @page.title},\n :html => {:method => :put, :multipart => true, :id => 'wiki_form'} do |f| \n f.hidden_field :version \n if @section \n hidden_field_tag 'section', @section \n hidden_field_tag 'section_hash', @section_hash \n end \n error_messages_for 'content' \n text_area_tag 'content[text]', @text, :cols => 100, :rows => 25,\n :class => 'wiki-edit', :accesskey => accesskey(:edit) \n if @page.safe_attribute_names.include?('parent_id') && @wiki.pages.any? \n fields_for @page do |fp| \n l(:field_parent_title) \n fp.select :parent_id,\n content_tag('option', '', :value => '') +\n wiki_page_options_for_select(\n @wiki.pages.includes(:parent).to_a -\n @page.self_and_descendants, @page.parent) \n end \n end \n l(:field_comments) \n f.text_field :comments, :size => 120, :maxlength => 1024 \nl(:label_attachment_plural)\n render :partial => 'attachments/form' \n submit_tag l(:button_save) \n preview_link({:controller => 'wiki', :action => 'preview', :project_id => @project, :id => @page.title }, 'wiki_form') \n link_to l(:button_cancel), wiki_page_edit_cancel_path(@page) \n wikitoolbar_for 'content_text' \n end \n content_for :header_tags do \n robot_exclusion_tag \n end \n html_title @page.pretty_title \n\n if defined?(container) && container && container.saved_attachments \n container.saved_attachments.each_with_index do |attachment, i| \n i \n text_field_tag(\"attachments[p#{i}][filename]\", attachment.filename, :class => 'filename') +\n text_field_tag(\"attachments[p#{i}][description]\", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description') +\n link_to(' '.html_safe, attachment_path(attachment, :attachment_id => \"p#{i}\", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') \n hidden_field_tag \"attachments[p#{i}][token]\", \"#{attachment.token}\" \n end \n end \n file_field_tag 'attachments[dummy][file]',\n :id => nil,\n :class => 'file_selector',\n :multiple => true,\n :onchange => 'addInputFiles(this);',\n :data => {\n :max_file_size => Setting.attachment_max_size.to_i.kilobytes,\n :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),\n :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,\n :upload_path => uploads_path(:format => 'js'),\n :description_placeholder => l(:label_optional_description)\n } \n l(:label_max_size) \n number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) \n content_for :header_tags do \n javascript_include_tag 'attachments' \n end \n\nend",
"title": ""
},
{
"docid": "baebe5e42833fa08cc616840bd8590b8",
"score": "0.50198007",
"text": "def blog_entry_params\n params.require(:blog_entry).permit(:title, :image_url, :content)\n end",
"title": ""
},
{
"docid": "4fb497098ed049dbf474f97d1922f567",
"score": "0.5016362",
"text": "def content_preview\n if description.present?\n description\n elsif headline.present?\n headline\n else\n name\n end\n end",
"title": ""
},
{
"docid": "3aa9f1efca488b84834c640a96f932fd",
"score": "0.5016285",
"text": "def show\n @comment = Comment.new\n @avatar = @layout.user.image+'?type=large'\n prepare_meta_tags(title: @layout.name,\n description: @layout.description,\n keywords: @layout.heading,\n image: @avatar,\n twitter: {card: \"summary_large_image\"})\n end",
"title": ""
},
{
"docid": "87d332716f75abfbe07f688e30cf4b47",
"score": "0.50156385",
"text": "def update\n @weblog_post.attributes = params[:weblog_post]\n\n respond_to do |format|\n if @commit_type == 'preview' && @weblog_post.valid?\n format.html do\n find_images_and_attachments\n find_content\n render template: 'admin/shared/update_preview', locals: { record: @weblog_post }, layout: 'admin/admin_preview'\n end\n format.xml { render xml: @weblog_post, status: :created, location: @weblog_post }\n elsif @commit_type == 'save' && @weblog_post.save(user: current_user)\n format.html do\n @refresh = true\n render 'admin/shared/update'\n end\n format.xml { head :ok }\n else\n format.html { render template: 'admin/shared/edit', locals: { record: @weblog_post }, status: :unprocessable_entity }\n format.xml { render xml: @weblog_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9a986f9e5562b40698f842f96a3427df",
"score": "0.5014634",
"text": "def preview\n \n @content = acquire_content_object\n \n render :layout => 'preview'\n \n end",
"title": ""
},
{
"docid": "b5a87b4e59d95b69ce8f08d1f4b49fbb",
"score": "0.5012617",
"text": "def show\n @post = Post.unscoped.find(params[:id])\n redirect_to user_posts_path(@user), :alert => :post_not_published_yet.l and return false unless @post.is_live? || @post.user.eql?(current_user) || admin? || moderator?\n\n @rss_title = \"#{configatron.community_name}: #{@user.login}'s posts\"\n @rss_url = user_posts_path(@user,:format => :rss)\n\n @user = @post.user\n @is_current_user = @user.eql?(current_user)\n @comment = Comment.new\n\n @comments = @post.comments.includes(:user).order('created_at DESC').limit(20).to_a\n\n @previous = @post.previous_post\n @next = @post.next_post\n @popular_posts = @user.posts.except(:order).order('view_count DESC').limit(10).to_a\n @related = Post.find_related_to(@post)\n @most_commented = Post.find_most_commented\nruby_code_from_view.ruby_code_from_view do |rb_from_view|\n home_url \n csrf_meta_tag \n page_title \n if @meta \n @meta.each do |key| \n key[1] \n key[0] \n end \n end \n if @rss_title && @rss_url \n auto_discovery_link_tag(:rss, @rss_url, {:title => @rss_title}) \n end \n stylesheet_link_tag 'community_engine' \n if forum_page? \n unless @feed_icons.blank? \n @feed_icons.each do |feed| \n auto_discovery_link_tag :rss, feed[:url], :title => \"Subscribe to '#{feed[:title]}'\" \n end \n end \n end \n yield :head_css \n \n unless configatron.auth_providers.facebook.key.blank? \n \n end \n link_to configatron.community_name, home_path, :class => 'navbar-brand' \n \n if current_page?(site_clippings_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :clippings.l, site_clippings_path \n \n if params[:controller] == 'events' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :events.l, events_path \n \n if params[:controller] == 'forums' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :forums.l, forums_path \n \n if current_page?(popular_path) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :popular.l, popular_path \n \n if current_page?(users_path) || (params[:controller] == 'users' && !@user.nil? && @user != current_user) \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n link_to :people.l, users_path \n \n if @header_tabs.any? \n for tab in @header_tabs \n link_to tab.name, tab.url \n end \n end \n if logged_in? \n if current_user.unread_messages? \n if params[:controller] == 'messages' \n css_class = 'active' \n else \n css_class = 'inactive' \n end \n css_class \n user_messages_path(current_user) \n current_user.unread_message_count \n fa_icon \"envelope inverse\" \n end \n end \n \n \n \n render_jumbotron \n container_title \n \n @section = (@post.category && @post.category.name) \n @meta = { :title => \"#{@post.title}\", :description => \"#{truncate_words(@post.post, 75, '...' )}\", :keywords => \"#{@post.tags.join(\", \") unless @post.tags.nil?}\", :robots => configatron.robots_meta_show_content } \n widget do \n :author.l \n link_to tag(:img, :src => user.avatar_photo_url(:medium), \"alt\"=>\"#{user.login}\", :class => \"img-responsive\"), user_path(user), :title => \"#{user.login}'s\"+ :profile.l \n link_to user.login, user_path(user), :class => 'url' \n if user.featured_writer? \n :featured_writer.l \n end \n if user.description \n truncate_words( user.description, 12, '...') \n end \n :member_since.l+\" #{I18n.l(user.created_at, :format => :short_published_date)}\" \n if user.posts.count == 1 \n link_to :singular_posts.l(:count => user.posts.count), user_posts_path(user) \n else \n link_to :plural_posts.l(:count => user.posts.count), user_posts_path(user) \n end \n link_to fa_icon('rss', :text => :rss_feed.l), user_posts_path(user, :format => :rss) \n end \n \n unless @related.empty? \n widget do \n :related_posts.l \n @related.each do |post| \n link_to truncate(post.title, :length => 75), user_post_path(post.user, post) \n end \n end \n end \n unless @popular_posts.empty? \n widget do \n :popular_posts.l \n @popular_posts.each do |post| \n link_to truncate(post.title, :length => 75), user_post_path(post.user, post) \n end \n end \n end \n :users_blog.l :user=> @user.login \n user_post_path(@user, @post) \n fa_icon \"calendar fw\" \n @post.published_at \n @post.published_at_display(:literal_date) \n fa_icon \"eye fw\", :text => :view_count.l \n @post.view_count \n user_post_path(@user, @post) \n fa_icon \"comment fw\", :text => :comments.l \n @post.comments.count \n if current_user and current_user.can_request_friendship_with(@post.user) \n add_friend_link(@post.user) \n end \n :print_this_story.l \n fa_icon \"print fw\", :text => :print.l \n :email_this_story_to_friends.l \n fa_icon \"envelope fw\", :text => :email_to_friends.l \n sharethis_options(@post) \n if @is_current_user || admin? || moderator? \n edit_user_post_path(@post.user, @post) \n fa_icon \"pencil-square-o fw\", :text => :edit.l \n link_to fa_icon(\"trash-o fw\", :text => :delete.l), user_post_path(@post.user, @post), {:method => :delete, data: { confirm: :permanently_delete_this_post.l }, :class => \"list-group-item\"} \n end \n @post.post.html_safe \n has_voted = logged_in? && poll.voted?(current_user) \n poll.question \n :total_votes.l \n poll.votes.size \n poll.choices.each do |choice| \n if @is_current_user || has_voted \n choice.votes_percentage \n choice.votes_percentage \n else \n if logged_in? && !has_voted \n link_to :vote.l, votes_path(:choice_id => choice), :method => :post, :class => 'act-via-ajax' \n elsif !logged_in? \n link_to :vote.l, new_vote_path(:post_id => poll.post.id), {:title => :log_in_to_vote.l, :class => 'vote'} \n end \n end \n choice.description \n end \n if !has_voted \n :you_must_vote_to_see_the_results.l \n elsif logged_in? \n :you_have_already_voted.l \n end \n \n unless @post.tags.empty? \n @post.tags.each do |t| \n tag_url(t) \n fa_icon \"tag inverse\", :text => t.name \n end \n end \n :post_comments.l \n :add_your_comment.l \n if logged_in? || configatron.allow_anonymous_commenting \n bootstrap_form_for(:comment, :url => commentable_comments_path(commentable.class.to_s.tableize, commentable), :remote => true, :layout => :horizontal, :html => {:id => 'comment'}) do |f| \n f.text_area :comment, :rows => 5, :style => 'width: 99%', :class => \"rich_text_editor\", :help => :comment_character_limit.l \n if !logged_in? && configatron.recaptcha_pub_key && configatron.recaptcha_priv_key \n f.text_field :author_name \n f.text_field :author_email, :required => true \n f.form_group do \n f.check_box :notify_by_email, :label => :notify_me_of_follow_ups_via_email.l \n if commentable.respond_to?(:send_comment_notifications?) && !commentable.send_comment_notifications? \n :comment_notifications_off.l \n end \n end \n f.text_field :author_url, :label => :comment_web_site_label.l \n f.form_group do \n recaptcha_tags :ajax => true \n end \n end \n f.form_group :submit_group do \n f.primary :add_comment.l, data: { disable_with: \"Please wait...\" } \n end \n end \n else \n link_to :log_in_to_leave_a_comment.l, new_commentable_comment_path(commentable.class, commentable.id), :class => 'btn btn-primary' \n link_to :create_an_account.l, signup_path, :class => 'btn btn-primary' \n end \n \n comment.id \n if comment.pending? \n end \n if comment.user \n link_to image_tag(comment.user.avatar_photo_url(:medium), :alt => comment.user.login, :class => \"img-responsive\"), user_path(comment.user), :rel => 'bookmark', :title => :users_profile.l(:user => comment.user.login), :class => 'list-group-item' \n user_path(comment.user) \n fa_icon \"hand-o-right fw\", :text => comment.user.login \n commentable_url(comment) \n fa_icon \"calendar\" \n comment.created_at \n I18n.l(comment.created_at, :format => :short_literal_date) \n if logged_in? && (current_user.admin? || current_user.moderator?) \n link_to fa_icon(\"pencil-square-o fw\", :text => :edit.l), edit_commentable_comment_path(comment.commentable_type, comment.commentable_id, comment), :class => 'edit-via-ajax list-group-item' \n end \n if ( comment.can_be_deleted_by(current_user) ) \n link_to fa_icon(\"trash-o fw\", :text => :delete.l), commentable_comment_path(comment.commentable_type, comment.commentable_id, comment), :method => :delete, 'data-confirm' => :are_you_sure_you_want_to_permanently_delete_this_comment.l, :remote => true, :class => \"list-group-item\" \n end \n comment.comment.html_safe \n else \n image_tag(configatron.photo.missing_thumb, :height => '50', :width => '50', :class => \"img-responsive\") \n if comment.author_url.blank? \n h comment.username \n else \n link_to fa_icon('hand-o-right', :text => h(comment.username)), h(comment.author_url) \n end \n commentable_url(comment) \n fa_icon \"calendar fw\" \n comment.created_at \n I18n.l(comment.created_at, :format => :short_literal_date) \n if logged_in? && (current_user.admin? || current_user.moderator?) \n link_to fa_icon(\"pencil-square-o fw\", :text => :edit.l), edit_commentable_comment_path(comment.commentable_type, comment.commentable_id, comment), :class => 'edit-via-ajax list-group-item' \n end \n if ( comment.can_be_deleted_by(current_user) ) \n link_to fa_icon(\"trash-o fw\", :text => :delete.l), commentable_comment_path(comment.commentable_type, comment.commentable_id, comment), :method => :delete, 'data-confirm' => :are_you_sure_you_want_to_permanently_delete_this_comment.l, :remote => true, :class => \"list-group-item\" \n end \n comment.comment.html_safe \n end \n \n more_comments_links(@post) \n \n render_widgets \n \n if show_footer_content? \n image_tag 'spinner.gif', :plugin => 'community_engine' \n :loading_recent_content.l \n end \n \n :community_tagline.l \n javascript_include_tag 'community_engine' \n tiny_mce_init_if_needed \n if show_footer_content? \n end \n \n \n\nend\n\n end",
"title": ""
},
{
"docid": "1bc6bc81e3c110905a87e2e8c92df674",
"score": "0.5012432",
"text": "def show\n @suggested_communities = new_suggested_communities.first(2)\n @suggested_connections = new_suggested_connections.first(2)\n @suggested_groups = new_suggested_groups.first(2)\n if params[:post_id]\n @post = current_user.posts.friendly.find(params[:post_id])\n @post.upload\n else\n @post = Post.new\n @post.build_upload\n end\n @posts = @community.posts.order(\"updated_at desc\").paginate(:page => params[:page], :per_page => 5)\n @comment = Comment.new \n end",
"title": ""
},
{
"docid": "50a3d580ae799e899a11a7f6f61fcc88",
"score": "0.5009644",
"text": "def content_preview\n self.body\n end",
"title": ""
},
{
"docid": "50a3d580ae799e899a11a7f6f61fcc88",
"score": "0.5009644",
"text": "def content_preview\n self.body\n end",
"title": ""
},
{
"docid": "50a3d580ae799e899a11a7f6f61fcc88",
"score": "0.5009644",
"text": "def content_preview\n self.body\n end",
"title": ""
},
{
"docid": "8819f3586264b961c04d76ef8bf35a33",
"score": "0.50093484",
"text": "def characters_limit(post)\n if post && post.content.length <= 10\n return post.content\n elsif post && post.content.length > 10\n return post.content[0,10] + \"...\"\n else !post\n return \"投稿はありません\"\n end\n end",
"title": ""
},
{
"docid": "c12cf22dbb9166655c0fabfda1d92da5",
"score": "0.50050324",
"text": "def show\n url = (@blog_post.slug.nil? || @blog_post.slug.empty?) ? blog_post_path(@blog_post) : \"#{blog_root_path}/#{@blog_post.slug}\"\n @breadcrumbs.push [@blog_post.title, url]\n comments = Comment.where(category: 'post').\n where(entity_id: @blog_post.id).all\n @comments = Comment.flatten(comments)\n @attachments=[]\n if @blog_post.attachments\n attachments_string = @blog_post.attachments\n @attachments = attachments_string.split(';')\n @attachments = @attachments.map do |attachment_string|\n description, url = attachment_string.split '|'\n url.strip!\n description.strip!\n attachment = {\n 'file' => \"/downloads/#{url}\",\n 'description' => description\n }\n extension = url.split('.')[1]\n attachment['icon'] =\n case extension\n when 'xlsx', 'xls'\n 'excel_icon.png'\n end\n attachment\n end\n end\n respond_with(@blog_post)\n end",
"title": ""
},
{
"docid": "9e858cc57ddcfe2e55c21200262d7a80",
"score": "0.5000644",
"text": "def prepare_content_body(doc, blog_entry)\n #puts doc\n content_node = doc.search('#documentDisplay')\n\n # remove the empty first wikiPara\n if(content_node.css('p.wikiPara')[0].text.strip!.empty?)\n content_node.css('p.wikiPara')[0].unlink\n end\n\n # remove h1 title since title will be rendered on the new site via the meta data\n content_node.css('div#j_id490').unlink\n\n # adjust anchor links (used in blog headings)\n content_node.css('a').each do |link_node|\n if link_node['href'] =~ /^\\/Bloggers\\/.*(#.*)$/\n updated_href = blog_entry.relative_url + link_node['href'].match(/^\\/Bloggers\\/.*(#.*)$/).captures[0]\n link_node['href'] = updated_href\n end\n end\n\n unless @skip_image_procesing\n import_images(content_node)\n end\n\n unless @skip_asset_procesing\n import_assets(doc, content_node)\n end\n\n return content_node.to_s\n end",
"title": ""
},
{
"docid": "274cd31236a1cd35c74cb45c57e44a92",
"score": "0.5000028",
"text": "def get_caption\n caption = \"\"\n begin\n case self.object_class\n when \"PostType_Post\"\n caption = \"Fields for Contents in <b>#{self.site.post_types.find(self.objectid).decorate.the_title}</b>\"\n when 'PostType_Category'\n caption = \"Fields for Categories in <b>#{self.site.post_types.find(self.objectid).decorate.the_title}</b>\"\n when 'PostType_PostTag'\n caption = \"Fields for Post tags in <b>#{self.site.post_types.find(self.objectid).decorate.the_title}</b>\"\n when 'Widget::Main'\n caption = \"Fields for Widget <b>(#{CamaleonCms::Widget::Main.find(self.objectid).name.translate})</b>\"\n when 'Theme'\n caption = \"Field settings for Theme <b>(#{self.site.themes.find(self.objectid).name rescue self.objectid})</b>\"\n when 'NavMenu'\n caption = \"Field settings for Menus <b>(#{CamaleonCms::NavMenu.find(self.objectid).name})</b>\"\n when 'Site'\n caption = \"Field settings the site\"\n when 'PostType'\n caption = \"Fields for all <b>Post_Types</b>\"\n when 'Post'\n p = CamaleonCms::Post.find(self.objectid).decorate\n caption = \"Fields for content <b>(#{p.the_title})</b>\"\n else # 'Plugin' or other class\n caption = \"Fields for <b>#{self.object_class}</b>\"\n end\n rescue => e\n Rails.logger.info \"----------#{e.message}----#{self.attributes}\"\n end\n caption\n end",
"title": ""
}
] |
a599e46f8e1cf68cff8835c4807a3b1a | create applications in all states and set the created_at: and updated_at dates to create_date default create_date = Time.zone.now | [
{
"docid": "cb485073c7917d0af9331fdef765d0f3",
"score": "0.7496882",
"text": "def create_apps_in_states(create_date: Time.current)\n\n NUM_APPS_IN_STATE.each_pair do |state, number|\n create_shf_apps_in_state(number, state, create_date: create_date)\n end\n\n end",
"title": ""
}
] | [
{
"docid": "acacd0d0171d5c1a5acd6558035921f9",
"score": "0.67802423",
"text": "def create_shf_apps_in_state(num, state, create_date: Time.current)\n shf_apps = []\n\n num.times do\n shf_apps << create(:shf_application, state: state, created_at: create_date,\n updated_at: create_date)\n end\n\n shf_apps\n end",
"title": ""
},
{
"docid": "10d937fb56e9c8ffe09d1bed662e34b2",
"score": "0.6033695",
"text": "def apps_by_creation_date(createdat)\n t = createdat.is_a?(Time) ? createdat.to_i : createdat\n apps(:createdat => t)\n end",
"title": ""
},
{
"docid": "109ad70a2fa1e8ad3898a0310ee08426",
"score": "0.5781957",
"text": "def create\n @application_date = ApplicationDate.new(application_date_params)\n\n respond_to do |format|\n if @application_date.save\n format.html { redirect_to admin_home_path, notice: '时间阶段创建成功' }\n format.json { render action: 'show', status: :created, location: @application_date }\n else\n format.html { render action: 'new' }\n format.json { render json: @application_date.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bc8d6bd5c915571abe988fadc32b8cf1",
"score": "0.5771342",
"text": "def create_everything\n create_users\n create_user_keys\n create_comments\n create_filters\n create_columns\n create_organizations\n create_approvals\n create_whitelists\n create_user_key_columns\n create_user_key_organizations\n end",
"title": ""
},
{
"docid": "43ffa28f426874b6f3d3cb3ad98e9437",
"score": "0.57342434",
"text": "def create\n @application = Application.new(application_params)\n\n if @application.save\n @application.status = Application.where(nursery_id: @application.nursery_id, date: @application.date, status: :appointed).count < @application.nursery.capacity ? :appointed : :waiting\n @application.save\n render :show, status: :created, location: @application\n else\n render json: @application.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "0bae6096167a5450b1a8b4aedfb5724d",
"score": "0.57287693",
"text": "def create_database\n DATA[:calendars].each do |calendar|\n CalendarCoordinator::Calendar.create(calendar).save\n end\n\n calendar = CalendarCoordinator::Calendar.first\n DATA[:events].each do |event|\n calendar.add_event(event)\n end\n end",
"title": ""
},
{
"docid": "7521e7b49a8ba0c7fc7be393eb75f45d",
"score": "0.56911033",
"text": "def create\n @driver_application = DriverApplication.new(driver_application_params)\n \n # Always get the current time to save\n @driver_application.created_at = DateTime.current\n\n respond_to do |format|\n if @driver_application.save\n format.html { redirect_to @driver_application, notice: 'Driver application was successfully created.' }\n format.json { render :show, status: :created, location: @driver_application }\n else\n format.html { render :new }\n format.json { render json: @driver_application.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1d7c58e877026534ee122825c8a2abfb",
"score": "0.56450516",
"text": "def create_database\n DATA[:accounts].each do |account|\n CalendarCoordinator::AccountService.create(data: account).save\n end\n\n account = CalendarCoordinator::Account.first\n DATA[:calendars].each do |calendar|\n account.add_owned_calendar(calendar)\n end\n end",
"title": ""
},
{
"docid": "0cecf2f35ae1bc0c394aea358aa6a747",
"score": "0.5643362",
"text": "def before_create; self.created_on = Time.now.utc; end",
"title": ""
},
{
"docid": "465db0294ef09618762b2b41e14b339c",
"score": "0.56431955",
"text": "def safe_initial_application_dates(status)\n case status\n when :draft, :enrollment_open\n if TimeKeeper.date_of_record.month == 11 && TimeKeeper.date_of_record.day < 16\n current_effective_date TimeKeeper.date_of_record.beginning_of_month\n else\n current_effective_date (TimeKeeper.date_of_record + 2.months).beginning_of_month\n end\n when :enrollment_closed, :enrollment_eligible, :enrollment_extended\n current_effective_date (TimeKeeper.date_of_record + 1.months).beginning_of_month\n when :active, :terminated, :termination_pending, :expired\n current_effective_date (TimeKeeper.date_of_record - 2.months).beginning_of_month\n end\n end",
"title": ""
},
{
"docid": "c0fca51f05081a327fd6cb76114bd272",
"score": "0.5642254",
"text": "def set_created_at\n self.created_at ||= Date.today if new_record?\n end",
"title": ""
},
{
"docid": "3ce343f51c84ad589948cdb06c4018a2",
"score": "0.56245863",
"text": "def create_date\n\t\tcreated_at.to_date\n\tend",
"title": ""
},
{
"docid": "5d05a51725ddad6f387fff8114b2614b",
"score": "0.55921745",
"text": "def created\n\t\t\t# Picked a random lender application and temporary set it's status to pending\n\t\tlender_app \t\t\t= LenderApplication.first\n\t\tlender_app.status \t= 'pending'\n\t\tLenderApplicationsMailer.created(lender_app)\n\tend",
"title": ""
},
{
"docid": "62da29c70c79391bb1a3bb5f4a03bd06",
"score": "0.5544943",
"text": "def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&organization_id=1\"\n session.delete('previous_url')\n\n @organization = current_user.organizations.to_a.find { |o| o.id && o.id.to_s == params[:organization_id].to_s }\n authorize! :manage_app_instances, @organization\n\n app_instances = []\n params[:apps].each do |product_name|\n app_instance = @organization.app_instances.create(product: product_name)\n app_instances << app_instance\n MnoEnterprise::EventLogger.info('app_add', current_user.id, 'App added', app_instance)\n end\n\n render json: app_instances.map(&:attributes).to_json, status: :created\n end",
"title": ""
},
{
"docid": "d2b2f50c9a0d1b010667ff9f2593f339",
"score": "0.5516274",
"text": "def create\n date_format = \"#{appointment_params[\"date(1i)\"]}-#{appointment_params[\"date(2i)\"]}-#{appointment_params[\"date(3i)\"]}\"\n @appointment = Appointment.new(type_appointment_id: appointment_params[:type_appointment_id], description: appointment_params[:description], date: date_format,\n user_id: appointment_params[:user_id], estate_id: appointment_params[:estate_id], doctor_id: appointment_params[:doctor_id])\n \n respond_to do |format|\n if @appointment.save\n format.html { redirect_to @appointment, notice: 'Appointment was successfully created.' }\n format.json { render :show, status: :created, location: @appointment }\n else\n format.html { render :new }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8c5cd58c0906be1eb80fb819c4f12fa4",
"score": "0.54866517",
"text": "def generate_default_values\n self.created_at = DateTime.now unless self.created_at\n end",
"title": ""
},
{
"docid": "c955e6cd3cb795323f3d51d1b7247d61",
"score": "0.5482571",
"text": "def before_create\n self.created_at = Time.now\n self.updated_at = Time.now\n end",
"title": ""
},
{
"docid": "e24e8b0ac1d957bd6f1eda3dd628c300",
"score": "0.54647434",
"text": "def create_application\n unless self.has_current_application?\n Application.create_for_student self\n end\n end",
"title": ""
},
{
"docid": "0066d18b82363a02329a98987f4dd06d",
"score": "0.54512715",
"text": "def create_contexts\n create_stores\n create_employees\n create_assignments\n end",
"title": ""
},
{
"docid": "5660b1b421ffcd8f4f27a6347c66a367",
"score": "0.54324293",
"text": "def create_and_activate\n create\n activate\n end",
"title": ""
},
{
"docid": "22bc6083fe02d61257b2c68cf9bada19",
"score": "0.54225755",
"text": "def create\n self[:created] = Time.now.to_s\n save\n end",
"title": ""
},
{
"docid": "b6194db9a3e8c94929dc35bcb5558059",
"score": "0.5398941",
"text": "def create_initial_state(app)\n raise 'Invalid app' unless SUPPORTED_APPS[app]\n SUPPORTED_APPS[app].initial_state\nend",
"title": ""
},
{
"docid": "c5b1fc58a39a595bbbc721c29728525f",
"score": "0.53973293",
"text": "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end",
"title": ""
},
{
"docid": "a7c77b800207718e13406ca7aa8948a3",
"score": "0.5389928",
"text": "def create_timestamp\n self.created_at = Time.now\n end",
"title": ""
},
{
"docid": "a7c77b800207718e13406ca7aa8948a3",
"score": "0.5389176",
"text": "def create_timestamp\n self.created_at = Time.now\n end",
"title": ""
},
{
"docid": "d258b794bbc66e45f3785281db212d65",
"score": "0.53834116",
"text": "def create\n push_to_db\n end",
"title": ""
},
{
"docid": "d258b794bbc66e45f3785281db212d65",
"score": "0.53834116",
"text": "def create\n push_to_db\n end",
"title": ""
},
{
"docid": "5dc43654ba257ede90c57e526ad97c77",
"score": "0.5379169",
"text": "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end",
"title": ""
},
{
"docid": "e3fc30956b75a8ed80c2569a5b22a067",
"score": "0.5370076",
"text": "def create\n\n @event = Event.new(event_params)\n\n # if @event.cloudy already exist => duplicate else create from scratch\n @cloudy = @event.cloudy ? @event.cloudy : Cloudy.create\n @save_is_ok = true\n\n # dates is range\n if @event.calendar_range_string.size > 0\n\n @event = Event.new(event_params)\n @event.organizer = ( current_member.has_role?(ROLE_ADMIN) && @event.teacher) ? @event.teacher : current_member\n @event.cloudy = @cloudy\n @event.duration = @event.end_at - @event.begin_at\n # force image to avoid uplaod a new image per event created\n @save_is_ok &&= @event.save\n\n if @save_is_ok\n ContactMailer.new_user_action('Nouvel évènement', @event.url).deliver_now\n @event.reload\n @cloudy.identifier = @event.image.filename\n @cloudy.prefix_cloudinary = 'http://res.cloudinary.com/' + YAML.load_file('config/cloudinary.yml')['production']['cloud_name'] + '/'\n @cloudy.save\n @event.index!\n end\n\n elsif @event.calendar_string.size > 0\n\n # multi_dates_id = Time.new is Id group of all items\n tab_dates = @event.calendar_string.split(',')\n time_stamp = Time.new\n\n @save_is_ok = tab_dates.count > 0\n\n flash[:alert] = \"Il faut choisir une ou plusieurs dates\" unless @save_is_ok\n\n tab_dates.each do |d|\n @event = Event.new(event_params)\n @event.multi_dates_id = time_stamp if tab_dates.count > 1\n @event.organizer = ( current_member.has_role?(ROLE_ADMIN) && @event.teacher) ? @event.teacher : current_member\n\n @event.cloudy = @cloudy\n # if local zone = Paris, the 2 instruction follow add + hours in execution but not in debug\n # so DO NOT CHANGE LOCAL ZONE\n time_at = I18n.l(@event.begin_at, format: '%H:%M')\n @event.begin_at = DateTime.strptime(d+' '+time_at, '%d/%m/%Y %H:%M')\n time_at = I18n.l(@event.end_at, format: '%H:%M')\n @event.end_at = DateTime.strptime(d+' '+time_at, '%d/%m/%Y %H:%M')\n @event.duration = @event.end_at - @event.begin_at\n\n # save once to get cloudinary infos, break if save not ok\n break unless @save_is_ok &&= @event.save\n\n if @save_is_ok\n ContactMailer.new_user_action('Nouvel évènement', @event.url).deliver_now\n if !@cloudy.identifier\n @event.reload\n @cloudy.identifier = @event.image.filename\n @cloudy.prefix_cloudinary = 'http://res.cloudinary.com/' + YAML.load_file('config/cloudinary.yml')['production']['cloud_name'] + '/'\n @cloudy.save\n params[:event].delete(:image)\n end\n @event.index!\n end\n end\n end\n\n respond_to do |format|\n if @save_is_ok\n format.html { redirect_to @event}\n format.json { render :show, status: :created, location: @event }\n else\n # simple_form doesn t show errors for :begin_at & :end_at because\n flash[:alert] = \"Problème dans la création de l événement\"\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"title": ""
},
{
"docid": "99b695f71165d6dfab9f1ab967ec8976",
"score": "0.53690886",
"text": "def create\n\t\tbegin\n\t\t\tActiveRecord::Base.transaction do\n\t\t\t\t@application = Application.create!(name: params[:name])\n end\n rescue => e #ActiveRecord::RecordNotUnique\n p e.message\n p e.backtrace\n\t\t\tActiveRecord::Rollback\n\t\t\trender plain: e.message, status: :unprocessable_entity and return\n end\n render json:\" Application created with token = #{@application.token}\", status: :created\n end",
"title": ""
},
{
"docid": "62b856e7f7005c4643296d12f28738cb",
"score": "0.5368047",
"text": "def create\n @job_start_date = Job.find_by(id: params[:id]).job_start_date.to_date\n @job_end_date = Job.find_by(id: params[:id]).job_end_date.to_date\n @seeker_start_date = Jobseeker.find_by(user_id: current_user.id).start_date.to_date\n @seeker_end_date = Jobseeker.find_by(user_id: current_user.id).end_date.to_date\n if @job_start_date < @seeker_start_date\n redirect_to root_path, notice: 'Unable to apply. Job starts before your available period'\n return\n elsif @job_end_date > @seeker_end_date\n redirect_to root_path, notice: 'Unable to apply. Job ends after your availabilty period'\n return\n end\n @application = Application.new(job_id: params[:id], jobseeker_id: Jobseeker.find_by(user_id: current_user.id).id, status: \"Pending\")\n if @application.save\n ApplicationNotificationMailer.notification_email(params[:id]).deliver\n redirect_to @application, notice: 'You application has been sent. Good luck!'\n else\n redirect_to root_path, notice: 'You have already applied for this job'\n end\n end",
"title": ""
},
{
"docid": "f6e5c183741ed8756e21af93a31fdfc7",
"score": "0.536071",
"text": "def create\n @app = App.new(app_params)\n\n if @app.save\n render json: @app, status: :created, location: @app\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "114fcd698fa45950ccdaeba3cbc478f5",
"score": "0.5356219",
"text": "def create_created\n controller.create_created(resource: resource)\n end",
"title": ""
},
{
"docid": "52e9835f803b5224caf7d87afdeedef4",
"score": "0.53546196",
"text": "def create\n @project_states = ProjectState.create!(project_state_params)\n json_response(@project_states, :created)\n end",
"title": ""
},
{
"docid": "85821b7c901833285eb68d70d01fd111",
"score": "0.5343083",
"text": "def create\n \n end",
"title": ""
},
{
"docid": "16a0703d5ed7324581d42f45533db6a5",
"score": "0.528831",
"text": "def after_create\n\t\tsuper\n\t\t# associate an enrollment queue\n\t\teq = EnrollmentQueue.create(user_id: self.id)\n\t\tself.enrollment_queue = eq\n\t\teq.user = self\n\t\t# associate a state table\n\t\tst = StateTable.create(user_id: self.id)\n\t\tself.state_table = st\n\t\tst.user = self\n\n\n if not ['app', 'android', 'ios'].include? self.platform\n\t\t self.state_table.update(subscribed?: false) unless ENV['RACK_ENV'] == 'test'\n # self.state_table.update(subscribed?: true)\n end\n\n\t\tif not ['fb', 'app', 'android', 'ios'].include? self.platform\n\t\t\tself.code = generate_code\n\t\tend\n\t\t# puts \"start code = #{self.code}\"\n\t\twhile !self.valid?\n\t\t\tself.code = (self.code.to_i + 1).to_s\n\t\t\t# puts \"new code = #{self.code}\"\n\t\tend\n\t\t# set default curriculum version\n\t\tENV[\"CURRICULUM_VERSION\"] ||= '0'\n\t\tself.update(curriculum_version: ENV[\"CURRICULUM_VERSION\"].to_i)\n\n\t\t# we would want to do\n\t\t# self.save_changes\n\t\t# self.state_table.save_changes\n\t\t# but this is already done for us with self.update and self.state_table.update\n\n\trescue => e\n\t\tp e.message + \" could not create and associate a state_table, enrollment_queue, or curriculum_version for this user\"\n\tend",
"title": ""
},
{
"docid": "8ed701f331a977cda5968e154d9e34f1",
"score": "0.5281985",
"text": "def enter_created; end",
"title": ""
},
{
"docid": "97301b2c736ea6616951090e649623a1",
"score": "0.5280762",
"text": "def create\n\n # physician = Physician.find(physician_id)\n # unless physician.patients.where(email: email).exists?\n # patient = Patient.find_or_create_by(email: email)\n # physician.appointments.create(patient: patient)\n\n unless Appointment.where(doctor_id: appointment_params[:doctor_id], appointment_date_id: appointment_params[:appointment_date_id], time_table_id: appointment_params[:time_table_id]).exists?\n # unless Appointment.where(doctor_id: requested_doctor, appointment_date_id: requested_date, time_table_id: requested_timing).exists?\n @appointment = Appointment.new(appointment_params)\n @patient_id = @current_patient.id\n end\n\n # if @appointment.try(:save)\n # if !@appointment.nil? && @appointment.save\n if @appointment && @appointment.save\n puts \"Im saving!\"\n redirect_to @appointment, notice: 'Appointment was successfully created.'\n else\n puts \"Failed saving!\"\n redirect_to new_appointment_url, notice: 'Appointment was NOT successfully created.'\n end\n end",
"title": ""
},
{
"docid": "89c1fcfe75f6d41de68d3cc4e2c16f87",
"score": "0.5271319",
"text": "def create\n if params[:start_date].present?\n mes_para_consulta = params[:start_date].to_date\n else\n mes_para_consulta = Date.current\n end\n\n beginning_of_month = mes_para_consulta.beginning_of_month\n end_of_month = beginning_of_month.end_of_month\n\n @appointments_todos = Appointment.where(schedule_on: beginning_of_month..end_of_month)\n @appointments_todos = @appointments_todos.para_o_calendar(current_user.calendar_id)\n\n\n\n @appointment = Appointment.new(appointment_params)\n @appointment.calendar_id = current_user.calendar_id\n\n respond_to do |format|\n if @appointment.save\n format.html { redirect_to @appointment, notice: t('create_success') }\n format.json { render :show, status: :created, location: @appointment }\n else\n format.html { render :new }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e2680da4adc3b9dfe3051f12a30d3a70",
"score": "0.52649057",
"text": "def create\n create_params = application_params\n if applicant_signed_in?\n create_params[:applicant_id] = current_applicant.id\n end\n @application = Application.new(create_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: \"Application was successfully created.\" }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d91a4700be84ee73241d480fd94f10d0",
"score": "0.5253676",
"text": "def create_objects(apps_config, changed_apps = [])\n debug 'create objects'\n apps_config.each do |app_name, app_cfg|\n update_or_create_application(app_name, app_cfg.clone) if changed_apps.include?(app_name)\n end\n\n # sorting applications\n @applications.sort_by!(&:name)\n end",
"title": ""
},
{
"docid": "fa6dea3324ceeb9722ee50be038e0cd6",
"score": "0.5252349",
"text": "def create\n @application = Application.new(application_params)\n\n if @application.save\n render json: @application, status: :created, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "3daee33268a95cd2476262d111643cdb",
"score": "0.5246539",
"text": "def create_starting_statuses\n new_status_attributes = { :public_title => \"New\",\n :application_status_type => ApplicationStatusType.find_or_create_by_name(\"new\"),\n :disallow_user_edits => 0,\n :disallow_all_edits => 0,\n :allow_application_edits => 1 }\n statuses.create(new_status_attributes)\n in_progress_status_attributes = { :public_title => \"In Progress\",\n :application_status_type => ApplicationStatusType.find_or_create_by_name(\"in_progress\"),\n :disallow_user_edits => 0,\n :disallow_all_edits => 0,\n :allow_application_edits => 1 }\n statuses.create(in_progress_status_attributes)\n submitted_status_attributes = { :public_title => \"Submitted\",\n :application_status_type => ApplicationStatusType.find_or_create_by_name(\"submitted\"),\n :disallow_user_edits => 1,\n :disallow_all_edits => 0,\n :allow_application_edits => 0 }\n statuses.create(submitted_status_attributes)\n end",
"title": ""
},
{
"docid": "8cbdf21eecd4051688d0d2fb71fd8f27",
"score": "0.5245228",
"text": "def create\n @app = App.new(app_params)\n @app.count = 0\n @app.uid = SecureRandom.uuid\n respond_to do |format|\n if @app.save\n format.html { redirect_to app_path(uid: @app.uid), notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3d4e0c94710e6b85807d075e46c7d0c8",
"score": "0.5236238",
"text": "def create; end",
"title": ""
},
{
"docid": "3d4e0c94710e6b85807d075e46c7d0c8",
"score": "0.5236238",
"text": "def create; end",
"title": ""
},
{
"docid": "3d4e0c94710e6b85807d075e46c7d0c8",
"score": "0.5236238",
"text": "def create; end",
"title": ""
},
{
"docid": "3d4e0c94710e6b85807d075e46c7d0c8",
"score": "0.5236238",
"text": "def create; end",
"title": ""
},
{
"docid": "7c2b11094d00be4ea5f185733e22414b",
"score": "0.5212792",
"text": "def create\n \n end",
"title": ""
},
{
"docid": "4073df8bc06fce71f2c24d02577e1831",
"score": "0.5211392",
"text": "def create\n end",
"title": ""
},
{
"docid": "98d912d9f7d300fd10dac2bb325a7749",
"score": "0.5205777",
"text": "def create_events\n end",
"title": ""
},
{
"docid": "00f579b789718b01afc52b9e5281fa66",
"score": "0.5205436",
"text": "def create\n @application = Oread::Application.new(application_params)\n @application.owner = current_user\n respond_to do |format|\n if @application.save\n format.html { redirect_to settings_admin_oread_applications_path, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "296138714af6a64d65a527413ea62bdf",
"score": "0.52019846",
"text": "def create\n authorize @application, policy_class: Oauth::ApplicationPolicy\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if T.unsafe(Doorkeeper).configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end",
"title": ""
},
{
"docid": "74df945b149353ed8e2dfab510168b5a",
"score": "0.5200781",
"text": "def create\n @activity_application = @meetup_event.activity_applications.new(activity_application_params_for_create)\n\n respond_to do |format|\n if @activity_application.save\n format.html {redirect_to [@meetup_event, @activity_application], notice: 'Activity application was successfully created.'}\n format.json {render :show, status: :created, location: meetup_event_activity_application_path(@meetup_event, @activity_application)}\n else\n format.html {render :new}\n format.json {render json: @activity_application.errors, status: :unprocessable_entity}\n end\n end\n end",
"title": ""
},
{
"docid": "b70ed7f0544a2b9ab8e480c0120da004",
"score": "0.5192765",
"text": "def timestamps!\n before(:create) do\n self['updated_at'] = self['created_at'] = Time.now\n end \n before(:update) do \n self['updated_at'] = Time.now\n end\n end",
"title": ""
},
{
"docid": "3bba833a38db4da64c4697997f32b311",
"score": "0.51876",
"text": "def get_initial_state\n {\n appointments_for_dates: {}\n }\n end",
"title": ""
},
{
"docid": "0c45cad942d57e7e74ca987e4590caba",
"score": "0.5181069",
"text": "def initialize\n @created_at = Time.now\n end",
"title": ""
},
{
"docid": "a4c9735fc1c3448875fba1965457b30f",
"score": "0.5178902",
"text": "def create_or_update_booking_dates\n if check_in_changed? || check_out_changed?\n # Delete all booking dates if check in or check out changed\n booking_dates.delete_all\n # Adding all the dates of the check_in and check_out range into the reserved dates\n (check_in..check_out).each do |reserved_date| \n # Createing booking dates with specified reserved_date\n booking_dates.create(reserved_date: reserved_date)\n end\n end\n end",
"title": ""
},
{
"docid": "3d302e18238ad7c6aea13d17df1e75ca",
"score": "0.517478",
"text": "def begin_create\n create_stack.push(true)\n end",
"title": ""
},
{
"docid": "650ac323810f0bc5e134e2b96762be6a",
"score": "0.51652265",
"text": "def create\n end",
"title": ""
},
{
"docid": "8f95e7a016ecdfb94bb81a1a79d5f94d",
"score": "0.5164175",
"text": "def create_app()\n app = OpenShift::TestApplication.new(self)\n\n $logger.info(\"Created new application #{app.name} for account #{@name}\")\n\n @apps << app\n app\n end",
"title": ""
},
{
"docid": "dea64d6f2a03fa31814656b36d223b8e",
"score": "0.51600415",
"text": "def create\n # TODO: implement create\n end",
"title": ""
},
{
"docid": "c5180eb1132cf1517d095e4dbb9f32ac",
"score": "0.51481724",
"text": "def new\n puts \"Creating new blank Praxis app under #{app_name}\"\n create_root_files\n create_config\n create_app\n create_design\n create_spec\n create_docs\n end",
"title": ""
},
{
"docid": "aec61a93fac14d1835227adb20d49b55",
"score": "0.5147468",
"text": "def create_reservations\n Time.use_zone(@timezone) do\n @reservations = build_reservations\n return nil unless @reservations.any?\n @reservations = commit_reservations(@reservations)\n return nil unless valid? && @reservations.all?(&:persisted?)\n charge(@reservations) && @reservations.each(&:reload) if @pay\n track(@reservations)\n\n @reservations\n end\n end",
"title": ""
},
{
"docid": "83399f0f9de376bd46d1ceeafa7c7b80",
"score": "0.51378906",
"text": "def create(options)\n API::request(:post, 'escrow_service_applications', options)\n end",
"title": ""
},
{
"docid": "88946b2140a932d5d0e6e7eae2f88d9f",
"score": "0.5136771",
"text": "def allowed_to_create_apps=(value)\n @allowed_to_create_apps = value\n end",
"title": ""
},
{
"docid": "0dbe1cc67d0bbbd2a81dacdef809c8d5",
"score": "0.51261145",
"text": "def create\n @appointment = Appointment.new(appointment_params)\n @appointment.status = 'new'\n @appointment.create_date = Time.now\n respond_to do |format|\n if @appointment.save\n @notice = ('The appointment was succesfuly create, you will recieve an email about your appointment confirmation')\n format.html { render :success, notice: ('The appointment was succesfuly create, you will recieve an email about your appointment confirmation') }\n format.json { render :success, status: :ok, location: @appointment }\n else\n format.html { render :new }\n format.json { render json: @appointment.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bfc167ec3fc19206c53d2274564a8d98",
"score": "0.51259255",
"text": "def create_application \n @user = current_user(session)\n @business = Business.find_by(id: params[:id])\n if !@user.admin\n @application = Application.create(business_id: @business.id, user_id: current_user(session).id)\n # binding.pry\n flash[:notice] = \"Your application hass been successfully submitted to #{@business.name} business\"\n else \n flash[:notice] = \"You are an administrator. Please log in without you admin account to apply to '#{@business.name}' business\"\n end\n redirect_to \"/businesses\"\n end",
"title": ""
},
{
"docid": "ed7f5cb8b152c4c748550106f66240fb",
"score": "0.5122916",
"text": "def before_create\n temp_time = Time.sl_local\n self.created_at = temp_time\n self.modified_at = temp_time\n end",
"title": ""
},
{
"docid": "ec4918c6b63a601aa827792c75b8cc64",
"score": "0.5119769",
"text": "def create\n appointment_request = current_user.pending_requests.new(\n appointment_request_params\n )\n\n if appointment_request.save\n if appointment_request.initialize_appointment!(appointment_params)\n redirect_to root_path\n else\n render json: {\n status: 500,\n error: 'This expert is not available on the scheduled date'\n }, status: 500\n end\n else\n render json: {\n status: 500, error: appointment_request.errors\n }, status: 500\n end\n end",
"title": ""
},
{
"docid": "5e4255af2154941a1f4b05e96a9ca00b",
"score": "0.5115738",
"text": "def execute(request)\n Doorkeeper::Application.create(params)\n end",
"title": ""
},
{
"docid": "134612772a5e972788b2c93698fce5bf",
"score": "0.511415",
"text": "def create_tables\n create_mirrors\n create_users\n create_user_tokens\n create_products\n create_users_products\n create_versions\n create_dependencies\n create_access_keys\n end",
"title": ""
},
{
"docid": "e6a01eaba4ab73fc5b7a6e1b5b84bcdc",
"score": "0.5110416",
"text": "def create\r\n end",
"title": ""
},
{
"docid": "be26c087a7405926fc6d59516d6bb3db",
"score": "0.5109506",
"text": "def seed_all\n current_or_create_new_misc\n current_or_create_new_institutions\n current_or_create_new_williams_dining_opps\n current_or_create_new_williams_dining_places\n current_or_create_new_dining_opps\n seed_app_dining_periods\n seed_williams_rss_scraping\nend",
"title": ""
},
{
"docid": "145256d7e18bcad7d14374b1c245596d",
"score": "0.51086104",
"text": "def create\n @application_event=ApplicationsEvent.find(params[:applications_event_id])\n @applications_application = ApplicationsApplication.new(params[:applications_application])\n @applications_application.applications_event_id=@application_event.id\n \n respond_to do |format|\n if @applications_application.save\n format.html { redirect_to @application_event, notice: 'Applications application was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"title": ""
},
{
"docid": "81e62cf0fdbaea8ae54088a683b3ee99",
"score": "0.5108332",
"text": "def create\n end",
"title": ""
},
{
"docid": "81e62cf0fdbaea8ae54088a683b3ee99",
"score": "0.5108332",
"text": "def create\n end",
"title": ""
},
{
"docid": "81e62cf0fdbaea8ae54088a683b3ee99",
"score": "0.5108332",
"text": "def create\n end",
"title": ""
},
{
"docid": "41faa708112da8b2ad80d289774cd72c",
"score": "0.51076037",
"text": "def create\n \t\n end",
"title": ""
},
{
"docid": "dd295edda5d37075d514d37ceae13f29",
"score": "0.51030135",
"text": "def after_created\n super.tap do |val|\n app_state_ruby(self)\n end\n end",
"title": ""
},
{
"docid": "f12073ff190c707e33f527cbb162fe96",
"score": "0.5102917",
"text": "def create\n @application = Application.new()\n @application.name = params[:application][:name].to_s.downcase\n # true - доступ запрещен, false - разрешен\n @application.default = true\n respond_to do |format|\n if @application.save\n format.html { redirect_to applications_path, notice: 'Приложение создано.' }\n format.json { render json: @application, status: :created, location: @application }\n else\n format.html { render action: \"new\" }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a9b819643df3fe9bce8176e96a563655",
"score": "0.5098844",
"text": "def index\n @creates = Create.all\n end",
"title": ""
},
{
"docid": "fc6bbaae8b0f64dfd7cfcd174fb0f10f",
"score": "0.5098457",
"text": "def create\n @application = Application.new(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: @application }\n else\n format.html { render :new }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"title": ""
},
{
"docid": "cc35161ba3577c0b8c749e06c2c908b3",
"score": "0.5095048",
"text": "def create_application_record\n template \"application_record.rb\", application_record_file_name\n end",
"title": ""
},
{
"docid": "4dc19725e3d7174a7210eb2d45050840",
"score": "0.5092984",
"text": "def create\n\n begin\n Meeting.transaction do\n @meeting = Meeting.new(meeting_params)\n\n create_agenda\n\n @meeting.save!\n\n create_material\n # create the history of meeting\n create_history(MeetingHistory.operations[:regist])\n # use cybozu api\n use_schedule_coordination_of_cybozu\n\n @meeting.save!\n end\n rescue CybozuApi::Error => e\n logger.info e.message\n @error = t('error.cybozu') << e.message\n rescue => e\n logger.info e.message\n else\n redirect_to @meeting\n end\n\n render :new if @error || @meeting.errors.any?\n\n end",
"title": ""
},
{
"docid": "5f14ea63c7b88e9e9da9fc48012dd0f8",
"score": "0.50909567",
"text": "def create\r\n\r\n\r\n end",
"title": ""
},
{
"docid": "45255dadc065b8787647c9614dba02f4",
"score": "0.50853163",
"text": "def before_create\n self.created_at ||= Time.now\n super # ($)\n end",
"title": ""
},
{
"docid": "b653740e834cf86114a303b1585f31f3",
"score": "0.50848746",
"text": "def create_app app_name, dev_name, dev_email\n data[:app_name] = app_name\n data[:dev_name] = dev_name\n data[:dev_email] = dev_email\n end",
"title": ""
},
{
"docid": "0c3c1c22d49c05c6ceea98e116cccdb7",
"score": "0.50823337",
"text": "def create\n run_callbacks :create do\n true\n end\n end",
"title": ""
},
{
"docid": "d2f821636d3d6271b6884a3c13fdd3b9",
"score": "0.5082089",
"text": "def create\n @transaction = Transaction.new(transaction_params)\n @transaction.update(user_id: session[:user_id])\n @transaction.update(status: 'Scheduled')\n\n @timingsList = []\n @datesList = []\n @timings = Timing.find_by_sql(\"SELECT day, hours, minutes, ampm FROM timings\")\n @timings.each do |timing|\n timing.day = date_of_next(timing.day).strftime(\"%d %b %Y\") + \" - \" + timing.hours + \":\" + timing.minutes + \" \" + timing.ampm\n @timingsList.push([timing.day, timing.day])\n end\n for i in 0..9\n @datesList.push([(Date.today+i).strftime(\"%d %b %Y\"), (Date.today+i).strftime(\"%d %b %Y\")])\n end\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to transactions_path, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "65c568a38f0d44d637a6b32a05e97dfd",
"score": "0.50809187",
"text": "def update_appeal_state_on_task_creation\n update_appeal_state_when_privacy_act_created\n update_appeal_state_when_appeal_docketed\n update_appeal_state_when_ihp_created\n end",
"title": ""
},
{
"docid": "0fe557f7a0995a84cf25c7ca343e755c",
"score": "0.50631756",
"text": "def create\n create_checkpoints\n create_config_base\n generate_deploy_files\n generate_hiera_template\n end",
"title": ""
},
{
"docid": "01e544afce7a8362da6ac6d7b4a03a2d",
"score": "0.5060353",
"text": "def set_record_created_at\n self.record_created_at = Time.current.utc.iso8601(3)\n end",
"title": ""
},
{
"docid": "d69e6b4c4aaca02969396a338c1b11f4",
"score": "0.5059969",
"text": "def create\n make_create_request\n end",
"title": ""
},
{
"docid": "3ec4aec7b2d1404bd50577dd8cbd36c7",
"score": "0.50577015",
"text": "def default_values #to set the status as pending and creation date as defaults \n\tif (self.status).nil?\n\t\tself.status ||= \"Pending\"\n\t\tself.application_date = Date.today\n\tend\nend",
"title": ""
},
{
"docid": "4e5572fffdd1616aa205e08ad0442f8c",
"score": "0.5057539",
"text": "def create\n @event = current_user.created_events.build(event_params)\n @upcoming_events = Event.upcoming_events.order('created_at DESC')\n @past_events = Event.past_events.order('created_at DESC')\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to event_path(@event), notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :index, alert: 'Event was not created. Please try again!' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ea17872aa5f6a85fd0f207f6c82f6ac4",
"score": "0.505034",
"text": "def create\n @app = current_user.apps.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, :notice => \"The application app was successfully created\" }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n format.html { render :action => :new }\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2db1790181c7393bfe760f2d2e563fb1",
"score": "0.5049954",
"text": "def create\n @application = current_user.build_application(application_params)\n\n respond_to do |format|\n if @application.save\n format.html { redirect_to @application, alert: 'Your application was successfully created.' }\n format.json { render action: 'show', status: :created, location: @application }\n else\n format.html { render action: 'new' }\n format.json { render json: @application.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d995c017bda02d4db57d96a293c9c2b1",
"score": "0.5046557",
"text": "def create(_state)\n workflow do\n run_apply\n end\n end",
"title": ""
},
{
"docid": "bddd971f311c2a4d8dcf5f22d9fd5bec",
"score": "0.50453544",
"text": "def create\n @app = App.new(app_params)\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, notice: 'App was successfully created.' }\n format.json { render :show, status: :created, location: @app }\n else\n format.html { render :new }\n format.json { render json: @app.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
c2dc7019e8b9925d0838fbc1a353ff98 | [BETA] Find nonposted vouchers. | [
{
"docid": "c0b7248be515d6981ca71ccfc346ecc9",
"score": "0.0",
"text": "def non_posted_with_http_info(include_non_approved, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LedgervoucherApi.non_posted ...\"\n end\n # verify the required parameter 'include_non_approved' is set\n if @api_client.config.client_side_validation && include_non_approved.nil?\n fail ArgumentError, \"Missing the required parameter 'include_non_approved' when calling LedgervoucherApi.non_posted\"\n end\n # resource path\n local_var_path = \"/ledger/voucher/>nonPosted\"\n\n # query parameters\n query_params = {}\n query_params[:'includeNonApproved'] = include_non_approved\n query_params[:'dateFrom'] = opts[:'date_from'] if !opts[:'date_from'].nil?\n query_params[:'dateTo'] = opts[:'date_to'] if !opts[:'date_to'].nil?\n query_params[:'changedSince'] = opts[:'changed_since'] if !opts[:'changed_since'].nil?\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'sorting'] = opts[:'sorting'] if !opts[:'sorting'].nil?\n query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['tokenAuthScheme']\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 => 'ListResponseVoucher')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LedgervoucherApi#non_posted\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
}
] | [
{
"docid": "8b7f0a9c5641ddce5830776dbc9322cd",
"score": "0.6195597",
"text": "def index\n @gift_vouchers = current_user.gift_vouchers.not_claimed\n end",
"title": ""
},
{
"docid": "65e9ea6dea4953d8e8d5cf42bac39b6f",
"score": "0.61915946",
"text": "def unapproved_reviews\n reviews.where('approved_by_id IS NULL')\n end",
"title": ""
},
{
"docid": "c4c9ec84234d01034ac516fb60069be3",
"score": "0.6144876",
"text": "def find_uninvited_users(users, paper)\n Invitation.find_uninvited_users_for_paper(users, paper)\n end",
"title": ""
},
{
"docid": "d329d6fdbbf97fc7adba4d6aaf02e305",
"score": "0.6110544",
"text": "def nonparticipating_reviewers\n reviewers.where('dev_id NOT IN (SELECT dev_id FROM participants WHERE issue=?)', issue)\n end",
"title": ""
},
{
"docid": "85d1a16be9d3a13af7da6a47ad1f071c",
"score": "0.60914105",
"text": "def survived_reviews\n reviews.where(:deleted_at.exists => false)\n end",
"title": ""
},
{
"docid": "873996419a7474a24e10ab4894026d21",
"score": "0.5959881",
"text": "def vouchers\n @page_title = _('Vouchers')\n\n @default = {:page => 1, :s_usable => \"all\", :s_active => \"all\", :s_number => \"\", :s_tag => \"\", :s_credit_min => \"\", :s_credit_max => \"\", :s_curr => \"\", :s_use_date => \"\", :s_active_till => \"\"}\n session[:vouchers_vouchers_options] ? @options = session[:vouchers_vouchers_options] : @options = @default\n\n # search\n\n if params[:clean]\n @options = @default\n else\n @options[:page] = params[:page].to_i if params[:page]\n @options[:s_usable] = params[:s_usable].to_s if params[:s_usable]\n @options[:s_usable] = params[:s_usable].to_s if params[:s_usable]\n @options[:s_active] = params[:s_active].to_s if params[:s_active]\n @options[:s_number] = params[:s_number].to_s if params[:s_number]\n @options[:s_tag] = params[:s_tag].to_s if params[:s_tag]\n @options[:s_credit_min] = params[:s_credit_min].to_s if params[:s_credit_min]\n @options[:s_credit_max] = params[:s_credit_max].to_s if params[:s_credit_max]\n @options[:s_curr] = params[:s_curr].to_s if params[:s_curr]\n @options[:s_use_date] = params[:s_use_date].to_s if params[:s_use_date]\n @options[:s_active_till] = params[:s_active_till].to_s if params[:s_active_till]\n end\n\n cond = ['vouchers.id > 0']\n var = []\n\n if @options[:s_active].to_s.downcase != 'all'\n if @options[:s_active].to_s == 'yes'\n cond << \"vouchers.active = 1\"\n else\n cond << \"vouchers.active = 0\"\n end\n end\n\n if @options[:s_usable].to_s.downcase != 'all'\n is_active = \"(NOT ISNULL(use_date) OR active_till < ?)\"\n\n if @options[:s_usable].to_s == 'yes'\n cond << \"(NOT (#{is_active}) AND active = 1)\"\n else\n cond << \"NOT (NOT (#{is_active}) AND active = 1)\"\n end\n var << current_user.user_time(Time.now)\n end\n\n [\"number\", \"tag\"].each { |col|\n add_contition_and_param(@options[\"s_#{col}\".to_sym], \"%\"+@options[\"s_#{col}\".intern].to_s+\"%\", \"vouchers.#{col} LIKE ?\", cond, var) }\n\n [\"use_date\", \"active_till\"].each { |col|\n add_contition_and_param(@options[\"s_#{col}\".to_sym], @options[\"s_#{col}\".intern].to_s+\"%\", \"vouchers.#{col} LIKE ?\", cond, var) }\n\n if !@options[:s_credit_min].blank?\n cond << \"credit_with_vat >= ?\"; var << @options[:s_credit_min]\n end\n\n if !@options[:s_credit_max].blank?\n cond << \"credit_with_vat <= ?\"; var << @options[:s_credit_max]\n end\n\n if !@options[:s_curr].blank?\n cond << \"currency = ?\"; var << @options[:s_curr]\n end\n\n @total_vouchers = Voucher.count(:all, :conditions => [cond.join(\" AND \")]+var, :order => \"use_date DESC, active_till ASC\")\n MorLog.my_debug(\"TW: #{@total_vouchers}\")\n @options[:page] = @options[:page].to_i < 1 ? 1 : @options[:page].to_i\n @total_pages = (@total_vouchers.to_d / session[:items_per_page].to_d).ceil\n @options[:page] = @total_pages if @options[:page].to_i > @total_pages.to_i and @total_pages.to_i > 0\n @fpage = ((@options[:page] -1) * session[:items_per_page]).to_i\n\n @vouchers = Voucher.find(:all, :include => [:tax, :user], :conditions => [cond.join(\" AND \")]+var, :order => \"use_date DESC, active_till ASC\", :limit => \"#{@fpage}, #{session[:items_per_page].to_i}\")\n\n @search = 0\n @search = 1 if cond.length > 0\n\n @use_dates = Voucher.get_use_dates\n @active_tills = Voucher.get_active_tills\n @currencies = Voucher.get_currencies\n\n session[:vouchers_vouchers_options] = @options\n\n if params[:csv] and params[:csv].to_i > 0\n sep = Confline.get_value(\"CSV_Separator\", 0).to_s\n dec = Confline.get_value(\"CSV_Decimal\", 0).to_s\n @vouchers = Voucher.find(:all, :include => [:tax, :user], :conditions => [cond.join(\" AND \")]+var, :order => \"use_date DESC, active_till ASC\")\n csv_string = _(\"Active\")+sep+_(\"Number\")+sep+_(\"Tag\")+sep+_(\"Credit\")+sep + _(\"Credit_with_VAT\")+sep + _(\"Currency\")+sep + _(\"Use_date\")+sep + _(\"Active_till\")+sep + _(\"User\")\n csv_string += \"\\n\"\n for v in @vouchers\n # credit= nice_number v.get_tax.count_amount_without_tax(v.credit_with_vat)\n user = v.user\n active = 1\n active = 0 if v.use_date\n active = 0 if v.active_till.to_s < Time.now.to_s\n user ? nuser = nice_user(user) : nuser = \"\"\n\n csv_string += \"#{active.to_s}#{sep}#{v.number.to_s}#{sep}#{v.tag.to_s}#{sep}\"\n if can_see_finances?\n csv_string += \"#{nice_number(v.count_credit_with_vat).to_s.gsub(\".\", dec).to_s}#{sep}#{nice_number(v.credit_with_vat).to_s.gsub(\".\", dec).to_s}#{sep}#{v.currency}#{sep}\"\n end\n csv_string += \"#{nice_date_time v.use_date}#{sep}#{nice_date(v.active_till).to_s}#{sep}#{nuser}\"\n csv_string +=\"\\n\"\n end\n\n filename = \"Vouchers.csv\"\n if params[:test].to_i == 1\n render :text => csv_string\n else\n send_data(csv_string, :type => 'text/csv; charset=utf-8; header=present', :filename => filename)\n end\n end\n\n end",
"title": ""
},
{
"docid": "1b3044a19d78c35e5efa96d23967e8ff",
"score": "0.59258443",
"text": "def get_volunteers_not_assigned_to_poc(poc_id_param)\n User.find_by_sql(\"select distinct u.* from users u join reports_tos rt on\n (rt.user_id = u.id) join user_role_maps rm on (u.id = rm.user_id) join roles r on\n (rm.role_id = r.id) where rm.user_id != \" + poc_id_param + \" and r.role = '\" + Role.VOLUNTEER.to_s + \"' and u.is_deleted=0\");\n end",
"title": ""
},
{
"docid": "978ccb8c95eb0b3fa056edea75b25255",
"score": "0.59235215",
"text": "def records_not_reviewed\n Collection.all_records.select do |record|\n (record.reviews.select do |review|\n (review.user == self && review.review_state == 1)\n end).empty?\n end\n end",
"title": ""
},
{
"docid": "5b08a72121a1def8c4d13b6537f10cae",
"score": "0.5891216",
"text": "def cannot_accommodate(vouchers)\n seats = self.seat_list.split(/\\s*,\\s*/)\n vouchers.select do |v|\n ! v.seat.blank? && ! seats.include?(v.seat)\n end\n end",
"title": ""
},
{
"docid": "5d2ff7ac8713c76efdb92f61fa7d612f",
"score": "0.5870799",
"text": "def votes_without_bad_users\n @votes_without_bad_users ||= votes.reject { |v| Vote.count(:conditions => {'voter_id' => v.voter_id}) < 2 }\n end",
"title": ""
},
{
"docid": "7021894d2dcb92d3a060106fa7803774",
"score": "0.5796045",
"text": "def past_officers\n officers.reject { |x| x.current? }\n end",
"title": ""
},
{
"docid": "455e9c29460094ae9a5170f85b2ab770",
"score": "0.57747316",
"text": "def self_unapproved(current_user,product)\n product.reviews.collect{|r| r if r.user_id == current_user.id || r.approved}.reject(&:blank?)\n end",
"title": ""
},
{
"docid": "91a149a230fb4e8ea4747b2e71da106c",
"score": "0.57414216",
"text": "def missing\n # Getting the components of the cutoff date doesn't really work...\n\n # @cutoff_date = Date.new(params[:date][\"cutoff_date(1i)\"].to_i,params[:date][\"cutoff_date(2i)\"].to_i,params[:date][\"cutoff_date(3i)\"].to_i)\n @cutoff_date = (params[:date] && Date.send(:new, *params[:date].to_a.sort_by(&:first).collect(&:second).collect(&:to_i))) || Date.today\n\n officers, candidates = ['officers', 'candidates'].collect do |group_name|\n Group.find_by_name(group_name).people.order(:first_name).includes(:resumes)\n end\n\n # limit officers to current only\n officers &= Committeeship.current.officers.collect(&:person)\n\n @officers_without_resumes, @candidates_without_resumes = [officers,candidates].collect do |ppl|\n ppl.reject { |p| p.resumes.since(@cutoff_date).exists? }\n end\n\n @people_in_book = Resume.since(@cutoff_date).includes(:person).collect(&:person).uniq.sort_by(&:full_name)\n\n end",
"title": ""
},
{
"docid": "73ff44a69fd2e6c84053dd5bc8b77c06",
"score": "0.57311916",
"text": "def notapproved\n\t\t@not_approves = Death.find(:all, :conditions => \"approved = 0\")\n\tend",
"title": ""
},
{
"docid": "5ad3fccab7b8756d52a8166b205f7dd7",
"score": "0.57286",
"text": "def records_not_reviewed\n application_mode = self.mdq_user? ? :mdq_mode : :arc_mode\n Collection.all_records(application_mode).select do |record|\n (record.reviews.select do |review|\n (review.user == self && review.review_state == 1)\n end).empty?\n end\n end",
"title": ""
},
{
"docid": "924699db2e2b1061b905b794d4fe85da",
"score": "0.5711177",
"text": "def unconfirmed_guests\n #first - unconfirmed invitations\n unconfirmed = invitations.select do |i|\n i.confirmed == false\n end\n #then - guests on those unconfirmed invitations\n unconfirmed.map do |u|\n u.guest\n end\n end",
"title": ""
},
{
"docid": "8862e7b66c02bf6437ad04c44d9330a0",
"score": "0.56345284",
"text": "def voters\n User.where(:id => self.votings.map(&:voter_id))\n end",
"title": ""
},
{
"docid": "0a7e66eee8d2a91e2b6fd3ed1fe30775",
"score": "0.56156135",
"text": "def filter(arg, vouchers)\n total_vouchers = 0\n begin\n if arg[:promotion_id].present?\n vouchers = Promotion.find(arg[:promotion_id]).vouchers\n end\n\n total_vouchers = vouchers.count\n\n if vouchers.kind_of?(Array)\n vouchers = Kaminari.paginate_array(vouchers).page(arg[:page]).per(arg[:per])\n else\n vouchers = vouchers.page(arg[:page]).per(arg[:per])\n end\n\n rescue\n vouchers = []\n total_vouchers = 0\n end\n\n return vouchers, total_vouchers\n end",
"title": ""
},
{
"docid": "7d98c6f530d810794c33e6381b450340",
"score": "0.5608846",
"text": "def approved_reviews\n reviews.where('approved_by_id IS NOT NULL')\n end",
"title": ""
},
{
"docid": "4f9273aad40c5b581205ed71a9615fcc",
"score": "0.5602543",
"text": "def off_list_users\n venue.users.where.not(id: email_list_user_connectors.select(:user_id))\n end",
"title": ""
},
{
"docid": "2d28f81f3c96376ed553d84b358aaa7a",
"score": "0.5602056",
"text": "def unapproved_holiday_requests\n self.holiday_requests.where(\n \"authorised = ? AND authorised_by_id IS NOT NULL\",\n false\n )\n end",
"title": ""
},
{
"docid": "d89d44e2a98788e6a9b4f4102318cad1",
"score": "0.5567035",
"text": "def not_reviewed\n @reviewing = self.reviewees\n @users = User.all\n @not_reviewing = @users - @reviewing\n end",
"title": ""
},
{
"docid": "51462ce8489c3be217e57122664360ca",
"score": "0.5563229",
"text": "def num_non_proxy_user_reviews\r\n reviews.count :conditions => { :partner_pub_date => nil }\r\n end",
"title": ""
},
{
"docid": "ed12153b26e91365e6997fed4fd0471c",
"score": "0.5554239",
"text": "def index\n @votes = Vote.all.select { |v| !v.private }\n end",
"title": ""
},
{
"docid": "7282e7a1802b5ff7b91b2606b0b7e34f",
"score": "0.554778",
"text": "def get_unviewed_ids(user)\n key = user_key(user)\n redis.zremrangebyscore(key, '-inf', Time.now.to_i)\n redis.zrevrangebyscore(key, '+inf', '-inf')\n end",
"title": ""
},
{
"docid": "72672bcdd3110b6ee385800eccca6d52",
"score": "0.5545694",
"text": "def unviewed_alerts\n ReviewerAlert.find(:all, \n :joins => \"LEFT JOIN alert_viewings ON alert_viewings.reviewer_alert_id = reviewer_alerts.id AND alert_viewings.user_id = #{self.id}\",\n :conditions => \"alert_viewings.reviewer_alert_id IS NULL\",\n :order => \"reviewer_alerts.created_at desc\", :limit => 10)\n end",
"title": ""
},
{
"docid": "80db23c413d9e56d184e78785999ac18",
"score": "0.5536908",
"text": "def index\n @deposits = Investment.where.not(status: 'draft')\n end",
"title": ""
},
{
"docid": "8b3c919471f7f08a73fa93917bc7b903",
"score": "0.55299854",
"text": "def invites_to_me\n invites.where(\"created_by != ?\", self.id)\n end",
"title": ""
},
{
"docid": "1a318ddd7b554b74d9150c6cc95b18f6",
"score": "0.55266106",
"text": "def get_included_vouchers\n if self.bundle?\n (self.included_vouchers ||= {}).\n delete_if { |k,v| v.blank? }.\n inject(Hash.new) { |h,(k,v)| h[k.to_i] = v.to_i ; h }\n else\n {}\n end\n end",
"title": ""
},
{
"docid": "794137547091376fdad1ddb9fd129669",
"score": "0.55250555",
"text": "def index \n @reviews = @company.reviews.where('user_id != ?', current_user.id).all.paginate(:page => params[:page])\n render json: @reviews\n end",
"title": ""
},
{
"docid": "cfc01a84062670e051c36fdd067a600d",
"score": "0.55245227",
"text": "def missing\n @cutoff_date = params[:date] ? params[:date].map{|k,v| v}.join(\"-\").to_date : nil\n if @cutoff_date\n session[:cutoff_date] = @cutoff_date # hack to hold the cutoff date on location.reload when including/excluding\n else\n @cutoff_date = session[:cutoff_date]\n end\n\n officers = Role.semester_filter(MemberSemester.current).officers.all_users_resumes\n candidates = Role.semester_filter(MemberSemester.current).candidates.all_users_resumes\n\n @officers_without_resumes, @candidates_without_resumes = [officers,candidates].collect do |ppl|\n ppl.reject { |p| p.resume && p.resume.file_updated_at.to_date >= @cutoff_date }\n end\n\n @users_in_book = Resume.where(\"file_updated_at >= ?\", @cutoff_date).includes(:user).collect(&:user).sort_by(&:full_name)\n\n end",
"title": ""
},
{
"docid": "d4cdf4166066fff6f4d71948e4559333",
"score": "0.55122334",
"text": "def get_all_tivit_commenters_excluding_user (user)\n# Ilan: This code can be improved by using a distinct SQL command\n#return array of users excluding user\n users = User.joins(:tivitcomments).where(\"tivitcomments.activity_id = ? AND users.id = tivitcomments.user_id AND NOT tivitcomments.user_id = ? \",self.id, user.get_id)\n \n users = users.uniq\n return users\n end",
"title": ""
},
{
"docid": "577cd8357e7f1255be1d905c12bb1cb3",
"score": "0.5501956",
"text": "def uninfecteds\n where(infested: \"Nao\")\n end",
"title": ""
},
{
"docid": "8214d2c0fc853e4e443c9686e390b5cd",
"score": "0.5493848",
"text": "def rejected_invitations\n contacts.where(rejected_on: nil)\n end",
"title": ""
},
{
"docid": "76d0b6a43c82187a8ca7b7673a8436a6",
"score": "0.54819757",
"text": "def index\n @docs=DocHead.where(\"id in (#{params[:doc_ids]})\").all\n rg_all=(params[:rg]==\"true\")\n @docs.each {|d| d.rg_vouches(current_user.person.name) if (rg_all or d.vouches.count==0) }\n end",
"title": ""
},
{
"docid": "4435740c7c9d2d9b6863666f15404bcc",
"score": "0.5479906",
"text": "def get_unviewed_ids(user)\n key = user_key(user)\n redis.zremrangebyscore(key, '-inf', Process.clock_gettime(Process::CLOCK_MONOTONIC).to_i)\n redis.zrevrangebyscore(key, '+inf', '-inf')\n end",
"title": ""
},
{
"docid": "4435740c7c9d2d9b6863666f15404bcc",
"score": "0.5479906",
"text": "def get_unviewed_ids(user)\n key = user_key(user)\n redis.zremrangebyscore(key, '-inf', Process.clock_gettime(Process::CLOCK_MONOTONIC).to_i)\n redis.zrevrangebyscore(key, '+inf', '-inf')\n end",
"title": ""
},
{
"docid": "984741e4ad6fed651d25d73ec21325ee",
"score": "0.54715925",
"text": "def all_docs_rejected(person)\n person.try(:consumer_role).try(:vlp_documents).select{|doc| doc.identifier}.all?{|doc| doc.status == \"rejected\"}\n end",
"title": ""
},
{
"docid": "667e024cc9cfbc9c7bd9653eb5c6a7b7",
"score": "0.5409585",
"text": "def resident_upvotes \n self.votes_for.voters.select { |user| user.city == self.city }\n end",
"title": ""
},
{
"docid": "0d4124e2918ebf48752a5ebb71630be9",
"score": "0.5394656",
"text": "def potential_partners\n ids = partners.pluck(:id)\n ids.empty? ? Partner.scoped : Partner.where('id NOT IN (?)', ids)\n end",
"title": ""
},
{
"docid": "467a9d1366f31870d5ee3d6c12fe7a7b",
"score": "0.5386486",
"text": "def userless_people\n people.select{|p| p.user.nil?}\n end",
"title": ""
},
{
"docid": "467a9d1366f31870d5ee3d6c12fe7a7b",
"score": "0.5386486",
"text": "def userless_people\n people.select{|p| p.user.nil?}\n end",
"title": ""
},
{
"docid": "bf491ecd0037490f416e3cbba64052fd",
"score": "0.53648835",
"text": "def bar_reviews\n # self.events.map(&:reviews).flatten.select { |rev| rev.user_id != self.id }\n self.events.map(&:reviews).flatten.reject { |rev| rev.user_id == self.user.id }\n end",
"title": ""
},
{
"docid": "ef8554e0abc347965c961d6deceaef2f",
"score": "0.535806",
"text": "def get_entries_without_bets(week)\n entry_ids_for_week = SurvivorBet.where(week: week)\n .select(:survivor_entry_id)\n .collect { |bet| bet.survivor_entry_id }\n return SurvivorEntry.includes(:user)\n .where(year: Date.today.year)\n .where(\"id not in (?)\", entry_ids_for_week)\n .where(\"is_alive = true OR knockout_week = \" + week.to_s)\n end",
"title": ""
},
{
"docid": "daea871692371987ccf73cf4dc288a9a",
"score": "0.53542864",
"text": "def except_current_user(users) #passing in instance variable of users\n users.reject{ |user| user.id == self.id } #if the (instance that's calling it, which is a user) search users id matches the search result user that populates, reject it.\n end",
"title": ""
},
{
"docid": "3f0c81f5c04b5f99eec60cfdfd6bd8b6",
"score": "0.5321338",
"text": "def bundles_include_only_zero_cost_vouchers\n included_vtypes = Vouchertype.find(included_vouchers.keys)\n non_free = included_vtypes.select { |v| v.price.to_i != 0 }\n unless non_free.empty?\n errors.add(:base, \"Bundles cannot include revenue vouchers (#{non_free.map(&:name).join(', ')})\")\n end\n end",
"title": ""
},
{
"docid": "ca71d8895e56f59cf713c42be02b529c",
"score": "0.5319129",
"text": "def pets_not_reviewed\n pending_pets = pets.joins(:application_pets).where(\"application_pets.status = 'Pending'\")\n pending_pets.uniq\n end",
"title": ""
},
{
"docid": "0a69f4dee4052416d37de414931efcce",
"score": "0.5318473",
"text": "def voters\n Member.from_response client.get(\"/cards/#{id}/membersVoted\")\n end",
"title": ""
},
{
"docid": "64ce96f3ea4fa05fa2342f5c0f227ce7",
"score": "0.53132015",
"text": "def for email\n reject do |reviewer|\n reviewer.emails.include? email\n end\n end",
"title": ""
},
{
"docid": "c954b9be22eb612a8b79244f876f902c",
"score": "0.53116184",
"text": "def unregistered_user(new_user)\n conn = http_connection()\n\n response = conn.get do |req|\n req.url \"/admin/customers/search.json\"\n req.params = { query: new_user}\n end\n customers = JSON.parse(response.body)['customers']\n customers.length == 0 && Invitation.where(email: new_user).length == 0\nend",
"title": ""
},
{
"docid": "3c42e3b40843303e8745d6d6bef353b4",
"score": "0.5311048",
"text": "def listVoters\n Vote.find_all_by_post_id(self.id)\n end",
"title": ""
},
{
"docid": "53e36eafd722ce3a0515494f85e28592",
"score": "0.5307855",
"text": "def dvds(options= {:order => 'created_at DESC', :limit => 5}, without_mydvds = false)\n #Dvd.all(:conditions => ['owner_id in (?) and state = ? and owner_id != ?', get_visible_user_ids, 'available', without_mydvds ? self.id : 0 ])\n Dvd.all(options.merge(:conditions => ['owner_id in (?) and state != ? and owner_id != ?', get_visible_user_ids, 'blocked', without_mydvds ? id : 0 ]))\n end",
"title": ""
},
{
"docid": "09a6fffa73705266e70a9f41237f8763",
"score": "0.5305193",
"text": "def viewers(movie)\n\n\t \tuserarray=@movies[movie.to_i]\n\t \tusers=@users.select {|k,v| userarray.include? k} \n\t return users\n\t end",
"title": ""
},
{
"docid": "01d2ee6745afb8ad53372d7defdc2e73",
"score": "0.53008616",
"text": "def index\n @redeemed_vouchers = RedeemedVoucher.all\n end",
"title": ""
},
{
"docid": "2f1b3ee0de9302703fddd98f29aa2563",
"score": "0.52958983",
"text": "def votes_pending_notification\n votes.not_notified.where.not(voter_id: user_id)\n end",
"title": ""
},
{
"docid": "ce1ad1a3c1d2ce9d3521edd861681f35",
"score": "0.5270626",
"text": "def upvotes\n if current_user == object.creator # return everything\n object.upvotes\n elsif current_user&.shadow_banned? # return non-shadowbanned + own votes\n object.upvotes.select do |u|\n u.user.shadow_banned? == false || u.user == current_user\n end\n else # return non-shadowbanned\n object.upvotes.select { |u| u.user.shadow_banned? == false }\n end\n end",
"title": ""
},
{
"docid": "9d4973e053cc4630f7d8b1838d68d51f",
"score": "0.5269642",
"text": "def find_all_soon_to_expire_partners\n find(:all, find_options_for_expired_partners(-7)) - find_all_expired_partners\n end",
"title": ""
},
{
"docid": "cc63c88d3d2ac9d71d5ed2150bda1104",
"score": "0.5269598",
"text": "def list_venues users\n venues = []\n users.each do |u|\n u.favourites.each do |f|\n f.venues.each do |v|\n venues << v unless venues.include? v\n end\n end\n end\n return venues\n end",
"title": ""
},
{
"docid": "a47664e293b7792d88f52bae5c95f906",
"score": "0.52687806",
"text": "def show\n @vouchers = Catering.find(params[:id]).vouchers\n end",
"title": ""
},
{
"docid": "4fd08e35fd49233bebda1f1afeceafde",
"score": "0.526379",
"text": "def index\n # @people = Person.not_customers\n @people = @company.people.not_customers\n end",
"title": ""
},
{
"docid": "ac3b8aaacad0ee1ae2f0d1ad422d83d2",
"score": "0.5262023",
"text": "def get_non_pruned\n @qq.select { |q| !pruned?(q) }\n end",
"title": ""
},
{
"docid": "3643a985c550f8fc459de07b24200eb5",
"score": "0.52582186",
"text": "def missing_reviews\n if @missing_reviews.nil?\n @missing_reviews = []\n attribs = [:by_group, :by_user, :by_project, :by_package]\n\n (open_requests + selected_requests).uniq.each do |req|\n req.reviews.each do |rev|\n unless rev.state.to_s == 'accepted' || rev.by_project == name\n # FIXME: this loop (and the inner if) would not be needed\n # if every review only has one valid by_xxx.\n # I'm keeping it to mimic the python implementation.\n # Instead, we could have something like\n # who = rev.by_group || rev.by_user || rev.by_project || rev.by_package\n attribs.each do |att|\n if who = rev.send(att)\n @missing_reviews << { id: rev.id, request: req.number, state: rev.state.to_s, package: req.package, by: who }\n end\n end\n end\n end\n end\n end\n @missing_reviews\n end",
"title": ""
},
{
"docid": "c9fcd2b6db94ec4c037b760164e3201b",
"score": "0.52551913",
"text": "def survived_comments\n comments.where(:deleted_at.exists => false)\n end",
"title": ""
},
{
"docid": "cee860a3bdf7b05f7245c53f76972700",
"score": "0.52512324",
"text": "def non_submitted_poems\n self.poems.where(:submitted => false)\n end",
"title": ""
},
{
"docid": "c1f6a4c7b725a4f6a3518e71b22f4af3",
"score": "0.5248226",
"text": "def get_all_invisible_to_me\n #invited_users = User.with_role(:invited_user).pluck('users.id')\n deleted_users = User.where('deleted_at is not null').pluck('users.id')\n users = self.hidden_user_ids.concat(self.invisible_to_me).concat(deleted_users).concat([self.id])\n if users == []\n # Needed to fix MySQL bug where an '.. NOT IN (NULL)' query does not work\n return [self.id]\n else\n return users\n end\n end",
"title": ""
},
{
"docid": "70d96c9417b9c5bafedc1f9a782e7dc1",
"score": "0.5246829",
"text": "def player_non_submitted_poems\n self.non_submitted_poems.select do |poem|\n Round.find(poem.round_id).creator_id != self.id\n end\n end",
"title": ""
},
{
"docid": "bd91f036ac4341218fcc91453100c94e",
"score": "0.52358884",
"text": "def searches_not_ready(sr_id)\n Search.where(:user_id=>user[:id], :valid=>nil, :systematic_review_id=>sr_id)\n end",
"title": ""
},
{
"docid": "7cf8232ddfd5ddd7742a127285202610",
"score": "0.5234301",
"text": "def relevant_incivents(search)\r\n Incivent.unarchived.search(self, search)\r\n end",
"title": ""
},
{
"docid": "3f1f31a4edf41f39efa2a35a0a03e879",
"score": "0.5234194",
"text": "def dont_ask_for_feedback(days_not_to_reask = 10)\n #find comments where user updated in last X days\n comments = Comment.where(\"updated_at >= ?\",Date.today-days_not_to_reask.days)\n .where(user_id: self.id)\n #see if untouched; if so, get provider\n comments = comments.reject{|c| c.untouched?}\n return comments.map{|c| c.provider.name}.uniq\n #dedupe and return the names as array\n end",
"title": ""
},
{
"docid": "e982d57561d2fee4dec9c127d758ed0d",
"score": "0.52319795",
"text": "def non_pr_results\n Result.joins(:grouping)\n .where('groupings.assessment_id': id, 'submissions.submission_version_used': true)\n .where.missing(:peer_reviews)\n end",
"title": ""
},
{
"docid": "5bad7e63865d7f32f13c03e23824899b",
"score": "0.52312243",
"text": "def extant_citations\n citations.select {|c|! c.status.eql? 'Deleted'}\n end",
"title": ""
},
{
"docid": "6b7597cd9d0ec71b070cfb9f292cf52e",
"score": "0.5214402",
"text": "def non_business_owner_enrolled\n enrolled.select{|ce| !ce.is_business_owner}\n end",
"title": ""
},
{
"docid": "ea89a9332df4f75f653b33ba332f2427",
"score": "0.5211428",
"text": "def has_not_seen\n Politician.all.select do |politician|\n !self.politicians.include?(politician)\n end\n end",
"title": ""
},
{
"docid": "06d8ee1c4385e1c29cb8e3bc98075a67",
"score": "0.520672",
"text": "def no_offer_custumise_24\n\t\trequests = Request.where(created_at: 24.hours.ago..Time.now).includes(:offers).where( :offers => { :request_id => nil } )\n\t\treq = []\n\t\tif requests.present?\n\t\t\trequests.each do |f|\n\t\t\t \tif f.request_designers.present?\n\t\t\t \t\tf.request_designers.each do |ff|\n\t\t\t \t\t\tif (ff.designer.full_name.include? \"Custumise Gold\") || (ff.designer.full_name.include? \"Custumise\")\n\t\t\t \t\t\t\treq.push(f)\n\t\t\t \t\t\tend\n\t\t\t \t\tend\n\t\t\t \tend\n\t\t\tend\n\t\tend\n\t\t@req = req.uniq\n\t\t@requests = Request.where(id:@req)\n\t\tif @requests.present?\n\t\t\trespond_to do |format|\n\t format.csv {send_data @requests.to_csv}\n\t end\n\t\telse\n\t redirect_to support_reports_path\n\t end\n\tend",
"title": ""
},
{
"docid": "1560645b91af2421c7a0df8be5c8e9a7",
"score": "0.51967686",
"text": "def get_undescribed_requests\n self.info_requests.find(\n :all, \n :conditions => [ 'awaiting_description = ? and ' + InfoRequest.last_event_time_clause + ' < ?', \n true, Time.now() - 1.day \n ] \n )\n end",
"title": ""
},
{
"docid": "8a8b0a38b6ad16063f9cc9c4df56f595",
"score": "0.51876503",
"text": "def index\n #@mailings = Mailing.where.not(creator: current_user.uid)\n mailings = Mailing.where.not(creator: current_user.uid).order(nom: :asc)\n @mailings = []\n\n mailings.each do |mailing|\n if ! mailing.contains_user_valide(current_user.uid)\n @mailings.push(mailing)\n end\n end\n end",
"title": ""
},
{
"docid": "81c6eab302c8c858ec569636116fc7d4",
"score": "0.51815987",
"text": "def invoices_not_paid\n @invoice_repository.all.reject do |invoice|\n invoice_paid_in_full?(invoice.id)\n end\n end",
"title": ""
},
{
"docid": "81c6eab302c8c858ec569636116fc7d4",
"score": "0.51815987",
"text": "def invoices_not_paid\n @invoice_repository.all.reject do |invoice|\n invoice_paid_in_full?(invoice.id)\n end\n end",
"title": ""
},
{
"docid": "0a7113c4fbe2383b0822454fa1cc0087",
"score": "0.51650316",
"text": "def index\n @free_doctors = Doctor.where.not(Appointment.all)\n end",
"title": ""
},
{
"docid": "e7837919dfb6dcc702671e8a0b228406",
"score": "0.5154933",
"text": "def get_pets_not_on_app\n Pet.where.not(id: pets.ids)\n end",
"title": ""
},
{
"docid": "00e08e71f3c7c949d1e2accde1fab324",
"score": "0.5148608",
"text": "def show_users_queue\n self.views.select do |v|\n !v.watched\n end \n end",
"title": ""
},
{
"docid": "d1b8f16477545af59ab21d0881ecf563",
"score": "0.5142928",
"text": "def reviews\n bookings.map(&:guest_review).compact\n end",
"title": ""
},
{
"docid": "f7f1a6129e7b0cb1354eb58c1d68ebec",
"score": "0.5137637",
"text": "def reviews\n @deal_reviews = @deal.reviews.where('end_user_id != ?',current_user.id)\n render_success(template: :reviews)\n end",
"title": ""
},
{
"docid": "25b3a71cf639e058d371ec8ba56df36a",
"score": "0.5135164",
"text": "def restaurants_not_reviewed_by(reviewer, limit = 5)\n TagMapping.all(\n :joins => ['LEFT JOIN reviews ON reviews.restaurant_id = tag_mappings.restaurant_id',\n 'LEFT JOIN restaurants ON restaurants.id = tag_mappings.restaurant_id',\n 'LEFT JOIN users ON reviews.user_id = users.id'],\n :select => 'tag_mappings.*, restaurants.*',\n :limit => limit,\n :group => 'reviews.restaurant_id',\n :conditions => ['tag_id = ? AND reviews.user_id <> ? AND restaurants.user_id <> ?',\n self.id, reviewer.id, reviewer.id]).collect(&:restaurant)\n end",
"title": ""
},
{
"docid": "b40a4367a7d7188cb3edaa0d4338cffa",
"score": "0.5125733",
"text": "def index\n @vouchers = Voucher.page(params[:page]).per(50)\n end",
"title": ""
},
{
"docid": "f6a8b3e65be02d59a4ab7b59c164d237",
"score": "0.51240003",
"text": "def expire_vouchers(opts = {})\n expire_vouchers_with_http_info(opts)\n nil\n end",
"title": ""
},
{
"docid": "4236c7b6b37de70177a4278a59f2604a",
"score": "0.5123904",
"text": "def bundles_include_only_zero_cost_vouchers\n return if self.get_included_vouchers.empty?\n self.get_included_vouchers.each_pair do |id,num|\n next if num.to_i.zero?\n unless v = Vouchertype.find_by_id(id)\n errors.add_to_base \"Vouchertype #{id} doesn't exist\"\n else\n unless v.price.to_i.zero?\n errors.add_to_base \"Bundle can't include revenue voucher #{id} (#{v.name})\"\n end\n end\n end\n end",
"title": ""
},
{
"docid": "adbfc780d32dae433dd44867a583d52b",
"score": "0.51098996",
"text": "def index\n own_id = current_user.id\n @all_requests = Request.all\n @requests_to_me = Request.where(:requested => own_id).where.not(:accepted => \"deleted\")\n @my_requests = Request.where(:requester => own_id)\n end",
"title": ""
},
{
"docid": "b66803d9cab46b88e521a77d33ceded9",
"score": "0.5107913",
"text": "def missing_email\n @customers = Customer.where(:email_address => nil)\n end",
"title": ""
},
{
"docid": "89347b1add39270ad2f4b6420347a766",
"score": "0.50997967",
"text": "def search_pending\n ::User.not_approved\n end",
"title": ""
},
{
"docid": "acb6f3599553fddef1f0cf3999fd7e41",
"score": "0.50970244",
"text": "def notapproved\n\t\t@notapproves = Birth.find(:all, :conditions => \"approved = 0\",:order => \"register_id\")\n \trespond_to do |format|\t\t\n \t\t format.html \n \t\t format.xml { render :xml => @notapproves }\t\t#Render to XML File\n \tend\n\tend",
"title": ""
},
{
"docid": "f037ced8feefbcd2a17238077940a0bd",
"score": "0.5089432",
"text": "def voters\n\t\t@voter\n\tend",
"title": ""
},
{
"docid": "a55ecded962061aeda9051033c411cb1",
"score": "0.5087718",
"text": "def num_proxy_user_reviews\r\n reviews.count :conditions => \"`partner_pub_date` IS NOT NULL\"\r\n end",
"title": ""
},
{
"docid": "22797c118a73664ba958039eb24922bf",
"score": "0.5086967",
"text": "def vrn_not_found\n @search = helpers.payment_query_data[:search]\n end",
"title": ""
},
{
"docid": "e06005ced3e9a85f35119196255585a8",
"score": "0.5084551",
"text": "def index\n @vouchers = Voucher.all\n end",
"title": ""
},
{
"docid": "e06005ced3e9a85f35119196255585a8",
"score": "0.5084551",
"text": "def index\n @vouchers = Voucher.all\n end",
"title": ""
},
{
"docid": "9a63255275fada0dee2727b1532e6066",
"score": "0.5083759",
"text": "def non_draft_articles(articles)\n articles.select { |a| !a.data[:draft] }\n end",
"title": ""
},
{
"docid": "b05df2e0d5e7d8ad35bd324a3d519293",
"score": "0.50800973",
"text": "def voters_for\n voters = object.voters(true)\n format_voters(voters)\n end",
"title": ""
},
{
"docid": "ad51f3f1823c4fad404ae8e4474c8139",
"score": "0.5079739",
"text": "def search_non_baptised_members\n render json: @church.members.where(user_relationships: {baptised_at: nil}).search(params[:search]).limit(15).to_json(only: [:id, :full_name, :email, :avatar_url, :mention_key])\n end",
"title": ""
},
{
"docid": "dbda488f8fde077c3edb3c5adb0f9376",
"score": "0.5078085",
"text": "def reject\n @guests.select! do |guest|\n guest.accepted?\n end\n\n @users.select! do |user|\n @message.wedding.users.include? user\n end\n end",
"title": ""
},
{
"docid": "9d964cff0008283effd8389b06ff0c18",
"score": "0.5076749",
"text": "def exclude_user_guessed(user)\n photo_set.search()\n end",
"title": ""
}
] |
938d5c828b7d67a6589db1a0a64dbb0f | clear SMS fields if requested | [
{
"docid": "5d9fdf33ae4d0f74e88f582b6d30c5b7",
"score": "0.8240544",
"text": "def clear_sms_fields_if_requested\n if clear_twilio == \"1\"\n self.twilio_phone_number = nil\n self.twilio_account_sid = nil\n self.twilio_auth_token = nil\n self.twilio_auth_token1 = nil\n end\n self.frontlinecloud_api_key = nil if clear_frontlinecloud == \"1\"\n end",
"title": ""
}
] | [
{
"docid": "03b7c7e503d8e1cfa595e9780df6a36e",
"score": "0.66473264",
"text": "def clear_client_data\n self.phone = self.phone_normalized = self.email = self.name = nil\n end",
"title": ""
},
{
"docid": "65e29abe9c22a4d51fa7e52e9c554c3c",
"score": "0.658037",
"text": "def clear_standard_fields()\n\t\tend",
"title": ""
},
{
"docid": "6128c02cc922747dc89ea2f099572e5c",
"score": "0.65001804",
"text": "def clear\n @msgs.clear\n end",
"title": ""
},
{
"docid": "2ecca5def0109fb67ced463bfc9cfe31",
"score": "0.649201",
"text": "def clear_user_data\n self.phone = self.phone_normalized = self.email = self.name = nil\n end",
"title": ""
},
{
"docid": "e8567d29b2c839f0256dad612b490d8c",
"score": "0.64110637",
"text": "def clear\n messages.clear\n end",
"title": ""
},
{
"docid": "779d8ba84d21fef15618827e25d7e95d",
"score": "0.64092016",
"text": "def clear!\n _sent_messages.clear\n end",
"title": ""
},
{
"docid": "69c1b5c85ed2703ffe539a369917692f",
"score": "0.6402334",
"text": "def reset\n @messages.clear\n update\n end",
"title": ""
},
{
"docid": "69c1b5c85ed2703ffe539a369917692f",
"score": "0.6402334",
"text": "def reset\n @messages.clear\n update\n end",
"title": ""
},
{
"docid": "1e8748e879a9c67ebbc206bc7b529075",
"score": "0.6370699",
"text": "def clear\n @fields = []\n end",
"title": ""
},
{
"docid": "73b1b6ddd41fd514cb810f5b49a121c8",
"score": "0.6309438",
"text": "def clear_all_data\n\n @internal_fields.each do |key, value|\n\n @internal_fields[key] = ''\n\n end\n\n end",
"title": ""
},
{
"docid": "f3a5475d24538646de36c92d4825fb52",
"score": "0.62950504",
"text": "def clear\n @messages.clear\n end",
"title": ""
},
{
"docid": "f3a5475d24538646de36c92d4825fb52",
"score": "0.62950504",
"text": "def clear\n @messages.clear\n end",
"title": ""
},
{
"docid": "3f9b5c3ca29a868224e83da87d7374b8",
"score": "0.62944955",
"text": "def clear\n messages.clear\n end",
"title": ""
},
{
"docid": "2e36683fd6f9a419a82398f9bcdc0fcc",
"score": "0.628006",
"text": "def clear\n Cproton.pn_message_clear(@impl)\n @properties.clear unless @properties.nil?\n @instructions.clear unless @instructions.nil?\n @annotations.clear unless @annotations.nil?\n @body = nil\n end",
"title": ""
},
{
"docid": "b6e4b2ba948206ae5d2df0d146f898d5",
"score": "0.623506",
"text": "def clear\n @subject['value'] = ''\n end",
"title": ""
},
{
"docid": "e1d85b75ea422f5778f04b611c372e0e",
"score": "0.6226206",
"text": "def reset_messages\n messages.clear\n end",
"title": ""
},
{
"docid": "79e863483f5fe8fc1e993f0f3de43767",
"score": "0.6137444",
"text": "def clear\n @messages = []\n @timestamp = nil\n @fields = nil\n @tags = nil\n\n self\n end",
"title": ""
},
{
"docid": "18badff5a97526ab32b2690f760d657b",
"score": "0.61199605",
"text": "def reset\n @mailbox = nil\n end",
"title": ""
},
{
"docid": "d05b93d01a4024088922f64173359817",
"score": "0.609338",
"text": "def clear_fields\n self.password = nil\n end",
"title": ""
},
{
"docid": "b7c5b7b5523860073f53e6988a5705b2",
"score": "0.60582435",
"text": "def clear\n self.value = \"\"\n end",
"title": ""
},
{
"docid": "b7c5b7b5523860073f53e6988a5705b2",
"score": "0.60582435",
"text": "def clear\n self.value = \"\"\n end",
"title": ""
},
{
"docid": "0f2060f4c18a9dbfb4c1fd34c1807e63",
"score": "0.6051646",
"text": "def clear_fields\n self.password=nil\n self.role=nil\n self.username=nil\n self.email=nil\n self.password_confirmation=nil\n #self.email=nil\n end",
"title": ""
},
{
"docid": "935615ce06923726e2adc474f836ed20",
"score": "0.604482",
"text": "def clean_source_field\n source_field = rmq(:source_field).get\n source_field.text = \"\"\n end",
"title": ""
},
{
"docid": "ee28ff95d0bec591451eb56e2ba9c668",
"score": "0.6019411",
"text": "def clear_form()\n @pubname = @realname = @email = @filename = @user = ''\n @project = @pdfproject = ''\n @votelink = ''\n @familyfirst = false\n end",
"title": ""
},
{
"docid": "a9e588ef8a2aaed7cb886ce90c2879c3",
"score": "0.6018204",
"text": "def clear_messages\n @message_list.clear\n end",
"title": ""
},
{
"docid": "8153403e311339e4a9548c2b1a154ba8",
"score": "0.59972245",
"text": "def clear_amounts\n %w(amount_usd amount_wmr amount_wme).each{|m| self.send(\"#{m}=\", nil) }\n end",
"title": ""
},
{
"docid": "c90ebbab7b2915b38e8a5840709e58cd",
"score": "0.5979444",
"text": "def clear\n @service.clear_messages(self)\n end",
"title": ""
},
{
"docid": "e74c77d29a0ae722b7b7721cb72ce5e7",
"score": "0.59717554",
"text": "def clear_crm_mailchimp_data!\n FfcrmMailchimp.config.mailchimp_list_fields.collect{ |f| [f.klass, f.name] }.each do |klass, attr|\n klass.update_all( attr => nil )\n end\n end",
"title": ""
},
{
"docid": "0670168e48ca4373389c24b16228d600",
"score": "0.5967783",
"text": "def clear\n @_content = \"\"\n end",
"title": ""
},
{
"docid": "545f3e9ea8e1241e04ede1b44ea7e2fd",
"score": "0.5937273",
"text": "def clear!\n messages.clear\n @has_warnings = false\n end",
"title": ""
},
{
"docid": "5b4d2ac51f813d646e09ac0a5af030bb",
"score": "0.5929405",
"text": "def clear_fields\n update(author: nil, body: '[deleted]')\n end",
"title": ""
},
{
"docid": "1137d411b3e64f0a1ac20c5e309a548f",
"score": "0.5884332",
"text": "def clear\n ContactList.clear\n end",
"title": ""
},
{
"docid": "f9570199761f9b6a7a143974f9f534de",
"score": "0.58703625",
"text": "def clearField(theField)\n\t@length = theField.value\n\t@length.each_char { |c| theField.send_keys :backspace }\nend",
"title": ""
},
{
"docid": "9e7e9547f6fae56053a4c84c15e3089e",
"score": "0.58253187",
"text": "def cleanup\n self.value.strip!\n if is_phone? && get_area_code(value).blank? && !international? \n self.value = add_area_code(get_area_code(source.mobile_number),value)\n end\n end",
"title": ""
},
{
"docid": "d6f30906dfdbf2b4386e600a5d9a39ca",
"score": "0.5817928",
"text": "def remove_all_fields\n end",
"title": ""
},
{
"docid": "49327e6d240865323b985ea64e434f82",
"score": "0.58165896",
"text": "def empty_mailbox(options = {})\n if options.empty?\n self.sent_messages.delete_all\n self.received_messages.delete_all\n elsif options[:inbox]\n self.inbox.update_all(:deleted => true)\n elsif options[:outbox]\n self.outbox.delete_all\n elsif options[:trash]\n self.trash.delete_all\n end\n end",
"title": ""
},
{
"docid": "e4df3ab153912c9cce2851daa6cd72d1",
"score": "0.5814061",
"text": "def clean_telecom_numbers\n clean_did(self.phone)\n clean_did(self.mobile)\n clean_did(self.fax)\n end",
"title": ""
},
{
"docid": "e4df3ab153912c9cce2851daa6cd72d1",
"score": "0.5814061",
"text": "def clean_telecom_numbers\n clean_did(self.phone)\n clean_did(self.mobile)\n clean_did(self.fax)\n end",
"title": ""
},
{
"docid": "a7a9069d6fffb86837b41e07e74a5282",
"score": "0.5795814",
"text": "def reset\n @messages.clear\n @topics.each_value(&:clear)\n end",
"title": ""
},
{
"docid": "dbde5ad07dea75e599bf8fc28330d309",
"score": "0.57834685",
"text": "def reset\n @messages = []\n end",
"title": ""
},
{
"docid": "c5f39796d5b52be5623fdef27e52fea1",
"score": "0.5773001",
"text": "def reset_new_customer_box\n @new_customer_box.setHidden_(true)\n\t for i in 0..8\n @customer_form.cellAtIndex_(i).setStringValue(\"\")\n\t end\n end",
"title": ""
},
{
"docid": "cbcf5a33903a2a9436f773134fd50c46",
"score": "0.5769333",
"text": "def clear_info()\n $url_label['textvariable'].value = ''\n $board_label['textvariable'].value = ''\n $date_label['textvariable'].value = ''\n $replies_label['textvariable'].value = ''\n $images_label['textvariable'].value = ''\n $date_add_label['textvariable'].value = ''\n $last_post_label['textvariable'].value = ''\n $title_label['textvariable'].value = ''\n $new_posts_label['textvariable'].value = ''\n $status_label['textvariable'].value = ''\n \n $enabled_check.state = 'disabled'\nend",
"title": ""
},
{
"docid": "02f30137b2358968129d2869c0cebfee",
"score": "0.57476395",
"text": "def delete_sms_message sms_message\n @at_interface.send \"AT+CMGD=#{sms_message.message_id}\"\n end",
"title": ""
},
{
"docid": "02e9fb9ba8a16dbb4efde5ecb7365bab",
"score": "0.57275546",
"text": "def strip_empty_fields\n unset(\"email\") if email.blank?\n unset(\"oim_id\") if oim_id.blank?\n end",
"title": ""
},
{
"docid": "4f380fe5e613d69ad4efb8584abea081",
"score": "0.5726794",
"text": "def clear_basic\r\n self.clear_name_element.when_present.clear\r\n self.clear_description_element.when_present.clear\r\n self.clear_startdate_element.when_present.clear\r\n self.clear_industry_element.when_present.select \"--Please choose--\" \r\n end",
"title": ""
},
{
"docid": "05a21d39e5bdf1810e71530d309ff3f0",
"score": "0.5720266",
"text": "def clear!\n @content = \"\"\n end",
"title": ""
},
{
"docid": "a5a59704c9be21a0148a1fa5c7a2c1d4",
"score": "0.5719789",
"text": "def clear_messages\n \"$('#messages').empty();\".html_safe\n end",
"title": ""
},
{
"docid": "983cfab5bdb5068e1182ad8136393346",
"score": "0.5718417",
"text": "def clear_current_contact\n self.current_contact = nil\n end",
"title": ""
},
{
"docid": "789a6b3f027fc82b3f3061cee7666497",
"score": "0.5692247",
"text": "def clear_messages!\n @received_messages = []\n end",
"title": ""
},
{
"docid": "789a6b3f027fc82b3f3061cee7666497",
"score": "0.5692247",
"text": "def clear_messages!\n @received_messages = []\n end",
"title": ""
},
{
"docid": "a00bb5460e908562eb55cf264bbc7541",
"score": "0.56870484",
"text": "def reset\n @transmission.reset\n end",
"title": ""
},
{
"docid": "2c7687238489a9dd2f96f5a0570e47a4",
"score": "0.5684301",
"text": "def remove_all\n @input_note_messages.clear\n mark_changed\n true\n end",
"title": ""
},
{
"docid": "be836cea45ecb622bf0641d28942d7d1",
"score": "0.5679674",
"text": "def clear_result\n @result.setStringValue(\"\")\n @title.setStringValue(\"\")\n @detailURL.setStringValue(\"\")\n @publication.setStringValue(\"\")\n @status.setStringValue(\"\")\n @bookMsg.setStringValue(\"\")\n @message.setStringValue(\"\")\n end",
"title": ""
},
{
"docid": "c302a177917cdb112a7aaae88319e774",
"score": "0.5675982",
"text": "def reset\n self.body = \"\"\n end",
"title": ""
},
{
"docid": "110dad41703ac634b69c611b791592f9",
"score": "0.56709695",
"text": "def clear_password_fields\n self.password.clear if self.password\n self.password_confirmation.clear if self.password_confirmation\n self.password_digest.clear if self.password_digest\n end",
"title": ""
},
{
"docid": "29c7ad93a134239eae7c286a6853b953",
"score": "0.56647295",
"text": "def clear_input\n begin\n $results.log_action(\"#{@action}(#{@params[0]})\")\n @driver.find_element(:id, $session.form + @params[0]).clear\n $results.success\n rescue => ex\n $results.fail(\"#{@action}(#{@params[0]})\", ex)\n end\n end",
"title": ""
},
{
"docid": "898d0aae34b710815ac70c78273d09bb",
"score": "0.56590635",
"text": "def reset_form\n @form = ''\n end",
"title": ""
},
{
"docid": "4590b316abdd5a7ede6ad0fd3bd33948",
"score": "0.5655825",
"text": "def clear_ban_message\n self.ban_message = nil\n end",
"title": ""
},
{
"docid": "8ffb8f3163852fd8446dfc75b6541353",
"score": "0.56464016",
"text": "def reset_form\n #all the form inputs have to be present for the search to work, even if they're empty strings\n %w(ACCT fname lname number DIRECTION STREET SUFFIX).each do |k|\n @search_form[k] = ''\n end\n end",
"title": ""
},
{
"docid": "bdd46f708aa2192c96cfee7445239203",
"score": "0.56337583",
"text": "def clear\n ''\n end",
"title": ""
},
{
"docid": "861332bbf66328e53e0dba2f35b020e5",
"score": "0.56321436",
"text": "def clear()\n\t\treturn send_command(\"clear\")\n\tend",
"title": ""
},
{
"docid": "2e16993c0ad07b6b0ea541c30deb6c60",
"score": "0.56270325",
"text": "def remove_sms\n cancel_sms\n if not self.removed and can_destroyed? then\n self.removed = true\n self.removed_at = Time.now\n self.save!\n \n self.sms_outbox.update_attribute(:status_invalid, true) unless self.sms_outbox.status_invalid\n true\n end\n end",
"title": ""
},
{
"docid": "5076c46eeadc0cdef4b217d69429803c",
"score": "0.56190205",
"text": "def clear\n @subject.clear\n end",
"title": ""
},
{
"docid": "f65abd5b046dbed812e23b433630b469",
"score": "0.56133634",
"text": "def clear\n @res = @fields = @result = nil\n end",
"title": ""
},
{
"docid": "1e7101eade53f41e5b57c303ee0d682a",
"score": "0.5602206",
"text": "def clear_message\n session['message'] = nil\n session['message_class'] = 'alert'\n end",
"title": ""
},
{
"docid": "81b9c29e6479b339b81559d73a370bb9",
"score": "0.5599094",
"text": "def clear_reminder_sent_on\n self.payment_reminder_sent_on = nil\n end",
"title": ""
},
{
"docid": "622178197efbf1c08301626e4cf261c6",
"score": "0.55922353",
"text": "def remove_text_from_to\n if !self.destinatario_id.blank?\n self.texto_destinatario = \"\"\n end\n if !self.remitente_id.blank?\n self.texto_remitente = \"\"\n end\n end",
"title": ""
},
{
"docid": "788ab6519cf6079ab22b77620e28cc27",
"score": "0.5587531",
"text": "def clear\n en_et_gm_c\n @name = ''\n end",
"title": ""
},
{
"docid": "fb64ae21960b42736bef2e1302875b47",
"score": "0.5573967",
"text": "def prepare_for_send\n @header.delete(ACTIVE_MAILBOX_CHECKSUM)\n \n #remove preceding \"From ...\" line\n @header.mbox_from = nil\n \n self\n end",
"title": ""
},
{
"docid": "81c1df3db9d51d880133f5fd81a84b87",
"score": "0.55654216",
"text": "def textfield_by_class_clear_text(textfield_class)\n textfield_by_class(textfield_class).clear\nend",
"title": ""
},
{
"docid": "fb86f3fc565ef18b64cf5685aebdb416",
"score": "0.55589974",
"text": "def clear\n clear_changed_bytes\n clear_addresses\n end",
"title": ""
},
{
"docid": "6f9bde555e17d06ad49594608436722e",
"score": "0.55547816",
"text": "def reset\n @name = ''\n @date = ''\n @time = ''\n @success = ''\n @temp_id = ''\n @failure_count = 0\n @action_count = 0\n reset_form\n end",
"title": ""
},
{
"docid": "f7a266ae90c20d1dc7b217ec171d2254",
"score": "0.5543624",
"text": "def clear_textfield(loc)\n @browser.text_field(parse_location(loc)).clear\n end",
"title": ""
},
{
"docid": "9a3759b070e06554ca1a4eb05dbd0efc",
"score": "0.5540665",
"text": "def clear_ask_for(message, type = :int)\n system 'clear'\n ask_for(message, type)\n end",
"title": ""
},
{
"docid": "07410fdfd2460cf8a194689c2ea8d769",
"score": "0.55387884",
"text": "def remove_encrypted_fields\n self.form_data = {} if status == ESTABLISHED\n end",
"title": ""
},
{
"docid": "035a83c4925da2a345b1dd9a65c4412e",
"score": "0.5527274",
"text": "def clear_search_product_field\n search_product_field.clear\n end",
"title": ""
},
{
"docid": "cf174d00c29b01732a1268ba22741da3",
"score": "0.5522243",
"text": "def reset\n @acro = ''\n @answers.clear\n @ballot.clear\n @first_answerer = ''\n @len = 0\n @playing = true\n @submitting = false\n @submit_order.clear\n @time = 0\n @voters.clear\n @voting = false\n end",
"title": ""
},
{
"docid": "30818167a935a8a3a4aaca4bc52dc3db",
"score": "0.55133027",
"text": "def sms_send\n end",
"title": ""
},
{
"docid": "6d549d27f65f240bc9ac915ce464b9b2",
"score": "0.5511238",
"text": "def set_sms_message\n # @sms_message = SmsMessage.find(params[:id])\n @sms_message = @unit.sms_messages.where(id: params[:id]).first!\n end",
"title": ""
},
{
"docid": "ab15ba42e8bb2b5aa874e78df927f0ca",
"score": "0.55107594",
"text": "def sms(options)\n @body = options[:body]\n @to = options[:to]\n @from = options[:from]\n self\n end",
"title": ""
},
{
"docid": "0811a15a6433d288a3777a338e128131",
"score": "0.55080456",
"text": "def clear_content\n @content = ''\n end",
"title": ""
},
{
"docid": "53fb97b402904e9f0195959e9b3e19c0",
"score": "0.54998887",
"text": "def clear()\n\t\t@txt_output.buffer.text=\"\"\n\tend",
"title": ""
},
{
"docid": "b75a644bfbb787733579d423f9544a88",
"score": "0.54993397",
"text": "def send_text\n message = create_message\n @client.account.sms.messages.create(:body => message,:to => @to_phone,:from => @from_phone)\n @accounts.each { |x| x.unread_total = 0 if x.unread_total > @max_unread_emails }\nend",
"title": ""
},
{
"docid": "2f60799b25edc82396b2e8d1b5a0aac2",
"score": "0.549895",
"text": "def clear(content)\n if content && content.to_s.size > 0\n content\n else\n {\"Action\" => \"Clear\"}\n end\n end",
"title": ""
},
{
"docid": "d2757e45406dcc0dc8ad51fdd2836c66",
"score": "0.5497454",
"text": "def sms_from; det.form(:name, 'configSmtpSms').text_field(:id, 'from'); end",
"title": ""
},
{
"docid": "6ab2c49f5c36aa3835bd1b9c42524124",
"score": "0.5490239",
"text": "def clear_message\n cookies[:message_text] = nil\n end",
"title": ""
},
{
"docid": "ce89505fc1fea200d701fe0e2f15d14d",
"score": "0.54887015",
"text": "def clear!\n set_ds_field false\n end",
"title": ""
},
{
"docid": "3586a53fb95109df7d3342b66958a208",
"score": "0.5488609",
"text": "def clear\n\n %w[ msgs schedules errors expressions workitems ].each do |type|\n purge_type!(type)\n end\n end",
"title": ""
},
{
"docid": "23a57ab614eb8feb26800e34d4535138",
"score": "0.5481349",
"text": "def reset_values\n @field_names.each { |key|\n @fields[key].value = nil\n }\n end",
"title": ""
},
{
"docid": "4d924fe0c35bf90fb55e7eb9b02e28c2",
"score": "0.5478885",
"text": "def sms_to; det.form(:name, 'configSmtpSms').text_field(:id, 'to'); end",
"title": ""
},
{
"docid": "adc0989759b7961e763da0f8777a0b0e",
"score": "0.54779273",
"text": "def clear_plain_text_password\n @password = nil\n end",
"title": ""
},
{
"docid": "59e57352f2dab2273fe898dca1383f40",
"score": "0.54760957",
"text": "def clear\n @params.clear\n @dparams.clear\n @amp_vals.clear\n @norm_vals.clear unless @norm_vals.nil?\n end",
"title": ""
},
{
"docid": "5ff7cc6f9c84993acbf31ea38e0bce61",
"score": "0.54743546",
"text": "def remove_fields\n end",
"title": ""
},
{
"docid": "4248683d80d05d3883f9973c965825da",
"score": "0.54743207",
"text": "def clear\n end",
"title": ""
},
{
"docid": "f76c43936ae5ee0259411cf9d8562ec4",
"score": "0.5470171",
"text": "def clear\n do_clear\n end",
"title": ""
},
{
"docid": "744473635d66d2d716df952714831b53",
"score": "0.546707",
"text": "def clearUI\n num = @spzUI.pkNrEdit.text\n @spzUI.pkNrEdit.text = Helper.increaseNumber(num)\n emit @spzUI.lieferscheinEdit.clear\n emit @spzUI.lufttempEdit.clear\n emit @spzUI.betontempEdit.clear\n emit @spzUI.ausbreitEdit.clear\n emit @spzUI.verdichtmassEdit.clear\n emit @spzUI.masseFBEdit.clear\n emit @spzUI.volumenEdit.clear\n emit @spzUI.rohEdit.clear\n emit @spzUI.luftgehaltEdit.clear\n emit @spzUI.lagerWEdit.clear\n emit @spzUI.lagerungLEdit.clear\n @spzUI.prfBNrEdit.text = (@spzUI.prfBNrEdit.text.to_i + 1).to_s\n emit @spzUI.lagerungLEdit.clear\n emit @spzUI.lagerWEdit.clear\n emit @spzUI.ebenflEdit.clear\n emit @spzUI.lengthEdit.clear\n emit @spzUI.widthEdit.clear\n emit @spzUI.heightEdit.clear\n emit @spzUI.weightEdit.clear\n emit @spzUI.volumeEdit.clear\n emit @spzUI.rohFestEdit.clear\n emit @spzUI.lineEdit_33.clear\n emit @spzUI.prfDatEdit.clear\n \n end",
"title": ""
},
{
"docid": "dd664659dec073409d5999c7555457c3",
"score": "0.54660946",
"text": "def clear_input\n @input_values.clear\n end",
"title": ""
},
{
"docid": "b7bb880e87b1148ff6e8af87e9145fd3",
"score": "0.5462811",
"text": "def clear(name)\n\t\tsend_msg(\"clear \" + name) == HLLD_DONE\n\tend",
"title": ""
},
{
"docid": "035aceee961d752bcf5b7976b36b717a",
"score": "0.54619443",
"text": "def clear!\n @content = \"\"\n @position = 0\n end",
"title": ""
},
{
"docid": "8f75db0444a2fdc95e6410557b951163",
"score": "0.5456225",
"text": "def reset\n @generated_fields = {}\n @confirmed_fields = {}\n end",
"title": ""
}
] |
1f9e3e287a8902dfcb5af91577b08448 | Takes an optional convention and returns a string suitable as a variable name in the convention. The support conventions are: snake_case (default) tallsnakecase CamelCase lowerCamelCase Any text between parans is removed. Any nonalphanumberic is removed. | [
{
"docid": "91134fdc360bf2e2e4a5c1041ddcd49d",
"score": "0.7316825",
"text": "def variablize(convention = 'snake_case')\n unless convention.valid_naming_convention?\n error \"Invalid naming convention: #{convention}; supported: #{VALID_NAMING_CONVENTIONS.join(', ')}\"\n return nil # SMELL: is this check just paranoid\n end\n if include?('(')\n p_start = index('(')\n p_end = index(')')\n self[p_start..p_end] = ''\n end\n parts = self.downcase.gsub(/[^0-9a-z ]/, ' ').squeeze(' ').split\n case convention\n when 'lowerCamelCase'\n parts.size.times do |x|\n next unless x>0\n parts[x][0] = parts[x][0].upcase\n end\n variable_name = parts.join\n when 'CamelCase'\n parts.size.times do |x|\n parts[x][0] = parts[x][0].upcase\n end\n variable_name = parts.join\n when 'snake_case'\n variable_name = parts.join('_')\n when 'tall-snake-case'\n variable_name = parts.join('-')\n else\n raise ArgumentError, \"Invalid Convention: #{convention}\"\n end\n\n return variable_name\n end",
"title": ""
}
] | [
{
"docid": "f3e2bc3700c0c8c91c5d565e8fcac99b",
"score": "0.67078286",
"text": "def variable_name_of(a_string, convention = :snake_case)\n unless String == a_string.class\n unless a_string.respond_to?(:to_s)\n raise ArgumentError, \"Expected a string; got #{a_string.class}\"\n else\n a_string = a_string.to_s\n end\n end\n if a_string.include?('(')\n \tp_start = a_string.index('(')\n \tp_end = a_string.index(')')\n \ta_string[p_start..p_end] = ''\n end\n parts = a_string.downcase.gsub(/[^0-9a-z ]/, ' ').squeeze(' ').split\n case convention\n when :lowerCamelCase \n parts.size.times do |x|\n \tnext unless x>0\n \tparts[x][0] = parts[x][0].upcase\n end\n variable_name = parts.join\n when :CamelCase \n parts.size.times do |x|\n \tparts[x][0] = parts[x][0].upcase\n end\n variable_name = parts.join \n when :snake_case \n variable_name = parts.join('_')\n when :tall_snake_case\n variable_name = parts.join('-')\n else\n raise ArgumentError, \"Invalid Convention: #{convention}\"\n end\n\n return variable_name\nend",
"title": ""
},
{
"docid": "92f5a3492977305aa7ca9b3f47f770c4",
"score": "0.61860913",
"text": "def variablize(original)\n return original.downcase if original =~ /[A-Z]+/ && original !~ /_/\n return original[0].downcase + original[1..-1] if original !~ /_/\n camelized = original.split('_').map { |e| e.capitalize }.join\n camelized[0].downcase + camelized[1..-1]\n end",
"title": ""
},
{
"docid": "615df74e22a094370b22952030628ede",
"score": "0.6139203",
"text": "def suggest_def_name(how)\n how.gsub!(/_+/,'_') # double underscores to one\n how.gsub!(/^_/, '') # if it begins with undrscore kill it.\n how.gsub!(/\\s+/, '_') # kill spaces if for some strange reason exist\n how = how[0,1].downcase << how[1,how.size] #downcase firs char\n end",
"title": ""
},
{
"docid": "df8faaaf94ed2b2b88cd02dee3a1b5a7",
"score": "0.6119076",
"text": "def naming_convention name=nil \n nc = name.present?? name.to_s : ref_name\n if namespace_prefix.present?\n \t nc.split(namespace_prefix).last.camelize\n else\n nc.camelize\n end\n\trescue\n\t\tnil\n end",
"title": ""
},
{
"docid": "1385a0bf8fb9f8f5f44d6d1ea06c6928",
"score": "0.5843181",
"text": "def snake(string)\n string.to_s.gsub(/([a-z])([A-Z])/, '\\1_\\2').downcase.to_sym\n end",
"title": ""
},
{
"docid": "00c33f270dcd43ea201ef31381bea86b",
"score": "0.5788104",
"text": "def snake_name\n @_snake_name ||= name_components.map(&:downcase).join('_')\n end",
"title": ""
},
{
"docid": "7e07553ea0f5a4145af486aa2a4e195f",
"score": "0.57335204",
"text": "def convention\n @convention ||= request.env['intercode.convention']\n end",
"title": ""
},
{
"docid": "d8daf5cb0583ff7ce922be6657c8e2ef",
"score": "0.5723318",
"text": "def objective_name snake_name\n\tsnake_name.split(\"_\").reduce(\"\") { |result, part| \n\t\tif result != \"\"\n\t\t\tresult + part.capitalize\n\t\telse\n\t\t\tpart\n\t\tend\n\t}\nend",
"title": ""
},
{
"docid": "5f83b3d3bff81e7c0e047212e5485c7b",
"score": "0.5706043",
"text": "def snakify\n return downcase if match(/\\A[A-Z]+\\z/)\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z])([A-Z])/, '\\1_\\2').\n downcase\n end",
"title": ""
},
{
"docid": "263559764e587123386817fa5c203d7f",
"score": "0.5671143",
"text": "def camelize(lower_case_and_underscored_word)\r\n lower_case_and_underscored_word.to_s.gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase }\r\n end",
"title": ""
},
{
"docid": "dac39719fdb1d657b6f7f13e97d343b7",
"score": "0.56708026",
"text": "def snakecase(name)\n name.gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').downcase\n end",
"title": ""
},
{
"docid": "78077f441188c40bdffcde600dc996e1",
"score": "0.5646942",
"text": "def proper_name(name)\n return name if name =~ /[[:upper:]]/\n\n name.gsub(/\\b[[:alpha:]]+/) { |w| w =~ PARTICLE_REGEX ? w : w.capitalize }\n end",
"title": ""
},
{
"docid": "d7bf55fc89a1fd43390894470f2cdbf5",
"score": "0.56322366",
"text": "def violated_convention(name_string)\n convention_name = config['convention'] || 'hyphenated_lowercase'\n\n convention = CONVENTIONS[convention_name] || {\n explanation: \"must match regex /#{convention_name}/\",\n validator: ->(name) { name =~ /#{convention_name}/ }\n }\n\n convention unless convention[:validator].call(name_string)\n end",
"title": ""
},
{
"docid": "b4bdf67e5535ab5fa340cc186e15a2f3",
"score": "0.5617819",
"text": "def pascalcase_to_snakecase(word)\n\tword.gsub(/\\B([A-Z])(?=[a-z0-9])|([a-z0-9])([A-Z])/, '\\2_\\+').downcase\nend",
"title": ""
},
{
"docid": "f3fc882183c263f437feac7ad69bef20",
"score": "0.56006336",
"text": "def humanize(lower_case_and_underscored_word)\n lower_case_and_underscored_word.to_s.gsub(/_id$/, '').tr('_', ' ').capitalize\n end",
"title": ""
},
{
"docid": "b7bb781065b4047fb0ec4fc057123348",
"score": "0.5599757",
"text": "def camel_to_snake(input)\n input.gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').downcase\n end",
"title": ""
},
{
"docid": "005209627adb4785d6d908a24c97c16b",
"score": "0.5592943",
"text": "def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)\n if first_letter_in_uppercase\n lower_case_and_underscored_word.to_s.gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase }\n end\n end",
"title": ""
},
{
"docid": "1df6004b94e86b74cacd741e90387d84",
"score": "0.55674815",
"text": "def humanize(lower_case_and_underscored_word)\n lower_case_and_underscored_word.to_s.gsub(/_id$/, \"\").gsub(/_/, \" \").capitalize\n end",
"title": ""
},
{
"docid": "887ad0d5f72cb933056b57dcc7b18720",
"score": "0.5539157",
"text": "def camel_to_snake_case input\n input = input.to_s.dup\n\n # handle camel case like FooBar => Foo_Bar\n while input.gsub!(/([a-z]+)([A-Z])(\\w+)/) { $1 + '_' + $2 + $3 }\n end\n\n # handle abbreviations like XMLParser => XML_Parser\n while input.gsub!(/([A-Z]+)([A-Z])([a-z]+)/) { $1 + '_' + $2 + $3 }\n end\n\n input\n end",
"title": ""
},
{
"docid": "b377817352865d68cd761e952cd72c96",
"score": "0.5526777",
"text": "def get_incguard_from_incfname incfname\n incfname.gsub(/[^\\w]+/, \"_\").upcase\nend",
"title": ""
},
{
"docid": "6b9b5ca6fcc3a7375509f1a7fb656e86",
"score": "0.5525104",
"text": "def column_name_convention(a_string)\n # TODO: i dunnot know what I was thinking\n get_location\n unless String == a_string.class\n error \"Expected a String #{location}\"\n else\n unless a_string.valid_naming_convention?\n error \"#{a_string} is not a supported naming convention #{location}\"\n else\n @params[:column_name_convention] = a_string\n end\n end\n end",
"title": ""
},
{
"docid": "bd0d409e3be26d3216ef5c8c75ed0433",
"score": "0.5520278",
"text": "def snake_case\n return downcase if match(/\\A[A-Z]+\\z/)\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z])([A-Z])/, '\\1_\\2').\n downcase\n end",
"title": ""
},
{
"docid": "02ab5e629cf4c1e7f175998a1b15f874",
"score": "0.5502462",
"text": "def humanize(lower_case_and_underscored_word, options = {})\n Geode::FastInflector.humanize(lower_case_and_underscored_word, options.fetch(:capitalize, true))\n end",
"title": ""
},
{
"docid": "1e5979094d122fe814e09f70d91c5b19",
"score": "0.54945284",
"text": "def name\n camel = self.class.to_s.gsub(/.*::/, '')\n camel.gsub(/(\\S)([A-Z])/, '\\1_\\2').downcase\n end",
"title": ""
},
{
"docid": "dcab090e1a3d34c3a86e2c01c73705d3",
"score": "0.5480755",
"text": "def table_name_convention(a_string)\n # TODO: i dunnot know what I was thinking\n get_location\n unless String == a_string.class\n error \"Expected a String #{location}\"\n else\n unless a_string.valid_naming_convention?\n error \"#{a_string} is not a supported naming convention #{location}\"\n else\n @params[:table_name_convention] = a_string\n end\n end\n end",
"title": ""
},
{
"docid": "25a32e35610db0795da4cab70ea3069f",
"score": "0.547821",
"text": "def convert_naming_convention(a_string)\n a_string.to_sym\n end",
"title": ""
},
{
"docid": "4cd9030665f709dda4e43cc2437647cd",
"score": "0.5468768",
"text": "def humanize(lower_case_and_underscored_word)\n result = lower_case_and_underscored_word.to_s.dup\n result.gsub!(/_id$/, \"\")\n result.gsub(/(_)?([a-z\\d]*)/i){ \"#{ $1 && ' ' }#{ $2.downcase}\" }.gsub(/^\\w/){ $&.upcase }\n end",
"title": ""
},
{
"docid": "3f2bbbed17fca8597cbe8d64fb33637f",
"score": "0.54630667",
"text": "def humanize(lower_case_and_underscored_word)\n result = lower_case_and_underscored_word.to_s.dup\n\n inflections.humans.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }\n result.gsub(/_id$/, \"\").gsub(/_/, \" \").capitalize\n end",
"title": ""
},
{
"docid": "3f2bbbed17fca8597cbe8d64fb33637f",
"score": "0.54630667",
"text": "def humanize(lower_case_and_underscored_word)\n result = lower_case_and_underscored_word.to_s.dup\n\n inflections.humans.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }\n result.gsub(/_id$/, \"\").gsub(/_/, \" \").capitalize\n end",
"title": ""
},
{
"docid": "991af9ab9335b13b4912128093b3a931",
"score": "0.54544705",
"text": "def callback_name(name)\n return name.gsub(/([^A-Z]+)([A-Z]+)/, '\\\\1_\\\\2').downcase\n end",
"title": ""
},
{
"docid": "c9ec56357f4d2525d02bf12af1c603b8",
"score": "0.54509294",
"text": "def snake_case\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end",
"title": ""
},
{
"docid": "bc1a7de5dcea1556a729edb47928274b",
"score": "0.5447905",
"text": "def underscorize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"_\").downcase)\n end",
"title": ""
},
{
"docid": "57b861337918210a4974a356261aafcc",
"score": "0.5432332",
"text": "def snake_case(name)\n name.gsub(/([a-z])([A-Z0-9])/, '\\1_\\2' ).downcase\nend",
"title": ""
},
{
"docid": "8580ff93a367400b407c80cc701a48a3",
"score": "0.5431062",
"text": "def underscore_vars\r\n self.gsub(/\\b[a-z][a-z]*(?:[A-Z][a-z]*)(?:[A-Z][a-z]*)*\\b/) {|word|\r\n word.underscore\r\n }\r\n end",
"title": ""
},
{
"docid": "7f70cf6b0e9b156855161bf227d3832d",
"score": "0.5429974",
"text": "def get_model_name(model_name)\n model_name.gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').downcase\n end",
"title": ""
},
{
"docid": "6f895fe78cd90a75bd49629cbce57aa6",
"score": "0.54135996",
"text": "def camel_to_snake(camel_string)\n camel_string.gsub(/[[:lower:]][[:upper:]]/) { |x| x.chars.join('_').downcase }\nend",
"title": ""
},
{
"docid": "f921dab510fe1acee5c574f24ba4a390",
"score": "0.54106706",
"text": "def word_replace word, first_word\n if word =~ /^[A-Z]*$/ then\n \"_PROPER_\"#proper names\n elsif word =~ /^[A-Z|\\.]*$/ then\n if first_word then\n \"_FIRST_\"\n else\n \"_FNOCO_\" #first name or companies\n end\n elsif word =~ /^[A-Z].+$/ then\n if first_word then\n \"_FIRST_NAME_\"\n else\n \"_NAME_\"\n end\n elsif word =~ /^[0-9|\\-]*$/ then\n \"_NUM_\" #number\n else\n \"_RARE_\"\n end\nend",
"title": ""
},
{
"docid": "d6bcc7af8c52a3853c415a0d58dc9876",
"score": "0.53880864",
"text": "def capitalize(skip_prefixed_underscores: false)\n self.capital skip_prefixed_underscores: skip_prefixed_underscores\n end",
"title": ""
},
{
"docid": "4094032aa90e4e11a8238f971d9abe2e",
"score": "0.53829855",
"text": "def underscored_name(word = self.class.to_s)\n @underscored_name ||= begin\n words = word.dup.split('::')\n word = words.last\n if word == 'Panel'\n word = words[-2] # Panel class is Panel... and this won't do.\n end\n # This bit from rails probably isn't needed here, and wouldn't work anyways.\n #word.gsub!(/(?:([A-Za-z\\d])|^)(#{inflections.acronym_regex})(?=\\b|[^a-z])/) { \"#{$1}#{$1 && '_'}#{$2.downcase}\" }\n word.gsub!(/Panel$/,'')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/,'\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n word.tr!(\"-\", \"_\")\n word.downcase!\n word\n end\n end",
"title": ""
},
{
"docid": "6edd6f2dcca60d68066dfde0bc7d6ae6",
"score": "0.53820264",
"text": "def capitalize!() end",
"title": ""
},
{
"docid": "aad9bcc709a8539914520274e872806d",
"score": "0.5381526",
"text": "def humanize\n\t\tlower_case_and_underscored_word = self\n\t\tresult = lower_case_and_underscored_word.to_s.dup\n#\t\tinflections.humans.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }\n\t\tresult.gsub!(/_id$/, \"\")\n\t\tresult.gsub!(/_/, ' ')\n#\t\tresult.gsub(/([a-z\\d]*)/) { |match|\n#\t\t\"#{inflections.acronyms[match] || match.downcase}\"\n#\t\t}.gsub(/^\\w/) { $&.upcase }\n\tend",
"title": ""
},
{
"docid": "1a5da321aba1a0a9af16c0d8287ef6d5",
"score": "0.5356214",
"text": "def underscore\n\t\tcamel_cased_word = self\n\t\tword = camel_cased_word.to_s.dup\n\t\tword.gsub!(/::/, '/')\n#\t\tword.gsub!(/(?:([A-Za-z\\d])|^)(#{inflections.acronym_regex})(?=\\b|[^a-z])/) { \"#{$1}#{$1 && '_'}#{$2.downcase}\" }\n\t\tword.gsub!(/([A-Z\\d]+)([A-Z][a-z])/,'\\1_\\2')\n\t\tword.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n\t\tword.tr!(\"-\", \"_\")\n\t\tword.downcase!\n\t\tword\n\tend",
"title": ""
},
{
"docid": "a529188656b320b8b88ece5cbcb08115",
"score": "0.5348344",
"text": "def humanize(lower_case_and_underscored_word)\n result = lower_case_and_underscored_word.to_s.dup\n result.gsub!(/_id$/, \"\")\n result.tr!('_', ' ')\n result.gsub(/([a-z\\d]*)/i) { |match| \"#{match.downcase}\" }.gsub(/^\\w/) { $&.upcase }\n end",
"title": ""
},
{
"docid": "8e96cb5c388f8d8af8d94ae29580f65c",
"score": "0.5341044",
"text": "def underscore(camel_cased_word)\n camel_cased_word.to_s.\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"title": ""
},
{
"docid": "a78c4d81a33e71c01c5850f1cb060aa1",
"score": "0.53387463",
"text": "def snake_case_to_camel_case(value)\n pieces = value.to_s.split '_'\n\n (pieces[0] + pieces[1..-1].map(&:capitalize).join).to_sym\n end",
"title": ""
},
{
"docid": "dda4df0ee04c5c51b81bb4f22c09dd25",
"score": "0.53284585",
"text": "def underscore(camel_cased_word)\n camel_cased_word.to_s.gsub(/(.)([A-Z])/, '\\1_\\2').downcase\n end",
"title": ""
},
{
"docid": "41d36ee770c415cbd45b781e7f19b1a6",
"score": "0.5324547",
"text": "def _normalize(name)\n # maybe do something more, maybe not.. ruby does allow for\n # some weird stuff to be used as a variable name. the user\n # should use some common sense. and, other things might\n # also be an syntax error, like starting with a number.\n # this normalization is more of a comvenience than anything\n # else\n name.tr('-', '_')\n end",
"title": ""
},
{
"docid": "b786b933819f841ce48701acb582e852",
"score": "0.53193223",
"text": "def camelize\n self.split('_').collect{|mot| mot.capitalize}.join(\"\")\n end",
"title": ""
},
{
"docid": "f68fa5cf297c7119197cbe5a05be06ca",
"score": "0.53189",
"text": "def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)\n if first_letter_in_uppercase\n lower_case_and_underscored_word.to_s.gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase }\n else\n lower_case_and_underscored_word[0..0].downcase + camelize(lower_case_and_underscored_word)[1..-1]\n end\n end",
"title": ""
},
{
"docid": "efa5535610b87b193843d617b385337a",
"score": "0.5310792",
"text": "def camelize_and_normalize_name(snake_cased_name)\n result = Client.camelize_name(snake_cased_name.to_s)\n PARAM_NORMALIZATION.each {|k, v| result.gsub!(/#{k}/, v) }\n result\n end",
"title": ""
},
{
"docid": "310f237568a17b743f8fc3aff6698ee4",
"score": "0.5308787",
"text": "def underscore(camel_cased_word)\n return camel_cased_word unless /[A-Z-]|::/.match?(camel_cased_word)\n\n word = camel_cased_word.to_s.gsub('::', '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/, '\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n word.tr!('-', '_')\n word.downcase!\n word\n end",
"title": ""
},
{
"docid": "52c5073959a71a13849ef6595227f458",
"score": "0.53041273",
"text": "def underscore(camel_cased_word)\n camel_cased_word.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"title": ""
},
{
"docid": "20d7bfe3a5b97fc2da504037db2c7eb2",
"score": "0.5303921",
"text": "def underscore(camel_cased_word)\n camel_cased_word.to_s.gsub(/::/, '/')\n .gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/,'\\1_\\2')\n .tr(\"-\", \"_\")\n .downcase\n end",
"title": ""
},
{
"docid": "a70ac508651956fa9bea234cf2f696ad",
"score": "0.52947",
"text": "def class_name_to_variable_name(name)\n name.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"title": ""
},
{
"docid": "a70ac508651956fa9bea234cf2f696ad",
"score": "0.52947",
"text": "def class_name_to_variable_name(name)\n name.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"title": ""
},
{
"docid": "cf7dd39fd8111c19807d6ce2d5b7bf6c",
"score": "0.52911085",
"text": "def argument_name_without_leading_underscore\n name = if argument_name_string[FIRST_CHARACTER] == UNDERSCORE\n argument_name_string.reverse.chop.reverse\n else\n argument_name_string\n end\n name.to_sym\n end",
"title": ""
},
{
"docid": "61702bb25a8bcfb199f370751b96ae7e",
"score": "0.52910835",
"text": "def underscore_name(name)\n name.to_s.sub(/.*::/, \"\").\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"title": ""
},
{
"docid": "838411d68776d9d492ff8ec58a8fa13f",
"score": "0.5290489",
"text": "def decapitalize(skip_prefixed_underscores: false)\n LuckyCase.decapitalize self, skip_prefixed_underscores: skip_prefixed_underscores\n end",
"title": ""
},
{
"docid": "8bdc79b192bf28b79b4843c3d4c1a769",
"score": "0.52903265",
"text": "def unusualCapitalization(*x); field('unusualCapitalization', *x) end",
"title": ""
},
{
"docid": "fc4e7cbd7e5db74a89f301e6efd7deff",
"score": "0.5279119",
"text": "def underscore(camel_cased_word)\n camel_cased_word.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"title": ""
},
{
"docid": "a4e4846788f166b21c376c25170abf1c",
"score": "0.52778715",
"text": "def sentence_maker(variable)\n\treturn variable.inject{|sentence, x| sentence + \" \" + x.to_s}.lstrip.capitalize + \".\"\nend",
"title": ""
},
{
"docid": "12ff8a87b9d4f8294c45c213552dd407",
"score": "0.5277467",
"text": "def underscore(camel_cased_word)\n camel_cased_word.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"title": ""
},
{
"docid": "28a3af04ce52e709eef2cb5a30f009f2",
"score": "0.5274068",
"text": "def get_trunc_name name\n name[0..3].downcase\n end",
"title": ""
},
{
"docid": "d8deb7a14856f481e0f6672e41ac46d1",
"score": "0.5270659",
"text": "def switch_name\n (long.first || short.first).sub(/\\A-+(?:\\[no-\\])?/, '')\n end",
"title": ""
},
{
"docid": "1f3b2e2bf7f87f12712f03d370182d13",
"score": "0.52687395",
"text": "def underscore(camel_cased_word)\n return camel_cased_word unless /[A-Z-]|::/.match?(camel_cased_word)\n\n word = camel_cased_word.to_s.gsub('::', '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/, '\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n word.tr!('-', '_')\n word.downcase!\n word\n end",
"title": ""
},
{
"docid": "3a67e44f37c0e97e0f99e160c4ff4378",
"score": "0.52654886",
"text": "def underscore(camel_cased_word)\n return camel_cased_word unless camel_cased_word =~ /[A-Z-]|::/\n word = camel_cased_word.to_s.gsub(/::/, '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/, '\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n word.tr!('-', '_')\n word.downcase!\n word.to_sym\n end",
"title": ""
},
{
"docid": "663aa70e5a12f5193372ec8907bf5fc5",
"score": "0.5264389",
"text": "def CamelCasetoUnderscore(str)\n str.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"title": ""
},
{
"docid": "19e3bdbcd5448ff0b740b0c02dbda2a8",
"score": "0.52630246",
"text": "def favorite_cleaned\n favorite.gsub(' ', '').snake_case\n end",
"title": ""
},
{
"docid": "180ea9b3876e940112619e5af57175f3",
"score": "0.52589774",
"text": "def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)\n if first_letter_in_uppercase\n lower_case_and_underscored_word.to_s.gsub(/\\/(.?)/) { \"::\" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }\n else\n lower_case_and_underscored_word.first + camelize(lower_case_and_underscored_word)[1..-1]\n end\n end",
"title": ""
},
{
"docid": "ab6677c7b1a55336f3b64561fc525b5a",
"score": "0.52589595",
"text": "def fix_string(input_string)\n input_string.delete! '_'\n input_string.delete! '-'\n input_string.delete! ' '\n input_string.downcase!\n return input_string.singularize\n end",
"title": ""
},
{
"docid": "15970efcb9ed28b457bae67d7af3ad45",
"score": "0.52580667",
"text": "def underscore(camel_cased_word)\n\tcamel_cased_word.to_s.gsub(/::/, '/').\n\t gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n\t gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n\t tr(\"-\", \"_\").\n\t downcase + \"s\"\nend",
"title": ""
},
{
"docid": "531a80018815efb091d952f8beeabae7",
"score": "0.5253241",
"text": "def camel_to_snake(ident)\n ident = ident.is_a?(String) ? ident.dup : ident.to_s\n ident[0] = ident[0].downcase\n ident.chars.reduce('') { |s, c| s + (/[A-Z]/ =~ c ? \"_#{c.downcase}\" : c) }.to_sym\nend",
"title": ""
},
{
"docid": "531a80018815efb091d952f8beeabae7",
"score": "0.5253241",
"text": "def camel_to_snake(ident)\n ident = ident.is_a?(String) ? ident.dup : ident.to_s\n ident[0] = ident[0].downcase\n ident.chars.reduce('') { |s, c| s + (/[A-Z]/ =~ c ? \"_#{c.downcase}\" : c) }.to_sym\nend",
"title": ""
},
{
"docid": "aba73c462a261cc0eb4b49a04c67d138",
"score": "0.52531666",
"text": "def underscored_name\n name.demodulize.gsub(Tuxedo.config.suffix, '').underscore\n end",
"title": ""
},
{
"docid": "af7dba9ae2586534c1360d17a731bc77",
"score": "0.52505845",
"text": "def underscore(camel_cased_word)\n word = camel_cased_word.to_s.gsub('::', '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/,'\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n word.tr!(\"-\", \"_\")\n word.downcase!\n word\n end",
"title": ""
},
{
"docid": "ee81b15c8ef4ae52d0752b711070ed70",
"score": "0.5244939",
"text": "def handle\n @name.to_str.strip.downcase.split(/[_ ]+/).join(\"_\")\n end",
"title": ""
},
{
"docid": "9018f71333dec647df2f099e3f0db330",
"score": "0.5241819",
"text": "def snake_case2\n (self.gsub! /(.)([A-Z])/, '\\1_\\2').downcase\n rescue\n self\n end",
"title": ""
},
{
"docid": "0d3671f14c4a78f4cac2287a3cb423f9",
"score": "0.52416176",
"text": "def makeCensoredVarname( varname )\n varname = basicCensor( varname )\n if( KEYWORD_TRANSLATIONS.has_key?( varname ))then\n varname = KEYWORD_TRANSLATIONS[ varname ];\n end\n return varname\nend",
"title": ""
},
{
"docid": "2e777fe37bd67f3baa2278d682f75557",
"score": "0.52329797",
"text": "def underscore(camel_cased_word)\n camel_cased_word.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").downcase\n end",
"title": ""
},
{
"docid": "c1295e482993d59f244cbefb57acd2ee",
"score": "0.52204347",
"text": "def camel_to_snake(string)\n chopped_camel = string.to_s.split(/([A-Z](?:\\d|[a-z])+)/).reject(&:empty?)\n chopped_camel.each_with_index.map {|word, idx| idx == 0 ? word.downcase : word.downcase.prepend('_') }.join\nend",
"title": ""
},
{
"docid": "e1bd1c9a6c8a453d624bbbb2032e1a81",
"score": "0.5220188",
"text": "def formatted_class_name(class_name)\n class_name = class_name.split(':')[-1]\n (class_name.gsub!(/(.)([A-Z])/, '\\1_\\2') || class_name).upcase\n end",
"title": ""
},
{
"docid": "d1c6875ce234dfe88a9d860863b5e466",
"score": "0.5215803",
"text": "def underscore(camel_cased_word)\n word = camel_cased_word.to_s.dup\n word.gsub!(/::/, '/')\n word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n word.tr!(\"-\", \"_\")\n word.downcase!\n word\n end",
"title": ""
},
{
"docid": "9708285e9331c5889bfd2f0fe17ef85f",
"score": "0.52115214",
"text": "def snake_name\n @mountain.name.gsub(/./,'').gsub(/ /,'_').downcase\n end",
"title": ""
},
{
"docid": "d3abe90886b8217a3a3c8db7a694d856",
"score": "0.5210283",
"text": "def formalize_marker_name marker\r\n if marker\r\n marker = marker.delete(' ')\r\n marker = marker.downcase\r\n marker = marker.capitalize\r\n end\r\n return marker\r\n end",
"title": ""
},
{
"docid": "9c48a7050c8137070985901d434e4329",
"score": "0.5209971",
"text": "def say_goodnight(name)\r\n \"Dobranoc #{ name.capitalize }\"\r\nend",
"title": ""
},
{
"docid": "c0ae30d68b5c79e8a7bcb690dc1ea810",
"score": "0.5204187",
"text": "def snake_case\n self.gsub(/([a-z])([A-Z])/) {|s| \"#{s[0]}_#{s[1]}\"}.gsub(/([A-Z])([A-Z][a-z])/) {|s| \"#{s[0]}_#{s[1..2]}\"}.downcase\n end",
"title": ""
},
{
"docid": "35df37968d7542ffbbf398574d4b8b38",
"score": "0.5203834",
"text": "def snake_to_camel(snake_string)\n string = snake_string.gsub(/(_[a-z])/) {|match| match[1].upcase}\n string\nend",
"title": ""
},
{
"docid": "c367d139807cf5b86114d7ba0bb71d73",
"score": "0.52020055",
"text": "def snake_to_camel(s)\n s.to_s.split('_').map(&:capitalize).join('')\n end",
"title": ""
},
{
"docid": "2c90473c9dd17979d3e6739f7ad44ae9",
"score": "0.52013755",
"text": "def violated_convention(name_string, type)\n convention_name = convention_name(type)\n\n existing_convention = CONVENTIONS[convention_name]\n\n convention = (existing_convention || {\n validator: ->(name) { name =~ /#{convention_name}/ }\n }).merge(\n explanation: convention_explanation(type), # Allow explanation to be customized\n )\n\n convention unless convention[:validator].call(name_string)\n end",
"title": ""
},
{
"docid": "99585d18e4df5d782f5e3a879820c076",
"score": "0.52006483",
"text": "def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)\n if first_letter_in_uppercase\n lower_case_and_underscored_word.to_s.gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase }\n else\n lower_case_and_underscored_word.first.downcase + camelize(lower_case_and_underscored_word)[1..-1]\n end\n end",
"title": ""
},
{
"docid": "e618e3e6e4ca5809dff60d73fc84ca44",
"score": "0.51940155",
"text": "def camelise(a_word)\n return a_word.split('_').collect(&:capitalize).join\nend",
"title": ""
},
{
"docid": "a456a80228a86b8c04eb456c91739ebf",
"score": "0.5192392",
"text": "def sanitize_case(value, kase)\n return value if value.nil?\n\n if kase == :camelcase\n value.camelcase(:lower)\n elsif kase == :pascalcase\n value.camelcase(:upper)\n else\n value.send(kase)\n end\n end",
"title": ""
},
{
"docid": "57e2813a5e01dc0eaf40497793132757",
"score": "0.5189518",
"text": "def camelize!\n self.titleize!\n self.replace(self[0, 1].downcase + self[1..-1])\n end",
"title": ""
},
{
"docid": "7465d13df86d456cf5374dc30912030f",
"score": "0.51840484",
"text": "def underscorized_classname\n self.class.name.split(\"::\").last.\n gsub( /([A-Z]+)([A-Z][a-z])/, '\\1_\\2' ).\n gsub( /([a-z\\d])([A-Z])/, '\\1_\\2' ).downcase\n end",
"title": ""
},
{
"docid": "205cdca46f9972b5fb92c018683e37ea",
"score": "0.51776373",
"text": "def camel_case(name)\n if name.include? '_'\n name.split('_').map{|e| e.capitalize}.join\n else\n unless name =~ (/^[A-Z]/)\n name.capitalize\n else\n name\n end\n end\nend",
"title": ""
},
{
"docid": "14386f679092588c11378003f883c8ea",
"score": "0.51746565",
"text": "def camelize(class_name)\n return class_name if class_name !~ /-/\n class_name.gsub(/(?:-|(\\/))([a-z\\d]*)/) { \"#{$1}#{$2.capitalize}\" }.strip\n end",
"title": ""
},
{
"docid": "ecd5d1736a654a09c803dffdb3576d8a",
"score": "0.51694596",
"text": "def un_camelcase( s )\n s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"title": ""
},
{
"docid": "ae59c3500bf8386e245a113c11f43262",
"score": "0.5162216",
"text": "def camel_case_to_snake_case(camel_case)\n camel_case.to_s.gsub(/([a-z])([A-Z])/, '\\1_\\2').gsub(/([A-Z])([A-Z])([a-z])/, '\\1_\\2\\3').downcase\n end",
"title": ""
},
{
"docid": "edd3103bc5866f3ea3e13fd31c0f4544",
"score": "0.5160036",
"text": "def underscore(klass)\n return klass unless /::/.match?(klass)\n\n word = klass.to_s.gsub('::'.freeze, '.'.freeze)\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/, '\\1_\\2'.freeze)\n word.gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2'.freeze)\n word.downcase!\n word\n end",
"title": ""
},
{
"docid": "9e850e6028c392495495b10c0bc7493c",
"score": "0.5158829",
"text": "def const_name\n components = title.gsub(/\\W/,' ').split.collect {|word| word.strip.upcase }\n components.join '_'\n end",
"title": ""
}
] |
a5fe838b1b4036caedcd71fab56683c1 | GET /sequoia_customers GET /sequoia_customers.json | [
{
"docid": "c19ef187abf03f0aeb27edaf711bfb92",
"score": "0.0",
"text": "def index\n if params[:product]\n @sequoia_customers = SequoiaCustomer.where('product LIKE ?', \"%#{params[:product]}%\")\n else\n @sequoia_customers = SequoiaCustomer.order(:purchase_date => :desc).first(75)\n end\n\n # @sequoia_customers = SequoiaCustomer.order(:purchase_date => :desc).first(25)\n @sequoia_customers_all = SequoiaCustomer.all\n\n @total = []\n\n @total_records = SequoiaCustomer.count(:uid)\n @newest_record = SequoiaCustomer.pluck(:purchase_date).max\n # @sequoia_customers_all.each do |i|\n # @total.push(i['Uid'])\n # end\n # @totalL = @total.length\n #\n # @date_ary = []\n # @sequoia_customers_all.each do |i|\n # @date_ary.push(i['purchase_date'])\n # end\n # @recent_date = @date_ary.max\n end",
"title": ""
}
] | [
{
"docid": "44d5c99d89ab374d2baf04ebcdda12b5",
"score": "0.7764741",
"text": "def getcustsjson\n render :json => @customers\n end",
"title": ""
},
{
"docid": "e9c7651d1891953067719cb341ff5ccb",
"score": "0.7752199",
"text": "def index\n @customers = Customer.all\n\n render json: @customers\n end",
"title": ""
},
{
"docid": "bce6853b21d51915cf2953720f94ffc5",
"score": "0.73777676",
"text": "def customer(id)\n get \"customers/#{id}\"\n end",
"title": ""
},
{
"docid": "970daf75753713fec5d078e7f9b1c654",
"score": "0.733955",
"text": "def show\n render json: @customer\n end",
"title": ""
},
{
"docid": "33c8538bf9534e22359c353d729415b7",
"score": "0.72008973",
"text": "def index\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end",
"title": ""
},
{
"docid": "360133f338e28c4eaa1bbb88f8184876",
"score": "0.71739995",
"text": "def get_customer(id)\n get(\"customers/#{id}\")\n end",
"title": ""
},
{
"docid": "360133f338e28c4eaa1bbb88f8184876",
"score": "0.71739995",
"text": "def get_customer(id)\n get(\"customers/#{id}\")\n end",
"title": ""
},
{
"docid": "7466efc84ba133a44c03c0e4a76376ef",
"score": "0.7170871",
"text": "def customer(options = nil)\n request = Request.new(@client)\n path = \"/invoices/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end",
"title": ""
},
{
"docid": "c56a1df84ba86e526361aaafe88ef9aa",
"score": "0.71186584",
"text": "def customer(options = nil)\n request = Request.new(@client)\n path = \"/subscriptions/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end",
"title": ""
},
{
"docid": "5e9784fc89d7fc44e40f1724fda2089b",
"score": "0.7103919",
"text": "def show\n\t\t@customer = Customer.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @customers }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "05b334dcd82e9a93de24c5547c06e63b",
"score": "0.70988196",
"text": "def index\n #pull customer based on params given\n if params.has_key?(:id)\n customer = Customer.find_by(id: params['id'])\n elsif params.has_key?(:email)\n customer = Customer.find_by(email: params['email'])\n end\n \n #return customer info if found\n if customer != nil\n data = format_customer(customer)\n render(json: data, status: 200)\n else\n head :not_found\n end\n end",
"title": ""
},
{
"docid": "ab3a471dfd63ac01284c3074cfbcb883",
"score": "0.7093433",
"text": "def customer\n fetcher.get(Customer, customer_id)\n end",
"title": ""
},
{
"docid": "b3f4e1c47b40920b54a4945ccfea1a92",
"score": "0.7078918",
"text": "def show\n render json: Customer.find(params[:id])\n end",
"title": ""
},
{
"docid": "1f1bf437b8ead0829d90a1af0aab19cb",
"score": "0.70575535",
"text": "def customer\n @customer = Sale.where(\"user_id = ?\" , current_user.id).distinct.pluck(:customer)\n # send date in form of json\n render json: @customer\n end",
"title": ""
},
{
"docid": "8b8d8e122613aa2b0ebe8c3bb79e8be0",
"score": "0.7056309",
"text": "def index\n\n @customers = Fetchers::FetchCustomerService.index(params)\n Rails.logger.info \"---- customers\" + @customers.inspect\n respond_to do |format|\n format.js\n format.html\n end\n \n end",
"title": ""
},
{
"docid": "b01063ce2709689540c4dc080b5fd1a0",
"score": "0.70206916",
"text": "def customer(id)\n response = get(\"customers/#{id}\")\n response\n end",
"title": ""
},
{
"docid": "d30cce48ae05b18e862b8efa1a326540",
"score": "0.70167106",
"text": "def index\n @customers = User.customers\n end",
"title": ""
},
{
"docid": "c54146389444d205dca16dc4404a7ef8",
"score": "0.70039576",
"text": "def show\n @customers = Kopi.find(params[:id]).customers\n end",
"title": ""
},
{
"docid": "dba3fe97c4e48ff5c61d62cf89626b6a",
"score": "0.69871044",
"text": "def index\n @customers = Customer.all_customers(current_user.id)\n end",
"title": ""
},
{
"docid": "6164b63cbdde473b1dad3ce824374c67",
"score": "0.69631946",
"text": "def index\n\n @customers = Fetchers::FetchCustomerService.index(params)\n respond_to do |format|\n format.js\n format.html\n end\n end",
"title": ""
},
{
"docid": "39e9df87d6fdf6d8b4e75a99457d6e67",
"score": "0.6942171",
"text": "def customer(customer_id:)\n path = '/api/customer/get'\n\n private_get(path, { customerId: customer_id })\n end",
"title": ""
},
{
"docid": "a6ce78b20fb89f988e3729081fbaa1a7",
"score": "0.69394106",
"text": "def customers\n @customers ||= Services::CustomersService.new(@api_service)\n end",
"title": ""
},
{
"docid": "326558fdc53eeada598a2f8acf2f3379",
"score": "0.6923853",
"text": "def all(options = { Page: 1, PageSize: 200 })\n endpoint = 'Customers'\n params = options.dup\n\n # Handle Page option\n endpoint << \"/#{params[:Page]}\" if params[:Page].present?\n response = JSON.parse(@client.get(endpoint, params).body)\n customers = response.key?('Items') ? response['Items'] : []\n customers.map { |attributes| Unleashed::Customer.new(@client, attributes) }\n end",
"title": ""
},
{
"docid": "08c50dcf8046709d9d42c82fb5f5ddb7",
"score": "0.69182295",
"text": "def customers\n @customers ||= CustomersApi.new config\n end",
"title": ""
},
{
"docid": "664aa165be5b2061565ec0da84f566b0",
"score": "0.69048715",
"text": "def all(options = nil)\n request = Request.new(@client)\n path = \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n a = Array.new\n body = response.body\n for v in body['customers']\n tmp = Customer(@client)\n tmp.fill_with_data(v)\n a.push(tmp)\n end\n\n return_values.push(a)\n \n\n \n return_values[0]\n end",
"title": ""
},
{
"docid": "ce4d01c6ba3802da1741bf2edf776583",
"score": "0.6903229",
"text": "def index\n @customers = Customer.all\n #Respond to request will all data (Permissions maybe here)\n respond_to do |format|\n format.json { render :json => @customers }\n end\n end",
"title": ""
},
{
"docid": "d64a0407fe82747739b043b2b5a11a85",
"score": "0.6876033",
"text": "def index\n #@customers = Customer.all\n\t@customers = Customer.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end",
"title": ""
},
{
"docid": "1eab075faeeda7bba265c0916954e7cb",
"score": "0.6860612",
"text": "def index\n @customers = Customer.all :limit => \"10\", :fields => \"LAST_NAME FIRST_NAME DOB GENDER\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end",
"title": ""
},
{
"docid": "f562283ac17e076cf45be88cbc3d7c5a",
"score": "0.684411",
"text": "def get_customers(oid, options = {})\n path = customers_path(oid)\n params = options.select do |key, _value|\n PARAMS_WHITELIST.include?(key)\n end\n format_response(conn.get(path, params))\n end",
"title": ""
},
{
"docid": "dc48705b83db1f0994df732e74db6e98",
"score": "0.68207926",
"text": "def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customers ...'\n end\n # resource path\n local_var_path = '/customer/customers'\n\n # query parameters\n query_params = {}\n query_params[:'email'] = opts[:'email'] if !opts[:'email'].nil?\n query_params[:'qb_class'] = opts[:'qb_class'] if !opts[:'qb_class'].nil?\n query_params[:'quickbooks_code'] = opts[:'quickbooks_code'] if !opts[:'quickbooks_code'].nil?\n query_params[:'last_modified_dts_start'] = opts[:'last_modified_dts_start'] if !opts[:'last_modified_dts_start'].nil?\n query_params[:'last_modified_dts_end'] = opts[:'last_modified_dts_end'] if !opts[:'last_modified_dts_end'].nil?\n query_params[:'signup_dts_start'] = opts[:'signup_dts_start'] if !opts[:'signup_dts_start'].nil?\n query_params[:'signup_dts_end'] = opts[:'signup_dts_end'] if !opts[:'signup_dts_end'].nil?\n query_params[:'billing_first_name'] = opts[:'billing_first_name'] if !opts[:'billing_first_name'].nil?\n query_params[:'billing_last_name'] = opts[:'billing_last_name'] if !opts[:'billing_last_name'].nil?\n query_params[:'billing_company'] = opts[:'billing_company'] if !opts[:'billing_company'].nil?\n query_params[:'billing_city'] = opts[:'billing_city'] if !opts[:'billing_city'].nil?\n query_params[:'billing_state'] = opts[:'billing_state'] if !opts[:'billing_state'].nil?\n query_params[:'billing_postal_code'] = opts[:'billing_postal_code'] if !opts[:'billing_postal_code'].nil?\n query_params[:'billing_country_code'] = opts[:'billing_country_code'] if !opts[:'billing_country_code'].nil?\n query_params[:'billing_day_phone'] = opts[:'billing_day_phone'] if !opts[:'billing_day_phone'].nil?\n query_params[:'billing_evening_phone'] = opts[:'billing_evening_phone'] if !opts[:'billing_evening_phone'].nil?\n query_params[:'shipping_first_name'] = opts[:'shipping_first_name'] if !opts[:'shipping_first_name'].nil?\n query_params[:'shipping_last_name'] = opts[:'shipping_last_name'] if !opts[:'shipping_last_name'].nil?\n query_params[:'shipping_company'] = opts[:'shipping_company'] if !opts[:'shipping_company'].nil?\n query_params[:'shipping_city'] = opts[:'shipping_city'] if !opts[:'shipping_city'].nil?\n query_params[:'shipping_state'] = opts[:'shipping_state'] if !opts[:'shipping_state'].nil?\n query_params[:'shipping_postal_code'] = opts[:'shipping_postal_code'] if !opts[:'shipping_postal_code'].nil?\n query_params[:'shipping_country_code'] = opts[:'shipping_country_code'] if !opts[:'shipping_country_code'].nil?\n query_params[:'shipping_day_phone'] = opts[:'shipping_day_phone'] if !opts[:'shipping_day_phone'].nil?\n query_params[:'shipping_evening_phone'] = opts[:'shipping_evening_phone'] if !opts[:'shipping_evening_phone'].nil?\n query_params[:'pricing_tier_oid'] = opts[:'pricing_tier_oid'] if !opts[:'pricing_tier_oid'].nil?\n query_params[:'pricing_tier_name'] = opts[:'pricing_tier_name'] if !opts[:'pricing_tier_name'].nil?\n query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?\n query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?\n query_params[:'_since'] = opts[:'_since'] if !opts[:'_since'].nil?\n query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil?\n query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']\n data, status_code, headers = @api_client.call_api(: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 => 'CustomersResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "023e5ee939ac36374f8b21b072cf9548",
"score": "0.6816792",
"text": "def index\n @customers = Customer.all :order => \"customers_id\"\n\trespond_with (@customers)\n end",
"title": ""
},
{
"docid": "c3e9f68f2f24d6c788be8c6cc4fd0155",
"score": "0.6808729",
"text": "def customers\n @title = \"Customer List\"\n @customers = OrderUser.paginate(\n :include => ['orders'],\n :order => \"last_name ASC, first_name ASC\",\n :page => params[:page],\n :per_page => 30\n ) \n end",
"title": ""
},
{
"docid": "612c094dc1a7d024d84b295c770a2958",
"score": "0.6795429",
"text": "def show\n @customer = Customer.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790737",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "7e5e0e86054a8755023c0737916e1b7c",
"score": "0.6790491",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "37107ac517374e859a8f000a616538dd",
"score": "0.6781077",
"text": "def customers_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomersApi.customers_list ...\"\n end\n # resource path\n local_var_path = \"/customers\".sub('{format}','json')\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/javascript'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/javascript'])\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomersApi#customers_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "05afb9dd2f5e876bc1acdc7377a58bf8",
"score": "0.676984",
"text": "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "1a4409a46fdcad0d6b3f11feef9997b8",
"score": "0.6767461",
"text": "def customers\n @customers ||= Jortt::Client::Customers.new(self)\n end",
"title": ""
},
{
"docid": "1a4409a46fdcad0d6b3f11feef9997b8",
"score": "0.6767461",
"text": "def customers\n @customers ||= Jortt::Client::Customers.new(self)\n end",
"title": ""
},
{
"docid": "3f484e5f2c7be695c02355bd21013e05",
"score": "0.6763768",
"text": "def index\n @customers = Customer.find(:all, :conditions => \"customer_type_id = 2\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end",
"title": ""
},
{
"docid": "4f0ac60cfd7a38ca44d59d55350d8890",
"score": "0.67633015",
"text": "def show\n begin\n @customer = Customer.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n @customer = nil\n puts 'customer not found'\n end\n if @customer\n render json: {'customer': @customer}\n end\n end",
"title": ""
},
{
"docid": "ec5bcc92e31255a7e571529ebbef33ca",
"score": "0.67473334",
"text": "def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomersApi.get_customers ...\"\n end\n # resource path\n local_var_path = \"/customers\"\n\n # query parameters\n query_params = {}\n query_params[:'includes'] = @api_client.build_collection_param(opts[:'includes'], :csv) if !opts[:'includes'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'order_by'] = @api_client.build_collection_param(opts[:'order_by'], :multi) if !opts[:'order_by'].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 = ['APIKeyHeader']\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<Customer>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomersApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "4e2663ec924b9b9053185e04c54f40ee",
"score": "0.6731505",
"text": "def list\n customers = @customers_repository.all\n @view.list(customers)\n end",
"title": ""
},
{
"docid": "26fa236b670fa98ca96592e491042ba2",
"score": "0.6728431",
"text": "def show\n @customer = Customer.find(params[:id])\n @orders=@customer.orders\n @orders=@customer.orders.paginate :page=>params[:page], :per_page=>7\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "2e2e51b34cbacbcec180a73ebaf08136",
"score": "0.67262983",
"text": "def index\n\n customers = ShopifyAPI::Customer.all\n result = customers.map{|customer|\n field = find_metafield_for_customer(customer)\n\n {\n customer_id: customer.id,\n field: field\n }\n\n }\n\n json_response = {\n metafields: result\n }\n render json: json_response\n end",
"title": ""
},
{
"docid": "aec3caef69c873f9e9afe44e8acfbdd7",
"score": "0.67258894",
"text": "def index\n #byebug\n #CHECK AUTHORIZATION HERE NOT JUST JUST AUTHENTICATION\n render json: CustomerUser.all\n end",
"title": ""
},
{
"docid": "1740cd253f9d3ff0b87e6a11a431c3ee",
"score": "0.67186415",
"text": "def index\n render json: Student.where(customer_id: @api_user.customer_id)\n end",
"title": ""
},
{
"docid": "7cc4f4bb0983d66197d430ff9d4398c6",
"score": "0.6716111",
"text": "def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InventoryApi.get_customers ...'\n end\n # resource path\n local_var_path = '/customer'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'Page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'Limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'ID'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'Name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'ContactFilter'] = opts[:'contact_filter'] if !opts[:'contact_filter'].nil?\n query_params[:'ModifiedSince'] = opts[:'modified_since'] if !opts[:'modified_since'].nil?\n query_params[:'IncludeDeprecated'] = opts[:'include_deprecated'] if !opts[:'include_deprecated'].nil?\n query_params[:'IncludeProductPrices'] = opts[:'include_product_prices'] if !opts[:'include_product_prices'].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] || 'Customers' \n\n # auth_names\n auth_names = opts[:auth_names] || ['accountID', 'appKey']\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: InventoryApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "ee472114b58c9ccf4defc35dd35a5816",
"score": "0.6688462",
"text": "def index\n # manual authorisation to allow customers to reach\n # /customers via post in create method\n redirect_to root_path and return unless current_user\n\n @customers = Customer.search(params[:search]).order(\"created_at DESC\").paginate(:per_page => 10, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end",
"title": ""
},
{
"docid": "aba5c805fa4141166fcb9ce0dc60c4dd",
"score": "0.6679587",
"text": "def index\n @customers = current_company.customers.all\n respond_to do |format|\n format.xml{ render :xml=> @customers }\n format.json{ render :json => @customers }\n end\n end",
"title": ""
},
{
"docid": "1d287b0091232f553dee03fe06b86aa2",
"score": "0.66784865",
"text": "def customers\n @customers ||= CustomersApi.new @global_configuration\n end",
"title": ""
},
{
"docid": "874f3dd9867fe17120343547e29f645e",
"score": "0.66761494",
"text": "def show\n @customer = Customer.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "1881b89b94937fbb2cfd63028252e1f7",
"score": "0.6670712",
"text": "def index\n\t render json: @customers = Customer.where(\"created_at >= ?\", Time.zone.now.beginning_of_day)\n\t \n\tend",
"title": ""
},
{
"docid": "6f7be47bf606e44c3149986fbcd8036d",
"score": "0.6663301",
"text": "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "6f7be47bf606e44c3149986fbcd8036d",
"score": "0.6663301",
"text": "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "6f7be47bf606e44c3149986fbcd8036d",
"score": "0.6663301",
"text": "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "6f7be47bf606e44c3149986fbcd8036d",
"score": "0.6663301",
"text": "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "6f7be47bf606e44c3149986fbcd8036d",
"score": "0.6663301",
"text": "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "6f7be47bf606e44c3149986fbcd8036d",
"score": "0.6663301",
"text": "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "6f7be47bf606e44c3149986fbcd8036d",
"score": "0.6663301",
"text": "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "6f7be47bf606e44c3149986fbcd8036d",
"score": "0.6663301",
"text": "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "6f7be47bf606e44c3149986fbcd8036d",
"score": "0.6663301",
"text": "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "6f7be47bf606e44c3149986fbcd8036d",
"score": "0.6663301",
"text": "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "6f7be47bf606e44c3149986fbcd8036d",
"score": "0.6663301",
"text": "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "6f7be47bf606e44c3149986fbcd8036d",
"score": "0.6663301",
"text": "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end",
"title": ""
},
{
"docid": "3298705623d8dc8572ef40174a1dc6b5",
"score": "0.66617566",
"text": "def list_customers(options={})\n customers = []\n list_customers_each(options) { |c| customers << c }\n customers\n end",
"title": ""
},
{
"docid": "d2477aaed4b8d8420ca337b1bee4f46a",
"score": "0.66586405",
"text": "def show\n @customers = Customer.where(:user_id => current_user.id)\n end",
"title": ""
},
{
"docid": "d9277d95342521bdb15be41c22095477",
"score": "0.66583663",
"text": "def get_customers(opts = {})\n data, _status_code, _headers = get_customers_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "d9277d95342521bdb15be41c22095477",
"score": "0.66583663",
"text": "def get_customers(opts = {})\n data, _status_code, _headers = get_customers_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "3e09fc5d49c23c53ee0c642d76c32641",
"score": "0.6649216",
"text": "def index\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "37c087df04055eef1c1b33a173bb5767",
"score": "0.664779",
"text": "def index\n @customers = Customer.page(params[:page]).order(params[:sort])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end",
"title": ""
},
{
"docid": "8e831a6d359c56ecfa3edd995c9be0e2",
"score": "0.6644473",
"text": "def customers(limit=0, firstName=nil, lastName=nil, email=nil)\n options = {}\n if firstName\n options[:firstName] = firstName\n end\n if lastName\n options[:lastName] = lastName\n end\n if email\n options[:email] = email\n end\n\n Client.load_paginated_items_list(@auth, '/customers.json', Customer, options, limit)\n end",
"title": ""
},
{
"docid": "0258ebd9dd833730f807ec5049fa33bc",
"score": "0.66408217",
"text": "def index\n orders_index = ::Index::OrdersIndex.new(self)\n orders = orders_index.orders(current_user.orders)\n render json: orders,\n meta: meta(orders),\n include: :customer\n end",
"title": ""
},
{
"docid": "6f5132390232207b6b60f2ed4542ba71",
"score": "0.66078275",
"text": "def get_customer(id)\n get \"/customers/#{id}\"\n\n @customer_hash = JSON.parse(response.body)\n @referral_hash = @customer_hash['referrals'].last\n\n assert_response :ok\n end",
"title": ""
},
{
"docid": "e25a3706197bc03974b1ee9b9dbcf1a2",
"score": "0.6599675",
"text": "def index\n @customers = Customer.all\n prepFormVariables\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end",
"title": ""
},
{
"docid": "a4806d57e2356949ea599b057203cc22",
"score": "0.6581685",
"text": "def index\n if params[:search].present?\n @customers = Customer.order('id DESC').basic_search(params[:search]).page(params[:page])\n else\n @customers = Customer.order('id DESC').page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end",
"title": ""
},
{
"docid": "a4ab3debf1234f631f421fcbd0fd5c2d",
"score": "0.6567918",
"text": "def selected_customer\n begin\n customer = Customer.find(params[:id])\n rescue\n customer = Customer.find(:first)\n end\n render :json => [{'customer_identity' => customer.identity, 'customer_house_number' => customer.house_number, 'customer_street' => customer.street, 'customer_colony' => customer.colony, 'customer_landmark' => customer.landmark, 'customer_city' => customer.city, 'customer_zipcode' => customer.zipcode, 'customer_state' => customer.state, 'customer_mobile_number' => Integer(customer.mobile_number), 'customer_phone_number' => Integer(customer.phone_number), 'customer_model_name' => customer.model_name}].to_json\n\n end",
"title": ""
}
] |
81f1ebf08e21b3ea074868f44d1156df | PATCHes data to the API via the Cropster::Client | [
{
"docid": "d32eeb2786beeb7d69cb4777abc3b659",
"score": "0.0",
"text": "def update(object_url, id, data)\n response = patch(\"/#{object_url}/#{id}\", data)\n handle_error(response)\n process(response)\n end",
"title": ""
}
] | [
{
"docid": "a9a7bf63fffdaf43ed4c76593ebe2674",
"score": "0.70921266",
"text": "def patch(url, data, options={})\n default_client.patch(url, data, options)\n end",
"title": ""
},
{
"docid": "05c1bed948daa058e70016e863c7cd96",
"score": "0.6985142",
"text": "def update_request(data)\n client.create_request('PATCH', url_path, 'data' => data)\n end",
"title": ""
},
{
"docid": "035be415cd85526f3f2f4f19ea4ec295",
"score": "0.6570075",
"text": "def patch(*args)\n response = super\n response.client = self\n\n response\n end",
"title": ""
},
{
"docid": "4b9b35c9afd5685c3cbb2133b1139093",
"score": "0.6438489",
"text": "def api_patch(endpoint:, data:)\n begin\n resp = self.http.patch([self.url, endpoint].join('/'), data.to_json, {'Content-Type' => 'application/json', 'Accept' => 'application/json'})\n begin\n data = JSON.parse(resp.body) unless resp.body.empty?\n rescue JSON::ParserError\n raise Exception, \"Failed to decode response message\"\n end\n if resp.status != 200\n error = data.include?('error') ? data['error'] : data.inspect if data\n raise Exception, \"Query returned a non successful HTTP code (Status: #{resp.status}, Reason: #{resp.reason}#{\", Error: #{error}\" if error}\"\n end\n rescue\n raise Exception, \"Failed to execute PATCH request to Kapacitor REST API (#{$!})\"\n end\n\n data\n end",
"title": ""
},
{
"docid": "0c1a09a9d20ee815b5c9f998eda70b44",
"score": "0.64172226",
"text": "def patch(path, params = {}, options = {})\n options[:content_type] ||= :json\n options[:Authorization] = \"simple-token #{self.access_token}\"\n RestClient.patch(request_url(path), params.to_json, options)\n end",
"title": ""
},
{
"docid": "3698b3a5eae2bc44424c7ebcd3b9c9bd",
"score": "0.6401066",
"text": "def update(options)\n ensure_client && ensure_uri\n response = @client.rest_put(@data['uri'], 'body' => options)\n new_data = @client.response_handler(response)\n set_all(new_data)\n end",
"title": ""
},
{
"docid": "2993ee4af1337fea08403ad969751b2c",
"score": "0.6380066",
"text": "def patch(*args)\n\t\tconn.patch(*args)\n\tend",
"title": ""
},
{
"docid": "cb7232de163704d68f9bf91f3f47e40c",
"score": "0.63772184",
"text": "def update\n uri = URI('https://api.ridemetro.org/data/CalculateItineraryByPoints')\n\n query = URI.encode_www_form({\n # Request parameters\n 'lat1' => params[:lat1],\n 'lon1' => params[:lon1],\n 'lat2' => params[:lat2],\n 'lon2' => params[:lon2],\n 'startTime' => `datetime'#{Time.now.utc.iso8601}'`,\n '$format' => 'JSON',\n '$orderby' => 'EndTime',\n '$expand' => 'Legs'\n })\n\n if uri.query && uri.query.length > 0\n uri.query += '&' + query\n else\n uri.query = query\n end\n\n request = Net::HTTP::Get.new(uri.request_uri)\n # Request headers\n request['Ocp-Apim-Subscription-Key'] = '6741c2454ce544309f5020fbd7b6e4ca'\n # Request body\n request.body = \"{body}\"\n\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n http.request(request)\n end\n puts \"you made a patch request I think??\"\n render json: response.body\n\n end",
"title": ""
},
{
"docid": "5fd5f00640bdb0c785bcac4689a46f3c",
"score": "0.63744044",
"text": "def patch(data, options={})\n raise NotImplementedError, \"We only patchs to singular resources.\" if count > 1\n first.patch(data, options)\n end",
"title": ""
},
{
"docid": "d5eaea298e64625a71a15a970f3b75ed",
"score": "0.6344939",
"text": "def patch *args\n make_request :patch, *args\n end",
"title": ""
},
{
"docid": "d61c0aeb123e4c5cfcb2ba019dd903a0",
"score": "0.6325426",
"text": "def patch(options = {})\n request :patch, options\n end",
"title": ""
},
{
"docid": "765d7164cee41701ef01fb20d8645882",
"score": "0.63213664",
"text": "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"title": ""
},
{
"docid": "ca9fd5f1d76d6a1a8f9b0a89c64e0aa5",
"score": "0.6311858",
"text": "def post_update(params)\n @client.post(\"#{path}/update\", nil, params, \"Content-Type\" => \"application/json\")\n end",
"title": ""
},
{
"docid": "28fbd8e089e8dc397fff00099e4c93e1",
"score": "0.6295866",
"text": "def patch_resource(path, data)\n check_string(path)\n uri = return_uri(path)\n req = Net::HTTP::Patch.new(uri.path)\n if @customer_id == \"Bearer \"\n req.add_field(\"Authorization\", @customer_id+@customer_key)\n else\n req.basic_auth @customer_id, @customer_key\n end\n req.body = data\n res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) {|http|\n http.request(req)\n }\n parse_response(res)['data']\n end",
"title": ""
},
{
"docid": "8a1fcbdae3046e2102f533f681b61c66",
"score": "0.6292544",
"text": "def update_contact\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/contacts/3'\n ).to_s\n\n puts RestClient.patch(\n url, {contact: {name: \"Josh\", email: \"josh@gmail.com\"}} )\nend",
"title": ""
},
{
"docid": "fdb6fd1ad90795d4091f430832940fd5",
"score": "0.62845784",
"text": "def patch(path, data = nil, headers = nil)\n req = Net::HTTP::Patch.new(path, (headers || {}).merge(@request_headers))\n req.basic_auth(@api_key, 'x')\n req.body = data.to_json unless data.nil?\n res = @http.start { |session| session.request(req) }\n\n handle_response(res)\n end",
"title": ""
},
{
"docid": "5013fdcb0de3eaf0c28fec9734b540f0",
"score": "0.6283536",
"text": "def patch(url, data)\n Typhoeus::Request.patch(\n base_url + url,\n body: data,\n userpwd: authentication\n )\n end",
"title": ""
},
{
"docid": "cfe60af276f4366be6cdb1b797753da6",
"score": "0.6273478",
"text": "def update\n resource.update(client_params)\n respond_with resource\n end",
"title": ""
},
{
"docid": "b4cc3ee2207b39abaf779a6078bbaf3a",
"score": "0.62658983",
"text": "def patch\n PATCH\n end",
"title": ""
},
{
"docid": "b4cc3ee2207b39abaf779a6078bbaf3a",
"score": "0.62658983",
"text": "def patch\n PATCH\n end",
"title": ""
},
{
"docid": "16714f614b8fe1809e96d03da962e6d9",
"score": "0.62441236",
"text": "def edit_client (client_id = nil, name = nil, contact = nil, email = nil, password = nil, msisdn = nil, timezone = nil, client_pays = nil, sms_margin = nil, opts={})\n query_param_keys = [:client_id,:name,:contact,:email,:password,:msisdn,:timezone,:client_pays,:sms_margin]\n headerParams = {}\n\n \n \n # set default values and merge with input\n options = {\n :'client_id' => client_id,\n :'name' => name,\n :'contact' => contact,\n :'email' => email,\n :'password' => password,\n :'msisdn' => msisdn,\n :'timezone' => timezone,\n :'client_pays' => client_pays,\n :'sms_margin' => sms_margin\n \n }.merge(opts)\n\n #resource path\n path = \"/edit-client.json\".sub('{format}','json')\n \n # pull querystring keys from options\n queryopts = options.select do |key,value|\n query_param_keys.include? key\n end\n\n # header parameters\n headers = {}\n\n _header_accept = 'application/json'\n if _header_accept != ''\n headerParams['Accept'] = _header_accept\n end \n _header_content_type = ['application/x-www-form-urlencoded']\n headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'\n\n \n \n headers[:'Authorization'] = @api_key_secret\n\n # http body (model)\n post_body = nil\n \n # form parameters\n form_parameter_hash = {}\n \n \n \n Swagger::Request.new(:PUT, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make\n \n \n end",
"title": ""
},
{
"docid": "1b68da87c25627ab95752c1c9e6e3ddb",
"score": "0.61895895",
"text": "def patch(attributes, header = {})\n url = \"#{ApiClient.config.path}#{self.resource_path}\"\n response = ApiClient::Dispatcher.patch(url, attributes, header)\n params = ApiClient::Parser.response(response, url)\n build(params)\n end",
"title": ""
},
{
"docid": "ff5b557acb5b43e5f35cd12653dc85b1",
"score": "0.6185995",
"text": "def patch(path, data = {}, headers = {})\n exec_request(:patch, path, data, headers)\n end",
"title": ""
},
{
"docid": "edca1e6081642d467f430e2bfeac44b2",
"score": "0.6164169",
"text": "def patch(operation, path, value)\n ensure_client && ensure_uri\n response = @client.rest_patch(@data['uri'], 'body' => [{ op: operation, path: path, value: value }])\n patched_data = @client.response_handler(response)\n set_all(patched_data)\n end",
"title": ""
},
{
"docid": "1036cf9c12dfcd7b9de1de645086e08a",
"score": "0.61530197",
"text": "def update!\n @update_called = true\n self.class.put( uri, :body => self.to_json )\n nil\n end",
"title": ""
},
{
"docid": "a6449a909079f924199a7286968ff6a5",
"score": "0.6152851",
"text": "def update\n @options[:body] = @entity.attrs[:body]\n @options[:headers]['Content-Type'] = 'application/json'\n url = @url_helper.entity_url\n request(:patch, url)\n end",
"title": ""
},
{
"docid": "4eba30b7eeec9de84122a3ea194b409c",
"score": "0.6145651",
"text": "def patch(end_point_url, data = nil)\n uri = URI(@api_url + end_point_url)\n request = Net::HTTP::Patch.new uri\n @headers.each_with_index do |(k, v)|\n request[k] = v\n end\n request.basic_auth(@auth.credentials[0], @auth.credentials[1])\n request['Content-Type'] = 'application/json'\n request.body = data.to_json if data\n start_response(request, uri)\n end",
"title": ""
},
{
"docid": "3527698628d32da57b7104a88226815c",
"score": "0.61357903",
"text": "def patch(resource_url, body = nil, &block)\n http_patch = Net::HTTP::Patch.new resource_url, {'Content-Type' =>'application/json'}\n http_patch.body = json_body(body) if body\n call_http_server http_patch, &block\n end",
"title": ""
},
{
"docid": "79c7ba87be4b11a11984efbead480d3f",
"score": "0.6129559",
"text": "def patch(url, data={}, headers={})\n request = connection.patch(url, data, headers)\n\n Automatic::Response.new(request)\n end",
"title": ""
},
{
"docid": "63686b23d548d352954518c736c25119",
"score": "0.6116454",
"text": "def patch(path, data, headers = {})\n request(:patch, path, data, headers)\n end",
"title": ""
},
{
"docid": "ca05caf24165523ad1175692f618ac09",
"score": "0.6104895",
"text": "def patch(url, data)\n response = request('PATCH', url, data)\n response['data'] = response['Error'] unless response['Error'].nil?\n return response['data']\n end",
"title": ""
},
{
"docid": "431858658800c05f6aefddecaf05cc00",
"score": "0.60808784",
"text": "def dock_upsert_patch_docks_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DockApi.dock_upsert_patch_docks ...\"\n end\n # resource path\n local_var_path = \"/Docks\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json', 'application/x-www-form-urlencoded', 'application/xml', 'text/xml']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'data'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Dock')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DockApi#dock_upsert_patch_docks\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "8482a820ab283aa406d45d7b159445ad",
"score": "0.6044626",
"text": "def update\n # UPDATE OPERATIONS ARE NOT ALLOWED: USERS WILL HAVE TO LOG INTO ESS TO EDIT THEIR DATA. DON'T WANT THINGS TO GET OUT OF SYNC\n end",
"title": ""
},
{
"docid": "fa16209f5ac39ae638cdf45c17fd5f18",
"score": "0.6036116",
"text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end",
"title": ""
},
{
"docid": "fa16209f5ac39ae638cdf45c17fd5f18",
"score": "0.6036116",
"text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end",
"title": ""
},
{
"docid": "f18a5ea789bdc704a911f19c7b8d281d",
"score": "0.60355",
"text": "def edit(url, data)\n\t\tresponse = self.request('PATCH', url, data)\n\t\treturn response['data']\n\tend",
"title": ""
},
{
"docid": "d61a25d69ed10b03601d4f17ba7d9ef3",
"score": "0.6030958",
"text": "def update\n #RAILS_DEFAULT_LOGGER.debug(\"******** REST Call to CRMS: Updating #{self.class.name}:#{self.id}\")\n #RAILS_DEFAULT_LOGGER.debug(caller[0..5].join(\"\\n\")) \n response = connection.put(element_path(prefix_options), to_xml, self.class.headers)\n save_nested\n load_attributes_from_response(response)\n merge_saved_nested_resources_into_attributes\n response\n end",
"title": ""
},
{
"docid": "dbb28b78ebd14a35895337cf6eecee2a",
"score": "0.6022787",
"text": "def patch(path, data = nil)\n request(:patch, path, data)\n end",
"title": ""
},
{
"docid": "ad628f1fbccc9ec84489acc4f44a2ff1",
"score": "0.60078496",
"text": "def patch_update\n user = @company.public_send(ScimRails.config.scim_users_scope).find(params[:id])\n update_status(user)\n json_scim_response(object: user)\n end",
"title": ""
},
{
"docid": "308cbdafb3dc155c61409a4efd850d4b",
"score": "0.600207",
"text": "def patch(parameters={}, type='json')\n perform_request Net::HTTP::Patch, parameters, type\n end",
"title": ""
},
{
"docid": "cfd1e58be02f5ee22bcc3da86ea0c079",
"score": "0.5996928",
"text": "def update_data\n\n end",
"title": ""
},
{
"docid": "4a09c59b44e70f6516a9a1fae812389b",
"score": "0.5994997",
"text": "def patch(key, records, criteria)\n resp = client.patch(path(slug, key), records, \"X-Criteria\" => criteria.join(\", \"))\n\n if resp.response.code != \"202\"\n raise Reflect::RequestError, Reflect._format_error_message(resp)\n end\n end",
"title": ""
},
{
"docid": "48f6a25e88fff8462cba1f48ab30af0c",
"score": "0.59915656",
"text": "def update\n @crop = Crop.find(params[:id])\n if @crop.update(crop_params)\n render json:@crop\n else\n render json: { error: {code: 404, message: 'Invalid crop' }}, status: :not_found\n end\n end",
"title": ""
},
{
"docid": "2419dedc224096ac6e498aaee208fb8c",
"score": "0.5986996",
"text": "def update\n @client = set_client\n @client.update(client_params)\n render json: @client\n end",
"title": ""
},
{
"docid": "8b07036032d2600d633b2d20797f1dd0",
"score": "0.5975777",
"text": "def update\n if @api_v1_client.update(api_v1_client_params)\n render json: @api_v1_client, meta: { errors: nil }\n else\n render json: @api_v1_client, meta: { errors: @api_v1_client.errors.full_messages }\n end\n end",
"title": ""
},
{
"docid": "c3c751dfdfd69cb47f061dfc175c4bbe",
"score": "0.5967287",
"text": "def patch(path, data = {}, headers = {})\n connection.patch(merged_path(path), data, merged_headers(headers))\n end",
"title": ""
},
{
"docid": "7c8e4c53355fb1351b09e6ca4615399c",
"score": "0.5946588",
"text": "def update\n # if @image.update(x: params[:crop_data][:x],\n # y: params[:crop_data][:y],\n # width: params[:crop_data][:width],\n # height: params[:crop_data][:height])\n\n if @image.update(image: @image.cropped_image(params[:crop_data]))\n render json: @image.image_data, status: :ok, location: @image\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "b806407b0044a17936e6e86e8340ec6a",
"score": "0.593336",
"text": "def update(base=self) \n \n if self.class.update_url \n response = do_request(\"update_url\", :put) \n if ([\"200\", \"201\"].include? response.code.to_s )\n self.fill_from_response(response.body) \n end\n \n else\n raise ARError, \"This class can't be updated remotely, \\\n Check the Resource Definition\"\n end\n \n if block_given?; yield response; end\n \n end",
"title": ""
},
{
"docid": "47abb2cddfa1a665018f717cdaaa4164",
"score": "0.5931566",
"text": "def update!(params)\n res = @client.put(path, {}, params, \"Content-Type\" => \"application/json\")\n\n @attributes = res.json if res.status == 201\n end",
"title": ""
},
{
"docid": "2572fb900123dab962d92dfd5cd31505",
"score": "0.5929814",
"text": "def update\n spice = Spice.find_by(id: params[:id])\n spice.update(spice_params)\n render json: spice\nend",
"title": ""
},
{
"docid": "9ac08ea5d68b39422e9c66d3a14dd98a",
"score": "0.5920831",
"text": "def api_campaigns_batch_edit_patch_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.api_campaigns_batch_edit_patch ...'\n end\n # resource path\n local_var_path = '/api/campaigns/batch/edit'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Basic']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_campaigns_batch_edit_patch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "2e032aed14867db4c1e26a7f1812953c",
"score": "0.5920439",
"text": "def api_points_batch_edit_patch_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.api_points_batch_edit_patch ...'\n end\n # resource path\n local_var_path = '/api/points/batch/edit'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Basic']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_points_batch_edit_patch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "65ed998bf60b8cc3dcc85259114e4416",
"score": "0.59188586",
"text": "def patch(data, options={})\n hal_client.patch(href, data, options).tap do\n stale!\n end\n end",
"title": ""
},
{
"docid": "306087ac201b8c728342c4a66d77b684",
"score": "0.59133404",
"text": "def update\n uri = \"#{API_BASE_URL}/products/#{params[:id]}\"\n payload = params.to_json\n rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n begin\n rest_resource.put payload , :content_type => \"application/json\"\n flash[:notice] = \"Product Updated successfully\"\n rescue Exception => e\n flash[:error] = \"Product Failed to Update\"\n end\n redirect_to users_path\n\n end",
"title": ""
},
{
"docid": "28c41b3779f73357ba0b7d55cbc5a3eb",
"score": "0.5904122",
"text": "def update attributes\n perform_patch(\"/me\", attributes)\n end",
"title": ""
},
{
"docid": "d9b3115e352e77881587e8b6f1ab8942",
"score": "0.589678",
"text": "def update\n authorize @api_client\n respond_to do |format|\n if @api_client.update(api_client_params)\n format.html { redirect_to @api_client, notice: 'Api client was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_client }\n else\n format.html { render :edit }\n format.json { render json: @api_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "af9aedd4f428a2c26c3fd57798526020",
"score": "0.58814347",
"text": "def put(path, data = {}, header = {})\n _send(json_request(Net::HTTP::Patch, path, data, header))\n end",
"title": ""
},
{
"docid": "d55964b62eb8f1334d6fd09c1ea0f9ee",
"score": "0.5879793",
"text": "def update(data)\n # XXX: Check if the client is allowed to call the method\n\n params = data[:params] || {}\n\n record = data[:model].find(params[:id]) rescue nil\n\n error = nil\n\n if record.present?\n begin\n record.update(params[:fields])\n rescue Exception => e\n error = e.message\n end\n else\n error = \"There is no record with id: #{params[:id]}\"\n end\n\n if error\n response = {\n collection: data[:model].model_name.collection,\n msg: 'error',\n command: data[:command],\n error: error || record.errors.full_messages\n }\n\n # Send error notification to the client\n transmit_packet response\n end\n\n end",
"title": ""
},
{
"docid": "c74817b2c0e19eb6c6c4b277ba4fbcff",
"score": "0.587852",
"text": "def update\n @api_client = ApiClient.find(params[:id])\n\n respond_to do |format|\n if @api_client.update_attributes(params[:api_client])\n format.html { redirect_to @api_client, notice: 'Api client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_client.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "781b2f0ac0622ebf22bfde8972b7037e",
"score": "0.5875517",
"text": "def update\n if @client.update(client_params)\n render json: @client\n else\n render json: @client.errors, status: :unprocessable_entity\n end\nend",
"title": ""
},
{
"docid": "d66ef818a3c0596f38f73692cac06bc7",
"score": "0.58750004",
"text": "def update(data={})\n set_data = {}\n set_data[:data] = data\n set_data = api_key_hash.merge(set_data)\n set_data[:timestamp] = time_to_unix(data[:timestamp]) if data[:timestamp]\n post(set_data)\n end",
"title": ""
},
{
"docid": "29180f648f67370c1fa5bcbc7ae78761",
"score": "0.5870913",
"text": "def replace_request(data)\n client.create_request('PUT', url_path, 'data' => data)\n end",
"title": ""
},
{
"docid": "2bd0f8437d690524e73d4e5ae5481fa0",
"score": "0.5868624",
"text": "def patch(path, params: {}, body: {})\n request(:patch, URI.parse(api_endpoint).merge(path), params: params, body: body)\n end",
"title": ""
},
{
"docid": "cb1cca99ea20526015e43e253e7aa4cf",
"score": "0.5859239",
"text": "def _update(data, id=nil)\n # a hash holding HTTP headers\n headers = { \"Content-Type\" => \"application/json\", \"Accept\"=>\"application/json\" }\n\n # if we're given an ID use it, otherwise see if there's one in the data object\n if id==nil\n id = data['_id']\n end\n\n # do the HTTP POST request, passing the data object as JSON and the HTTP headers\n response = Net::HTTP.start(@host, @port) do |http|\n http.send_request('PUT', \"/documents/#{id}\", data.to_json, headers)\n end\n\n # show response body\n p response['content-type']\n p response.body\n\n # response should be JSON\n assert response['content-type'].match( /application\\/json/ )\n end",
"title": ""
},
{
"docid": "ed06cf3d6b28b30037cc998b4858255c",
"score": "0.5855953",
"text": "def update!(**args)\n @client_info = args[:client_info] if args.key?(:client_info)\n @impressions = args[:impressions] if args.key?(:impressions)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"title": ""
},
{
"docid": "ed06cf3d6b28b30037cc998b4858255c",
"score": "0.5855953",
"text": "def update!(**args)\n @client_info = args[:client_info] if args.key?(:client_info)\n @impressions = args[:impressions] if args.key?(:impressions)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"title": ""
},
{
"docid": "c4cd6a29891cc20894ef20b9631e2eed",
"score": "0.5841559",
"text": "def update #this action changed after reviewing Codey github\n @clipping = current_user.clippings.find(params[:id])\n #@clipping = current_user.find(params[:id])\n\n\n #respond_to do |format|\n if @clipping.update_attributes(params[:clipping])\n redirect_to @clipping, :notice => \"Successfully updated clipping.\"\n # format.html { redirect_to @clipping, notice: 'Clipping was successfully updated.' }\n # format.json { head :ok }\n else\n render :action => 'edit'\n # format.html { render action: \"edit\" }\n # format.json { render json: @clipping.errors, status: :unprocessable_entity }\n end\n #end\n end",
"title": ""
},
{
"docid": "c5161f89f5809ab8f8c0691386ffdb5c",
"score": "0.5841448",
"text": "def update_api\n source.try(:sync_with_api)\n end",
"title": ""
},
{
"docid": "e800757934bb3ebe3d0594a8a5f6e732",
"score": "0.58384097",
"text": "def update\n safe_params = safe_update_params\n\n begin\n client = Client.find @current_user_credentials[:id]\n rescue ActiveRecord::RecordNotFound\n return render nothing: true, status: :unauthorized\n end\n\n # it doesn't update arrays, that's why previous logic\n if client.update safe_params\n render json: client, status: :ok\n else\n render json: {\n errors: client.errors.full_messages\n }, status: :bad_request\n end\n end",
"title": ""
},
{
"docid": "78a0f6fb696f9cb643bdd145d8498551",
"score": "0.58320665",
"text": "def api_points_triggers_batch_edit_patch_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.api_points_triggers_batch_edit_patch ...'\n end\n # resource path\n local_var_path = '/api/points/triggers/batch/edit'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Basic']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_points_triggers_batch_edit_patch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "95ebe44bdba451b98b0dbd1556b3b24f",
"score": "0.58293605",
"text": "def patch_update\n group = @company.public_send(ScimRails.config.scim_groups_scope).find(params[:id])\n\n json_scim_missing_field_response(params) and return if patch_path.blank?\n\n if patch_path == :members\n case patch_operation.downcase\n when \"add\"\n add_members(group) if members_param.present?\n when \"remove\"\n remove_members(group) if members_param.present?\n end\n else\n update_attribute(group)\n end\n\n json_scim_response(object: group)\n end",
"title": ""
},
{
"docid": "30bc0e4af8d1bad94d47f644ff14650d",
"score": "0.582094",
"text": "def update\n dpl = find_item(params[:id])\n dpl.base_uri = api_path()\n dpl.user = 'root' # Ugly hack since no auth is needed for this method on theg5k API\n\n begin\n dpl.touch! if dpl.active?\n rescue Exception => e\n raise ServerError, e.message\n end\n\n location_uri = uri_to(\n resource_path(dpl.uid),\n :in, :absolute\n )\n\n render :text => \"\",\n :head => :ok,\n :location => location_uri,\n :status => 204\n end",
"title": ""
},
{
"docid": "70480ecce842944897a1f5d66172a98b",
"score": "0.58197874",
"text": "def update\n @client = Client.find(params[:id])\n @client.update_attributes(params[:client])\n respond_with(@client)\n end",
"title": ""
},
{
"docid": "91bd57fd2890920c2c954945bb2b1ef0",
"score": "0.58194983",
"text": "def api_smses_batch_edit_patch_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.api_smses_batch_edit_patch ...'\n end\n # resource path\n local_var_path = '/api/smses/batch/edit'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Basic']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_smses_batch_edit_patch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "a21658e8869b48b877bfbe57de8fb717",
"score": "0.5814018",
"text": "def update_contact\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/contacts/3'\n ).to_s\n\n puts RestClient.put(\n url,\n { Contact: { email: \"wacky_new_email@coolstuff.com\" } } )\n \nend",
"title": ""
},
{
"docid": "eeebc67e2d9edc08727a0b95157fcd8a",
"score": "0.58101076",
"text": "def patch(header = {})\n return self if ApiClient.config.mock\n url = \"#{ApiClient.config.path[path]}#{self.class.resource_path}/#{id}\"\n response = ApiClient::Dispatcher.patch(url, self.to_hash, header)\n update(response, url)\n end",
"title": ""
},
{
"docid": "cfa67a36f9b1cbb6072700692ce3370d",
"score": "0.5807411",
"text": "def update!(params={})\n @client.put(path, params)\n\n @attributes.merge!(params)\n end",
"title": ""
},
{
"docid": "b6fec253ce57897d9c492606f988d4a1",
"score": "0.580601",
"text": "def supplier_update\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : User click the supplier update button\"\n begin\n \tparams.permit!\n \n #supplier = {\"id\": data[:id], \"name\": data[:name], \"email\": data[:email], \"phone_number\": data[:phone_number], \"address\": data[:address]}\n supplier = {:supplier => {\"id\": params[\"suppliers\"][:id], \"supplier_name\": params[:supplier_name],\"expiry_broken\": params[:suppliers][\"expiry_broken\"], \"supplier_abb\": params[:supplier_abb], \"address_one\": params[:address_one],\"addrsss_two\": params[:addrsss_two], \"addrsss_three\": params[:addrsss_three], \"gst_no\": params[:gst_no], \"order_copy_format\": params[\"order_copy_format\"], \"phone_number\": params[:phone_number], \"city\": params[:city], \"state\": params[:state], \"country\": params[:country], supplier_code: params[\"code\"], batch:params[\"batch\"]}}\n \n supplier = RestClient.put $api_service+'/suppliers/'+params[\"suppliers\"][:id],supplier\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : supplier Updated successfully\"\n rescue => e\n Rails.logger.custom_log.error { \"#{e} supplier_controller supplier_update method\" }\n end\n redirect_to :action => \"index\"#, :id => data[:id]\n end",
"title": ""
},
{
"docid": "4bc4d29128ffcb5e1ab2bde2966d12eb",
"score": "0.5804536",
"text": "def patch(uri, data)\n get_response(Net::HTTP::Patch.new(\"#{API}/#{uri}\", HEADER), data)\n end",
"title": ""
},
{
"docid": "741ae85456e39c529fbf04dc63734550",
"score": "0.5802282",
"text": "def update(id, body)\n with_200 do\n api_service.request(Net::HTTP::Put, \"/api/#{api_version}/#{api_resource_name}/#{id}\", nil, body, true)\n end\n logger.warn 'Successfully restored to datadog.'\n end",
"title": ""
},
{
"docid": "03b14059c43d89ea05d1fc496754ac14",
"score": "0.57949716",
"text": "def update\n do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user)\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end",
"title": ""
},
{
"docid": "8f7f417647db7cec92f2670ab59e4c88",
"score": "0.5794173",
"text": "def patch(path, options = {}, &block)\n perform_request Net::HTTP::Patch, path, options, &block\n end",
"title": ""
},
{
"docid": "725f906944f7111f0c4969a456fe9ba2",
"score": "0.57936275",
"text": "def update\n respond_to do |format|\n if @crop.update(crop_params)\n format.html { redirect_to [@farm, @crop], notice: 'Crop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @crop.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4a8e655f8614f09af503c818aa8d0cc7",
"score": "0.5791775",
"text": "def patch(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = self.to_patch_request_information(\n body, request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::SecurityEdiscoveryCustodian.create_from_discriminator_value(pn) }, error_mapping)\n end",
"title": ""
},
{
"docid": "be0e0dbfdcaeb9621f37994fdf6de581",
"score": "0.5787035",
"text": "def update\n dpl = find_item(params[:id])\n dpl.base_uri = api_path\n dpl.tls_options = tls_options_for(:out)\n dpl.user = 'root' # Ugly hack since no auth is needed for this method on theg5k API\n\n begin\n dpl.touch! if dpl.active?\n rescue StandardError => e\n raise ServerError, e.message\n end\n\n location_uri = uri_to(\n resource_path(dpl.uid),\n :in, :absolute\n )\n\n render plain: '',\n head: :ok,\n location: location_uri,\n status: 204\n end",
"title": ""
},
{
"docid": "bb852392895418f02760740d2d89a8ca",
"score": "0.5786987",
"text": "def patch(body, request_configuration=nil)\n raise StandardError, 'body cannot be null' if body.nil?\n request_info = self.to_patch_request_information(\n body, request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, lambda {|pn| MicrosoftGraph::Models::SecurityEdiscoveryNoncustodialDataSource.create_from_discriminator_value(pn) }, error_mapping)\n end",
"title": ""
},
{
"docid": "a6ac8ddc32d9b88811117afa46ef81f7",
"score": "0.5780912",
"text": "def api_tweets_batch_edit_patch_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.api_tweets_batch_edit_patch ...'\n end\n # resource path\n local_var_path = '/api/tweets/batch/edit'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Basic']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_tweets_batch_edit_patch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "7f7c16b9e14f1352bb07fd27f83679a7",
"score": "0.57778674",
"text": "def patch(path, params: {}, headers: {})\n request_json :patch, path, params, headers\n end",
"title": ""
},
{
"docid": "4eefcf3c4bcbbbba9e48c4ae2b932af2",
"score": "0.57713765",
"text": "def api_companies_batch_edit_patch_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.api_companies_batch_edit_patch ...'\n end\n # resource path\n local_var_path = '/api/companies/batch/edit'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Basic']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_companies_batch_edit_patch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "242bebf5ac97316fa87dc43874aefd94",
"score": "0.57706463",
"text": "def api_categories_batch_edit_patch_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.api_categories_batch_edit_patch ...'\n end\n # resource path\n local_var_path = '/api/categories/batch/edit'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Basic']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_categories_batch_edit_patch\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "c504524494cd3a42791b8a8f836fa889",
"score": "0.5769635",
"text": "def update\n if @client.update(client_params)\n head(:ok)\n else\n render json: @client.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "52f56b9e973c1e3c8958ea53d717bba1",
"score": "0.5769611",
"text": "def update\n build_responder.call(update_resource, :action => :update)\n end",
"title": ""
},
{
"docid": "b094d2d9e05d560edfc9226aa941ad22",
"score": "0.5761219",
"text": "def patch(path, options={})\n send_request(:patch, path, options)\n end",
"title": ""
},
{
"docid": "8526bda945752e27df3ffdba1b7efea0",
"score": "0.5758479",
"text": "def update_mobile_carrier(args = {}) \n put(\"/mobile.json/#{args[:carrierId]}\", args)\nend",
"title": ""
},
{
"docid": "1b17678659e42bf715c716da9230a6bd",
"score": "0.5758419",
"text": "def update\n expose Deliverable.update(@oauth_token, params[:data])\n end",
"title": ""
},
{
"docid": "d1c6ee30a60d89a3980ed0f001ff6f41",
"score": "0.5756835",
"text": "def update\n respond_to do |format|\n if @cro.update(cro_params)\n format.html { redirect_to @cro, notice: \"Cro was successfully updated.\" }\n format.json { render :show, status: :ok, location: @cro }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @cro.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "67987b36f9d627752ee5cdb5bcd6f7a3",
"score": "0.5750171",
"text": "def patch(body: nil, path: nil, headers: nil, id: nil)\n post(body: body, path: path, headers: headers, http_method: :patch, id: id)\n end",
"title": ""
},
{
"docid": "93e91c2952dd29f0d82148b31bbe642e",
"score": "0.57470304",
"text": "def update\n #TODO\n end",
"title": ""
},
{
"docid": "d0f2c1015395f391f27438531ca483a9",
"score": "0.5745074",
"text": "def update\n render_error(errors: 'This API functionality has not yet been implemented.', status: :server_error) and return\n end",
"title": ""
},
{
"docid": "1d215cda2f65d7a3adfd5336b0b3aab4",
"score": "0.57416576",
"text": "def update_client(id:, body:)\n response = put(\"clients/#{id}\", body: body)\n\n PhysitrackApi::Response.from(response)\n end",
"title": ""
},
{
"docid": "d5abc3101486a7064a30dcb398ae7ffa",
"score": "0.57394207",
"text": "def update!(**args)\n @data = args[:data] if args.key?(:data)\n @kind = args[:kind] if args.key?(:kind)\n @request_id = args[:request_id] if args.key?(:request_id)\n @trip_option = args[:trip_option] if args.key?(:trip_option)\n end",
"title": ""
}
] |
d0848cee9ea416dfbd5b07103b6fd1ec | get every test to pass before coding runner below | [
{
"docid": "e1e97430455e198a14e711f879a87be9",
"score": "0.0",
"text": "def runner\n\n welcome\n counter = initial_round\n \n until counter > 21 do\n counter = hit?(counter)\n display_card_total(counter)\nend\nend_game(counter) \nend",
"title": ""
}
] | [
{
"docid": "5026efbc525d65125229c5ec4866d886",
"score": "0.7274132",
"text": "def run_tests\n puts \"Running exactly #{@spec.size} tests.\"\n @spec.each do |test_case|\n sleep test_case.wait_before_request\n response = send_request_for(test_case)\n Checker.available_plugins.each do |plugin|\n result = @expectation.check(plugin, response, test_case)\n if not result.success?\n putc \"F\"\n @results << result\n break\n else\n if plugin == Checker.available_plugins.last\n @results << result\n putc \".\"\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "ef0ac8b53e3a1e460fd91b7f75bc92f4",
"score": "0.7200911",
"text": "def test_all\n @results['test_start'] = Time.now()\n passed = []\n boot_vm() if @options[:vmm_enabled]\n prep\n freeze_vm() if @options[:vmm_enabled]\n @log.info \"RUNNING NO-SERVICE TEST\"\n passed << one_test(@config['init_scenario'])\n # Stop testing if our initial test fails.\n unless passed.first == true\n @log.error \"Initial setup failed.. sleeping 60 seconds for debugging.\"\n sleep 60\n stop_vm() if @options[:vmm_enabled]\n return passed\n end\n freeze_vm() if @options[:vmm_enabled]\n @log.info \"RUNNING TESTS\"\n scenarios = get_scenarios\n test_counter = 0\n scenarios.each do |scenario|\n test_counter += 1\n @log.info \"Running test for #{scenario} - #{test_counter} of #{scenarios.size}\"\n passed << one_test(scenario)\n end\n stop_vm() if @config[:vmm_enabled]\n all_passed = passed.select{|p| p == false}.size == 0\n @log.info \"Number of tests run : #{passed.size}\"\n @log.info \"Result of ALL tests: Passed? #{all_passed}\"\n @results['test_stop'] = Time.now()\n @results['elapsed_time'] = @results['test_stop'] - @results['test_start']\n return all_passed\n end",
"title": ""
},
{
"docid": "8f1c94592f39e6f7649463118849a3c2",
"score": "0.71905994",
"text": "def test_cases; end",
"title": ""
},
{
"docid": "0cc2586182a0df29857e86268931634b",
"score": "0.7134598",
"text": "def passed_tests\n self.tests.select do |test|\n test.status == 'passed'\n end\n end",
"title": ""
},
{
"docid": "673fffe280dadec43056f2952087a93e",
"score": "0.7127439",
"text": "def final_test\n return unless MiniApivore.all_test_ran?\n\n @errors = MiniApivore.prepare_untested_errors\n assert(@errors.empty?, @errors.join(\"\\n\"))\n\n # preventing duplicate execution\n MiniApivore.runnable_list << \"#{self.class}::#{__method__}_runned\"\n end",
"title": ""
},
{
"docid": "f19a04f7a9e89d5c1afa9f7cb9a11fef",
"score": "0.70358455",
"text": "def run_tests\n tests_passed = true\n %w(desktop mobile kc_dm).each do |profile|\n tests_passed &= execute_test(profile)\n end\n tests_passed\n end",
"title": ""
},
{
"docid": "b58cbce0e86395667aaeb65004559c80",
"score": "0.6860759",
"text": "def running_test_case; end",
"title": ""
},
{
"docid": "dfe11ecb130dfb7638a723e3862abe76",
"score": "0.68229115",
"text": "def all_tests_pass\n cucumber_guard = ::Guard.guards({ :name => 'cucumber', :group => 'puppet_tests'}).first\n cucumber_passed = cucumber_guard.instance_variable_get(\"@failed_paths\").empty?\n rspec_guard = ::Guard.guards({ :name => 'rspec', :group => 'puppet_tests'}).first\n rspec_passed = rspec_guard.instance_variable_get(\"@failed_paths\").empty?\n return rspec_passed && cucumber_passed\nend",
"title": ""
},
{
"docid": "20eee1803dc33c3ccfc6a8680fd523f5",
"score": "0.68049264",
"text": "def my_tests\n end",
"title": ""
},
{
"docid": "8fbc98d9068bd9c82033a031286f0a1e",
"score": "0.6790065",
"text": "def tests; end",
"title": ""
},
{
"docid": "8fbc98d9068bd9c82033a031286f0a1e",
"score": "0.6790065",
"text": "def tests; end",
"title": ""
},
{
"docid": "e7c560b4a3161a8573c7f9514df1aa72",
"score": "0.6768047",
"text": "def passed_checks\n all_checks_which_pass\n end",
"title": ""
},
{
"docid": "e007912aa2471df7b0cc3f2905ed991f",
"score": "0.65728307",
"text": "def passes\n count - failures - errors - skips\n end",
"title": ""
},
{
"docid": "c8863d023c5c275cdeb48ac5b9e41384",
"score": "0.65551996",
"text": "def report\n\t\t\tputs \"Tests: #{@ok} ok, #{@fail} failures.\"\n\t\t\tif (@fail > 0)\n\t\t\t\tputs \"*** THERE WERE FAILURES *** \"\n\t\t\telse \n\t\t\t\tputs \"*** ALL TESTS PASSED ***\"\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "8d6a6e4a81c52a35ff6b09cda065a51a",
"score": "0.65487796",
"text": "def all_external_test_runs_passed?(test_types = nil)\n external_tests_blocking(test_types).empty?\n end",
"title": ""
},
{
"docid": "29d4fe73a55b16a531e04c3a8909f5f7",
"score": "0.65460235",
"text": "def doTests( *tests )\n tests.find_all {|name,data|\n ! doTest(name)\n }\nend",
"title": ""
},
{
"docid": "0b550f209ce3fef3f2d0abdeea54c612",
"score": "0.65293026",
"text": "def go_run_tests\n @status = :running\n Thread.new do\n begin\n test_cases = @test_suite.sources\n\n @mutex.synchronize do\n @test_cases = test_cases\n @test_results = {}\n end\n\n @test_suite.run_tests do |result|\n @mutex.synchronize do\n @test_results[result[:source]] = result[:result]\n end\n end\n\n rescue => e\n puts e\n print e.bracktrace.join(\"\\n\")\n ensure\n @status = :ran\n end\n\n end\n end",
"title": ""
},
{
"docid": "ba378bae3045159ad20d0a338968e56e",
"score": "0.64595217",
"text": "def run\n @testcases.each do |test|\n print \"[ RUN... ] \".green + \" #{name} #{test.name}\\r\"\n\n if test.run\n puts \"[ OK ] \".green + \" #{name} #{test.name}\"\n else\n puts \"[ FAIL ] \".red + \" #{name} #{test.name}\"\n puts\n puts \"Command that failed:\"\n test.explain\n return false\n end\n end\n\n true\n end",
"title": ""
},
{
"docid": "428b5d1eaf9535043f41374ccd294f0d",
"score": "0.6447049",
"text": "def test_steps; end",
"title": ""
},
{
"docid": "428b5d1eaf9535043f41374ccd294f0d",
"score": "0.6447049",
"text": "def test_steps; end",
"title": ""
},
{
"docid": "5c3c2bda2cb467f9af74f5d00c707bcd",
"score": "0.6441135",
"text": "def uninit_ok_tests\n if (!@num_tests_run.nil? && !@num_tests_failed.nil?)\n @num_tests_ok += @num_tests_run - @num_tests_failed\n end\n end",
"title": ""
},
{
"docid": "154f5c1f18576f3da8e2e0aa4e6600d9",
"score": "0.64316434",
"text": "def before_test(test); end",
"title": ""
},
{
"docid": "154f5c1f18576f3da8e2e0aa4e6600d9",
"score": "0.64316434",
"text": "def before_test(test); end",
"title": ""
},
{
"docid": "10809c6585f3f74041754b3d096c52ff",
"score": "0.642825",
"text": "def generate_alltest\n\n end",
"title": ""
},
{
"docid": "5a4611c2abd8d87da273054b80362747",
"score": "0.63923085",
"text": "def running_test_step; end",
"title": ""
},
{
"docid": "c3083a401d03bb211ecc97a3b74a220b",
"score": "0.636345",
"text": "def _test_pages_available\n #execute this code x number of times\n @custom_number_of_users.times do |i|\n puts 'Running tests for user #'+i.to_s\n # assert_section nil\n end\n end",
"title": ""
},
{
"docid": "e319cc704698b8a7c4b5bc4b75585046",
"score": "0.6343057",
"text": "def testing_begin(files)\n end",
"title": ""
},
{
"docid": "e827f1e7bb107572f1e9502ec5ea3523",
"score": "0.63372016",
"text": "def unitTests\n\t\ttotalTests = 12\n\t\ttotalFailed = 0\n\t\toutput = \"\"\n\t\t@debug = true\n\n\t\t#CLEAR DB BEFORE RUNNING TEST. DEFINITELY CRUDE BUT THE ONLY THING I COULD GET WORKING\n\t\tself.TESTAPI_resetFixture\n\n\t\t#Test1: \"Does not allow a non-registered user login\"\n\t\tresponse = self.login(\"NonUser\",\"pass0\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test1\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test2: \"Allows a user that supplies no password get added\"\n\t\tresponse = self.add(\"user2\",\"\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test2\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test3: \"Allows a user with a username and password get added\"\n\t\tresponse = self.add(\"user3\",\"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test3\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test4: \"Doesn't allow an already added user get added again\"\n\t\tresponse = self.add(\"user3\",\"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test4\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test5: \"Doesn't allow a blank username get added\"\n\t\tresponse = self.add(\"\",\"pass5\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -3\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test5\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test6: \"It allows a username and password of 128 characters to get added\"\n\t\tresponse = self.add(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test6\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test7: \"Does not allow a username greater than 128 characters\"\n\t\tresponse = self.add(\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"pass7\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -3\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test7\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test8: \"Does not allow a password greater than 128 characters\"\n\t\tresponse = self.add(\"user8\",\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -4\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test8\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test9: \"Allows a registered user with a password to login and counts number of logins\"\n\t\tresponse = self.login(\"user3\", \"pass3\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test9\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test10: \"Allows a registered user without a password to login and counts number of logins\"\n\t\tresponse = self.login(\"user2\", \"\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 2\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test10\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test11: \"Doesn't allow a user with wrong password to login\"\n\t\tresponse = self.login(\"user3\", \"pass2\")\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != -1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test11\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t#Test12: \"Sucessfully Deletes the DB with call to TESTAPI_reset_fixture\"\n\t\tresponse = self.TESTAPI_resetFixture\n\t\tresult = response[\"result\"]\n\t\toutput += response[\"output\"]\n\t\tif result != 1\n\t\t\ttotalFailed += 1\n\t\t\tputs \"Failed Test12\"\n\t\tend\n\t\tputs \"Failed: \" + totalFailed.to_s\n\t\tputs \"result: \" + result.to_s\n\t\tputs \"output: \" + output.to_s\n\n\t\t@debug = false\n\t\trender json: {:totalTests => totalTests, :nrFailed => totalFailed, :output => output}\n\t\t\n\tend",
"title": ""
},
{
"docid": "92bae84bbb034fca6ffbccfe3527bb2e",
"score": "0.63203555",
"text": "def run\n test_using_random_sample\n test_using_first_of\n end",
"title": ""
},
{
"docid": "f351e673dd6cb3aa83d8f5b92f0944af",
"score": "0.6299623",
"text": "def done\n puts 'Done running tests'\n end",
"title": ""
},
{
"docid": "e556847bea0717929ba2c0cc2564c8ab",
"score": "0.6284468",
"text": "def all_failing\n all(\"#qunit-tests .fail\")\n end",
"title": ""
},
{
"docid": "f5dce2fcfb6ab8ed7f66a1ac1352a4f2",
"score": "0.62774086",
"text": "def passing_tests\n return self.product_tests.includes(:test_executions).select do |test|\n test.execution_state == :passed\n end\n end",
"title": ""
},
{
"docid": "e2d77a1a5aae8a8bd6feb60ff09eb2c5",
"score": "0.62632114",
"text": "def run_all\n passed = Runner.run(['spec'], cli)\n if passed\n Formatter.notify \"How cool, all works!\", :image => :success\n else\n Formatter.notify \"Failing... not there yet.\", :image => :failed\n end\n end",
"title": ""
},
{
"docid": "56bb6795bba4b9693e1bb6ba25f03b5d",
"score": "0.6259585",
"text": "def run_tests_under(config, options, root)\n summary = {}\n test_list(File.join($work_dir,root)).each do |path|\n name = path.sub(\"#{$work_dir}/\", '')\n puts \"\", \"\", \"#{name} executing...\"\n result = TestWrapper.new(config,options,path).run_test\n puts \"#{name} returned: #{result.fail_flag}\"\n summary[name] = result.fail_flag\n end\n return summary\nend",
"title": ""
},
{
"docid": "df79d167f0332a7b5066a4e7341a2cb1",
"score": "0.62464374",
"text": "def init_tests\n unless @init_tests\n @test_duration = 0\n @num_tests_run = 0\n @num_tests_failed = 0\n @num_tests_ok = 0\n @num_tests_skipped = 0\n @init_tests = true\n end\n end",
"title": ""
},
{
"docid": "f5778da9625835ac09293c903ac36604",
"score": "0.6235319",
"text": "def before_test_case(*args)\n @test_steps =[]\n @scenario_tags = []\n @failed_step = {}\n end",
"title": ""
},
{
"docid": "3f280c87fe3f8e9fdf293a6a5315df33",
"score": "0.62153786",
"text": "def test_step; end",
"title": ""
},
{
"docid": "31f69f2e2967a822b52df381fc438c65",
"score": "0.62005377",
"text": "def scenarios\n @runner.done_scenarios\n end",
"title": ""
},
{
"docid": "4a87f2c35d052b745aba34b0821a72d1",
"score": "0.6199617",
"text": "def define_tests\n @ours.each do |pkg|\n their = @theirs.find { |x| x.name == pkg.name }\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(ours: pkg, theirs: their).run\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f84d387304673f27f9c3a2e867f85f7a",
"score": "0.6199139",
"text": "def external_test_runs_passed_for?(test_type)\n test_types = ExternalTestType.get(test_type).with_related_types\n current_runs = current_external_test_runs_for(test_types)\n current_runs.any? && current_runs.all?(&:passed_ok?)\n end",
"title": ""
},
{
"docid": "1e2ca9cc04c51d92a1f84fd80d1ea5ef",
"score": "0.61982924",
"text": "def test_passed(array)\n last_item = array.length - 1\n test_name = array[last_item - 1]\n test_suite_verify(array[@class_name])\n printf \"%-40s PASS\\n\", test_name\n\n return unless @xml_out\n\n @array_list.push ' <testcase classname=\"' + @test_suite + '\" name=\"' + test_name + '\"/>'\n end",
"title": ""
},
{
"docid": "b1a0655930bdb76fce3cb9fc55b79c6e",
"score": "0.6195854",
"text": "def execute_all &decision\n @result = nil\n @exception = nil\n\n @test_lines.each do |line|\n break if execute_line line, &decision\n end\n unless @exception\n #puts \"=> \" + @result.inspect\n end\n end",
"title": ""
},
{
"docid": "eb7d1aa7504eee6b8461301801ffb6fe",
"score": "0.61939454",
"text": "def call(*tests, env:)\n summary = execute_all(tests, env)\n List.new(\n List.new(Symbol.new(\"success\"), List.new(*summary[:success])),\n List.new(Symbol.new(\"failures\"), List.new(*summary[:failures]))\n )\n end",
"title": ""
},
{
"docid": "74ba02e40a24e2d0007990e47f9b5246",
"score": "0.6193542",
"text": "def run_test(tests, ints_to_test, current_test_name)\n require \"./primality_tests/\" + current_test_name + \".rb\"\n tests[current_test_name.to_sym][:result] = []\n ints_to_test.each {|int|\n tests[current_test_name.to_sym][:result] << send(current_test_name, int)\n }\nend",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.6192025",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.6192025",
"text": "def failures; end",
"title": ""
},
{
"docid": "998a325d9d8e25bf1a5f6187120ed11a",
"score": "0.6192025",
"text": "def failures; end",
"title": ""
},
{
"docid": "51d45fbb4d6347c1d7a19058d694824e",
"score": "0.61888516",
"text": "def process(files) #called at end of script\n if files.class==Array \n files.each {|f| \n puts \"\\n\\n--------------------\\n#{f}:\\n\\n\"\n result=system(\"#{$PROGRAM_NAME} #{f} #{ARGV}\")\n puts \"\\n\\nERRORS IN TEST #{f}!!!\\n\\n\" unless result\n }\n else\n test_name=File.basename(files).sub(/\\..*?$/,'')\n test_case=Class.new(Test::Unit::TestCase)\n Object.const_set(:\"Test#{test_name.capitalize}\", test_case)\n mk_test_context(files, test_case)\n end\nend",
"title": ""
},
{
"docid": "94b23797cd6b11f3caf30da26a18d2a4",
"score": "0.6185608",
"text": "def run\n\t\t @stats.tests += 1\n\t\t\tputs \"Testi: #{@name}\"\n\t\t\tctx = Context.new\n\t\t\tbegin\n\t\t\t\tctx.instance_eval(&@block)\n\t\t\trescue TestAbort # we don't really care if it aborts.\n\t\t\trescue Exception => ex\n\t\t\t\tctx.fail\n\t\t\t\t@stats.failed += 1\n\t\t\t\tputs ex.inspect\n\t\t\t\tputs ex.backtrace.join(\"\\n\")\n\t\t\tend\n\t\t\tif ctx.failed?\n\t\t\t\tputs \" # FAIL!!! ############\"\n\t\t\t\t@stats.failed += 1\n\t\t\telsif ctx.skipped?\n\t\t\t\tputs \" = skipped ============\"\n\t\t\t\t@stats.skipped += 1\n\t\t\telse\n\t\t\t\tputs \" - ok.\"\n\t\t\t\t@stats.passed += 1\n\t\t\tend\n\t\t\tputs\n\t\tend",
"title": ""
},
{
"docid": "a9f4c2a19b80ba89e2afaa1cdd14095b",
"score": "0.6170051",
"text": "def test_case; end",
"title": ""
},
{
"docid": "b7339cdd0163ac0c4b1b5a225024f195",
"score": "0.61620754",
"text": "def print_results\n if !@failures.empty?\n @failures.each do |test|\n pout \"\\nFailed: #{test[:desc]}\"\n puts test[:result]\n # print a newline for easier reading\n puts \"\"\n end\n abort\n else\n puts \"All passed!\".green\n end\nend",
"title": ""
},
{
"docid": "d3f1035f1b4f9da9dc2a9486182e5333",
"score": "0.6158359",
"text": "def test_contains_13_eachsuit\n assert true == false\n end",
"title": ""
},
{
"docid": "9002d90d507f140bab6735989a840c63",
"score": "0.61409265",
"text": "def test_runnable_methods_random\n @assertion_count = 0\n\n random_tests_1 = sample_test_case 42\n random_tests_2 = sample_test_case 42\n random_tests_3 = sample_test_case 1_000\n\n assert_equal random_tests_1, random_tests_2\n refute_equal random_tests_1, random_tests_3\n end",
"title": ""
},
{
"docid": "4064f9752c2291871c38289ab3c1a85e",
"score": "0.61348844",
"text": "def compare_tests(test_a, test_b); end",
"title": ""
},
{
"docid": "4064f9752c2291871c38289ab3c1a85e",
"score": "0.61348844",
"text": "def compare_tests(test_a, test_b); end",
"title": ""
},
{
"docid": "5a628fb61130e971532ad3ae10b6ec45",
"score": "0.61343503",
"text": "def test_setup\r\n \r\n end",
"title": ""
},
{
"docid": "40198eea5846f44a3e00ab2743b45786",
"score": "0.61328936",
"text": "def test_truth\n end",
"title": ""
},
{
"docid": "91cd5148ae47a37ea9e7154d972c91d7",
"score": "0.61303157",
"text": "def start_tests(files)\n end",
"title": ""
},
{
"docid": "6062808d333f3aa69deef80ca80e8be9",
"score": "0.6121021",
"text": "def run(selected_tests)\n # Test names (ordered) to be performed in game, per tests suite\n # Hash< Symbol, Array<String> >\n in_game_tests = {}\n selected_tests.each do |tests_suite, suite_selected_tests|\n if @tests_suites[tests_suite].respond_to?(:run_test)\n # Simple synchronous tests\n suite_selected_tests.each do |test_name|\n # Store statuses after each test just in case of crash\n set_statuses_for(tests_suite, [[test_name, @tests_suites[tests_suite].run_test(test_name)]])\n end\n end\n # We run the tests from the game itself.\n in_game_tests[tests_suite] = suite_selected_tests if @tests_suites[tests_suite].respond_to?(:in_game_tests_for)\n end\n return if in_game_tests.empty?\n\n # Keep track of the mapping between tests suites and in-game tests, per in-game tests suite.\n # Associated info is:\n # * *tests_suite* (Symbol): The tests suite that has subscribed to the statuses of some in-game tests of the in-game tests suite.\n # * *in_game_tests* (Array<String>): List of in-game tests that the tests suite is interested in.\n # * *selected_tests* (Array<String>): List of selected tests for which in-game tests are useful.\n # Hash< Symbol, Array< Hash< Symbol, Object > > >\n in_game_tests_subscriptions = {}\n # List of all in-game tests to perform, per in-game tests suite\n # Hash< Symbol, Array< String > >\n merged_in_game_tests = {}\n # Get the list of in-game tests we have to run and that we will monitor\n in_game_tests.each do |tests_suite, suite_selected_tests|\n in_game_tests_to_subscribe = @tests_suites[tests_suite].in_game_tests_for(suite_selected_tests)\n in_game_tests_to_subscribe.each do |in_game_tests_suite, selected_in_game_tests|\n selected_in_game_tests_downcase = selected_in_game_tests.map(&:downcase)\n in_game_tests_subscriptions[in_game_tests_suite] = [] unless in_game_tests_subscriptions.key?(in_game_tests_suite)\n in_game_tests_subscriptions[in_game_tests_suite] << {\n tests_suite: tests_suite,\n in_game_tests: selected_in_game_tests_downcase,\n selected_tests: suite_selected_tests\n }\n merged_in_game_tests[in_game_tests_suite] = [] unless merged_in_game_tests.key?(in_game_tests_suite)\n merged_in_game_tests[in_game_tests_suite] = (merged_in_game_tests[in_game_tests_suite] + selected_in_game_tests_downcase).uniq\n end\n end\n in_game_tests_runner = InGameTestsRunner.new(@config, @game)\n in_game_tests_runner.run(merged_in_game_tests) do |in_game_tests_suite, in_game_tests_statuses|\n # This is a callback called for each in-game test status change.\n # Update the tests results based on what has been run in-game.\n # Find all tests suites that are subscribed to those in-game tests.\n # Be careful that updates can be given for in-game tests suites we were not expecting\n if in_game_tests_subscriptions.key?(in_game_tests_suite)\n in_game_tests_subscriptions[in_game_tests_suite].each do |tests_suite_subscription|\n selected_in_game_tests_statuses = in_game_tests_statuses.slice(*tests_suite_subscription[:in_game_tests])\n next if selected_in_game_tests_statuses.empty?\n\n tests_suite = @tests_suites[tests_suite_subscription[:tests_suite]]\n tests_suite.statuses = tests_suite.\n parse_auto_tests_statuses_for(tests_suite_subscription[:selected_tests], { in_game_tests_suite => selected_in_game_tests_statuses }).\n select { |(test_name, _test_status)| tests_suite_subscription[:selected_tests].include?(test_name) }\n end\n end\n end\n end",
"title": ""
},
{
"docid": "3a33a4e12e2f1d34af2a620214dc2fc5",
"score": "0.6111094",
"text": "def define_tests\n Apt.update if Process.uid.zero? # update if root\n @lister.packages.each do |pkg|\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(pkg).run\n end\n end\n end\n end",
"title": ""
},
{
"docid": "3f6c24f9e33e4033c755922a815dd44e",
"score": "0.6106691",
"text": "def test_contains_four_eachface\n assert true == false\n end",
"title": ""
},
{
"docid": "14c59228e7a6fd175c35b62519df0194",
"score": "0.60886276",
"text": "def check test, block\n res = []\n begin\n block.call\n rescue ApiPi::AssertionError => e\n res << e.message\n end\n failed = !res.empty?\n failed ? @failure_count += 1 : @success_count += 1\n puts \"\\tERROR: #{res.first}\\n\" if failed\n end",
"title": ""
},
{
"docid": "8565de233139e9ad6a1506a3006ea95d",
"score": "0.6087629",
"text": "def runTest(browser)\n puts \"Step 2: At step description here\"\n #Do shit here\n #....\n puts \"Step 3: ....\"\n #Do more shit here\n #....\n\n puts \"Expected Result:\"\n puts \"Result that we expect to happen.\"\n\n if true #Test passed condition here\n self.passed = true\n puts \"TEST PASSED. Add some description/details here\"\n else #Test failed condition here\n self.passed = false\n puts \"TEST FAILED. Show what we have screwed up\"\n end\n end",
"title": ""
},
{
"docid": "1a568d7c95c23ffab78555a77d19e4d6",
"score": "0.6087446",
"text": "def testcase_processed\n\t\n\t\tcontinue = true\n\n\t\tthread = ::Thread.new do\n\t\t\n\t\t\tkill_browser\n\n\t\t\tcase @current_pass\n\t\t\t\twhen 1\n\t\t\t\t\t# Initial verification\n\t\t\t\t\t@genopts.keep\n\t\t\t\twhen 2\n\t\t\t\t\t# Reducing elements\n\t\t\t\t\t@elems.keep\n\t\t\t\twhen 3\n\t\t\t\t\t# Reducing idx's\n\t\t\t\t\t@idxs.keep\n\t\t\t\twhen 4\n\t\t\t\t\t# Final verification\n\t\t\t\t\t# booo, pass 4 has failed!?!.\n\t\t\t\t\tcontinue = false\n\t\t\t\telse\n\t\t\t\t\tcontinue = false\n\t\t\tend\n\n\t\t\t# while we still have testcases to generate...\n\t\t\tif( continue )\n\t\t\t\t# we go again an try the next testcase in a new browser instance\n\t\t\t\tspawn_browser\n\t\t\telse\n\t\t\t\t@reduction_server.stop\n\t\t\t\t::Thread.current.kill\n\t\t\tend\n\t\tend\n\t\t\n\t\tthread.join\n\t\t\n\t\treturn continue\n\tend",
"title": ""
},
{
"docid": "960e32ca6655ecf3ea8cc24ff5080f2d",
"score": "0.60841537",
"text": "def passes; end",
"title": ""
},
{
"docid": "960e32ca6655ecf3ea8cc24ff5080f2d",
"score": "0.60841537",
"text": "def passes; end",
"title": ""
},
{
"docid": "bb7ab3fedf55ad1946333ff97d7b4fa8",
"score": "0.60830265",
"text": "def rspec_test(nodes)\n node_manager.assert_known(nodes)\n for node in nodes\n node_manager.find(node).rspec_test\n end\n end",
"title": ""
},
{
"docid": "7ed7ccefe89ebb0e96265d3ccc21dc70",
"score": "0.60774684",
"text": "def test_checklist_status_values_not_started\n test = @product.product_tests.checklist_tests.first\n passing, failing, not_started, total = checklist_status_values(test)\n\n assert_equal 0, passing\n assert_equal 0, failing\n assert_equal 1, not_started\n assert_equal 1, total\n end",
"title": ""
},
{
"docid": "bfe6082caaf5b3163e7e61e7a6abce02",
"score": "0.60764015",
"text": "def test\n\n puts \"Performing test tasks:\"\n\n puts \"Test 1 \" + (generate_intcode([1, 0, 0, 0, 99]) === [2, 0, 0, 0, 99] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 2 \" + (generate_intcode([2, 3, 0, 3, 99]) === [2, 3, 0, 6, 99] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 3 \" + (generate_intcode([2, 4, 4, 5, 99, 0]) === [2, 4, 4, 5, 99, 9801] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 4 \" + (generate_intcode([1, 1, 1, 4, 99, 5, 6, 0, 99]) === [30, 1, 1, 4, 2, 5, 6, 0, 99] ? \"succeeded\": \"failed\") + \"!\"\n\nend",
"title": ""
},
{
"docid": "f5c73cf741b832cf8fc115c265a74551",
"score": "0.6075713",
"text": "def run_all\n run_suite(@suite)\n end",
"title": ""
},
{
"docid": "f2ccc6ac14a0e3664005f3ea5cda46a3",
"score": "0.6073246",
"text": "def completed_tests()\n test_array = []\n self.problems.each do |problem|\n problem.tests.each do |test|\n test_array.push(test)\n end\n end\n test_array\n end",
"title": ""
},
{
"docid": "5b5ff5d847506ccbc65e9f595502c90f",
"score": "0.6063769",
"text": "def run\n test_files.each do |file|\n eval File.read(file)\n end\n\n results = []\n @tests.each_pair do |name, test|\n results << test.call(@config)\n end\n results.reject!(&:nil?)\n results.reject!(&:empty?)\n results.flatten!\n results\n end",
"title": ""
},
{
"docid": "362809535c824de3b51f731dc4685cba",
"score": "0.6051214",
"text": "def check_all_here\n end",
"title": ""
},
{
"docid": "8c368e3c13ebb7f555d9fa1697745567",
"score": "0.6050966",
"text": "def final_test_methods\n return []\n end",
"title": ""
},
{
"docid": "b4d058567760b12a406b059f97385543",
"score": "0.6042158",
"text": "def run_all\n @last_run_states = @persistence ? @persistence.read('final_states', {}) : {}\n @skipped = {}\n run_suite(@suite)\n @persistence.store('final_states', @last_run_states) if @persistence\n end",
"title": ""
},
{
"docid": "b7b7d5cd4e885cbbfa35e9c438507bc1",
"score": "0.60243255",
"text": "def run(selected_tests)\n unknown_tests_suites = selected_tests.keys - @available_tests_suites\n log \"[ In-game testing #{@game.name} ] - !!! The following in-game tests suites are not supported: #{unknown_tests_suites.join(', ')}\" unless unknown_tests_suites.empty?\n tests_to_run = selected_tests.reject { |tests_suite, _tests| unknown_tests_suites.include?(tests_suite) }\n return if tests_to_run.empty?\n\n FileUtils.mkdir_p \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData\"\n tests_to_run.each do |tests_suite, tests|\n # Write the JSON file that contains the list of tests to run\n File.write(\n \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{tests_suite}_Run.json\",\n JSON.pretty_generate(\n 'stringList' => {\n 'tests_to_run' => tests\n }\n )\n )\n # Clear the AutoTest test statuses that we are going to run\n statuses_file = \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{tests_suite}_Statuses.json\"\n next unless File.exist?(statuses_file)\n\n File.write(\n statuses_file,\n JSON.pretty_generate('string' => JSON.parse(File.read(statuses_file))['string'].delete_if { |test_name, _test_status| tests.include?(test_name) })\n )\n end\n auto_test_config_file = \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_Config.json\"\n # Write the JSON file that contains the configuration of the AutoTest tests runner\n File.write(\n auto_test_config_file,\n JSON.pretty_generate(\n 'string' => {\n 'on_start' => 'run',\n 'on_stop' => 'exit'\n }\n )\n )\n out ''\n out '=========================================='\n out '= In-game tests are about to be launched ='\n out '=========================================='\n out ''\n out 'Here is what you need to do once the game will be launched (don\\'t launch it by yourself, the test framework will launch it for you):'\n out '* Load the game save you want to test (or start a new game).'\n out ''\n out 'This will execute all in-game tests automatically.'\n out ''\n out 'It is possible that the game crashes during tests:'\n out '* That\\'s a normal situation, as tests don\\'t mimick a realistic gaming experience, and the Bethesda engine is not meant to be stressed like that.'\n out '* In case of game crash (CTD), the Modsvaskr test framework will relaunch it automatically and resume testing from when it crashed.'\n out '* In case of repeated CTD on the same test, the Modsvaskr test framework will detect it and skip the crashing test automatically.'\n out '* In case of a game freeze without CTD, the Modsvaskr test framework will detect it after a few minutes and automatically kill the game before re-launching it to resume testing.'\n out ''\n out 'If you want to interrupt in-game testing: invoke the console with ~ key and type stop_tests followed by Enter.'\n out ''\n out 'Press enter to start in-game testing (this will lauch your game automatically)...'\n wait_for_user_enter\n last_time_tests_changed = nil\n with_auto_test_monitoring(\n on_auto_test_statuses_diffs: proc do |in_game_tests_suite, in_game_tests_statuses|\n yield in_game_tests_suite, in_game_tests_statuses\n last_time_tests_changed = Time.now\n end\n ) do\n # Loop on (re-)launching the game when we still have tests to perform\n idx_launch = 0\n loop do\n # Check which test is supposed to run first, as it will help in knowing if it fails or not.\n first_tests_suite_to_run = nil\n first_test_to_run = nil\n current_tests_statuses = check_auto_test_statuses\n @available_tests_suites.each do |tests_suite|\n next unless tests_to_run.key?(tests_suite)\n\n found_test_ok =\n if current_tests_statuses.key?(tests_suite)\n # Find the first test that would be run (meaning the first one having no status, or status 'started')\n tests_to_run[tests_suite].find do |test_name|\n found_test_name, found_test_status = current_tests_statuses[tests_suite].find { |(current_test_name, _current_test_status)| current_test_name == test_name }\n found_test_name.nil? || found_test_status == 'started'\n end\n else\n # For sure the first test of this suite will be the first one to run\n tests_to_run[tests_suite].first\n end\n next unless found_test_ok\n\n first_tests_suite_to_run = tests_suite\n first_test_to_run = found_test_ok\n break\n end\n if first_tests_suite_to_run.nil?\n log \"[ In-game testing #{@game.name} ] - No more test to be run.\"\n break\n else\n log \"[ In-game testing #{@game.name} ] - First test to run should be #{first_tests_suite_to_run} / #{first_test_to_run}.\"\n # Launch the game to execute AutoTest\n @game.launch(autoload: idx_launch.zero? ? false : 'auto_test')\n idx_launch += 1\n log \"[ In-game testing #{@game.name} ] - Start monitoring in-game testing...\"\n last_time_tests_changed = Time.now\n while @game.running?\n check_auto_test_statuses\n # If the tests haven't changed for too long, consider the game has frozen, but not crashed. So kill it.\n if Time.now - last_time_tests_changed > @game.timeout_frozen_tests_secs\n log \"[ In-game testing #{@game.name} ] - Last time in-game tests statuses have changed is #{last_time_tests_changed.strftime('%F %T')}. Consider the game is frozen, so kill it.\"\n @game.kill\n else\n sleep @game.tests_poll_secs\n end\n end\n last_test_statuses = check_auto_test_statuses\n # Log latest statuses\n log \"[ In-game testing #{@game.name} ] - End monitoring in-game testing. In-game test statuses after game run:\"\n last_test_statuses.each do |tests_suite, statuses_for_type|\n log \"[ In-game testing #{@game.name} ] - [ #{tests_suite} ] - #{statuses_for_type.select { |(_name, status)| status == 'ok' }.size} / #{statuses_for_type.size}\"\n end\n # Check for which reason the game has stopped, and eventually end the testing session.\n # Careful as this JSON file can be written by Papyrus that treat strings as case insensitive.\n # cf. https://github.com/xanderdunn/skaar/wiki/Common-Tasks\n auto_test_config = JSON.parse(File.read(auto_test_config_file))['string'].map { |key, value| [key.downcase, value.downcase] }.to_h\n if auto_test_config['stopped_by'] == 'user'\n log \"[ In-game testing #{@game.name} ] - Tests have been stopped by user.\"\n break\n end\n if auto_test_config['tests_execution'] == 'end'\n log \"[ In-game testing #{@game.name} ] - Tests have finished running.\"\n break\n end\n # From here we know that the game has either crashed or has been killed.\n # This is an abnormal termination of the game.\n # We have to know if this is due to a specific test that fails deterministically, or if it is the engine being unstable.\n # Check the status of the first test that should have been run to know about it.\n first_test_status = nil\n _found_test_name, first_test_status = last_test_statuses[first_tests_suite_to_run].find { |(current_test_name, _current_test_status)| current_test_name == first_test_to_run } if last_test_statuses.key?(first_tests_suite_to_run)\n if first_test_status == 'ok'\n # It's not necessarily deterministic.\n # We just have to go on executing next tests.\n log \"[ In-game testing #{@game.name} ] - Tests session has finished in error, certainly due to the game's normal instability. Will resume testing.\"\n else\n # The first test doesn't pass.\n # We need to mark it as failed, then remove it from the runs.\n log \"[ In-game testing #{@game.name} ] - First test #{first_tests_suite_to_run} / #{first_test_to_run} is in error status: #{first_test_status}. Consider it failed and skip it for next run.\"\n # If the test was started but failed before setting its status to something else then change the test status in the JSON file directly so that AutoTest does not try to re-run it.\n if first_test_status == 'started' || first_test_status == '' || first_test_status.nil?\n File.write(\n \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{first_tests_suite_to_run}_Statuses.json\",\n JSON.pretty_generate(\n 'string' => ((last_test_statuses[first_tests_suite_to_run] || []) + [[first_test_to_run, '']]).map do |(test_name, test_status)|\n [\n test_name,\n test_name == first_test_to_run ? 'failed_ctd' : test_status\n ]\n end.to_h\n )\n )\n # Notify the callbacks updating test statuses\n check_auto_test_statuses\n end\n end\n # We will start again. Leave some time to interrupt if we want.\n if @config.no_prompt\n out 'Start again automatically as no_prompt has been set.'\n else\n # First, flush stdin of any pending character\n $stdin.getc until select([$stdin], nil, nil, 2).nil?\n out \"We are going to start again in #{@game.timeout_interrupt_tests_secs} seconds. Press Enter now to interrupt it.\"\n key_pressed =\n begin\n Timeout.timeout(@game.timeout_interrupt_tests_secs) { $stdin.gets }\n rescue Timeout::Error\n nil\n end\n if key_pressed\n log \"[ In-game testing #{@game.name} ] - Run interrupted by user.\"\n # TODO: Remove AutoTest start on load: it has been interrupted by the user, so we should not keep it in case the user launches the game by itself.\n break\n end\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "c34e403acda011868eeafd519aa1a101",
"score": "0.60241014",
"text": "def querytests(binaries)\n # There are no test cases -- inconclusive.\n return 0 if binaries.empty?\n\n # If there are test cases, and _at least_ one of them managed to\n # _pass_, we assume the function is implemented.\n binaries.each { |b|\n f = File.new(\"#{b[0]}/log.passed\", 'r')\n while (line = f.gets)\n return 1 if line.include? b[1]\n end\n f.close\n }\n\n # Require at least 2 failing test cases.\n # XXX: Increase this to eliminate false positive results.\n return 0 if binaries.size < 2\n\n # The function is not implemented.\n return -1\nend",
"title": ""
},
{
"docid": "af09ed2d8448f488f7942145770ace65",
"score": "0.6019627",
"text": "def testloop\n \n end",
"title": ""
},
{
"docid": "121a8d403c0c2e2113ed9e4ccbb780fa",
"score": "0.6019041",
"text": "def test test_cases, f\n test_cases.each do |s, l, e|\n a = send(f, s, l)\n print \"#{f} #{s}, #{l} = #{a} ... \"\n if a == e\n puts 'PASS'\n else\n puts 'FAIL'\n end\n end\nend",
"title": ""
},
{
"docid": "2016220e624ab162601ef3d40450afc7",
"score": "0.60136944",
"text": "def integration_test()\n return [\"all\"]\n end",
"title": ""
},
{
"docid": "798161d9c7e91f579fc1960f8e4d0dbd",
"score": "0.60131127",
"text": "def save_tests\n filtered_builds.each do |build|\n tests = test_failures(build['build_num'])\n tests.each do |test|\n save_test(test, build['build_num'])\n end\n end\n end",
"title": ""
},
{
"docid": "e63ed608c3f58bbe43a147a905ebc797",
"score": "0.6006864",
"text": "def failed_checks\n all_checks_which_pass(false)\n end",
"title": ""
},
{
"docid": "619be52812cb8b1d3069a29bbe25e801",
"score": "0.6000295",
"text": "def run_test\n # Add your code here...\n end",
"title": ""
},
{
"docid": "619be52812cb8b1d3069a29bbe25e801",
"score": "0.6000295",
"text": "def run_test\n # Add your code here...\n end",
"title": ""
},
{
"docid": "820d21bb48d3d48db23dd33ea4cb6605",
"score": "0.6000057",
"text": "def spec_tests(&block)\n require 'onceover/testconfig'\n\n # Load up all of the tests and deduplicate them\n testconfig = Onceover::TestConfig.new(@onceover_yaml, @opts)\n testconfig.spec_tests.each { |tst| testconfig.verify_spec_test(self, tst) }\n tests = testconfig.run_filters(Onceover::Test.deduplicate(testconfig.spec_tests))\n\n # Loop over each test, executing the user's block on each\n tests.each do |tst|\n block.call(tst.classes[0].name, tst.nodes[0].name, tst.nodes[0].fact_set, tst.nodes[0].trusted_set, tst.nodes[0].trusted_external_set, testconfig.pre_condition)\n end\n end",
"title": ""
},
{
"docid": "4c19dfa9f5fd3f7e08fe8999045be7d0",
"score": "0.5990331",
"text": "def after_test(_test); end",
"title": ""
},
{
"docid": "4c19dfa9f5fd3f7e08fe8999045be7d0",
"score": "0.5990331",
"text": "def after_test(_test); end",
"title": ""
},
{
"docid": "4c19dfa9f5fd3f7e08fe8999045be7d0",
"score": "0.5990331",
"text": "def after_test(_test); end",
"title": ""
},
{
"docid": "35a51327dd0b5c9a884bb0e6f7155697",
"score": "0.5983938",
"text": "def testing\n # ...\n end",
"title": ""
},
{
"docid": "37d9e0ca36ef4af3f961c56ab19ec353",
"score": "0.5971915",
"text": "def passed?\n return @test_passed\n end",
"title": ""
},
{
"docid": "67679f5c8dde566428f067d2ef315366",
"score": "0.5969684",
"text": "def run\n checks.each(&:run)\n end",
"title": ""
},
{
"docid": "f424dc81541387d5e86f8a217c75e232",
"score": "0.59696263",
"text": "def count_tests\n Dir.entries(@path.to_s + \"sandbox\").each do |currFile|\n isFile = currFile.to_s =~ /\\.java$|\\.py$|\\.c$|\\.cpp$|\\.js$|\\.php$|\\.rb$|\\.hs$|\\.clj$|\\.go$|\\.scala$|\\.coffee$|\\.cs$|\\.groovy$\\.erl$/i\n\n unless isFile.nil?\n file = @path.to_s + \"sandbox/\" + currFile.to_s\n begin\n case @language.to_s\n when \"Java-1.8_JUnit\"\n if File.open(file).read.scan(/junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Mockito\"\n if File.open(file).read.scan(/org\\.mockito/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Powermockito\"\n if File.open(file).read.scan(/org\\.powermock/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Approval\"\n if File.open(file).read.scan(/org\\.approvaltests/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Python-unittest\"\n if File.open(file).read.scan(/unittest/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Python-pytest\"\n if file.include?\"test\"\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-TestUnit\"\n if File.open(file).read.scan(/test\\/unit/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-Rspec\"\n if File.open(file).read.scan(/describe/).count > 0\n @totaltests += File.open(file).read.scan(/it /).count\n end\n when \"C++-assert\"\n if File.open(file).read.scan(/cassert/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"C++-GoogleTest\"\n if File.open(file).read.scan(/gtest\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-CppUTest\"\n if File.open(file).read.scan(/CppUTest/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-Catch\"\n if File.open(file).read.scan(/catch\\.hpp/).count > 0\n @totaltests += File.open(file).read.scan(/TEST_CASE\\(/).count\n end\n when \"C-assert\"\n if File.open(file).read.scan(/assert\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"Go-testing\"\n if File.open(file).read.scan(/testing/).count > 0\n @totaltests += File.open(file).read.scan(/func /).count\n end\n when \"Javascript-assert\"\n if File.open(file).read.scan(/assert/).count > 0\n @totaltests += File.open(file).read.scan(/assert/).count - 2 #2 extra because of library include line\n end\n when \"C#-NUnit\"\n if File.open(file).read.scan(/NUnit\\.Framework/).count > 0\n @totaltests += File.open(file).read.scan(/\\[Test\\]/).count\n end\n when \"PHP-PHPUnit\"\n if File.open(file).read.scan(/PHPUnit_Framework_TestCase/).count > 0\n @totaltests += File.open(file).read.scan(/function /).count\n end\n when \"Perl-TestSimple\"\n if File.open(file).read.scan(/use Test/).count > 0\n @totaltests += File.open(file).read.scan(/is/).count\n end\n when \"CoffeeScript-jasmine\"\n if File.open(file).read.scan(/jasmine-node/).count > 0\n @totaltests += File.open(file).read.scan(/it/).count\n end\n when \"Erlang-eunit\"\n if File.open(file).read.scan(/eunit\\.hrl/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(\\)/).count\n end\n when \"Haskell-hunit\"\n if File.open(file).read.scan(/Test\\.HUnit/).count > 0\n @totaltests += File.open(file).read.scan(/TestCase/).count\n end\n when \"Scala-scalatest\"\n if File.open(file).read.scan(/org\\.scalatest/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(/).count\n end\n when \"Clojure-.test\"\n if File.open(file).read.scan(/clojure\\.test/).count > 0\n @totaltests += File.open(file).read.scan(/deftest/).count\n end\n when \"Groovy-JUnit\"\n if File.open(file).read.scan(/org\\.junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Groovy-Spock\"\n if File.open(file).read.scan(/spock\\.lang/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count - 1 #1 extra because of object def\n end\n else\n @totaltests = \"NA\"\n end\n rescue\n puts \"Error: Reading in count_tests\"\n end\n end\n end\nend",
"title": ""
},
{
"docid": "f901eb055431bcb45ce3fcbd6170b4f3",
"score": "0.5965452",
"text": "def run test_identifier=nil\n @dispatcher.run!\n # start\n message(\"start\")\n suite_setup,suite_teardown,setup,teardown,tests=*parse(test_identifier)\n if tests.empty? \n @dispatcher.exit\n raise RutemaError,\"No tests to run!\"\n else\n # running - at this point all checks are done and the tests are active\n message(\"running\")\n run_scenarios(tests,suite_setup,suite_teardown,setup,teardown)\n end\n message(\"end\")\n @dispatcher.exit\n @dispatcher.report(tests)\n end",
"title": ""
},
{
"docid": "79a59a5289dbe6289f1cf72a6bdb512f",
"score": "0.5955056",
"text": "def report_from(tests)\n tests.map do |test|\n report = [test.name, test.executed?]\n report << test.platform.name unless test.platform.nil?\n report << test.node unless test.node.nil?\n # Only report the first line of the error messages, as some contain callstacks\n report << test.errors.map { |error| error.split(\"\\n\").first } unless test.errors.empty?\n report\n end\n end",
"title": ""
},
{
"docid": "dfbef69b97a7e5b28dbadc9a7a076b96",
"score": "0.59545577",
"text": "def run_all\n UI.info \"Running all tests...\"\n _really_run(Util.xcodebuild_command(options))\n end",
"title": ""
},
{
"docid": "1d3ffd962c8a31a67b2f7994a7ff2413",
"score": "0.59439194",
"text": "def process_test_cases\n raise NotImplementedError, 'You must implement this'\n end",
"title": ""
},
{
"docid": "1cbab3d4a1fcc651df478e30651c3cff",
"score": "0.594306",
"text": "def test_run_completed(test_run)\n report_results test_run\n end",
"title": ""
},
{
"docid": "834c00d9838d67a9841194157e324993",
"score": "0.5942392",
"text": "def run_fe_tests\n end",
"title": ""
},
{
"docid": "06f4530ed3a006d306ce1d0604e0e51a",
"score": "0.5942066",
"text": "def run_all\n passed = @runner.run_all!\n\n throw :task_has_failed unless passed\n end",
"title": ""
},
{
"docid": "18196134de6983b83a0d7b12a0efc5ab",
"score": "0.5933383",
"text": "def run_tests\n\n ::RSpec::Core::Runner.run([])\n\n print ::IRB.CurrentContext.io.prompt\n\n end",
"title": ""
},
{
"docid": "1deeedb8cb3e556562be7eef950ba948",
"score": "0.59289336",
"text": "def test_list\n list = []\n instance_methods.each do |m|\n next unless m.to_s =~ /^(ok|no)[_ ]/\n list << m\n end\n list\n end",
"title": ""
}
] |
3db70fc8b1ee4900edf24c44cbca871b | Add a new swagger response header | [
{
"docid": "7aaa26bfa05fd156b0d762a8452ab61b",
"score": "0.8288922",
"text": "def add_response_header(name, type, description)\n name = name.to_s\n check_duplicate(name, 'Response header')\n @response_headers[name] = SwaggerResponseHeader.new(name, type, description)\n end",
"title": ""
}
] | [
{
"docid": "26588b231630360edf8fd96ad29c9b61",
"score": "0.702932",
"text": "def set_header name, value\n response_object.header name, value\n end",
"title": ""
},
{
"docid": "1a22640ad4f2799a55545b062243fafb",
"score": "0.6890965",
"text": "def fill_header(response); end",
"title": ""
},
{
"docid": "ab860a0f3e4ecc47b2143c96205f4b42",
"score": "0.68728316",
"text": "def header(name, value)\n har_headers << [name, value]\n super(name, value)\n end",
"title": ""
},
{
"docid": "eeba64b9492ec50ee7cd480b7b69f4f4",
"score": "0.6844559",
"text": "def add_response_header(key, value)\n new(\n response_headers: ConnSupport::Headers.add(\n response_headers, key, value\n )\n )\n end",
"title": ""
},
{
"docid": "a1555ce8ef44fcc6feb58a8f128cf604",
"score": "0.68121576",
"text": "def add_headers; end",
"title": ""
},
{
"docid": "ed919c7076d5e81ebb5136a24767aabc",
"score": "0.6746823",
"text": "def add_header(name, value)\n end",
"title": ""
},
{
"docid": "d9fc3d084730c7637867f3b526417f5f",
"score": "0.67214227",
"text": "def build_headers(include_api = true)\n headers = {\n 'referer' => '/swagger/index.html'\n }\n\n headers\nend",
"title": ""
},
{
"docid": "b1c0cefb3c9718b14a560e03fa3fbe31",
"score": "0.6672544",
"text": "def response_header(node)\n node = node.is_a?(Array) ? node.last : node\n\n {\n 'Content-Type' => 'application/json',\n 'X-Etcd-Index' => node['createdIndex'],\n 'X-Raft-Index' => 300000 * rand,\n 'X-Raft-Term' => 4\n }\n end",
"title": ""
},
{
"docid": "fb2932ab6aff6dbc30a103b4296cdbf0",
"score": "0.65597916",
"text": "def header=(header = {})\n @header = { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }.merge(header)\n end",
"title": ""
},
{
"docid": "fb2932ab6aff6dbc30a103b4296cdbf0",
"score": "0.6559678",
"text": "def header=(header = {})\n @header = { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }.merge(header)\n end",
"title": ""
},
{
"docid": "88ced72576a88966361775b695325f7c",
"score": "0.651118",
"text": "def render_header\n response_header = \"#{@version} #{@status} #{@reason}#{CRLF}\"\n\n unless @headers.empty?\n response_header << @headers.map do |header, value|\n \"#{header}: #{value}\"\n end.join(CRLF) << CRLF\n end\n\n response_header << CRLF\n end",
"title": ""
},
{
"docid": "138e67bf46fe54cb4136d8adfd2fd2ab",
"score": "0.64835316",
"text": "def set_header(token)\n response.headers['Authorization'] = \"Bearer #{token.to_jwt}\"\n end",
"title": ""
},
{
"docid": "d86d0303fec2deb4eb2e58899cf9a0bb",
"score": "0.6483332",
"text": "def prepend_header(name, value)\n end",
"title": ""
},
{
"docid": "1e6e8547042eba9e2dc829ac7a80d144",
"score": "0.6450356",
"text": "def add_header(header)\n @headers.merge!(header)\n end",
"title": ""
},
{
"docid": "4f95a6e63ca72a368f4878087066ba82",
"score": "0.6414877",
"text": "def header_set(name, value)\n return dup_without_response.header_set(name, value) if response\n\n name = name.to_s\n if value.nil?\n @headers.delete name\n return self\n end\n\n @headers[name] = value.to_s\n self\n end",
"title": ""
},
{
"docid": "d27dae4b33fdf058404cd8fe88e8ab8a",
"score": "0.63739485",
"text": "def set_json_api_header\n response.set_header(\"Content-Type\", \"application/vnd.api+json\")\n end",
"title": ""
},
{
"docid": "4b24a94a1655ca8c98234bea69e485f4",
"score": "0.6344346",
"text": "def headers(header = nil)\n @response.headers.merge!(header) if header\n @response.headers\n end",
"title": ""
},
{
"docid": "b60ddaef7c86475deffc5e2dc0ded803",
"score": "0.6296884",
"text": "def add_http_header(key, value)\n @http_headers[key] = value\n end",
"title": ""
},
{
"docid": "fe4a37a4028a5b6f5eea6574fb738d69",
"score": "0.62878793",
"text": "def safe_append_header(key, value)\n resp_headers[key] = value.to_s\n end",
"title": ""
},
{
"docid": "2e21c2540476ab084c427cd2fe2cd31e",
"score": "0.62686014",
"text": "def add_custom_header(value)\n if value.instance_of? CustomHeaderJson\n @custom_headers.push(value)\n end\n end",
"title": ""
},
{
"docid": "246e162278007570aac4a0af321f9525",
"score": "0.6231002",
"text": "def apply_headers(req)\n req.add_field('API-Version', self.api_version)\n req.add_field('accept','application/json')\n req.add_field('Content-Type','application/json')\n req.add_field('API-Appid', self.app_id)\n req.add_field('API-Username', self.username)\n req.add_field('API-Password', self.password)\n return req\n end",
"title": ""
},
{
"docid": "da417ea85611895c71760750efc9802d",
"score": "0.6228675",
"text": "def header(header_name, description, options = {}) #:doc\n return unless Apipie.active_dsl?\n _apipie_dsl_data[:headers] << {\n name: header_name,\n description: description,\n options: options\n }\n end",
"title": ""
},
{
"docid": "aa4628d4fd8a344cf262ba6efd369cfe",
"score": "0.6208527",
"text": "def new_header\n SimpleOAuth::Header.new(\n request_method,\n API_URL,\n params,\n client.oauth_options\n )\n end",
"title": ""
},
{
"docid": "06a863b2ca25bf3a22855d0bc8c27614",
"score": "0.612298",
"text": "def write_headers(response)\n @headers.each do |key, value|\n case key\n when /^Content-Type$/i\n response.setContentType(value.to_s)\n when /^Content-Length$/i\n length = value.to_i\n # setContentLength(int) ... addHeader must be used for large files (>2GB)\n response.setContentLength(length) if ! chunked? && length < 2_147_483_648\n else\n # servlet container auto handle chunking when response is flushed \n # (and Content-Length headers has not been set) :\n next if key == TRANSFER_ENCODING && skip_encoding_header?(value)\n # NOTE: effectively the same as `v.split(\"\\n\").each` which is what\n # rack handler does to guard against response splitting attacks !\n # https://github.com/jruby/jruby-rack/issues/81\n if value.respond_to?(:each_line)\n value.each_line { |val| response.addHeader(key.to_s, val.chomp(\"\\n\")) }\n elsif value.respond_to?(:each)\n value.each { |val| response.addHeader(key.to_s, val.chomp(\"\\n\")) }\n else\n case value\n when Numeric\n response.addIntHeader(key.to_s, value.to_i)\n when Time\n response.addDateHeader(key.to_s, value.to_i * 1000)\n else\n response.addHeader(key.to_s, value.to_s)\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "6afb38a034b752a4a60f67bf2f69a028",
"score": "0.6103855",
"text": "def add_header key, value\n\t\t\t@headers ||= {}\n\t\t\t@headers[key] = value\n\t\tend",
"title": ""
},
{
"docid": "2f21aed76f9efb4d688c2911057ba348",
"score": "0.6067866",
"text": "def headers hash=nil\n @response.headers.merge! hash if hash\n @response.headers\n end",
"title": ""
},
{
"docid": "2db2dd0299ab959b6423cdf6af087028",
"score": "0.605933",
"text": "def add_headers\n @headers.each do |field, value|\n @request_header << \"#{field}: #{value}\"\n end\n end",
"title": ""
},
{
"docid": "b15962601e2aa1a4183b616ee26a8725",
"score": "0.60451156",
"text": "def formulate_headers(auth_header)\n {\n 'Content-Type' => 'application/json',\n 'Authorization' => auth_header,\n 'Content-Encoding' => 'gzip',\n 'Accept' => 'application/json'\n }\n end",
"title": ""
},
{
"docid": "d34248d94f1099a514dfd8eefef6b853",
"score": "0.60353816",
"text": "def header(name)\n @env.response_headers[name]\n end",
"title": ""
},
{
"docid": "d5ea41b00604e0afe99ba5c163b3af2a",
"score": "0.60284096",
"text": "def upd_header(headers)\n hdr={'Content-Type' =>'application/json'}\n if(headers!=nil)\n headers['Content-Type']='application/json'\n hdr=headers\n end\n hdr\n end",
"title": ""
},
{
"docid": "dd8b1ba900ef0551d5cc16e97221a521",
"score": "0.60230654",
"text": "def header(name)\n @response[name]\n end",
"title": ""
},
{
"docid": "879babb3e924e25675904d39241c93fb",
"score": "0.60211873",
"text": "def include_default_headers\n\t\t\tapi_header\n\t\t\tapi_response_format\n\t\tend",
"title": ""
},
{
"docid": "6a1866ba6f8cda35648661d645d8a239",
"score": "0.5979931",
"text": "def set_header_options(curl)\n summary = summary_for_feed\n \n unless summary.nil?\n curl.headers['If-None-Match'] = summary[:etag] unless summary[:etag].nil?\n curl.headers['If-Modified-Since'] = summary[:last_modified] unless summary[:last_modified].nil?\n end\n \n curl\n end",
"title": ""
},
{
"docid": "141835f63b8831adf7d8218756a9d7b2",
"score": "0.59714204",
"text": "def set_auth_header(token)\n\t\t\tActiveResource::Base.headers['Authorization'] = \"Bearer #{token}\"\n\t\t\tnil\n\t\tend",
"title": ""
},
{
"docid": "117228f1da4a0a4e21eb5afc9c5bf228",
"score": "0.59568936",
"text": "def add_response_headers(resp)\n resp['Server'] = self.server_name if not resp['Server']\n end",
"title": ""
},
{
"docid": "2a8d600ddd38b02686c84cbc25f3d805",
"score": "0.5953189",
"text": "def defaultHeaders(token)\n { 'Accept' => '*/*',\n 'Content-Type' => 'application/json',\n 'Authorization' => 'Bearer ' + token }\nend",
"title": ""
},
{
"docid": "9fad870603acd8a8b2c5b4bc88c5c16f",
"score": "0.5925239",
"text": "def headers=(new_headers)\n @_response ||= ActionDispatch::Response.new\n @_response.headers.replace(new_headers)\n end",
"title": ""
},
{
"docid": "3ddd64b4d36040f819bc1f44598adb5e",
"score": "0.5891714",
"text": "def response_headers! http_status_code = 200, http_with_version = 'HTTP 1.1', header_hash\n errors = header_hash.each_with_object [] do |(key, val), errors|\n key = key.to_s; val = val.to_s\n rv = Wrapper.msc_add_n_response_header txn_ptr, (strptr key), key.bytesize, (strptr val), val.bytesize\n rv == 1 or errors << \"msc_add_n_response_header failed adding #{[key,val].inspect}\"\n end\n\n raise Error, errors if errors.any?\n\n rv = Wrapper.msc_process_response_headers txn_ptr, (Integer http_status_code), (strptr http_with_version)\n rv == 1 or raise \"msc_process_response_headers failed\"\n\n intervention!\n end",
"title": ""
},
{
"docid": "a6b9a15490e174e1d6261c056b369b05",
"score": "0.58744997",
"text": "def header(hash = {})\n @headers.merge!(hash)\n end",
"title": ""
},
{
"docid": "a1866092fc1aee6a7854790959a5783d",
"score": "0.58709586",
"text": "def header\n @header ||= create_header\n end",
"title": ""
},
{
"docid": "4058d88e002ad53e64adce811ca54641",
"score": "0.5862966",
"text": "def generate_header\n \n self.reload\n self.headers.reload\n \n layout_path = self.current_layout.relative_path unless self.current_layout.nil?\n \n # Default header values\n yaml_headers = {'title' => self.name, \n 'created_at' => Time.now,\n 'layout' => layout_path}\n \n self.headers.each do |header|\n yaml_headers[header.name] = header.content\n end\n \n update_attributes(:generated_header => YAML::dump(yaml_headers) + \"---\\n\")\n end",
"title": ""
},
{
"docid": "3aa39ac90da15a7f9edf5163f35211bc",
"score": "0.58614016",
"text": "def install_header_callback( request, wrapped_response )\n original_callback = request.on_header\n request._ty_original_on_header = original_callback\n request._ty_header_str = ''\n request.on_header do |header_data|\n wrapped_response.append_header_data( header_data )\n\n if original_callback\n original_callback.call( header_data )\n else\n header_data.length\n end\n end\n end",
"title": ""
},
{
"docid": "1121c7fb426991a64c7ae1f00cd98a38",
"score": "0.5860472",
"text": "def getHeader\n #updateToken\n {'Content-Type' => 'application/json', 'Authorization' => 'Bearer ' + @token}\n end",
"title": ""
},
{
"docid": "1d5975bacd81691b1db76add78bf1948",
"score": "0.58520514",
"text": "def http_header(field=nil, value=nil)\n @_http_header ||= {}\n @_http_header[field] = value if field\n @_http_header\n end",
"title": ""
},
{
"docid": "fa6a559d97234be7ba0c4167ec4dd9f3",
"score": "0.58503103",
"text": "def header(routes)\n # no need for a header\n end",
"title": ""
},
{
"docid": "94963b230a1bb27bd82755cda7ff2e1b",
"score": "0.58376825",
"text": "def set_pagination_header(resource,resource_name)\n #print current page\n headers[\"x-page\"] = page\n #print records per page\n headers[\"x-per-page\"] = per_page\n #print total records\n headers[\"x-total\"] = resource.total_count\n #print next page url\n headers[\"next_page\"] = eval \"api_v1_#{resource_name}_url(request.query_parameters.merge(page: resource.next_page))\" if resource.next_page\n #print prev page url\n headers[\"prev_page\"] = eval \"api_v1_#{resource_name}_url(request.query_parameters.merge(page: resource.next_page))\" if resource.prev_page\n end",
"title": ""
},
{
"docid": "4717cefabd79044bf3f2661977659eac",
"score": "0.583459",
"text": "def default_http_header; end",
"title": ""
},
{
"docid": "7d41b3a9e7eb6f0de61fef1048050ddb",
"score": "0.582838",
"text": "def options\n head :status => 200, :'Access-Control-Allow-Headers' => 'accept, content-type'\n end",
"title": ""
},
{
"docid": "5b8283982c0fcc8494dc55cc844367a2",
"score": "0.58238524",
"text": "def fill_header response\n @response = Mechanize::Headers.new\n\n response.each { |k,v|\n @response[k] = v\n } if response\n\n @response\n end",
"title": ""
},
{
"docid": "e6a462b2a94fbe0eb368b854527d52a2",
"score": "0.5814858",
"text": "def get_response_header(response)\n raise \"REST response was nil\" if response == nil\n raise \"REST response had no attached header\" if response.headers == nil\n begin\n header = response.headers # already in Ruby Hash format\n set_all_defaults(body)\n rescue JSON::ParserError => e\n puts \"rescued : ParserError\"\n puts e\n header = response.headers\n end\n header\n end",
"title": ""
},
{
"docid": "ad209399551c359c5be3c71f02b15167",
"score": "0.5796433",
"text": "def change_header( header, value, index=1 )\n index = [index].pack('N')\n RESPONSE[\"CHGHEADER\"] + \"#{index}#{header}\\0#{value}\" + \"\\0\"\n end",
"title": ""
},
{
"docid": "4de62a385f85b55913f08db97cd9093c",
"score": "0.579331",
"text": "def header_write_callback\n @header_write_callback ||= proc {|stream, size, num, object|\n @response_headers << stream.read_string(size * num)\n size * num\n }\n end",
"title": ""
},
{
"docid": "bf286a10ffef31f9d7142eed38803bad",
"score": "0.5791185",
"text": "def headers\n { 'x-apigw-api-id' => tmp_api_id }\n end",
"title": ""
},
{
"docid": "9516e10f1eaf4f3bb720a8b034446584",
"score": "0.5783706",
"text": "def set_header key, value\n headers.update(key => value)\n end",
"title": ""
},
{
"docid": "7d7d2c64dc121746476433cc387e3eed",
"score": "0.57827777",
"text": "def header\n end",
"title": ""
},
{
"docid": "edbe4f5419827ab6ec41c091e5c12a30",
"score": "0.577788",
"text": "def set_header(name, value)\n @headers[name] = value\n \n return self\n end",
"title": ""
},
{
"docid": "c6ba0bc2cd5654e83e3c78155de9111a",
"score": "0.5774948",
"text": "def apply_header(options, key, value)\n options.merge! :headers => {} unless options.has_key? :headers\n options[:headers].merge!({ key => value })\n end",
"title": ""
},
{
"docid": "99b480a464c479c633abab0d0980ed8a",
"score": "0.5770374",
"text": "def header(hash)\n self._headers.merge!(hash)\n end",
"title": ""
},
{
"docid": "7ae80fca0f515a9307ce333085ecc531",
"score": "0.5767683",
"text": "def procore_headers(company_id: nil, token: '')\n if company_id.nil?\n {\n \"Authorization\": \"Bearer #{token}\",\n \"Content-Type\": \"application/json\",\n }\n else\n {\n \"Authorization\": \"Bearer #{token}\",\n \"Content-Type\": \"application/json\",\n \"Procore-Company-Id\": \"#{company_id}\"\n }\n end\nend",
"title": ""
},
{
"docid": "45554fbb7b6d957f23bd7fc743a474ab",
"score": "0.5755657",
"text": "def send_headers response_code\n end",
"title": ""
},
{
"docid": "e0549b015e8eaffcb4decf4536044e5e",
"score": "0.575306",
"text": "def write_hdr(field, value)\n @header_data.write_int(field, value)\n @header_modified = true\n end",
"title": ""
},
{
"docid": "980f9e71a2256d4d088602e4871782f7",
"score": "0.57466996",
"text": "def change_header( header, value, index=1 )\n index = [index].pack('N')\n RESPONSE[:chgheader] + \"#{index}#{header}\\0#{value}\" + \"\\0\"\n end",
"title": ""
},
{
"docid": "dea407bd8702cb239bdd11d39e798432",
"score": "0.57460934",
"text": "def response_header\n nil\n end",
"title": ""
},
{
"docid": "8df65dd91fac212cea72ef1f9050fb35",
"score": "0.57309127",
"text": "def header(name, value = nil)\n if value\n (@headers ||= {})[name] = value\n else\n (@headers || {})[name]\n end\n end",
"title": ""
},
{
"docid": "ad57def6da655ddf7b141f1374da4722",
"score": "0.5730699",
"text": "def generate_headers(response)\n\n return [@http_status, \n \"date: #{Time.now.ctime}\", \n \"server: test\",\n \"content-type: text/html; charset=iso-8859-1\",\n \"content-length: #{response.length}\\r\\n\\r\\n\"].join(\"\\r\\n\")\n end",
"title": ""
},
{
"docid": "fd96927b8d6b69c9971c3eca024cac09",
"score": "0.57163465",
"text": "def headers\n h = {\n 'X-Api-Version' => @api_version,\n :accept => :json,\n }\n\n if @account_id\n h['X-Account'] = @account_id\n end\n\n if @access_token\n h['Authorization'] = \"Bearer #{@access_token}\"\n elsif @cookies\n h[:cookies] = @cookies\n end\n\n if @local_token\n h['X-RLL-Secret'] = @local_token\n end\n\n h\n end",
"title": ""
},
{
"docid": "4111dbdb33614f84ff16fc8a51bb1420",
"score": "0.571041",
"text": "def header(name, value)\n if value.nil?\n @headers.delete(name)\n else\n @headers[name] = value\n end\n end",
"title": ""
},
{
"docid": "54437b4ac09815d7520311b588751938",
"score": "0.5706907",
"text": "def header(value = nil)\n value ? self.header = value : @header\n end",
"title": ""
},
{
"docid": "ced11f0b28504930604683c77d8972fc",
"score": "0.5699847",
"text": "def with_custom_headers(header)\n @header = header\n self\n end",
"title": ""
},
{
"docid": "8925d18bdfcb919d64a276af6a2932e8",
"score": "0.56923896",
"text": "def header header, op\n end",
"title": ""
},
{
"docid": "a1d39d41506aa9776da225d27af51a1e",
"score": "0.56835544",
"text": "def push_to_headers\n unless @session.nil?\n response.headers['sid'] = @session.id\n response.headers['utoken'] = @session.utoken\n end\n end",
"title": ""
},
{
"docid": "66354986b497267f09e6e0987b17e3da",
"score": "0.5681542",
"text": "def headers\n { 'Status' => ActionController::Base::DEFAULT_RENDER_STATUS_CODE }\n end",
"title": ""
},
{
"docid": "6c42852c50a730ec6295549403769f73",
"score": "0.5678519",
"text": "def write_headers(source_doc, output_file)\n items = [\"---\"]\n items << \"layout: #{@options[:layout]}\"\n items << \"title: \\\"#{source_doc.at_css(\"title\").text}\\\"\"\n items << \"description: \\\"#{source_doc.at_css(\"excerpt|encoded\", namespaces).text}\\\"\"\n items << \"date: #{source_doc.at_css(\"pubDate\").text}\"\n items << \"comments: #{@options[:comments]}\"\n items << \"author: #{@options[:author]}\"\n items << \"categories: [#{source_doc.css(\"category[domain='tag']\").collect { |n| n.text }.join(\",\")}]\"\n items << \"---\"\n output_file.write(\"#{items.join(\"\\r\\n\")}\\r\\n\\r\\n\") \n end",
"title": ""
},
{
"docid": "bc30638ea68dd735353f3504b0b46f70",
"score": "0.5669533",
"text": "def headers\n if self.middleware.to_sym == :reso_api\n reso_headers\n else\n spark_headers\n end\n end",
"title": ""
},
{
"docid": "0c72551b6e3036b9666c145e49641eef",
"score": "0.5665516",
"text": "def header(name)\n @responseheaders[name.downcase]\n end",
"title": ""
},
{
"docid": "5c9d3f6dbcb8501d793be7ba66261d9e",
"score": "0.5661101",
"text": "def perform\n add_request_if_new do |request|\n request.header_set(*arguments)\n end\n end",
"title": ""
},
{
"docid": "8b13c80888f7888bbbc5c0618afcd693",
"score": "0.5659764",
"text": "def header=(header)\n @header = header\n end",
"title": ""
},
{
"docid": "76971f566ea2e66aa9885bceef79a9b2",
"score": "0.5658162",
"text": "def headers\n end",
"title": ""
},
{
"docid": "76688234a9daa966090d377176a0875d",
"score": "0.56549734",
"text": "def api_key_header\n {'X-API-KEY' => 'some_api_key'}\n end",
"title": ""
},
{
"docid": "7efbf87bfab2373a721d68b021cd23a3",
"score": "0.5648657",
"text": "def add_caching_headers\n if etag = resource.generate_etag\n response.headers['ETag'] = ensure_quoted_header(etag)\n end\n if expires = resource.expires\n response.headers['Expires'] = expires.httpdate\n end\n if modified = resource.last_modified\n response.headers['Last-Modified'] = modified.httpdate\n end\n end",
"title": ""
},
{
"docid": "6e32a41352aa84e6c2cc329696b086a2",
"score": "0.5645169",
"text": "def set_header(auth_headers)\n header 'access-token', auth_headers['access-token']\n header 'token-type', auth_headers['token-type']\n header 'client', auth_headers['client']\n header 'expiry', auth_headers['expiry']\n header 'uid', auth_headers['uid']\nend",
"title": ""
},
{
"docid": "171905336d8cc345ad876f5adef5e248",
"score": "0.5643059",
"text": "def set_headers\n response.headers['Access-Control-Expose-Headers'] = 'Content-Range'\n response.headers['Content-Range'] = \"0-10/#{Item.all.length}\"\n end",
"title": ""
},
{
"docid": "4b772c7b906b42a38cf883a2ecac9c4b",
"score": "0.5642724",
"text": "def header(str)\n # {{{\n if @output_started\n raise \"HTTP-Headers are already send. You can't change them after output has started!\"\n end\n unless @output_allowed\n raise \"You just can set headers inside of a Rweb::out-block\"\n end\n if str.is_a?Array\n str.each do | value |\n self.header(value)\n end\n\n elsif str.split(/\\n/).length > 1\n str.split(/\\n/).each do | value |\n self.header(value)\n end\n\n elsif str.is_a? String\n str.gsub!(/\\r/, \"\")\n\n if (str =~ /^HTTP\\/1\\.[01] [0-9]{3} ?.*$/) == 0\n pattern = /^HTTP\\/1.[01] ([0-9]{3}) ?(.*)$/\n\n result = pattern.match(str)\n self.setstatus(result[0], result[1])\n elsif (str =~ /^status: [0-9]{3} ?.*$/i) == 0\n pattern = /^status: ([0-9]{3}) ?(.*)$/i\n\n result = pattern.match(str)\n self.setstatus(result[0], result[1])\n else\n a = str.split(/: ?/, 2)\n\n @header[a[0].downcase] = a[1]\n end\n end\n # }}}\n end",
"title": ""
},
{
"docid": "25058d45c64c1688cf8c07562c06ecf6",
"score": "0.5639483",
"text": "def default_header\n if @access_token.present?\n {\n \"Authorization\" => \"Bearer #{@access_token.token}\",\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json\"\n }\n else\n {\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json\"\n }\n end\n end",
"title": ""
},
{
"docid": "1d8cea46066c29cee358d7743e71dbb9",
"score": "0.56268203",
"text": "def header mold\n\t\t#puts \"#{@name} url: #{@url}\"\n\n\t\tret = comment(mold.name)\n\n\t\tret << \"@interface #{mold.name} : NSObject\\n\\n\"\n\n\t\t#writes the property declaration in the header file\n\t\tmold.properties.each { |p| ret << property(p) }\n\n\t\tret << \"\\n+ (RKObjectMapping *) mapping;\\n\"\n\n\t\tret << \"\\n@end\"\n\tend",
"title": ""
},
{
"docid": "3e4315563cfac0b7d6ee7bf50ab9858d",
"score": "0.56225234",
"text": "def initialize_http_header(initheader)\n super\n set_headers_for_body\n end",
"title": ""
},
{
"docid": "56c6385b360c1d1c65f656a541804cb6",
"score": "0.5617766",
"text": "def write_header() \n @builder.head do\n @builder.title('OmniFocus OPML Export')\n @builder.dateCreated(Time.now.httpdate)\n @builder.dateModified(Time.now.httpdate)\n# TODO @builder.ownerName(\"\")\n# TODO @builder.ownerEmail('example@example.com')\n end\n end",
"title": ""
},
{
"docid": "5f1b6fdcb149f38528b005afe0792825",
"score": "0.5614859",
"text": "def generate_headers(request, soap)\n credentials = @credential_handler.credentials\n headers = @auth_handler.headers(credentials)\n request_header = headers.inject({}) do |request_header, (header, value)|\n if header == :access_token\n request.url = soap.endpoint\n request.headers['Authorization'] =\n @auth_handler.generate_oauth_parameters_string(credentials,\n request)\n else\n request_header[prepend_namespace(header)] = value\n end\n request_header\n end\n soap.header[prepend_namespace(@element_name)] = request_header\n end",
"title": ""
},
{
"docid": "74ffdaaa04f4f55d3de0005e5c4c7781",
"score": "0.5609384",
"text": "def redmine_headers(h)\n h.each { |k,v| headers[\"X-Redmine-#{k}\"] = v }\n end",
"title": ""
},
{
"docid": "74ffdaaa04f4f55d3de0005e5c4c7781",
"score": "0.5609384",
"text": "def redmine_headers(h)\n h.each { |k,v| headers[\"X-Redmine-#{k}\"] = v }\n end",
"title": ""
},
{
"docid": "0fb03cb18d58d2a9ec8f8a9eefbf24ca",
"score": "0.56079155",
"text": "def post_headers(response=nil)\n hdrs = {\"Content-Type\" => 'application/json',\n \"Accept\" => \"application/json, text/javascript, */*; q=0.01\"}\n @headers.merge!(hdrs)\n end",
"title": ""
},
{
"docid": "e03c7c986aef2ce37dbd4ab72adae7ee",
"score": "0.56048113",
"text": "def add_link_header(query_parameters)\n response.headers['Link'] = construct_link_header(query_parameters)\n end",
"title": ""
},
{
"docid": "0610e5f2c5a4737f4d9607cbec2184b6",
"score": "0.5602762",
"text": "def header=(header)\n @header = header\n end",
"title": ""
},
{
"docid": "21e6b51f41dc6796bea80d3b506796ed",
"score": "0.55998117",
"text": "def set_extra_headers_for(params)\n maor_headers = {\n 'x-tmrk-version' => @version,\n 'Date' => Time.now.utc.strftime(\"%a, %d %b %Y %H:%M:%S GMT\"),\n }\n params[:headers].merge!(maor_headers)\n if params[:method]==\"POST\" || params[:method]==\"PUT\"\n params[:headers].merge!({\"Content-Type\" => 'application/xml'})\n params[:headers].merge!({\"Accept\" => 'application/xml'})\n end\n unless params[:body].empty?\n params[:headers].merge!({\"x-tmrk-contenthash\" => \"Sha256 #{Base64.encode64(Digest::SHA2.digest(params[:body].to_s)).chomp}\"})\n end\n if @authentication_method == :basic_auth\n params[:headers].merge!({'Authorization' => \"Basic #{Base64.encode64(@username+\":\"+@password).delete(\"\\r\\n\")}\"})\n elsif @authentication_method == :cloud_api_auth\n signature = cloud_api_signature(params)\n params[:headers].merge!({\n \"x-tmrk-authorization\" => %{CloudApi AccessKey=\"#{@access_key}\" SignatureType=\"HmacSha256\" Signature=\"#{signature}\"}\n })\n end\n params[:headers]\n end",
"title": ""
},
{
"docid": "66821db9a8198ddec886f54ccdea3627",
"score": "0.5594867",
"text": "def delete_response_header(key)\n new(\n response_headers: ConnSupport::Headers.delete(\n response_headers, key\n )\n )\n end",
"title": ""
},
{
"docid": "08ddacc2ea63852a5cd90256a03e44b7",
"score": "0.55931216",
"text": "def headers(value = nil, &block)\n __define__(:headers, value, block)\n end",
"title": ""
},
{
"docid": "406635b6f39987fa0d9a2690a4cb83d4",
"score": "0.5592716",
"text": "def set_validation_headers!(response)\n @header['If-None-Match'] = response.header['ETag'] if response.header.has_key?('ETag')\n @header['If-Modified-Since'] = response.header['Last-Modified'] if response.header.has_key?('Last-Modified')\n @header['Cache-Control'] = 'max-age=0' if response.must_be_revalidated?\n end",
"title": ""
},
{
"docid": "fc4c7ed633a6643eea9b786eb804aff0",
"score": "0.5587874",
"text": "def header\n { \"Authorization\" => 'Bearer ' + request_access_token.token }\n end",
"title": ""
},
{
"docid": "8187a61bd3cafcdb8e17ef71258eae76",
"score": "0.5584232",
"text": "def github_service_response_headers\n {\"Content-Type\" => \"application/json\"}\n end",
"title": ""
},
{
"docid": "a0b769d20135041a4151e867cec1ce76",
"score": "0.55812234",
"text": "def header; end",
"title": ""
}
] |
8c2af07abcb926cc00cb4c8699699261 | Show offert prices GET /projects/:project_id/subprojects/:subproject_id/subsubprojects/:subsubprojects_id/offerte | [
{
"docid": "2132384a430181923e420c9471ba1f1c",
"score": "0.6243222",
"text": "def offerte\n @subsubproject = Subsubproject.find(params[:subsubproject_id])\n @subproject = @subsubproject.subproject\n @project = @subproject.project\n @grobengineerings = Grobengineering.where(:subsubproject_id => @subsubproject.id).order(:id)\n\n\n @total_geraeteanzahl = 0\n @total_elplanung = 0\n @total_planung_sw = 0\n @total_ibn_bauleitung = 0\n @total_sps_brutto = 0\n @total_sps_netto = 0\n @total_sch_brutto = 0\n @total_sch_netto = 0\n @total_io_et_brutto = 0\n @total_io_et_netto = 0\n @total_io_pilz_brutto = 0\n @total_io_pilz_netto = 0\n @total_fu_brutto = 0\n @total_fu_netto = 0\n @total_elinst_brutto = 0\n @total_elinst_netto = 0\n @total_brutto = 0\n @total_netto = 0\n\n @offert_hash = Grobengineering.offert_hash(@subsubproject)\n @offert_hash.each do |key1, array1|\n array1[\"devices\"].each do |key2, array2|\n @total_geraeteanzahl += array2[\"device_anzahl\"]\n @total_elplanung += array2[\"kosten_eng_elplanung_total\"]\n @total_planung_sw += array2[\"kosten_eng_planung_sw_total\"]\n @total_ibn_bauleitung += array2[\"kosten_eng_ibn_bauleitung_total\"]\n @total_sps_brutto += array2[\"kosten_sps_total_brutto\"]\n @total_sps_netto += array2[\"kosten_sps_total_netto\"]\n @total_sch_brutto += array2[\"kosten_sch_total_brutto\"]\n @total_sch_netto += array2[\"kosten_sch_total_netto\"]\n @total_io_et_brutto += array2[\"kosten_io_et_total_brutto\"]\n @total_io_et_netto += array2[\"kosten_io_et_total_netto\"]\n @total_io_pilz_brutto += array2[\"kosten_io_pilz_total_brutto\"]\n @total_io_pilz_netto += array2[\"kosten_io_pilz_total_netto\"]\n @total_fu_brutto += array2[\"kosten_fu_total_brutto\"]\n @total_fu_netto += array2[\"kosten_fu_total_netto\"]\n @total_elinst_brutto += array2[\"kosten_elinst_total_brutto\"]\n @total_elinst_netto += array2[\"kosten_elinst_total_netto\"]\n @total_brutto += array2[\"kosten_total_brutto\"]\n @total_netto += array2[\"kosten_total_netto\"]\n end\n end\n end",
"title": ""
}
] | [
{
"docid": "9f818fd12dc107c8c1b4e434434b0d28",
"score": "0.59999967",
"text": "def show\n @project = Project.find(params[:project_id])\n @labour_estimate = @project.labour_estimates.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @labour_estimate }\n end\n end",
"title": ""
},
{
"docid": "adfda717d40237e72197121be6927d36",
"score": "0.5922856",
"text": "def show\n @grobengineering = Grobengineering.find(params[:id])\n @subsubproject = @grobengineering.subsubproject\n @subproject = @subsubproject.subproject\n @project = @subproject.project\n end",
"title": ""
},
{
"docid": "961484204821e21cc67c299987f640d0",
"score": "0.58924305",
"text": "def show\n if params[:id].nil?\n redirect_to root_path\n end\n if @project.image_id\n @image = Image.find(@project.image_id)\n end \n\n @perks = Perk.where(\"project_id = ?\",@project.id).order(\"price\")\n @permiso = check_propiety(@project)\n puts \"---------permiso--------------------------------\"\n puts @permiso\n puts \"-----------------------------------------\"\n add_breadcrumb @project.name.to_s, '/projects/' + @project.id.to_s\n\n if Funder.where(\"project_id = ?\", @project.id).count <= 0\n @limpio = true\n else\n @limpio = false\n end \n\n end",
"title": ""
},
{
"docid": "0596b8e71233ce5ae4b8f138cda44035",
"score": "0.5872212",
"text": "def show\n @subsubproject = Subsubproject.find(params[:id])\n @subproject = @subsubproject.subproject\n @project = @subproject.project\n end",
"title": ""
},
{
"docid": "439215e28d004f52215dd3bc595be9ee",
"score": "0.5826813",
"text": "def show\n @offer = Offer.find(params[:id])\n @user = current_user\n @event = @offer.event\n @organizer = @offer.organizer\n @confirmation = @offer.client_confirmation\n @confirmation_invoice = @offer.confirmation_invoice\n\n @articles = Article.all\n\n @new_offer_box = OfferBox.new\n @offer_boxes = OfferBox.all\n @thisofferboxes = @offer_boxes.where(:offer_id => @offer.id)\n \n @new_offer_article = OfferArticle.new\n @offer_articles = OfferArticle.all\n @thisofferarticles = @offer_articles.where(:offer_id => @offer.id)\n\n @prices = Price.all\n @regular_prices = @prices.where(:regular => true)\n @new_delivery = Delivery.new\n\n @new_return_box = ReturnBox.new\n\n @admin = @user.admin\n unless @admin or @organizer\n redirect_to :root, :alert => t(\"notice.access\")\n end\n end",
"title": ""
},
{
"docid": "3355ba2f893ebdcd5ff3d5111dbd4dc5",
"score": "0.58170724",
"text": "def index\n @knowledge_offers = KnowledgeOffer.where(project_id: @project.id)\n end",
"title": ""
},
{
"docid": "e04dcfd08e47ce7a37dd07bb2e7a9cbb",
"score": "0.58134276",
"text": "def show\n\t\t@public_officer = PublicOfficer.find(params[:public_officer_id])\n\t\t@public_officer_nombre = @public_officer.full_name\n\t\t@commission = @public_officer.commissions.find(params[:commission_id])\n\t\t@viaje = @commission.trips.find(params[:trip_id])\n\t\t@detalle = @viaje.detail\n\t\t@tema = TviajeCat.find(@detalle.id_tema_viaje).tema\n\t\t@tipoViaje = TipoPasajeCatalogo.find(@detalle.tipo_pasaje).tipo_pasaje\n\t\t@tipoV = TipoViajeCatalogo.find(@viaje.tipo_viaje).tipo_viaje\n if @detalle.flights.count > 0\n\t\t @vuelo = Flight.find(@detalle.id)\n @aerolineaOrigen = @vuelo.linea_origen\n @vueloOrigen = @vuelo.vuelo_origen\n @aerolineaDestino = @vuelo.linea_regreso\n @vueloDestino = @vuelo.vuelo_regreso\n end\n\t\t@id_localidad_destino = @viaje.localidad_destino\n\t\t\n\t\t\t\n\t\t@gastos = @viaje.expense\n\t\t@idMoneda = @viaje.expense.id_moneda\n\t\t@moneda = MonedaCatalogo.find(@idMoneda).moneda\n\t\t\n\t\t@pais = LocalidadesCatalogo.find(@id_localidad_destino).pais\n\t\t@estado = LocalidadesCatalogo.find(@id_localidad_destino).estado\n\t\t@ciudad = LocalidadesCatalogo.find(@id_localidad_destino).ciudad\n end",
"title": ""
},
{
"docid": "153f1c8467b406ce73083b538fbef82c",
"score": "0.5792911",
"text": "def show\n @project = Project.find(params[:id])\n @user ||= User.find_by(id: @project.user_id)\n @promises = Promise.where(project_id: @project.id)\n @category = Category.find_by(id: @project.category_id)\n @funders = Fund.where(project_id: @project.id).count\n @amount = Fund.where(project_id: @project.id).sum(:amount)\n end",
"title": ""
},
{
"docid": "d2ea8d158487c090121af0c524a4f72c",
"score": "0.5779631",
"text": "def show\n @etude = @projet.etudes.find(params[:id])\n @modif_supp = Etude.modif_supp_apparents([@etude])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etude }\n end\n end",
"title": ""
},
{
"docid": "472d93ea16542bcf0eeee7079eef3673",
"score": "0.57729816",
"text": "def show\n @contractor_trades = ContractorsTrades.where('contractor_id' => params[:id])\n @trades = Array.new\n @contractor_trades.each do |ct|\n #@trade = Trade.find(ct[\"trade_id\"])\n @trades << Trade.find(ct[\"trade_id\"])\n end\n\n @contractor_pwe = ContractorsPublicWorksExp.where('contractor_id' => params[:id])\n @selectedpwe = Array.new\n @contractor_pwe.each do |cp|\n #@trade = Trade.find(ct[\"trade_id\"])\n @selectedpwe << PublicWorksExp.find(cp[\"public_works_exp_id\"])\n end\n\n @contractor_lpwp = ContractorsLargestPublicWorksProjects.where('contractor_id' => params[:id])\n @selectedlpwp = Array.new\n @contractor_lpwp.each do |cl|\n @selectedlpwp << LargestPublicWorksProject.find(cl[\"largest_public_works_project_id\"])\n end\n\n @tradesMenu = Trade.all\n @publicworksMenu = PublicWorksExp.all\n @largepublicworksMenu = LargestPublicWorksProject.all\n end",
"title": ""
},
{
"docid": "f2b8af44bf58b7646cbff1be2a00a3dc",
"score": "0.57624984",
"text": "def show\n @project = current_user.organization.projects.find(params[:id])\n\t@project_types = current_user.organization.projects.find(:all, :order => \"project_name\" ,:select=> 'DISTINCT project_name')\n @project_changes = ProjectChange.find_by_sql(\"select * from project_changes where project_id ='#{@project.id}' \")\n # for time records\n @pro= current_user.organization.projects.find(params[:id]).time_records\n @time_records = @pro.find(:all,:order => 'updated_at DESC')\n @total_hrs = current_user.organization.projects.find(params[:id]).time_records.sum(:total_hours)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"title": ""
},
{
"docid": "4d2f6ba649a300d432f7ed2fe2ba591b",
"score": "0.57402915",
"text": "def show_price\n render json: Expense.find(params[:id]).price\n end",
"title": ""
},
{
"docid": "5ce18c7a5810d0424eb5443a92429f9a",
"score": "0.57263935",
"text": "def index\n @price_plans = PricePlan.all\n end",
"title": ""
},
{
"docid": "2fbbe566d8d885973b8df27e0455c8bc",
"score": "0.5713758",
"text": "def show\n @project = Project.find_detailed(params[:id])\n @paperstocks = Paperstock.all\n @various_stocks = VariousStock.all\n @spent_time = @project.tasks.sum(:duration)\n end",
"title": ""
},
{
"docid": "29f516ca5612120127bd1bc663ea26ba",
"score": "0.57002497",
"text": "def show\n @project = Project.includes(:user).find_by(id: params[:id])\n @reports = ProjectReport.includes(:project_fund).where(project_id: params[:id]).order(\"updated_at DESC\")\n @fund_release = 0\n @percent_done = 0\n @reports.each do |p|\n if p.fund_release\n @fund_release += p.project_fund.fund_amount\n @percent_done = p.percent_done > @percent_done ? p.percent_done : @percent_done\n end\n end\n end",
"title": ""
},
{
"docid": "78bc2cdc9edf1024d9ae9e3858171be2",
"score": "0.5672157",
"text": "def create\n @project = Project.find(params[:project_id])\n @offer = @project.offers.build(params[:offer])\n if @offer.save\n flash[:success] = \"Votre offre a été soumise avec succès.\"\n redirect_to @project\n else\n render :action => \"new\"\n end\n end",
"title": ""
},
{
"docid": "813b595b163015efe3bf4f359ee43e0e",
"score": "0.5671477",
"text": "def show\n @project = Project.friendly.find(params[:id])\n @question = Question.new(params[:question])\n @project_attacments = ProjectAttacment.where(project_id: @project.id)\n\n default_stavka = 10\n default_time_years = 10\n default_first_pay = 1000\n\n\n @project.stavka_pay = default_stavka\n @project.time_pay = default_time_years\n @project.first_pay = default_first_pay\n\n @ostatok = @project.final_price - @project.first_pay\n @pereplata = (@ostatok / 100) * @project.stavka_pay\n @total_pay = @ostatok + @pereplata\n @mounts = @project.time_pay * 12\n @mounts_pay = @total_pay / @mounts\n\n @current_mount = 1\n @current_year = 1\n \n end",
"title": ""
},
{
"docid": "65d98ab2d258c98a428041097cfd46d8",
"score": "0.5641645",
"text": "def index\n @current_submenu = \"epics\"\n if params[:project_id] != nil\n @epics = Epic.find_all_by_project_id(params[:project_id])\n else\n @epics = Epic.all \n end \n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @epics }\n end\n end",
"title": ""
},
{
"docid": "e1809ea3fd2ba618386ab014d5b8a4b9",
"score": "0.56381434",
"text": "def show_hotel_prices\n @place = Place.find(params[:id])\n document = http_client(\"/hotels/#{params[:hotel_id]}/availability.xml\",params[:availability])\n\n @hotel = OpenStruct.new(\n :hotel_id => document.find('//hotel/@id').first.value,\n :name => document.find('//hotel/name').first.content\n )\n\n @pricing = []\n document.find('//hotel/availability/source').each do |source|\n @pricing << OpenStruct.new(\n :name => source.find('@name').first.value,\n :price => source.find('@price').first ? source.find('@price').first.value : 'Check Site',\n :url => source.first.content\n )\n end\n\n end",
"title": ""
},
{
"docid": "2176fcb80cb32325327913596b731298",
"score": "0.56163204",
"text": "def show\n @budget = Budget.find(params[:id])\n \n prawnto prawn: {page_size: \"A4\", page_layout: :landscape}, inline: true\n\n\n\n @budgets_products_raw = @budget.budgets_products.where(show: [true, nil]).order('house_area ASC').order('product_type DESC')\n\t\t\n\n \t@budgets_products = []\n @budgets_products_raw.each do |bpr|\n\n \t\n \tif bpr.product_type == 0 && bpr.pair_id != nil\n\n\n \telse\n\n \t\t@budgets_products << bpr\n\n \t\tif bpr.pair_id != nil\n\n \t\t\tpairs = @budget.budgets_products.find_all_by_pair_id(bpr.pair_id)\n \t\t\t\n \t\t\tpairs.each do |pair|\n\n \t\t\t\tif pair.product_type == 0\n \t\t\t\t\t@budgets_products << pair\n \t\t\t\tend\n \t\t\tend\n \t\tend\n\n \tend\n\n end\n\n\n\n\n\n\n #respond_to do |format|\n #format.html # show.html.erb\n #format.json { render json: @budget }\n #end\n end",
"title": ""
},
{
"docid": "e626e89865c6bdfcfb3d1fe1c0053e28",
"score": "0.56010306",
"text": "def show\n if current_user.is_not_member?\n flash[:error] = \"You do not have permissions to access that feature.\"\n redirect_to root_path and return\n end\n \n @eab_project = EabProject.find(params[:id])\n \n @total_hours_spent = 0\n @eab_project.repair_hours_entries.each do |entry|\n @total_hours_spent = @total_hours_spent + entry.duration\n end\n @safety_inspections = @eab_project.bike.safety_inspections\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eab_project }\n end\n end",
"title": ""
},
{
"docid": "c4e5471cded7bce596f8c192584cf01c",
"score": "0.5582398",
"text": "def show\n @projetos_empresa = @empresa.projetos\n @rhs_empresa = @empresa.rhs\n end",
"title": ""
},
{
"docid": "0621e60ea60143ca662b69497134d0b7",
"score": "0.55786335",
"text": "def show\n @localizacao = Localizacao.find(params[:id])\n \n @localizacao.produtos.each do |p|\n\n produtoVPSA = HTTParty.get( url_vpsa_load_produtos p.idProduto.to_s '93' )\n \n p.nomeProduto = produtoVPSA['descricao']\n p.estoque = produtoVPSA['quantidadeEmEstoque']\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @localizacao.produtos.to_json(:methods => [:nomeProduto,:estoque])}\n end\n end",
"title": ""
},
{
"docid": "b4e5459763c5823d38e96921f424a676",
"score": "0.55642265",
"text": "def index\n @sub_projects = @project.sub_projects\n end",
"title": ""
},
{
"docid": "1806a3aeab2139d98cffa44e16069c97",
"score": "0.55624926",
"text": "def offer\n @company = Company.find(params[:id])\n @offers = @company.offers.all\n end",
"title": ""
},
{
"docid": "e6a3524dfbd5aa3592e22f6566db5499",
"score": "0.55548185",
"text": "def show\n @breadcrumb = 'read'\n @project = Project.find(params[:id])\n @charge_accounts = @project.charge_accounts.paginate(:page => params[:page], :per_page => per_page).by_code\n # Existing projects to generate new Analytical plan\n @current_projects = projects_dropdown\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"title": ""
},
{
"docid": "b5abd4042bff1d729e94bad559fc8270",
"score": "0.555175",
"text": "def show\n @invoice = Invoice.find(params[:id])\n\t#@tot_imponibile = @invoice.jobs.map{|x| x.importo * x.qty}.inject(0){|sum,item| sum + item}\n\t#@totale = @invoice.jobs.map{|x| (x.importo * x.qty) + (x.importo * x.qty * x.tipo_iva.aliquota / 100)}.inject(0){|sum,item| sum + item}\n\t\n\t@tot_imponibile = @invoice.jobs.map{|x| x.importo}.inject(0){|sum,item| sum + item}\n\t@totale = @invoice.jobs.map{|x| (x.importo) + (x.importo * x.tipo_iva.aliquota / 100)}.inject(0){|sum,item| sum + item}\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoice }\n end\n end",
"title": ""
},
{
"docid": "a9a72056305030e71357ab67305d6217",
"score": "0.55468035",
"text": "def show\n @article = Article.find(params[:id])\n @user = current_user\n @new_price = Price.new\n @prices = Price.all\n @regular_prices = @prices.where(:regular => true)\n @myregular_price = @regular_prices.where(:article_id => @article.id).last\n end",
"title": ""
},
{
"docid": "4b5ab62305924f8592cd8926616df3c3",
"score": "0.5517454",
"text": "def show\n @price = Price.where([\"spree_product_id = ?\", @spree_product.id]).first\n end",
"title": ""
},
{
"docid": "92b1d16d4c83a5225cea38c9aea3a4fd",
"score": "0.55157506",
"text": "def show\n @online_retailer.brand_link = @online_retailer.get_brand_link(website)\n @online_retailer_link = OnlineRetailerLink.new(online_retailer: @online_retailer)\n @products = Product.non_discontinued(website) - @online_retailer.online_retailer_links.collect{|l| l.product} - ParentProduct.find_each.collect{|p| p.product}\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @online_retailer }\n end\n end",
"title": ""
},
{
"docid": "a7beae32769089bd99957fc9d7e98bbd",
"score": "0.551331",
"text": "def show\n @project = Project.find(params[:id])\n @employees = Employee.find_all_by_project_id(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"title": ""
},
{
"docid": "dcf601adc7d2e96de4ae73bc4ccad40d",
"score": "0.55109626",
"text": "def show\n @features = @project.features.page(params[:features_page])\n @products = @project.products.page(params[:products_page])\n end",
"title": ""
},
{
"docid": "badd0261396fee348f246305110d61e0",
"score": "0.5502966",
"text": "def show\n @products = @group.products.joins(:employee_products).where(\n :employee_products => {:fiscal_year_id => @year.id, \n :employee_id => @employees.pluck(\"employees.id\")}\n ).uniq.order(:name).paginate(:page => params[:products_page], \n :per_page => session[:results_per_page])\n @portfolios = Portfolio.includes(:product_group_portfolios =>\n :product).where(:product_group_portfolios => {\n :group_id => @group.id}).order(\"portfolios.name\", \"products.name\").uniq\n @total_product_allocation = @group.get_total_product_allocation(@year, @allocation_precision)\n @total_service_allocation = @group.get_total_service_allocation(@year, @allocation_precision)\n end",
"title": ""
},
{
"docid": "a9bdaac42ced5d0917e5d71be86a762b",
"score": "0.549717",
"text": "def show\n @offer_schedule_flat_rate_price = OfferScheduleFlatRatePrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer_schedule_flat_rate_price }\n end\n end",
"title": ""
},
{
"docid": "1f254b8f68b2e07441c7dd024293b203",
"score": "0.5484079",
"text": "def po_update_selects_from_offer\n o = params[:o]\n project_id = 0\n work_order_id = 0\n charge_account_id = 0\n store_id = 0\n payment_method_id = 0\n if o != '0'\n @offer = Offer.find(o)\n @projects = @offer.blank? ? projects_dropdown : @offer.project\n @work_orders = @offer.blank? ? work_orders_dropdown : @offer.work_order\n @charge_accounts = @offer.blank? ? charge_accounts_dropdown : @offer.charge_account\n @stores = @offer.blank? ? stores_dropdown : @offer.store\n @payment_methods = @offer.blank? ? payment_methods_dropdown : @offer.payment_method\n @products = @offer.blank? ? products_dropdown : @offer.organization.products.order(:product_code)\n project_id = @projects.id rescue 0\n work_order_id = @work_orders.id rescue 0\n charge_account_id = @charge_accounts.id rescue 0\n store_id = @stores.id rescue 0\n payment_method_id = @payment_methods.id rescue 0\n else\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = charge_accounts_dropdown\n @stores = stores_dropdown\n @payment_methods = payment_methods_dropdown\n @products = products_dropdown\n end\n # Work orders array\n @orders_dropdown = orders_array(@work_orders)\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"project\" => @projects, \"work_order\" => @orders_dropdown,\n \"charge_account\" => @charge_accounts, \"store\" => @stores,\n \"payment_method\" => @payment_methods, \"product\" => @products_dropdown,\n \"project_id\" => project_id, \"work_order_id\" => work_order_id,\n \"charge_account_id\" => charge_account_id, \"store_id\" => store_id,\n \"payment_method_id\" => payment_method_id }\n render json: @json_data\n end",
"title": ""
},
{
"docid": "a74d22de7f0b419f1836679c24139805",
"score": "0.5483904",
"text": "def show\n @keyword = @product.title\n @description = \"#{@product.title}の販売価格\"\n\n # if @product.price && @product.cost\n # @amazon_profit = Product.calculate_profit_on_amazon(@product)\n # end\n\n set_ebay_data_for_single_product(@product.id)\n if @average && @product.cost\n # @ebay_profit = Product.calculate_profit_on_ebay(@product, @average)\n end\n\n @related_products = Product.where([\"category = ? AND id != ? AND RAND() < ?\", @product.category, @product.id, 0.01]).limit(3)\n # @amazon_profit_hash = @related_products.inject(Hash.new) {|h, p| h[p.id] = Product.calculate_profit_on_amazon(p) if p.price && p.cost; h}\n\n # puts @related_products.pluck(:id)\n\n set_ebay_data_for_multiple_products(@related_products.pluck(:id))\n # @ebay_profit_hash = @related_products.inject(Hash.new) {|h, p| h[p.id] = Product.calculate_profit_on_ebay(p, @average_hash[p.id]) if @average_hash[p.id] > 0 && p.cost; h}\n\n @product_to_sells = ProductToSell.where([\"product_id = ?\", @product.id]).pluck(:product_id)\n end",
"title": ""
},
{
"docid": "6d9923bcc709054a7897a83e19b41819",
"score": "0.54832065",
"text": "def show\n @project = Project.find(params[:id])\n @messages = @project.messages.find(:all,:order => 'updated_at desc',:limit => 3 )\n @tickets = @project.tickets.find(:all,:order => 'updated_at desc', :limit => 6 )\n @todos = @project.todos.find(:all,:order => 'updated_at desc', :limit => 6 )\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"title": ""
},
{
"docid": "334303fd786474b79e65fe1062d77b1b",
"score": "0.548143",
"text": "def show\n @iosignal = Iosignal.find(params[:id])\n @subsubproject = @iosignal.grobengineering.subsubproject\n @subproject = @subsubproject.subproject\n @project = @subproject.project\n end",
"title": ""
},
{
"docid": "67f6cc1692ec526c45b667778ffcf97f",
"score": "0.5478695",
"text": "def show\n $budget_type =1 # Presupuesto Interno\n $budget_id = 0\n $display_supplies = 1 #Mostrar area de captura de materiales \n lv_budget_id = params[:id]\n# Buscar el presupuesto\n @budgets_budget = Budgets::Budget.find(lv_budget_id)\n if @budgets_budget == nil\n else\n# Solicitud\n @requests_support_request = RequestsAdministration::SupportRequest.find(:first, :conditions => \"id =\"+ @budgets_budget.support_request_id.to_s)\n# Buscar los materiales que corresponden al presupuesto\n @budgets_budget_supplies = Budgets::BudgetSupply.find(:all,:conditions => {:budget_id => @budgets_budget.id, :type_supply=>1} )\n# Buscar mano de obra que corresponden al presupuesto\n @budgets_budget_supplies2 = Budgets::BudgetSupply.find(:all,:conditions => {:budget_id => @budgets_budget.id, :type_supply=>2} )\n\n $budget_id = @budgets_budget.id\n end\n\n $permiso =get_num_aut_req(@budgets_budget.id,\"V\") #get_num_aut($budget_id)\n $autorizacion =get_num_aut(@budgets_budget.id)\n $display_supplies =@budgets_budget.budget_type\n\n end",
"title": ""
},
{
"docid": "b8671f27821cb98308a8cf61cad98bed",
"score": "0.547635",
"text": "def getChildEpics\n @epics = Epic.find_all_by_epic_id_and_project_id(params[:id], @project_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @epics }\n end \n end",
"title": ""
},
{
"docid": "66f0a1c2331020a0d65cd2d4ba6b04fd",
"score": "0.54749995",
"text": "def index \r\n @projects = Project.all\r\n @tickets = Client.tickets_for_selected_project(get_selected_project.id) #Ticket.where(project_id: get_selected_project.id)\r\n end",
"title": ""
},
{
"docid": "9d98bd8806a779aa3eec82391ed454d4",
"score": "0.54669136",
"text": "def show\n puts params\n offers = OwnedPokemon.find(params[:id].to_i).offers\n # offers = offered_pokemons.map { |offered_pokemon| Offer.find(offered_pokemon.offer_id) }\n # @owned_pokemons = offers.map { |offer| OwnedPokemon.find(offered_pokemon.offer_id) }\n \n offered_pokemons = offers.map { |offer| OfferedPokemon.all.where({offer_id: offer.id.to_i}) }\n \n filtered_offered_pokemons = offered_pokemons.flatten.select{|offered_pokemon| offered_pokemon[:owned_pokemon_id].to_i != params[:id].to_i}\n \n @owned_pokemons = filtered_offered_pokemons.map { |offered_pokemon| OwnedPokemon.find(offered_pokemon[:owned_pokemon_id].to_i) }\n\n render 'index.json.jbuilder'\n end",
"title": ""
},
{
"docid": "0b316ed331890d32f3eebe1c1a8d4eeb",
"score": "0.54456705",
"text": "def show\n # get the tickets info for this event\n event_id = params[:id]\n event = Event.find(event_id)\n #Client.find_by_sql(\"SELECT * FROM clients \n #INNER JOIN orders ON clients.id = orders.client_id \n #ORDER clients.created_at desc\")\n #select distinct price from tickets where event_id=43434 order by price asc\n #SELECT \"events\".* FROM \"events\" WHERE \"events\".\"id\" = ? LIMIT 1\n @price = Ticket.find_by_sql(\"SELECT DISTINCT price FROM tickets WHERE event_id='\"+event.event_id+\"' ORDER BY tickets.price asc\")\n #@aa = Event.find_by_sql(\"SELECT * FROM events\")\n @ticket_result = Array.new\n @price.each do |p|\n tic_info=Ticket.find_by_sql(\"SELECT t_id,seller_id,price FROM tickets WHERE price=\"+p.price.to_s)\n @ticket_result.push(tic_info)\n\n end\n\n\n end",
"title": ""
},
{
"docid": "4230ed4a6b6246ca030abb06d11bce57",
"score": "0.54444057",
"text": "def edit\n @grobengineering = Grobengineering.find(params[:id])\n @subsubproject = @grobengineering.subsubproject\n @subproject = @subsubproject.subproject\n @project = @subproject.project\n end",
"title": ""
},
{
"docid": "0f51f505183e00a23c270924ec42b0d2",
"score": "0.5441786",
"text": "def show\n @project = Project.find(params[:id])\n @vendor = Vendor.find(@project.vendor_id)\n @services_ids = @project.services_ids\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"title": ""
},
{
"docid": "ef60cbb60f3a6bbe0c75275ef4ed3e39",
"score": "0.54344445",
"text": "def show\n @produtos = @quantidade.produtos.all\n end",
"title": ""
},
{
"docid": "7ab10961060a0efb489f1a60a34d41c1",
"score": "0.54308194",
"text": "def show\n if user_signed_in?\n\n #pegar o produto anunciado nessa oferta\n @product = get_product(@offer.product.id)\n\n @oldprice = @product.price\n\n @youngprice = @offer.priceproduct\n\n @downloads = has_downloaded(@offer.id)\n\n @rest = rest(@offer.id)\n\n @address = AddressEstablishment.where(establishment_id: @offer.establishment.id).first\n\n @cupons = offer_suggestions.paginate(page: params[:page], per_page: 3)\n\n #notes\n @note = Note.where(\"offer_id = ?\", @offer).last\n @rule = Rule.where(\"offer_id = ?\", @offer).last\n\n @feedimages = ImageEstablishment.where(\"establishment_id = ?\", @offer.establishment_id)\n\n # inserir como oferta visitada\n VisitedOffer.create(\n user_id: current_user.id,\n offer_id: @offer.id,\n category_establishments_id: @offer.establishment.category_establishment.id\n )\n\n else\n redirect_to new_user_session_path\n end # validando usuario logado para visualizar cupom\n end",
"title": ""
},
{
"docid": "9f5e62aa4b34b1d3a80312f2a4b5f072",
"score": "0.5423394",
"text": "def offers() Offer.all(:product_ids => self.id) end",
"title": ""
},
{
"docid": "6a83bdc4b370251a6d60d113caaba8bb",
"score": "0.542212",
"text": "def index\n @vendor = Vendor.find(params[:vendor_id])\n @offers = @vendor.offers.order(:tier)\n end",
"title": ""
},
{
"docid": "ed2914fe4137ea5d23c9748b241fb1f9",
"score": "0.5418358",
"text": "def show\n @breadcrumb = 'read'\n @offer_request = OfferRequest.find(params[:id])\n @items = @offer_request.offer_request_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n @suppliers = @offer_request.offer_request_suppliers.paginate(:page => params[:page], :per_page => per_page).order('id')\n @offers = sort_offers_by_total(@offer_request).paginate(:page => params[:page], :per_page => per_page)\n #@offers = @offer_request.offers.paginate(:page => params[:page], :per_page => per_page).order('id')\n # Offer Approvers\n @is_approver = false\n if @offers.count > 0\n offer = @offers.first\n @is_approver = company_approver(offer, offer.project.company, current_user.id) ||\n office_approver(offer, offer.project.office, current_user.id) ||\n (current_user.has_role? :Approver)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer_request }\n end\n end",
"title": ""
},
{
"docid": "7a0a29e9c8d821f01fc168e327e78079",
"score": "0.5412793",
"text": "def show\n @consumers = Consumer.find(params[:consumer_id])\n @services = Service.all\n @expenditure = @consumer.expenditures.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expenditure }\n end\n end",
"title": ""
},
{
"docid": "85ce79ae722a3951b79b21b561dec5e2",
"score": "0.54106164",
"text": "def index\n @prices = @ticket.prices\n end",
"title": ""
},
{
"docid": "b621f29a79513df047265b02117fca91",
"score": "0.540838",
"text": "def show\n @projects = @contracting_officer.projects.load\n end",
"title": ""
},
{
"docid": "cb5fba4e1d8629d6ba8f369788b3c8bb",
"score": "0.5407854",
"text": "def show\n @expenditures = @quarterly_budget.expenditures.order('purchase_date desc')\n end",
"title": ""
},
{
"docid": "f7dbe2a107e28f5872f996956076eb6b",
"score": "0.5403666",
"text": "def show\n @location = get_location\n @corkboards = @location.corkboards\n\n w_api = Wunderground.new(\"95dee549dd84ecec\")\n @temperature = w_api.conditions_for(@location.nation, @location.city)['current_observation']['temperature_string']\n\n\n url = \"http://www.numbeo.com/api/city_prices?api_key=95kfsvuejq8fyd&query=#{@location.city}¤cy=USD\"\n response = RestClient.get(url)\n\n\n numbeo_response = JSON.parse(response)\n\n numbeo_response[\"prices\"].each do |price|\n if price[\"item_id\"] == 26\n @rent_get = price[\"average_price\"].round\n elsif\n price[\"item_id\"] == 14\n @wine_get = price[\"average_price\"].round(2)\n elsif\n price[\"item_id\"] == 1\n @meal_get = price[\"average_price\"].round(2)\n elsif\n price[\"item_id\"] == 105\n @disp_income_get = price[\"average_price\"].round\n elsif\n price[\"item_id\"] == 30\n @utilities_get = price[\"average_price\"].round\n elsif\n price[\"item_id\"] == 20\n @trans_get = price[\"average_price\"].round\n elsif\n price[\"item_id\"] == 114\n @cappuccino_get = price[\"average_price\"].round(2)\n elsif\n price[\"item_id\"] == 111\n @oranges_get = price[\"average_price\"].round(2)\n elsif\n price[\"item_id\"] == 9\n @bread_get = price[\"average_price\"].round(2)\n else\n end\n end\n\n\n\n end",
"title": ""
},
{
"docid": "bb573c93e50bf96e4b68ca8daad4d9c9",
"score": "0.53917295",
"text": "def pricing_plan_list\n @pricing_plan, @feature_pp_list = PricingPlan.get_pricing_plan_list(params)\n @organization = Organization.find_by_id(params[\"organization_id\"])\n render :layout => false\n end",
"title": ""
},
{
"docid": "c3bfb296a563a96db9f5dabe616a7480",
"score": "0.539082",
"text": "def show\n reset_stock_prices_filter\n @breadcrumb = 'read'\n @product = Product.find(params[:id])\n @stocks = @product.stocks.paginate(:page => params[:page], :per_page => per_page).order(:store_id)\n @prices = @product.purchase_prices.paginate(:page => params[:page], :per_page => per_page).order(:supplier_id)\n @prices_by_company = @product.product_company_prices.paginate(:page => params[:page], :per_page => per_page).order(:company_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"title": ""
},
{
"docid": "9025883336bd4ad3d9bb6ffa266f59c3",
"score": "0.5389103",
"text": "def show\n project = @project.as_json(:include => [:development_plan, :financial])\n project['stats'] = get_stats(project['financial']['fund_raise_start'], project['financial']['fund_raise_completion'], project['development_plan']['completion_date'], project['financial']['num_bricks'])\n render json: project\n end",
"title": ""
},
{
"docid": "f48eeeea280681c2345ac1c864edbbc0",
"score": "0.5385091",
"text": "def show\n authorize @viaje\n \n @ruta = Rutum.find(@viaje.viaje_ruta)\n @lugares = set_descripcion_ruta(@ruta.ruta_descripcion)\n \n instSQL_select = \" reservas.id\n ,reservas.rsrv_codigo codigoReserva\n ,reservas.rsrv_trayectoViaje trayectoViaje\n ,reservas.created_at fechaReserva\n ,P1.pers_documentoIdentidad documIdentContacto\n ,P1.pers_nombres nombreContacto\n ,P1.pers_apellidos apellidosContacto\n ,P2.pers_documentoIdentidad documIdentCliente\n ,P2.pers_nombres nombreCliente\n ,P2.pers_apellidos apellidosCliente\n ,DR.detRsrv_estadoReserva\"\n instSQL_conditions = \"reservas.rsrv_estadoRegistro = 'A'\n AND DR.detRsrv_estadoRegistro = 'A'\n AND reservas.rsrv_tipoProducto = 'VUELO'\n AND V.id = \" + @viaje.id.to_s\n instSQL_joins = \"INNER JOIN detalle_reservas DR ON reservas.id = DR.reserva_id\n INNER JOIN viajes V ON reservas.rsrv_productoId = V.id\n INNER JOIN personas P1 ON P1.pers_documentoIdentidad = reservas.rsrv_contactoId \n INNER JOIN personas P2 ON P2.pers_documentoIdentidad = DR.detRsrv_clienteId \"\n \n rsrvViajes = Reserva.select(instSQL_select).joins(instSQL_joins).where(instSQL_conditions).order(\"reservas.rsrv_trayectoViaje, reservas.created_at, codigoReserva\")\n @rsrvsPendientes = []\n @rsrvsConfirmadas = []\n @rsrvsCanceladas = []\n \n rsrvViajes.each do |h|\n if h.detRsrv_estadoReserva == \"I\" then\n @rsrvsPendientes.push(h)\n elsif h.detRsrv_estadoReserva == \"C\" || h.detRsrv_estadoReserva == \"B\" then\n @rsrvsConfirmadas.push(h)\n elsif h.detRsrv_estadoReserva == \"N\" then\n @rsrvsCanceladas.push(h)\n end \n end\n end",
"title": ""
},
{
"docid": "7b8ba853bdfda3f4cd4eec357ef7d59d",
"score": "0.53797626",
"text": "def show\n @spot_price = Global.first.btc_usd_spot_price\n end",
"title": ""
},
{
"docid": "e4a1434edeffd64f8aee7ce2304cc3a7",
"score": "0.5379651",
"text": "def show\n @listaprecio = Listaprecio.find(params[:listaprecio_id])\n @precioarts = @listaprecio.precioarts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @precioart }\n end\n end",
"title": ""
},
{
"docid": "89d85f5b41de21ccea2bbc8e91951a28",
"score": "0.5371607",
"text": "def index\n #todo: poner delocalize_dates e integerize_money en todas las pantallas de filtros que lo necesiten\n if params[:search]\n delocalize_dates([:planned_start_date_greater_than_or_equal_to, :planned_start_date_less_than_or_equal_to,\n :planned_end_date_greater_than_or_equal_to, :planned_end_date_less_than_or_equal_to,\n :real_end_date_greater_than_or_equal_to, :real_end_date_less_than_or_equal_to,\n :real_start_date_greater_than_or_equal_to, :real_start_date_less_than_or_equal_to])\n\n integerize_money([:sale_price_cents_greater_than_or_equal_to, :sale_price_cents_less_than_or_equal_to,\n :risk_fund_cents_greater_than_or_equal_to, :risk_fund_cents_less_than_or_equal_to,\n :expense_fund_cents_greater_than_or_equal_to, :expense_fund_cents_less_than_or_equal_to])\n end\n\n @projects = do_index(Project, params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end",
"title": ""
},
{
"docid": "60d85f8d2e83d6f7e5f7a898df2d3e79",
"score": "0.53645873",
"text": "def show\n @offers = Offer.paginate(page: params[:page])\n end",
"title": ""
},
{
"docid": "88e56f9ff9156b9c69825bea0db24bb5",
"score": "0.5363312",
"text": "def index\n @spare_prices = SparePrice.all\n end",
"title": ""
},
{
"docid": "96e37c706bed3c84dc7b1cc410186a61",
"score": "0.53617394",
"text": "def show\n @price_entry_select = PriceEntry.where(\"package_id = ?\", params[:id])\n @price_entry_select_price = PriceEntry.where(\"package_id = ?\", params[:id]).select(:price, :distributor_id)\n\n\n @distributors = Distributor.all\n @units = Unit.all\n\n @price_entry_distributor_id = []\n @price_entry_max = []\n @price_entry_min = []\n @price_entry_recent = []\n\n @distributors.each do |distributor|\n\n @price_entry_temp = @price_entry_select_price.where(\"distributor_id = ?\", distributor.id)\n price_entry_list = []\n\n @price_entry_temp.each do |price|\n price_entry_list << price.price\n end\n\n if !@price_entry_temp.blank? \n @price_entry_distributor_id << distributor.id\n @price_entry_max << price_entry_list.max\n @price_entry_min << price_entry_list.min\n @price_entry_recent << price_entry_list.last\n end\n\n end\n\n end",
"title": ""
},
{
"docid": "475ab865dece22e465c011ef278711c0",
"score": "0.53602654",
"text": "def index\n @offertes = Offerte.all\n end",
"title": ""
},
{
"docid": "bafd661f81a1405fc25dff9e0fcf8093",
"score": "0.53334427",
"text": "def index\n @etudes = @projet.etudes.all.sort(_id: -1)\n @modif_supp = Etude.modif_supp_apparents(@etudes)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @etudes }\n end\n end",
"title": ""
},
{
"docid": "cbb235ff5abc51e3d141b30abc156c01",
"score": "0.533028",
"text": "def show\t\t\n\t\t\n\t\t@public_officer = PublicOfficer.find(params[:id])\n\t\t@ciudadano = Ciudadano.new\n\t\t@commissions = @public_officer.commissions.all\t\t\n\t\t@public_officer_nombre = @public_officer.full_name\n\t\t\n\t\thash_overview = {\n\t\t\t'text' => {\n\t\t\t\t'headline' => '<span class=\"vco-test\">Historial de Viajes</span>',\n\t\t\t\t'text' => \"<center><span>\"+ @public_officer_nombre +\"</span></center>\"\n\t\t\t},\n\t\t\t'type' => \"overview\"\n\t\t}\n\t\t@list_slides ||= []\n\t\t@list_slides << hash_overview \n\n\t\t@commissions.each do |commission|\n\t\t\t@trips = commission.trips.all\n\t\t\t@trips.each do |trip|\n\t\t\t\t\n\t\t\t\t@id_localidad_destino = trip.localidad_destino\n\t\t\t\t@latitud = LocalidadesCatalogo.find(@id_localidad_destino).latitud_ciudad\n\t\t\t\t@longitud = LocalidadesCatalogo.find(@id_localidad_destino).longitud_ciudad\n\t\t\t\t@detail = trip.detail\n\t\t\t\t@evento = trip.detail.evento\n\t\t\t\t@fhinicio = trip.detail.fechainicio_part\n\t\t\t\t@pais = LocalidadesCatalogo.find(@id_localidad_destino).pais\n\t\t\t\t@estado = LocalidadesCatalogo.find(@id_localidad_destino).estado\n\t\t\t\t@ciudad = LocalidadesCatalogo.find(@id_localidad_destino).ciudad\n\t\t\t\t@gastoTot = trip.expense.gasto_viatico\n\t\t\t\t@idMoneda = trip.expense.id_moneda\n\t\t\t\t@moneda = MonedaCatalogo.find(@idMoneda).moneda\n\t\t\t\t\n\t\t\t\turl_principal1 = (view_context.generar_link(@public_officer.id, commission.id, trip.id, @detail.id, @evento)).to_s\n\n\t\t\t\thash_slide = {\n\t\t\t\t\t'location' => {\n\t\t\t\t\t\t'lat' => @latitud,\n\t\t\t\t\t\t'lon' => @longitud\n\t\t\t\t\t},\n\t\t\t\t\t'text' => {\n\t\t\t\t\t\t'headline' => url_principal1,\n\t\t\t\t\t\t'text' => \"<span>Fecha:<br>\"+@fhinicio.to_s+\"</span><br><span>Destino:<br>\"+ @pais +\"<br> \"+ @estado +\"<br> \"+ @ciudad + \"</span><br><span>Gasto total: <br>\"+@gastoTot.to_s+ @moneda+\"</span>\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t@list_slides << hash_slide\n\t\t\tend\n\t \tend\n\t \t@hash_storymap = {\n\t\t\t\"storymap\" => { \n\t\t\t\t\"slides\" => @list_slides\n\t\t\t},\n\t\t\t\"width\" => 100, \"height\" => 300\n\t\t}\n\tend",
"title": ""
},
{
"docid": "55f0e6cd1bf957192f07d6ee622ed060",
"score": "0.53272855",
"text": "def show\n\n @invoice = Factura.find(params[:id])\n @company = Company.find(1)\n @customer = @invoice.customer\n @customers = @company.get_customers_all()\n @tipodocumento = @invoice.document \n\n @productos = @company.get_products\n \n if @invoice.descuento == \"1\"\n @factura_details = @invoice.factura_details\n end \n \n if current_user.level ==\"colateral\"\n \n $lcruc = \"20555691263\" \n \n $lcTipoDocumento = @invoice.document.descripshort\n parts1 = @invoice.code.split(\"-\")\n $lcSerie = parts1[0]\n $lcNumero = parts1[1]\n \n $lcIgv = @invoice.tax.round(2).to_s\n $lcTotal = @invoice.total.round(2).to_s \n $lcFecha = @invoice.fecha\n $lcFecha1 = $lcFecha.to_s\n $lg_fecha = @invoice.fecha.to_date\n \n parts = $lcFecha1.split(\"-\")\n $aa = parts[0]\n $mm = parts[1] \n $dd = parts[2] \n \n \n $lcFecha0 = $aa << \"-\" << $mm <<\"-\"<< $dd \n \n if @invoice.document_id == 1 \n $lcTipoDocCli = \"1\"\n else\n $lcTipoDocCli = \"6\"\n end \n $lcNroDocCli = @invoice.customer.ruc \n \n $lcCodigoBarra = $lcruc << \"|\" << $lcTipoDocumento << \"|\" << $lcSerie << \"|\" << $lcNumero << \"|\" <<$lcIgv<< \"|\" << $lcTotal << \"|\" << $lcFecha0 << \"|\" << $lcTipoDocCli << \"|\" << $lcNroDocCli\n \n else \n \n @invoiceitems = FacturaDetail.select(:product_id,\"SUM(quantity) as cantidad\",\"SUM(total) as total\").where(factura_id: @invoice.id).group(:product_id)\n \n $lg_fecha = @invoice.fecha.to_date\n lcCode = @invoice.code.split(\"-\")\n a = lcCode[0]\n b = lcCode[1]\n \n $lg_serie_factura = a \n $lg_serial_id = b.to_i\n $lg_serial_id2 = b\n \n $lcRuc = @invoice.customer.ruc\n $lcTd = @invoice.document.descripshort\n $lcMail = @invoice.customer.email\n $lcMail2 = \"\"\n $lcMail3 = \"\"\n \n legal_name_spaces = @invoice.customer.name.lstrip \n \n if legal_name_spaces == nil\n $lcLegalName = legal_name_spaces\n else\n $lcLegalName = @invoice.customer.name.lstrip \n end\n $lcDirCli = @invoice.customer.address1\n $lcDisCli = @invoice.customer.address2\n $lcProv = @invoice.customer.city\n $lcDep = @invoice.customer.state\n \n ### detalle factura \n \n \n for invoiceitems in @invoiceitems \n \n $lcCantidad = invoiceitems.cantidad \n lcPrecio = invoiceitems.total / invoiceitems.cantidad \n lcPrecioSIGV = lcPrecio /1.18\n lcValorVenta = invoiceitems.total / 1.18\n lcTax = invoiceitems.total - lcValorVenta\n \n $lcPrecioCigv1 = lcPrecio * 100\n \n $lcPrecioCigv2 = $lcPrecioCigv1.round(0).to_f\n $lcPrecioCigv = $lcPrecioCigv2.to_i \n\n $lcPrecioSigv1 = lcPrecioSIGV * 100\n $lcPrecioSigv2 = $lcPrecioSigv1.round(0).to_f\n $lcPrecioSIgv = $lcPrecioSigv2.to_i \n \n $lcVVenta1 = lcValorVenta * 100 \n $lcVVenta = $lcVVenta1.round(0)\n \n $lcIgv1 = lcTax * 100\n $lcIgv = $lcIgv1.round(0)\n \n $lcTotal1 = invoiceitems.total * 100\n $lcTotal = $lcTotal1.round(0)\n end \n #@clienteName1 = Client.where(\"vcodigo = ?\",params[ :$lcClienteInv ]) \n $lcClienteName = \"\"\n if invoiceitems != nil \n $lcDes1 = invoiceitems.product.name \n else\n $lcDes1 = \"\"\n \n end \n $lcMoneda = @invoice.moneda_id\n $lcLocal = @invoice.texto1\n $lcServiciotxt = @invoice.texto2\n\n \n \n #$lcGuiaRemision =\"NRO.CUENTA BBVA BANCO CONTINENTAL : 0244-0100023293\"\n $lcGuiaRemision = \"\"\n $lcPlaca = \"\"\n $lcDocument_serial_id = $lg_serial_id\n #$lcAutorizacion =\"\"\n #$lcAutorizacion1=\"\"\n \n $lcSerie = a \n $lcruc = \"20501683109\" \n \n if $lcTd == 'FT'\n $lctidodocumento = '01'\n end\n if $lcTd =='BV'\n $lctidodocumento = '03'\n end \n if $lcTd == 'NC'\n $lctidodocumento = '07'\n end \n if $lcTd == 'ND'\n $lctidodocumento = '06'\n end\n if @invoice.document.descripshort == \"FT\"\n $lcTipoDocCli = \"1\"\n else\n $lcTipoDocCli = \"6\"\n end \n $lcNroDocCli =@invoice.customer.ruc \n \n $lcFecha1codigo = $lg_fecha.to_s\n\n parts = $lcFecha1codigo.split(\"-\")\n $aa = parts[0]\n $mm = parts[1] \n $dd = parts[2] \n $lcFechaCodigoBarras = $aa << \"-\" << $mm << \"-\" << $dd\n $lcIGVcode = $lcIgv\n $lcTotalcode = $lcTotal\n \n \n $lcCodigoBarra = $lcruc << \"|\" << $lcTd << \"|\" << $lcSerie << \"|\" << $lcDocument_serial_id.to_s << \"|\" <<$lcIGVcode.to_s<< \"|\" << $lcTotalcode.to_s << \"|\" << $lcFechaCodigoBarras << \"|\" << $lcTipoDocCli << \"|\" << $lcNroDocCli\n \n $lcPercentIgv =18000 \n $lcAutorizacion=\" \"\n $lcCuentas=\" El pago del documento sera necesariamente efectuado mediante deposito en cualquiera de las siguientes cuentas bancarias: \n BBVA Continental Cuenta Corriente en Moneda Nacional Numero: BBVA SOLES 0011-0168-27010009824.\n Consultar en https://www.sunat.gob.pe/ol-ti-itconsultaunificadalibre/consultaUnificadaLibre/consulta\" \n\n\n $lcScop1 =\"\" \n $lcScop2 =\"\"\n $lcCantScop1 =\"\"\n $lcCantScop2 =\"\" \n $lcAutorizacion1 = $lcCuentas \n end # colateral \n\n end",
"title": ""
},
{
"docid": "3d426d2a2ab4d25d2bbad2966bded2a4",
"score": "0.53270626",
"text": "def prices\n get('price')\n end",
"title": ""
},
{
"docid": "36e0202c59fdbf72130d29d34e721bb7",
"score": "0.5326551",
"text": "def show\n @quoted_price = QuotedPrice.find(params[:id])\n @prices_table = []\n thead = []\n # Table head\n thead << \"区域\" << \"国家名称\"\n # Doc\n [@quoted_price.doc_head].flatten.each{|h| thead << \"首重#{h}\"} if @quoted_price.respond_to? :doc_head\n [@quoted_price.doc_continue].flatten.each{|c| thead << \"续重#{c}\"} if @quoted_price.respond_to? :doc_continue\n @quoted_price.doc_range.each{|r| thead << \"#{r[0]}-#{r[1]}\"} if @quoted_price.respond_to? :doc_range\n @quoted_price.small_head.each{|h| thead << \"首重#{h[0]}\"} if @quoted_price.respond_to? :small_head\n @quoted_price.small_continue.each{|c| thead << \"续重#{c}\"} if @quoted_price.respond_to? :small_continue\n @quoted_price.small_range.each{|r| thead << \"#{r[0]}-#{r[1]}\"} if @quoted_price.respond_to? :small_range\n @quoted_price.big_range.each{|r| thead << \"#{r[0]}-#{r[1]}\"} if @quoted_price.respond_to? :big_range\n @prices_table << thead\n @quoted_price.region_details.each do |region|\n row = [region.zone==-1? \"无\":region.zone, region.countrys_cn * ',']\n row += region.doc_prices if region.respond_to? :doc_prices\n row += region.small_prices if region.respond_to? :small_prices\n row += region.big_prices if region.respond_to? :big_prices\n @prices_table << row\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quoted_price }\n end\n end",
"title": ""
},
{
"docid": "9ab527f29d0bb3c60937e13c9627712a",
"score": "0.5318489",
"text": "def show\n \n @subjects.inject(0) { |sum, subject_cost|\n @price_total = sum += subject_cost.quantity.to_i * (subject_cost.hvk.to_i + subject_cost.fujii.to_i + subject_cost.imamoto.to_i)\n }\n \n @subjects.inject(0) { |sum, subject_cost|\n @hvk_total = sum += (subject_cost.quantity.to_i * subject_cost.hvk.to_i)\n #@imamoto_total = sum + (subject_cost.quantity.to_i * subject_cost.imamoto.to_i)\n }\n \n @subjects.inject(0) { |sum, subject_cost|\n @fujii_total = sum + (subject_cost.quantity.to_i * subject_cost.fujii.to_i)\n }\n \n @subjects.inject(0) { |sum, subject_cost|\n @imamoto_total = sum + (subject_cost.quantity.to_i * subject_cost.imamoto.to_i)\n }\n \n @subjects.inject(0) { |sum, subject_cost|\n @selling_price_total = sum + (subject_cost.quantity.to_i * subject_cost.selling_price.to_i)\n }\n \n if @price_total.to_i != 0\n @grossmargin_rate = ((@selling_price_total.to_f.quo(@price_total.to_f))*100).round # 粗利益率 = 売価の合計 / 原価の合計\n end\n \n @gross_profit = @selling_price_total - @price_total # 粗利益 = 売上合計 - 原価合計\n end",
"title": ""
},
{
"docid": "8b2e84c653f60ca4467a41fa4bcd88df",
"score": "0.53168637",
"text": "def show\n @profit = Product.calculate_cost(@product_to_sell.product_id) if @product_to_sell.product.price && @product_to_sell.product.shipping_cost && @product_to_sell.product.cost\n set_ebay_data_for_single_product(@product_to_sell.product.id)\n @ebay_profit = (@average * (1 - 0.1 - 0.039) - 0.3)*@exchange_rate - @product_to_sell.product.cost - @product_to_sell.product.shipping_cost if @average && @product_to_sell.product.cost && @product_to_sell.product.shipping_cost\n end",
"title": ""
},
{
"docid": "9a147475a7ae9ce6dc7bd9aeaa257113",
"score": "0.53109473",
"text": "def show\n @currentUser = current_user.id\n @pt = Kitco.platinum\n @pd = Kitco.palladium\n @rh = Kitco.rhodium\n @pt = JSON.parse(@pt)\n @pd = JSON.parse(@pd)\n rescue JSON::ParserError, TypeError => e\n puts e\n if(@currentUser && @currentUser.role_id != 5)\n @userdetail = User.find(@currentUser)\n if(@userdetail.company.value_troy_pt && @userdetail.company.value_troy_pt!='')\n @value_troy_pt = @userdetail.company.value_troy_pt\n else\n @value_troy_pt = @pt.low\n end\n\n if(@userdetail.company.value_troy_pd && @userdetail.company.value_troy_pd!='')\n @value_troy_pd = @userdetail.company.value_troy_pd\n else\n @value_troy_pd = @pd.low\n end\n\n if(@userdetail.company.value_troy_rh && @userdetail.company.value_troy_rh!='')\n @value_troy_rh = @userdetail.company.value_troy_rh\n else\n @value_troy_rh = @rh.low\n end\n\n @assay_mat = @userdetail.assay_mat.to_f\n @weight = @product.weight.to_f\n @moisture = @product.moisture.to_f\n @pt_weight = @product.pt_weight.to_f\n @pd_weight = @product.pd_weight.to_f\n @rh_weight = @product.rh_weight.to_f\n\n @price_pt = ((@assay_mat*(@weight * (1 - (@moisture / 100))* 16 * 0.9114375) * (@pt_weight / 100) * @value_troy_pt.to_f ))/100\n @price_pd = ((@assay_mat*(@weight * (1 - (@moisture / 100))* 16 * 0.9114375) * (@pd_weight / 100) * @value_troy_pd.to_f ))/100\n @price_rh = ((@assay_mat*(@weight * (1 - (@moisture / 100))* 16 * 0.9114375) * (@rh_weight / 100) * @value_troy_rh.to_f ))/100\n @total_price = @price_pt+@price_pd+@price_rh+(@product.stainless_steel.to_f * @userdetail.company.stainless_steel_price.to_f)\n else\n\t\t@total_price = ''\n\t end\n end",
"title": ""
},
{
"docid": "e0e058a9039af008da3e05d6e7349eba",
"score": "0.53100806",
"text": "def index\n manage_filter_state\n no = params[:No]\n supplier = params[:Supplier]\n project = params[:Project]\n order = params[:Order]\n account = params[:Account]\n # OCO\n init_oco if !session[:organization]\n # Initialize select_tags\n @supplier = !supplier.blank? ? Supplier.find(supplier).full_name : \" \"\n @project = !project.blank? ? Project.find(project).full_name : \" \"\n @work_order = !order.blank? ? WorkOrder.find(order).full_name : \" \"\n @charge_account = !account.blank? ? ChargeAccount.find(account).full_name : \" \"\n\n # Arrays for search\n if !supplier.blank? # Offer requests that include current supplier\n @request_suppliers = OfferRequestSupplier.group(:offer_request_id).where(supplier_id: supplier)\n else\n @request_suppliers = OfferRequestSupplier.group(:offer_request_id)\n end\n @projects = projects_dropdown if @projects.nil?\n current_suppliers = @request_suppliers.blank? ? [0] : current_suppliers_for_index(@request_suppliers)\n current_projects = @projects.blank? ? [0] : current_projects_for_index(@projects)\n # If inverse no search is required\n no = !no.blank? && no[0] == '%' ? inverse_no_search(no) : no\n\n # Auto generate request\n @suppliers = suppliers_dropdown if @suppliers.nil?\n @current_projects = Project.where(id: current_projects) if @current_projects.nil?\n @search_projects = @current_projects.map{ |p| p.id }.map(&:inspect).join(',')\n @families = families_dropdown if @families.nil?\n # @charge_accounts = projects_charge_accounts(@current_projects) if @charge_accounts.nil?\n @stores = projects_stores(@current_projects) if @stores.nil?\n @payment_methods = payment_methods_dropdown if @payment_methods.nil?\n\n @search = OfferRequest.search do\n with :project_id, current_projects\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n if !no.blank?\n if no.class == Array\n with :request_no, no\n else\n with(:request_no).starting_with(no)\n end\n end\n if !supplier.blank?\n with :id, current_suppliers\n end\n if !project.blank?\n with :project_id, project\n end\n if !order.blank?\n with :work_order_id, order\n end\n data_accessor_for(OfferRequest).include = [{approved_offer: :supplier}]\n order_by :sort_no, :desc\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n @offer_requests = @search.results\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offer_requests }\n format.js\n end\n end",
"title": ""
},
{
"docid": "74f7cd050a0df251462cc0a8ec5d9b45",
"score": "0.5309638",
"text": "def show\n @quote_message = QuoteMessage.new\n @item_groups = ItemGroup.all\n @project_item = ProjectItem.new\n @variation = Variation.new\n @variation_quote = Variation.new\n @post = Post.new\n @posts = Post.where(project_id: @project.id).order(\"created_at DESC\").all\n @post_reply = PostReply.new\n @zones = Zone.where(project_id: @project.id)\n \n #Builder Quote Stage\n @project_items = ProjectItem.where(project_id: @project.id).all\n \n end",
"title": ""
},
{
"docid": "78f35c045ad865e2c35a7aaebc474c39",
"score": "0.5307967",
"text": "def show\n authorize @reserva\n if @reserva.rsrv_tipoProducto == \"VUELO\" then\n @producto = \"DATOS DEL \" + @reserva.rsrv_tipoProducto\n elsif @reserva.rsrv_tipoProducto == \"PLAN\" then\n paquete = PaqueteTuristico.find(@reserva.rsrv_productoId)\n @producto = @reserva.rsrv_tipoProducto + \" \" + paquete.pqTur_nombre\n end\n \n @contacto = Persona.where(pers_documentoIdentidad: @reserva.rsrv_contactoId).take\n @reserva.rsrv_solicitanteId == nil ? @solicitante = @contacto : @solicitante = Persona.where(pers_documentoIdentidad: @reserva.rsrv_solicitanteId).take\n @reservas = reservas_buscar(\"\",\"\",\"\", codigoReserva = @reserva.rsrv_codigo, \"\", \"\", \"\")\n @servOpcReserva = set_actividades_reserva(@reserva.id)\n @valorTotalReserva = reserva_calcular_tarifa(@reserva.rsrv_codigo)\n @pagos = Pago.select(\"pago_fecha, pago_forma, pago_valor, pago_estado, pago_transaccion\").where(\"pago_tipoProducto = 'RESERVA' AND pago_productoId = ? AND pago_estadoRegistro = 'A'\", @reserva.rsrv_codigo)\n arrCiudad = @reserva.rsrv_trayectoViaje.split(\"|\")\n @enterOrigen = EntidadTerritorial.find(arrCiudad[0])\n @enterDestino = EntidadTerritorial.find(arrCiudad[1])\n end",
"title": ""
},
{
"docid": "6aace6b4534367bd9e98fed9e017e68c",
"score": "0.5307888",
"text": "def show\n @reverse_vat_rate = TaxRate.find(10001)\n @reverse_ship_rate = TaxRate.find(10020)\n @reverse_transfer_rate = TaxRate.find(10040)\n @reverse_dealer_rate = TaxRate.find(10041)\n @product_variant = ProductVariant.find_by_extproductcode(@product_cost_master.prod)\n \n end",
"title": ""
},
{
"docid": "7e6e4be6c0e6a50e256d23c93b50feac",
"score": "0.5305569",
"text": "def index\n @consumers = Consumer.find(params[:consumer_id])\n @services = Service.all\n @expenditures = @consumer.expenditures.paginate :page => params[:page], :per_page => 10, :order => \"created_at DESC\"\n @consumer_total = Expenditure.calculate(:sum, :amount, :conditions => ['consumer_id = ?', params[:consumer_id]])\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenditures }\n end\n end",
"title": ""
},
{
"docid": "6ea5317e4fe7cd89c27c13d7dab355a4",
"score": "0.52960104",
"text": "def show\n @project = @eva_comm_proj.project\n end",
"title": ""
},
{
"docid": "23f80b94748e4cc17b52b25936a61308",
"score": "0.52947074",
"text": "def index\n # expecting to have @set ready\n raise ClientError.new(\"ابتدا نوع ست مورد نظر خود را وارد کنید.\") if not @set\n # return if no workable info defined?\n return if not admin_pricing_compute_params.select { |k| [:fabric_brand_id, :paint_color_brand_id, :wood_type_id].include? k.to_sym }.values.map(&:numeric?).any?\n # compute the cost\n cost = ComputePrice.execute(@furniture, set: @set, **admin_pricing_compute_params.to_h.symbolize_keys.select { |k| [:fabric_brand_id, :paint_color_brand_id, :wood_type_id].include? k })\n # respond the cost\n respond_with_success cost.to_i.to_s.to_money\n # if anything occured\n rescue ClientError => e\n respond_with_error e.message\n end",
"title": ""
},
{
"docid": "6024a3f84c2479af0c8b9c9e506a6de8",
"score": "0.52922726",
"text": "def show\n @expenses = Expense.of_this_year.where(condo: @condo)\n @invoices = Invoice.where(expense: @expenses)\n end",
"title": ""
},
{
"docid": "260b58ea51b70725345ed7c41d6510ca",
"score": "0.52885187",
"text": "def show\n @yfcase = Yfcase.find(params[:id])\n # 地坪總面積 (平方公尺)\n @landtotalarea = @yfcase.lands.map{ |n| [n.land_area.to_f * (n.land_holding_point_personal.to_f / n.land_holding_point_all.to_f)] }.flatten.sum\n # 建坪總面積 (平方公尺)\n @buildtotalarea = @yfcase.builds.map { |n| [n.build_area.to_f * (n.build_holding_point_personal.to_f / n.build_holding_point_all.to_f)] }.flatten.sum \n\n # 坪價(萬)\n @pingprice1 = @yfcase.floor_price_1.to_f / (@buildtotalarea*0.3025).to_f\n @pingprice2 = @yfcase.floor_price_2.to_f / (@buildtotalarea*0.3025).to_f\n @pingprice3 = @yfcase.floor_price_3.to_f / (@buildtotalarea*0.3025).to_f\n @pingprice4 = @yfcase.floor_price_4.to_f / (@buildtotalarea*0.3025).to_f\n\n # 時價(萬)\n\n marketpricecount = @yfcase.objectbuilds.count\n marketpricesum=@yfcase.objectbuilds.map { |n| [(testvalue(n.total_price.to_f / n.build_area.to_f ,n.plusa,n.plusb))] }.flatten\n @marketprice = marketpricesum.map!{|e| e.to_f}.sum.fdiv(marketpricesum.size) * 10000\n respond_to do |format|\n format.html\n format.json\n format.pdf {render template:'yfcases/deedtax', pdf: 'Deedtax'}\n end\n # respond_to do |format|\n # format.html\n # format.pdf do \n # pdf = YfcasePdf.new(@yfcase)\n # send_data pdf.render, \n # filename: \"yfcase_#{@yfcase.case_number}.pdf\",\n # type: \"application/pdf\",\n # disposition: \"inline\"\n # end\n # end \n end",
"title": ""
},
{
"docid": "83ff9779e6e1f6823256c9de031f5757",
"score": "0.5286102",
"text": "def show\n @sub_project = SubProject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sub_project }\n end\n end",
"title": ""
},
{
"docid": "20896893548cb4fb55df271343c26add",
"score": "0.52846074",
"text": "def show\n @product = @adquisition_cost.product_id\n @product_price = Product.find(@product).standard_price\n end",
"title": ""
},
{
"docid": "7e60c04a8ffc6e6ed54cf5adc2d6c0b6",
"score": "0.5284182",
"text": "def show\n @empresa = Empresa.find(params[:empresa_id]) \n @producto = @empresa.productos.find(params[:producto_id])\n @item_producto = @producto.item_productos.find(params[:item_producto_id])\n @detalle = @item_producto.detalles.find(params[:detalle_id])\n @prop_especifica = @detalle.prop_especificas.find(params[:id])\n end",
"title": ""
},
{
"docid": "e7b703a4ef13d4f68208eaeeab79327f",
"score": "0.5274805",
"text": "def show\n @subprograms = {}\n if @programs_target_program.kpkv[6] == \"0\" # means that it its main program\n key = @programs_target_program.kpkv[0,6]\n @subprograms = Programs::TargetedProgram.where(:kpkv => /#{key}[1-9]/, :programs_town_id => @programs_target_program.programs_town_id) # get only subprograms\n end\n @amounts = {}\n @subprograms.each{|program|\n @amounts[program.id.to_s] = program.get_total_amount Time.now.year\n }\n @indicators = @programs_target_program.get_indicators\n end",
"title": ""
},
{
"docid": "85b034a9afc841185026e85e1057d642",
"score": "0.52700317",
"text": "def index\n @project_partners = ProjectPartner.all\n end",
"title": ""
},
{
"docid": "e3e94cde6f497ba8234ab48802ecee47",
"score": "0.52665573",
"text": "def show\n @offer = @request.offers.find(params[:id])\n end",
"title": ""
},
{
"docid": "e49ffc09ea5264a817beae1a672c16b7",
"score": "0.5266542",
"text": "def show\n @costs = @journal.costs\n end",
"title": ""
},
{
"docid": "caabaa02632f9b04975555932f3c5fdd",
"score": "0.5265832",
"text": "def index\n @offers = @request.offers\n\n end",
"title": ""
},
{
"docid": "78fa8e3d3a6cfe660172d7a7ca9840ec",
"score": "0.52641076",
"text": "def index\n @offers = Offer.where(order_union_id: params[:order_union_id])\n end",
"title": ""
},
{
"docid": "b5a7a8d5eb5e4e69b09bc4495bfc42b3",
"score": "0.526383",
"text": "def show\n @plates = @restaurante.plates\n if @order.plates.nil?\n @order.price = 0\n else\n @order.plates.each do |p|\n @order.price += (p.price*@order.order_plates.find_by(plate_id: p).plates_quantity)\n end\n end\n end",
"title": ""
},
{
"docid": "4c2f31f98e9000d1d70a40d246f107e6",
"score": "0.5262505",
"text": "def show\n @offer_price = OfferPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offer_price }\n end\n end",
"title": ""
},
{
"docid": "fa8ebd8b64e73f273bea924eaead151a",
"score": "0.5253872",
"text": "def poland\n @offers = Offer.with_associations.poland.published_or_owned_by(current_user)\n .featured_first.advanced_search(params).group(:id).page(params[:page])\n @total_count = Offer.poland.published_or_owned_by(current_user)\n .advanced_search(params).group(:id).reorder('').count.length\n ids = nil\n ids = @offers.pluck(:id) if search_params_present? && @total_count < 50\n\n set_search_description\n get_featured_offers(:poland, ids) if search_params_present? && @offers.last_page?\n respond_to do |f|\n f.js { render 'index' }\n f.html do\n set_province_list\n @fields = Field.all\n @popular_locations = Province.most_popular_voivodeships_with_counts.uniq\n end\n end\n end",
"title": ""
},
{
"docid": "4384747cd3cd4659db1234c940c2123a",
"score": "0.5253419",
"text": "def filter_by_priest_id\n return @spots unless @params[:priest_id].to_i > 0\n @spots.of_priest(@params[:priest_id])\n end",
"title": ""
},
{
"docid": "22ebaca7758e9402e6c277517edc8ba6",
"score": "0.5253152",
"text": "def show\n @project1 = Project.where(id: params[:id])\n if user_signed_in?\n if params[:id]\n @projects = Project.where(parent_id: params[:id])\n @ideas = Idea.where(project_id: params[:id])\n @projects << @ideas\n @projects.flatten\n @projects2 = Project.where(parent_id: nil)\n else\n @location = GeoIP.new('lib/GeoLiteCity.dat').city(current_user.current_sign_in_ip)\n # @location = GeoIP.new('lib/GeoLiteCity.dat').city('110.136.133.185')\n @projects = Project.where(city: @location.city_name, parent_id: params[:id])\n end\n else\n @projects = Project.where(parent_id: nil)\n end\n end",
"title": ""
},
{
"docid": "cb66e3cb5ee69c565d9bd3b31f0e1eb2",
"score": "0.5247301",
"text": "def show\n @empresa = Empresa.find(params[:empresa_id])\n @producto = @empresa.productos.find(params[:producto_id])\n @prop_general = @producto.prop_generals.find(params[:prop_general_id])\n @prop_general_item = @prop_general.prop_general_items.find(params[:id])\n end",
"title": ""
},
{
"docid": "41e01f95c7e7cf6ec9f5e5b8013faabd",
"score": "0.5244106",
"text": "def index\n @computers_prices = ComputersPrice.all\n end",
"title": ""
},
{
"docid": "0425c20d4298e553dd612820290ab5cd",
"score": "0.5243699",
"text": "def index\n @permit_prices = PermitPrice.all\n end",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "632efdf7deaa19eccee31462c434454d",
"score": "0.0",
"text": "def qa_setting_params\n params.require(:qa_setting).permit(:name, :setting_id, :team_id, :description, :out_of, :qa, :position)\n end",
"title": ""
}
] | [
{
"docid": "e164094e79744552ae1c53246ce8a56c",
"score": "0.69792545",
"text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e662f0574b56baff056c6fc4d8aa1f47",
"score": "0.6781151",
"text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1677b416ad07c203256985063859691b",
"score": "0.67419964",
"text": "def allow_params_authentication!; end",
"title": ""
},
{
"docid": "c1f317213d917a1e3cfa584197f82e6c",
"score": "0.674013",
"text": "def allowed_params\n ALLOWED_PARAMS\n end",
"title": ""
},
{
"docid": "547b7ab7c31effd8dcf394d3d38974ff",
"score": "0.6734356",
"text": "def default_param_whitelist\n [\"mode\"]\n end",
"title": ""
},
{
"docid": "a91e9bf1896870368befe529c0e977e2",
"score": "0.6591046",
"text": "def param_whitelist\n [:role, :title]\n end",
"title": ""
},
{
"docid": "b32229655ba2c32ebe754084ef912a1a",
"score": "0.6502396",
"text": "def expected_permitted_parameter_names; end",
"title": ""
},
{
"docid": "3a9a65d2bba924ee9b0f67cb77596482",
"score": "0.6496313",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "068f8502695b7c7f6d382f8470180ede",
"score": "0.6480641",
"text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.6477825",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "c04a150a23595af2a3d515d0dfc34fdd",
"score": "0.64565",
"text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "9a2a1af8f52169bd818b039ef030f513",
"score": "0.6438387",
"text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"title": ""
},
{
"docid": "c5f294dd85260b1f3431a1fbbc1fb214",
"score": "0.63791263",
"text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "631f07548a1913ef9e20ecf7007800e5",
"score": "0.63740575",
"text": "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"title": ""
},
{
"docid": "9735bbaa391eab421b71a4c1436d109e",
"score": "0.6364131",
"text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "12fa2760f5d16a1c46a00ddb41e4bce2",
"score": "0.63192815",
"text": "def param_whitelist\n [:rating, :review]\n end",
"title": ""
},
{
"docid": "f12336a181f3c43ac8239e5d0a59b5b4",
"score": "0.62991166",
"text": "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "c25a1ea70011796c8fcd4927846f7a04",
"score": "0.62978333",
"text": "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "822c743e15dd9236d965d12beef67e0c",
"score": "0.6292148",
"text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"title": ""
},
{
"docid": "7f0fd756d3ff6be4725a2c0449076c58",
"score": "0.6290449",
"text": "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"title": ""
},
{
"docid": "9d23b31178b8be81fe8f1d20c154336f",
"score": "0.6290076",
"text": "def valid_params_request?; end",
"title": ""
},
{
"docid": "533f1ba4c3ab55e79ed9b259f67a70fb",
"score": "0.62894756",
"text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "5f16bb22cb90bcfdf354975d17e4e329",
"score": "0.6283177",
"text": "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"title": ""
},
{
"docid": "1dfca9e0e667b83a9e2312940f7dc40c",
"score": "0.6242471",
"text": "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"title": ""
},
{
"docid": "a44360e98883e4787a9591c602282c4b",
"score": "0.62382483",
"text": "def allowed_params\n params.require(:allowed).permit(:email)\n end",
"title": ""
},
{
"docid": "4fc36c3400f3d5ca3ad7dc2ed185f213",
"score": "0.6217549",
"text": "def permitted_params\n []\n end",
"title": ""
},
{
"docid": "7a218670e6f6c68ab2283e84c2de7ba8",
"score": "0.6214457",
"text": "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"title": ""
},
{
"docid": "b074031c75c664c39575ac306e13028f",
"score": "0.6209053",
"text": "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"title": ""
},
{
"docid": "0cb77c561c62c78c958664a36507a7c9",
"score": "0.6193042",
"text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"title": ""
},
{
"docid": "9892d8126849ccccec9c8726d75ff173",
"score": "0.6177802",
"text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e3089e0811fa34ce509d69d488c75306",
"score": "0.6174604",
"text": "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"title": ""
},
{
"docid": "7b7196fbaee9e8777af48e4efcaca764",
"score": "0.61714715",
"text": "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"title": ""
},
{
"docid": "9d589006a5ea3bb58e5649f404ab60fb",
"score": "0.6161512",
"text": "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"title": ""
},
{
"docid": "d578c7096a9ab2d0edfc431732f63e7f",
"score": "0.6151757",
"text": "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "38a9fb6bd1d9ae5933b748c181928a6b",
"score": "0.6150663",
"text": "def safe_params\n params.require(:user).permit(:name)\n end",
"title": ""
},
{
"docid": "7a6fbcc670a51834f69842348595cc79",
"score": "0.61461",
"text": "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"title": ""
},
{
"docid": "fe4025b0dd554f11ce9a4c7a40059912",
"score": "0.61213595",
"text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.611406",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "60ccf77b296ed68c1cb5cb262bacf874",
"score": "0.6106206",
"text": "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9",
"score": "0.6105114",
"text": "def quote_params\n params.permit!\n end",
"title": ""
},
{
"docid": "86b2d48cb84654e19b91d9d3cbc2ff80",
"score": "0.6089039",
"text": "def valid_params?; end",
"title": ""
},
{
"docid": "34d018968dad9fa791c1df1b3aaeccd1",
"score": "0.6081015",
"text": "def paramunold_params\n params.require(:paramunold).permit!\n end",
"title": ""
},
{
"docid": "6d41ae38c20b78a3c0714db143b6c868",
"score": "0.6071004",
"text": "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.60620916",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "49052f91dd936c0acf416f1b9e46cf8b",
"score": "0.6019971",
"text": "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"title": ""
},
{
"docid": "5eaf08f3ad47cc781c4c1a5453555b9c",
"score": "0.601788",
"text": "def filtering_params\n params.permit(:email, :name)\n end",
"title": ""
},
{
"docid": "5ee931ad3419145387a2dc5a284c6fb6",
"score": "0.6011056",
"text": "def check_params\n true\n end",
"title": ""
},
{
"docid": "3b17d5ad24c17e9a4c352d954737665d",
"score": "0.6010898",
"text": "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "74c092f6d50c271d51256cf52450605f",
"score": "0.6001556",
"text": "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"title": ""
},
{
"docid": "75415bb78d3a2b57d539f03a4afeaefc",
"score": "0.6001049",
"text": "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"title": ""
},
{
"docid": "bb32aa218785dcd548537db61ecc61de",
"score": "0.59943926",
"text": "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"title": ""
},
{
"docid": "65fa57add93316c7c8c6d8a0b4083d0e",
"score": "0.5992201",
"text": "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"title": ""
},
{
"docid": "865a5fdd77ce5687a127e85fc77cd0e7",
"score": "0.59909594",
"text": "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "ec609e2fe8d3137398f874bf5ef5dd01",
"score": "0.5990628",
"text": "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"title": ""
},
{
"docid": "423b4bad23126b332e80a303c3518a1e",
"score": "0.5980841",
"text": "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"title": ""
},
{
"docid": "48e86c5f3ec8a8981d8293506350accc",
"score": "0.59669393",
"text": "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"title": ""
},
{
"docid": "9f774a9b74e6cafa3dd7fcc914400b24",
"score": "0.59589154",
"text": "def active_code_params\n params[:active_code].permit\n end",
"title": ""
},
{
"docid": "a573514ae008b7c355d2b7c7f391e4ee",
"score": "0.5958826",
"text": "def filtering_params\n params.permit(:email)\n end",
"title": ""
},
{
"docid": "2202d6d61570af89552803ad144e1fe7",
"score": "0.5957911",
"text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"title": ""
},
{
"docid": "8b571e320cf4baff8f6abe62e4143b73",
"score": "0.5957385",
"text": "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"title": ""
},
{
"docid": "d493d59391b220488fdc1f30bd1be261",
"score": "0.5953072",
"text": "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"title": ""
},
{
"docid": "f18c8e1c95a8a21ba8cd6fbc6d4d524a",
"score": "0.59526145",
"text": "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"title": ""
},
{
"docid": "4e6017dd56aab21951f75b1ff822e78a",
"score": "0.5943361",
"text": "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"title": ""
},
{
"docid": "67fe19aa3f1169678aa999df9f0f7e95",
"score": "0.59386164",
"text": "def list_params\n params.permit(:name)\n end",
"title": ""
},
{
"docid": "bd826c318f811361676f5282a9256071",
"score": "0.59375334",
"text": "def filter_parameters; end",
"title": ""
},
{
"docid": "bd826c318f811361676f5282a9256071",
"score": "0.59375334",
"text": "def filter_parameters; end",
"title": ""
},
{
"docid": "5060615f2c808bab2d45f4d281987903",
"score": "0.5933856",
"text": "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"title": ""
},
{
"docid": "7fa620eeb32e576da67f175eea6e6fa0",
"score": "0.59292704",
"text": "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"title": ""
},
{
"docid": "d9483565c400cd4cb1096081599a7afc",
"score": "0.59254247",
"text": "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"title": ""
},
{
"docid": "f7c6dad942d4865bdd100b495b938f50",
"score": "0.5924164",
"text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"title": ""
},
{
"docid": "70fa55746056e81854d70a51e822de66",
"score": "0.59167904",
"text": "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"title": ""
},
{
"docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa",
"score": "0.59088355",
"text": "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"title": ""
},
{
"docid": "3eef50b797f6aa8c4def3969457f45dd",
"score": "0.5907542",
"text": "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "753b67fc94e3cd8d6ff2024ce39dce9f",
"score": "0.59064597",
"text": "def url_whitelist; end",
"title": ""
},
{
"docid": "f9f0da97f7ea58e1ee2a5600b2b79c8c",
"score": "0.5906243",
"text": "def admin_social_network_params\n params.require(:social_network).permit!\n end",
"title": ""
},
{
"docid": "5bdab99069d741cb3414bbd47400babb",
"score": "0.5898226",
"text": "def filter_params\n params.require(:filters).permit(:letters)\n end",
"title": ""
},
{
"docid": "7c5ee86a81b391c12dc28a6fe333c0a8",
"score": "0.589687",
"text": "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"title": ""
},
{
"docid": "de77f0ab5c853b95989bc97c90c68f68",
"score": "0.5896091",
"text": "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "29d030b36f50179adf03254f7954c362",
"score": "0.5894501",
"text": "def sensitive_params=(params)\n @sensitive_params = params\n end",
"title": ""
},
{
"docid": "bf321f5f57841bb0f8c872ef765f491f",
"score": "0.5894289",
"text": "def permit_request_params\n params.permit(:address)\n end",
"title": ""
},
{
"docid": "5186021506f83eb2f6e244d943b19970",
"score": "0.5891739",
"text": "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"title": ""
},
{
"docid": "b85a12ab41643078cb8da859e342acd5",
"score": "0.58860534",
"text": "def secure_params\n params.require(:location).permit(:name)\n end",
"title": ""
},
{
"docid": "46e104db6a3ac3601fe5904e4d5c425c",
"score": "0.5882406",
"text": "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"title": ""
},
{
"docid": "abca6170eec412a7337563085a3a4af2",
"score": "0.587974",
"text": "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"title": ""
},
{
"docid": "26a35c2ace1a305199189db9e03329f1",
"score": "0.58738774",
"text": "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "de49fd084b37115524e08d6e4caf562d",
"score": "0.5869024",
"text": "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"title": ""
},
{
"docid": "7b7ecfcd484357c3ae3897515fd2931d",
"score": "0.58679986",
"text": "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "0016f219c5d958f9b730e0824eca9c4a",
"score": "0.5867561",
"text": "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"title": ""
},
{
"docid": "8aa9e548d99691623d72891f5acc5cdb",
"score": "0.5865932",
"text": "def url_params\n params[:url].permit(:full)\n end",
"title": ""
},
{
"docid": "c6a8b768bfdeb3cd9ea388cd41acf2c3",
"score": "0.5864461",
"text": "def backend_user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "be95d72f5776c94cb1a4109682b7b224",
"score": "0.58639693",
"text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"title": ""
},
{
"docid": "967c637f06ec2ba8f24e84f6a19f3cf5",
"score": "0.58617616",
"text": "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"title": ""
},
{
"docid": "e4a29797f9bdada732853b2ce3c1d12a",
"score": "0.5861436",
"text": "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"title": ""
},
{
"docid": "d14f33ed4a16a55600c556743366c501",
"score": "0.5860451",
"text": "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"title": ""
},
{
"docid": "46cb58d8f18fe71db8662f81ed404ed8",
"score": "0.58602303",
"text": "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"title": ""
},
{
"docid": "7e9a6d6c90f9973c93c26bcfc373a1b3",
"score": "0.5854586",
"text": "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"title": ""
},
{
"docid": "ad61e41ab347cd815d8a7964a4ed7947",
"score": "0.58537364",
"text": "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"title": ""
},
{
"docid": "8894a3d0d0ad5122c85b0bf4ce4080a6",
"score": "0.5850427",
"text": "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"title": ""
},
{
"docid": "53d84ad5aa2c5124fa307752101aced3",
"score": "0.5850199",
"text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"title": ""
}
] |
8844db07509109bbeb0b5fe4bdbd153c | GET /v1/year_amount_summary params: year | [
{
"docid": "f04b600a978acbe2b3b49e4df177350b",
"score": "0.81124383",
"text": "def year_amount_summary\n render json: Year.year_amount_summary(params[:year]), each_serializer: YearsAmountSummarySerializer, :callback => params[:callback]\n end",
"title": ""
}
] | [
{
"docid": "f5d394a348e8536221dd00fb482800cb",
"score": "0.6397139",
"text": "def getStatsEntityBy_year( entity_id, year)\n params = Hash.new\n params['entity_id'] = entity_id\n params['year'] = year\n return doCurl(\"get\",\"/stats/entity/by_year\",params)\n end",
"title": ""
},
{
"docid": "defffcdf4544a781987bab4384bc555b",
"score": "0.6385324",
"text": "def year_details(make, model, year, raw_parameters={}, &block)\n Edmunds::Api.get(\"/api/vehicle/v2/#{make}/#{model}/#{year}\") do |request|\n request.raw_parameters = raw_parameters\n\n request.allowed_parameters = {\n submodel: Edmunds::Vehicle::SUBMODEL_REGEX,\n category: Edmunds::Vehicle::VEHICLE_CATEGORIES,\n state: %w[new used future],\n year: ((1990.to_s)..(Date.current.year.to_s)),\n view: %w[basic full],\n fmt: %w[json]\n }\n\n request.default_parameters = { view: 'basic', fmt: 'json' }\n\n request.required_parameters = %w[fmt]\n\n request.result_function = block\n end\n end",
"title": ""
},
{
"docid": "7ae9689c301b7800cc78c4f97bc72ec0",
"score": "0.6325691",
"text": "def security_advisories_year_year_get_with_http_info(year, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.security_advisories_year_year_get ...\"\n end\n # verify the required parameter 'year' is set\n if @api_client.config.client_side_validation && year.nil?\n fail ArgumentError, \"Missing the required parameter 'year' when calling DefaultApi.security_advisories_year_year_get\"\n end\n # resource path\n local_var_path = \"/security/advisories/year/{year}\".sub('{' + 'year' + '}', year.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['psirt_openvuln_api_auth']\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#security_advisories_year_year_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "b2b2f1a880209adb1270379c416239e1",
"score": "0.62708014",
"text": "def makes_by_year(year)\n make_request :get, '/makes/byYear/' + year.to_s\n end",
"title": ""
},
{
"docid": "a35dcc8be0f5af0ce424e348d23e53cc",
"score": "0.62053895",
"text": "def get_year\n @year ||= params[:year] ? params[:year].to_i : Time.now.year\n end",
"title": ""
},
{
"docid": "c909d40866c4d7fd0c5baabe2dcf56e4",
"score": "0.61297846",
"text": "def donation_this_year\n donation_year = Donation.where(\"strftime('%Y', donation_date) = ?\", Time.now.year.to_s)\n currency(donation_year.sum(:amount))\n end",
"title": ""
},
{
"docid": "e0a593bb38e401529f2694a310c39501",
"score": "0.60873526",
"text": "def reporte_churn_rate\n\t\tcurrent_year = params[:year].to_i\n\t\tdata = HistoricoPerdidaClientes.reporte_churn_rate(current_year)\n\t\trender :json => data\n\tend",
"title": ""
},
{
"docid": "ff5ff45b38a8a22dfe5172b2737a6a4e",
"score": "0.6057251",
"text": "def show_total_income\n\n self.years.each do |year|\n if self.total_income\n self.total_income += year.total_income\n else\n total_income = 0\n end\n end\n total_income\n end",
"title": ""
},
{
"docid": "b215be5a2ff243f540f2c67056901418",
"score": "0.6019387",
"text": "def year\n 2020\n end",
"title": ""
},
{
"docid": "0eb773fb3b81cedd5c7adf478923b602",
"score": "0.60171974",
"text": "def print_year\n print_top_year\n print_body_rows\n end",
"title": ""
},
{
"docid": "ee2b59f98c93df6b3c6d382fe17558da",
"score": "0.6014259",
"text": "def years_count(make, model, raw_parameters={}, &block)\n Edmunds::Api.get(\"/api/vehicle/v2/#{make}/#{model}/years/count\") do |request|\n request.raw_parameters = raw_parameters\n\n request.allowed_parameters = {\n submodel: Edmunds::Vehicle::SUBMODEL_REGEX,\n category: Edmunds::Vehicle::VEHICLE_CATEGORIES,\n state: %w[new used future],\n year: ((1990.to_s)..(Date.current.year.to_s)),\n view: %w[basic full],\n fmt: %w[json]\n }\n\n request.default_parameters = { view: 'basic', fmt: 'json' }\n\n request.required_parameters = %w[fmt]\n\n request.result_function = block || ->(edmunds_hash) do\n edmunds_hash[:yearsCount]\n end\n end\n end",
"title": ""
},
{
"docid": "68e9d11777cb350996116b11acf7be84",
"score": "0.5997972",
"text": "def index\n if params[:year]\n @yearly_infos = YearlyInfo.where(year: params[:year])\n else\n @yearly_infos = YearlyInfo.all\n end\n\n respond_to do |format|\n format.html\n format.csv { send_data(@yearly_infos.to_csv(:except => [:created_at, :updated_at])) }\n end\n end",
"title": ""
},
{
"docid": "b6a1df77c07855f0666665cf92e26833",
"score": "0.59939975",
"text": "def year\n #movie_year = '2014'\n # @movie_year = params[:movie_year] # in order to be available in the view\n movies = search_query([], %[\n FILTER regex(?release_date, '^#{query_param(true)}')\n ])\n @groups = {nil => movies} unless movies.empty?\n render 'results', locals: {title: \"Movies released in #{query_param}\"}\n end",
"title": ""
},
{
"docid": "72463a4abaea094d8931772b93db2fa9",
"score": "0.5989518",
"text": "def get_total_year(user)\n source = get_page_source(user)\n headers = source.css('h2')\n string = nil\n headers.each do |i|\n # Strip excess whitespace and newlines\n header_text = i.text.gsub(/(\\s+|\\n)/, ' ')\n if /contributions in the last year/ =~ header_text\n string = header_text.to_i_separated\n break\n end\n end\n string || 0\n end",
"title": ""
},
{
"docid": "b388e8bef944cd3e6b6d0039b079f46c",
"score": "0.5988426",
"text": "def activities_billing_total(year)\n query_strategy.activities_billing_total(year).first\n end",
"title": ""
},
{
"docid": "27ff302d984675c66a493344293cf412",
"score": "0.5983269",
"text": "def print_year_with_info(year)\n puts \"\"\n puts \"In #{year.year}, #{year.player} scored #{year.total_points} total points in #{year.games_played} total games.\"\n puts \"\"\n end",
"title": ""
},
{
"docid": "9dac45f1837c9224da5cccab7fb80596",
"score": "0.59732705",
"text": "def stats\n\t\tif params[:year] != nil\n\t\t\tyear = Integer(params[:year])\n\t\t\tfinal_year = year + 1\n\t\telse\n\t\t\tyear=2012\n\t\t\tfinal_year=Date.today.year + 1\n\t\tend\n\n\t\tinitial_date = DateTime.new(year)\n\t\tfinal_date = DateTime.new(final_year)\n\n\t\t@first_year = Company.first.created_at.year\n\t\t@current_year = Date.today.year\n\t\t@received = Bill.where(:created_at => initial_date..final_date).where(\"state = 1\").sum(\"value\")\n\t\t@debt = Bill.where(:created_at => initial_date..final_date).where(\"state = 0\").sum(\"value\")\n\t\t@nr_companies = Company.where(:created_at => initial_date..final_date).count\n\n\t\tif @nr_companies > 0\n\t\t\t@avg_users = User.where(:created_at => initial_date..final_date).count/@nr_companies\n\t\telse\n\t\t\t@avg_users = 0\n\t\tend\n\tend",
"title": ""
},
{
"docid": "6cf3ce93a8a52467765e37640d5f03ab",
"score": "0.59548265",
"text": "def dropout_rate_in_year(year)\n if valid_year?(year)\n dropout_rate_select_data = @dropout_rate.find_all { |hash| hash[:category] == \"All Students\" && hash[:timeframe] == \"#{year}\" && hash[:dataformat] == \"Percent\" }\n truncate(dropout_rate_select_data[0][:data])\n end\n end",
"title": ""
},
{
"docid": "805401d302e34c253e77f8675b964092",
"score": "0.59489733",
"text": "def year\n return @year\n end",
"title": ""
},
{
"docid": "a3f618f8c70244560b1f53ee5d645284",
"score": "0.5946778",
"text": "def activities_billing_total(year)\n query = <<-QUERY\n select sum(orderds_order_items.item_cost) as total_cost\n FROM orderds_order_items \n JOIN orderds_orders on orderds_orders.id = orderds_order_items.order_id\n where YEAR(orderds_order_items.date) = ? and \n orderds_orders.status NOT IN (1,3) \n QUERY\n\n @repository.adapter.select(query, [year])\n end",
"title": ""
},
{
"docid": "8da589b549e2cf1bca9b5efe95c56ff6",
"score": "0.59465754",
"text": "def total_charged(year)\n data = query_strategy.total_charged(year)\n detail = data.inject({}) do |result, value|\n result.store(value.payment_method, {value: value.total,\n color: \"#%06x\" % (rand * 0xffffff),\n highlight: \"#%06x\" % (rand * 0xffffff),\n label: Payments.r18n.t.payment_methods[value.payment_method.to_sym]})\n result\n end\n\n result = {total: 0, detail: detail}\n data.each { |item| result[:total] += item.total}\n\n return result\n end",
"title": ""
},
{
"docid": "16b7e9ccc68b06dc63652d998db6a741",
"score": "0.59393793",
"text": "def year\n return @year\n end",
"title": ""
},
{
"docid": "90622096412dd097d47806918cce0872",
"score": "0.5924726",
"text": "def inspect\n \"the year is \" + humanize_list(@years)\n end",
"title": ""
},
{
"docid": "bdb19a163e829bbf659f72f0ec2f133d",
"score": "0.59029",
"text": "def year=(value)\n @year = value\n end",
"title": ""
},
{
"docid": "db4acbe11593dd4a85504ca32e79224c",
"score": "0.58940953",
"text": "def year\n @year ||= details.at(\"h1[itemprop='name'] span#titleYear a\").text.parse_year rescue nil\n end",
"title": ""
},
{
"docid": "c4490ee004a315f9236bddb5ae154483",
"score": "0.5880164",
"text": "def total_charged(year)\n query = <<-QUERY\n select c.payment_method_id as payment_method, sum(c.amount) as total\n from orderds_orders o\n join orderds_order_items oi on oi.order_id = o.id\n join orderds_order_charges oc on oc.order_id = o.id\n join payment_charges c on c.id = oc.charge_id\n where o.status NOT IN (1,3) and c.status IN (4) and\n YEAR(c.date) = ? \n group by c.payment_method_id\n order by total desc\n QUERY\n @repository.adapter.select(query, [year])\n end",
"title": ""
},
{
"docid": "c3e2207dfa8db9a4e8e23c8372282a09",
"score": "0.58796525",
"text": "def year()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Year::YearRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"title": ""
},
{
"docid": "03572e75117afeaa3559d12b5e713a88",
"score": "0.5856509",
"text": "def years(make)\n make_id = get_object_id make\n response = get_url \"Years/#{make_id}\"\n response_obj = JSON.parse response\n response_obj[\"GetYearsResult\"].map{|r| r[\"Year\"]}\n end",
"title": ""
},
{
"docid": "5a580e1c35d8cbde14b4c6fa0de3ef47",
"score": "0.5849243",
"text": "def raw_year\n start_on.year\n end",
"title": ""
},
{
"docid": "de78a888de4b22905379f958beeb2d09",
"score": "0.5839896",
"text": "def competition_by_year\n \tresult = CompetitionResult.group_by_year(:created_at, format: '%Y').count\n \trender json: [{ name: 'Count', data: result}]\n end",
"title": ""
},
{
"docid": "128f390b34ee60ad435cf6a63620b836",
"score": "0.5830097",
"text": "def get_by_year (year, page = 1)\n\t\taction = \"discover/movie\"\n\t\targument = \"&sort_by=release_date.desc\" + \"&year=\" + year + \"&page=\" + page.to_s\n\t\tresponse = call_api(action, argument)\n\t\tmovies = process_results(response[\"results\"])\n\tend",
"title": ""
},
{
"docid": "ae6bdc18faf456c6811f524780be7620",
"score": "0.5822791",
"text": "def get_number_with_year\n receipt_num.to_s + \" / \" + get_date_receipt().strftime(\"%Y\")\n end",
"title": ""
},
{
"docid": "7f11cbb162c53696d6d64fd2c365b774",
"score": "0.5821548",
"text": "def test_get_sales_totals_for_year\n sales_totals = Order.get_totals_for_year(2007)\n assert_equal 1, sales_totals[1]['number_of_sales'].to_f\n assert_equal @order.product_cost, sales_totals[1]['sales_total'].to_f\n assert_equal @order.tax, sales_totals[1]['tax'].to_f\n assert_equal @order.shipping_cost, sales_totals[1]['shipping'].to_f\n end",
"title": ""
},
{
"docid": "86524ad49a24e9f66f81cf1efa200f17",
"score": "0.58193946",
"text": "def totals\n @title = 'Sales Totals'\n sql = \"SELECT DISTINCT YEAR(created_on) as year \"\n sql << \"FROM orders \"\n sql << \"ORDER BY year ASC\"\n @year_rows = Order.find_by_sql(sql)\n @years = Hash.new\n # Build a hash containing all orders hashed by year.\n for row in @year_rows\n @years[row.year] = Order.get_totals_for_year(row.year)\n end\n end",
"title": ""
},
{
"docid": "9f49add7fd7433592abec8078d3bdfdd",
"score": "0.57864356",
"text": "def index\n @years = Year.all\n end",
"title": ""
},
{
"docid": "9f49add7fd7433592abec8078d3bdfdd",
"score": "0.57864356",
"text": "def index\n @years = Year.all\n end",
"title": ""
},
{
"docid": "76527a36ea775ced6d21ed409375f8ea",
"score": "0.5776922",
"text": "def year\n return @t_year\n end",
"title": ""
},
{
"docid": "1e4762bbadc02a5613ee02d128e79050",
"score": "0.5772936",
"text": "def year\n end",
"title": ""
},
{
"docid": "e71cd0ee58c230713699b75f0e4e1005",
"score": "0.5760496",
"text": "def overview\n @current_year = Time.zone.today.year\n (current_user.first_billing_date.year..Time.zone.today.year).each do |year|\n add_to_graph(year_start_date(year), year_end_date(year))\n end\n @year_json = {\n title: \"Full Overview\",\n y_title: \"Dollars\",\n categories: (current_user.first_billing_date.year..Time.zone.today.year).to_a,\n series: [\n {\n name: 'Gross Income',\n data: @gross_income,\n color: '#3c763d'\n },\n {\n name: 'Gross Spending',\n data: @gross_spending,\n color: '#a94442'\n },\n {\n name: 'Net Profit',\n data: @net_profit,\n color: '#5cb85c',\n negativeColor: '#d9534f'\n }\n ]\n }\n end",
"title": ""
},
{
"docid": "165996621591adf22ed74e63d95dfc30",
"score": "0.5751874",
"text": "def year_name(number); end",
"title": ""
},
{
"docid": "5ba7a642c86c5d688bdf1fd163c1b199",
"score": "0.57371134",
"text": "def card_year\n card[:year].to_i\n end",
"title": ""
},
{
"docid": "42727549405a4e609cf8b801d0777cf3",
"score": "0.5736986",
"text": "def year; end",
"title": ""
},
{
"docid": "42727549405a4e609cf8b801d0777cf3",
"score": "0.5736986",
"text": "def year; end",
"title": ""
},
{
"docid": "20f36814c985bd98123a57a3de5b0136",
"score": "0.5734449",
"text": "def show\n @thermo_oil_distribution_year = ThermoOilDistributionYear.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thermo_oil_distribution_year }\n end\n end",
"title": ""
},
{
"docid": "6db14b653eaa9f9a72986be64487316c",
"score": "0.57176",
"text": "def finding_year_and_category\n @year = []\n if @data.present?\n if params[:year].present? && params[:category].present?\n #debugger\n @data[\"prizes\"].group_by {|x| @year << x if (x[\"year\"]==params[:year] && x[\"category\"]==params[:category])}\n elsif params[:year].present?\n @data[\"prizes\"].group_by {|x| @year << x if x[\"year\"]==params[:year]}\n else\n @data[\"prizes\"].group_by {|x| @year << x if x[\"category\"] == params[:category]}\n end\n end\n render :json => @year\n end",
"title": ""
},
{
"docid": "d0992afd0bb8246a784ede55d2fc8412",
"score": "0.57149875",
"text": "def years_by_make(make)\n make_request :get, '/years/byMake/' + make.to_s\n end",
"title": ""
},
{
"docid": "6b650f0ba8d969b6ead8b881fb97f113",
"score": "0.57146335",
"text": "def year() end",
"title": ""
},
{
"docid": "c53934afa42b9f7a5618466d55b1f50c",
"score": "0.5710754",
"text": "def history_makes_by_year(year)\n make_request :get, '/histmakes/byYear/' + year.to_s\n end",
"title": ""
},
{
"docid": "8bc36c83848598fd1c0133e76b61ce14",
"score": "0.57052726",
"text": "def year_params\n params.require(:year).permit(:id, :year)\n end",
"title": ""
},
{
"docid": "03864ba3f8ad9cd396c95f8ac743a732",
"score": "0.5703804",
"text": "def year_params\n params.require(:year).permit(:value)\n end",
"title": ""
},
{
"docid": "446170ab39ccc2762d9adbbba5f738f5",
"score": "0.5698275",
"text": "def graduation_rate_in_year(year)\n if valid_year?(year)\n graduation_rate_select_data = @graduation_rate.find_all { |hash| hash[:timeframe] == \"#{year}\" && hash[:data] }\n truncate(graduation_rate_select_data[0][:data])\n end\n end",
"title": ""
},
{
"docid": "7c19cc77f06b7dda3c45a58be27e9bb1",
"score": "0.56844634",
"text": "def print_mvyr\n puts @year\nend",
"title": ""
},
{
"docid": "d66c959ddf207ce938cf09a892c71c37",
"score": "0.5667371",
"text": "def year\n doc.search(\"table.info a[href*='/m_act%5Byear%5D/']\").text.to_i\n end",
"title": ""
},
{
"docid": "a2340b4bc165f90f26d7ee3541742629",
"score": "0.5667325",
"text": "def index\n @signature_years = SignatureYear.all\n end",
"title": ""
},
{
"docid": "b46684936222c082cc63d7db93cd2343",
"score": "0.56667346",
"text": "def year\n self._id['year']\n end",
"title": ""
},
{
"docid": "0620c1f8355a56249db6b610edc0ed7a",
"score": "0.5658302",
"text": "def year\n self.range('year')\n end",
"title": ""
},
{
"docid": "102c13782bdf551c5708b797fcbf5a5e",
"score": "0.56573385",
"text": "def year\n @year = params[:id].to_i\n date_format = \"'%Y'\"\n @speakers = generate_speaker_list_with_counts_for_date(@year,date_format,\"event_date\")\n end",
"title": ""
},
{
"docid": "789290984c189fdfbd19a6ba3395d58a",
"score": "0.56556875",
"text": "def index\n @subscriptions_by_year = @subscriptions.group_by(&:year)\n @year = params[:year] || @subscriptions_by_year.keys.sort.last\n @member = Member.find(params[:member_id]) if params[:member_id]\n @subscriptions = @subscriptions_by_year[@year]\n\n respond_to do |format|\n format.html # index.html.erb\n format.tex\n format.json { render json: @subscriptions }\n end\n end",
"title": ""
},
{
"docid": "466125d0e7446bffe3ff2b38d0cd785c",
"score": "0.5653662",
"text": "def signature_year_params\n params.require(:signature_year).permit(:year)\n end",
"title": ""
},
{
"docid": "1a7020d54ee0d1f27ce52ed7683ede6a",
"score": "0.56371474",
"text": "def analysis\n venture = Venture.find(params[:id])\n setup = venture.setups.where(year: params[:year]).first\n render json: {\n :html => render_to_string(\n :partial => \"analysis\",\n :layout => false,\n :locals => {:setup => setup, :presets => venture.presets, :mode => params[:mode]})\n }\n end",
"title": ""
},
{
"docid": "c1816f2aa90229419c1933156fd502db",
"score": "0.5634088",
"text": "def year1total\n @year1total = @year1 + @manage + @corporate\n end",
"title": ""
},
{
"docid": "95e3f29bf7b23e232231148c469e9994",
"score": "0.56287915",
"text": "def publication_year\n end",
"title": ""
},
{
"docid": "12b6b65d65b2a8e70847bb6664eec368",
"score": "0.56162107",
"text": "def getClassYearItems\n items = DSpace.findByMetadataValue($year_metadata_field, $year, nil)\n $logger.info \"Select #{$year_metadata_field}=#{$year} in #{$root} found #{items.length} items\"\n items\nend",
"title": ""
},
{
"docid": "acde240e3900578e4e6f5cb4b8186be2",
"score": "0.56132936",
"text": "def make_year_stats(months)\n rows = months.map{|month|\n items = Item.all(:conditions => {\n :date => month_range(month),\n :type => [\"Expense\", \"Income\"]\n }).group_by(&:category)\n\n make_row(month, items)\n }\n\n return rows.push make_sum_row(rows)\n end",
"title": ""
},
{
"docid": "9fb3470f8af67998e866b31cd84bfc9e",
"score": "0.55950314",
"text": "def set_year\n @year = Year.friendly.find(params[:id])\n end",
"title": ""
},
{
"docid": "e78d17f9500e88035e592c8a5e240611",
"score": "0.55930626",
"text": "def set_budget_year\n @budget_year = Date.today.year\n end",
"title": ""
},
{
"docid": "a98fb035239968b440b6429ed4aa83fa",
"score": "0.5588828",
"text": "def year1\n @year1 = @subtotal3 + @mobilisation + @tupe\n end",
"title": ""
},
{
"docid": "5e9a60176ab0f174cf18c16e0fe3077d",
"score": "0.55789006",
"text": "def year_ranking\n ranked_albums = SortCollection.sort_albums('year')\n render json: ranked_albums.sort_by(&:last).reverse[0...5].to_h, status: 200\n end",
"title": ""
},
{
"docid": "ffa1b464d75862951b222739486e8851",
"score": "0.5562534",
"text": "def this_year(limit: 5, markdown: false, rank: :top) \r\n \r\n build_table sort_coins('year', limit: limit, rank: rank), markdown: markdown\r\n\r\n end",
"title": ""
},
{
"docid": "52d0c5b6f0069a692516257ef8c95221",
"score": "0.55372316",
"text": "def year\n document.search('a[@href^=\"/year/\"]').innerHTML.to_i\n end",
"title": ""
},
{
"docid": "e7f3a500f5e719e04e15403b94d973a0",
"score": "0.55344665",
"text": "def first_year\n 2012\n end",
"title": ""
},
{
"docid": "4d12ad939adeaaa0be42402bb0cc2f60",
"score": "0.5530323",
"text": "def get_meta_year \n send_cmd(\"get_meta_year\")\n end",
"title": ""
},
{
"docid": "8f1eb967d0688b9f273b5ca07e3b4091",
"score": "0.55245805",
"text": "def agency_chart\n if(params[ :year ].nil?)\n params[ :year ] = '2015'\n else\n # Nothing to do.\n end\n expenses_of_public_agency = HelperController.expenses_year( \n params[ :id ].to_i, params[ :year ] )\n expenses_list = change_type_list_expenses( \n expenses_of_public_agency, params[ :year ] )\n\n respond_to do |format|\n format.json { render json: expenses_list }\n end\n end",
"title": ""
},
{
"docid": "33cf365ddb7b199f1e04a2fa3b34ca46",
"score": "0.5519018",
"text": "def w_year; end",
"title": ""
},
{
"docid": "75ce1549e5d2ae5a55d363a0b13822ef",
"score": "0.55156547",
"text": "def get_year_with_number\n date_receipt.strftime(\"%Y\") + \"-\" + sprintf( \"%03i\", receipt_num )\n end",
"title": ""
},
{
"docid": "0940f1908eb2ef925a1172ebe7665c74",
"score": "0.5513783",
"text": "def stats\n year = Analytic.where(\"created_at > ?\", Time.now - 1.year)\n @stats = time_data year\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: time_data(year, :hash), callback: params[:callback] }\n format.xml { render xml: time_data(year, :hash) }\n end\n end",
"title": ""
},
{
"docid": "fb71834fc43b751d7a0a313fdfed7557",
"score": "0.55072534",
"text": "def least_popular_for_year\n limit = set_limit\n @names = Year.least_popular_for_year(params[:year], limit)\n render json: @names, each_serializer: YearNameSerializer, :callback => params[:callback]\n end",
"title": ""
},
{
"docid": "a06a63322c54de4af9780d5ebaed2bf9",
"score": "0.5504653",
"text": "def set_year\n @year = Year.find(params[:id])\n end",
"title": ""
},
{
"docid": "f502360af0fa80cc6f29ca54f9ca1075",
"score": "0.5503413",
"text": "def year(index)\n get_field_from_relationship(workspace_id(index), @fields_extra[:year])\n end",
"title": ""
},
{
"docid": "8e72f67e32d0ef8afd073087fac55744",
"score": "0.55023944",
"text": "def show\n @expenses = @expenses_file.expenses.select(\"strftime('%m', date) as month, strftime('%Y', date) as year, SUM(tax_amount) + SUM(pre_tax_amount) AS total\").\n group('month, year').order('year, month').as_json\n end",
"title": ""
},
{
"docid": "5924597d0ea1a77e421323f828ea2e26",
"score": "0.54992175",
"text": "def years_needed\n 30\n end",
"title": ""
},
{
"docid": "51a75ee93e556a5857fa46842f3cebae",
"score": "0.54989433",
"text": "def cwyear\n end",
"title": ""
},
{
"docid": "d52f1f401899df3fb8b1925dc0d756d0",
"score": "0.5490695",
"text": "def format_year(year)\n \"#{year}-#{year+1}\"\n end",
"title": ""
},
{
"docid": "e6e9cda54a7bf6b61ef7110cd5032f87",
"score": "0.5485395",
"text": "def year_params\n params.require(:year).permit(:id)\n end",
"title": ""
},
{
"docid": "964815a4bb5939efbcf69bd92a266c4f",
"score": "0.54788727",
"text": "def index\n @year = set_year\n @travel_dates = TravelDate.for_year(set_year)\n @first_year = TravelDate.first_year\n @final_year = TravelDate.final_year\n @next_year = @year + 1\n @prev_year = @year - 1\n end",
"title": ""
},
{
"docid": "a050d6d4ab716b379442c50224620d82",
"score": "0.5475619",
"text": "def make_year(year, bias); end",
"title": ""
},
{
"docid": "cc8fc39230dedc912da60319f437d8b7",
"score": "0.5468944",
"text": "def set_year\n @year = params[:year].blank? ? @today.year : params[:year].to_i\n end",
"title": ""
},
{
"docid": "5a8fb34bab4cb260e223caedae278e4a",
"score": "0.54669696",
"text": "def find_year_description(id)\n find(:first, :conditions => {_(:id) => id}).description\n end",
"title": ""
},
{
"docid": "235826e85841d7a55946dc9366908a06",
"score": "0.5463244",
"text": "def security_advisories_year_year_get(year, opts = {})\n security_advisories_year_year_get_with_http_info(year, opts)\n return nil\n end",
"title": ""
},
{
"docid": "e3860b6c0564cbaec1f782a3dcc359ee",
"score": "0.5456804",
"text": "def year\n # Creation of a new Scraper object with year's url as a parameter\n @scraper = Scraper.new\n @scraper.link = params[:link]\n\n # Construction of the figaro url\n url = \"http://avis-vin.lefigaro.fr\" + @scraper.link\n\n # Call of year's general informations scraping class method\n @wine = Scraper.get_year_info(url) # => hash containing year's general informations\n end",
"title": ""
},
{
"docid": "a5d2affb556976ec68a39680d97488f7",
"score": "0.5451438",
"text": "def pub_year_display_str(ignore_approximate = false)\n single_pub_year(ignore_approximate, :year_display_str)\n\n # TODO: want range displayed when start and end points\n # TODO: also want best year in year_isi fields\n # get_main_title_date\n # https://github.com/sul-dlss/SearchWorks/blob/7d4d870a9d450fed8b081c38dc3dbd590f0b706e/app/helpers/results_document_helper.rb#L8-L46\n\n # \"publication_year_isi\" => \"Publication date\", <-- do it already\n # \"beginning_year_isi\" => \"Beginning date\",\n # \"earliest_year_isi\" => \"Earliest date\",\n # \"earliest_poss_year_isi\" => \"Earliest possible date\",\n # \"ending_year_isi\" => \"Ending date\",\n # \"latest_year_isi\" => \"Latest date\",\n # \"latest_poss_year_isi\" => \"Latest possible date\",\n # \"production_year_isi\" => \"Production date\",\n # \"original_year_isi\" => \"Original date\",\n # \"copyright_year_isi\" => \"Copyright date\"} %>\n\n # \"creation_year_isi\" => \"Creation date\", <-- do it already\n # {}\"release_year_isi\" => \"Release date\",\n # {}\"reprint_year_isi\" => \"Reprint/reissue date\",\n # {}\"other_year_isi\" => \"Date\",\n end",
"title": ""
},
{
"docid": "e7738f801f228a06d08f3689d9b16468",
"score": "0.5451103",
"text": "def year(index)\n i = get_field_index_by_external_id(index,@fields[:year])\n fields(index, i).to_i unless i.nil?\n end",
"title": ""
},
{
"docid": "156caf95f1009c9900ff08b61ec57092",
"score": "0.5448046",
"text": "def year\n @year = params[:year].to_i\n @first_month = 1\n @last_month = (Date.today.year == @year) ? Date.today.month : 12\n end",
"title": ""
},
{
"docid": "cf3cb06964bc3ce74320719a2f90ae81",
"score": "0.5445091",
"text": "def index\n @variables = Variable.all\n @years = {'2011' => '', '2012' => '', '2013' => '', '2014' => ''}\n end",
"title": ""
},
{
"docid": "48ab82b438de62c4ca97a7ae118d0ac7",
"score": "0.54331094",
"text": "def year\n current_year = Date.today.year\n\n case raw_year\n when current_year; \"this year\"\n when current_year.next; \"next year\"\n when current_year.pred; \"last year\"\n else; raw_year.to_s\n end\n end",
"title": ""
},
{
"docid": "ca11519d9007d14f9444c3eac5ffaa5f",
"score": "0.5421999",
"text": "def show\n @gss = @grade_section.students_for_academic_year(params[:year])\n end",
"title": ""
},
{
"docid": "98cb673f20f259baa04b4ac37f440831",
"score": "0.5420772",
"text": "def dog_years(year)\n\t\tp year*7\n\tend",
"title": ""
},
{
"docid": "bbe6d1f0fbeb01d745d7665ccef31ef1",
"score": "0.5418755",
"text": "def get_expenses_summary(month_period)\n request('getExpensesSummary', base_api_parameters.merge({ monthPeriod: month_period }))\n end",
"title": ""
},
{
"docid": "5da146cc804de4cd953d84a7e257234b",
"score": "0.54162365",
"text": "def new\n @budget = Budget.new\n @budget.year = Time.new.year\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end",
"title": ""
},
{
"docid": "67312f89b78b81ea4c07041137d976a0",
"score": "0.54082483",
"text": "def ordered_year_count\n \tFishCount.for_year(Date.today.year).order(count_date: :desc)\n end",
"title": ""
}
] |
9af9e00d42a61f827de5de74018407d5 | Formats values for issue status | [
{
"docid": "7b559118f7fc99f6c26a88bdcdf9036a",
"score": "0.56145996",
"text": "def print_status(status)\n color = :green if %w(Fixed Closed).include? status\n color = :yellow if %w(Open Reopened).include? status\n color = :yellow if status == 'In Progress'\n set_color(status, color)\n end",
"title": ""
}
] | [
{
"docid": "0fc6fae6b71305322582f47f0951fee6",
"score": "0.6701027",
"text": "def status\n if @issue_deleted == false\n color=status_color(@issue.status)\n {\n value: @issue.status.name,\n color: color\n }\n else\n {\n value: l(:label_deleted).capitalize,\n color: status_color('deleted')\n }\n end\n end",
"title": ""
},
{
"docid": "3fb2dad20d3f219b844780f129f23007",
"score": "0.66568255",
"text": "def issue_status\n if issue_status_category_id == 1\n \"Open\"\n elsif issue_status_category_id == 5\n \"Resolved\"\n else\n \"Lien\"\n end\n end",
"title": ""
},
{
"docid": "827d3ca085b3294c8ff051e7e0f0dbe2",
"score": "0.66344696",
"text": "def format_issue(issue)\n t(config.format == 'one-line' ? 'issue.oneline' : 'issue.details',\n key: issue.key,\n summary: issue.summary,\n status: issue.status.name,\n assigned: optional_issue_property('unassigned') { issue.assignee.displayName },\n fixVersion: optional_issue_property('none') { issue.fixVersions.first['name'] },\n priority: optional_issue_property('none') { issue.priority.name },\n url: format_issue_link(issue.key))\n end",
"title": ""
},
{
"docid": "c521f3a0d1b6fb5d421965730bcb7b96",
"score": "0.6584333",
"text": "def format_status(status)\n case status\n when 'Good'\n content_tag :font, status, :color => 'limegreen'\n when 'Minor Issues'\n content_tag :font, status, :color => 'orange'\n when 'Weak'\n content_tag :font, status, :color => 'orange'\n when 'Not Working'\n content_tag :font, status, :color => 'red'\n when 'Retired'\n content_tag :font, status, :color => 'black'\n else\n status\n end\n end",
"title": ""
},
{
"docid": "3bddf7dfd460ae7f548694dbfa81a121",
"score": "0.6505662",
"text": "def get_issue_status(issue_key)\n get_issue(issue_key)['status']\n end",
"title": ""
},
{
"docid": "bc9ac2c78daa8858ea1dbd2ed9d6ff99",
"score": "0.6427461",
"text": "def interpolated_status\n return self.status % { affected_departments: self.affected_departments, service_impact: self.service_impact, responsible_service_support_resource_group: self.responsible_service_support_resource_group, incident_responsibility: self.incident_responsibility }\n end",
"title": ""
},
{
"docid": "fb88789f7651fb9c412774c3bb6aa285",
"score": "0.6370428",
"text": "def pretty_status\n status.titleize\n end",
"title": ""
},
{
"docid": "8d78173d78ab04b3941c425bd4ae3d20",
"score": "0.62874436",
"text": "def format_issue i, width = columns\n return unless i['created_at']\n ERB.new(<<EOF).result binding\n<% p = i['pull_request']['html_url'] %>\\\n<%= bright { no_color { indent '%s%s: %s' % [p ? '↑' : '#', \\\n*i.values_at('number', 'title')], 0, width } } %>\n@<%= i['user']['login'] %> opened this <%= p ? 'pull request' : 'issue' %> \\\n<%= format_date DateTime.parse(i['created_at']) %>. \\\n<%= format_state i['state'], format_tag(i['state']), :bg %> \\\n<% unless i['comments'] == 0 %>\\\n<%= fg('aaaaaa'){\n template = \"%d comment\"\n template << \"s\" unless i['comments'] == 1\n '(' << template % i['comments'] << ')'\n} %>\\\n<% end %>\\\n<% if i['assignee'] || !i['labels'].empty? %>\n<% if i['assignee'] %>@<%= i['assignee']['login'] %> is assigned. <% end %>\\\n<% unless i['labels'].empty? %><%= format_labels(i['labels']) %><% end %>\\\n<% end %>\\\n<% if i['milestone'] %>\nMilestone #<%= i['milestone']['number'] %>: <%= i['milestone']['title'] %>\\\n<%= \" \\#{bright{fg(:yellow){'⚠'}}}\" if past_due? i['milestone'] %>\\\n<% end %>\n<% if i['body'] && !i['body'].empty? %>\n<%= indent i['body'], 4, width %>\n<% end %>\n\nEOF\n end",
"title": ""
},
{
"docid": "41adc103fa58ecd178f9ed791f23b2d6",
"score": "0.62688005",
"text": "def to_s\n @status.to_s\n end",
"title": ""
},
{
"docid": "8bdfbaa89ee712adbad094668ef71061",
"score": "0.6264351",
"text": "def change_t_status_to_s(status)\n case status\n when 1\n 'Stable'\n when 2\n 'Proposed'\n when 3\n 'Dismissed'\n end\n end",
"title": ""
},
{
"docid": "ee72ea1152b2b8457df566861ed3d19c",
"score": "0.61858594",
"text": "def format_issue i, width = columns\n return unless i['created_at']\n ERB.new(<<EOF).result binding\n<% p = i['pull_request']['html_url'] if i.key?('pull_request') %>\\\n<%= bright { no_color { indent '%s%s: %s' % [p ? '↑' : '#', \\\n*i.values_at('number', 'title')], 0, width } } %>\n@<%= i['user']['login'] %> opened this <%= p ? 'pull request' : 'issue' %> \\\n<%= format_date DateTime.parse(i['created_at']) %>. \\\n<% if i['merged'] %><%= format_state 'merged', format_tag('merged'), :bg %><% end %> \\\n<%= format_state i['state'], format_tag(i['state']), :bg %> \\\n<% unless i['comments'] == 0 %>\\\n<%= fg('aaaaaa'){\n template = \"%d comment\"\n template << \"s\" unless i['comments'] == 1\n '(' << template % i['comments'] << ')'\n} %>\\\n<% end %>\\\n<% if i['assignee'] || !i['labels'].empty? %>\n<% if i['assignee'] %>@<%= i['assignee']['login'] %> is assigned. <% end %>\\\n<% unless i['labels'].empty? %><%= format_labels(i['labels']) %><% end %>\\\n<% end %>\\\n<% if i['milestone'] %>\nMilestone #<%= i['milestone']['number'] %>: <%= i['milestone']['title'] %>\\\n<%= \" \\#{bright{fg(:yellow){'⚠'}}}\" if past_due? i['milestone'] %>\\\n<% end %>\n<% if i['body'] && !i['body'].empty? %>\n<%= indent i['body'], 4, width %>\n<% end %>\n\nEOF\n end",
"title": ""
},
{
"docid": "2281c394071f1e88f8a9e71346bfd0c3",
"score": "0.61444324",
"text": "def status\n ticket_status.try(:description)\n end",
"title": ""
},
{
"docid": "3a0dc97bd17219bd65b7e04c7949098f",
"score": "0.61407536",
"text": "def format_issues(issues)\n results = [t('myissues.info')]\n results.concat(issues.map { |issue| format_issue(issue) })\n end",
"title": ""
},
{
"docid": "a424c5674357b27a4ea951cff31b3a4e",
"score": "0.6122874",
"text": "def get_status()\n @status.to_s\n end",
"title": ""
},
{
"docid": "a5c95cd461b88990f80a99fb9e4bea0b",
"score": "0.6120337",
"text": "def issue_params\n params.require(:issue).permit(:title, :description, :user_id, :manager_id, :status).tap {\n |u| u[:status] = u[:status].to_i\n }\n end",
"title": ""
},
{
"docid": "82a5374da3600bdac258b30157eea38c",
"score": "0.6102724",
"text": "def status_as_string\n status&.to_s&.humanize&.downcase&.sub('exposure ', '')&.sub('isolation ', '')\n end",
"title": ""
},
{
"docid": "9637e73ca3a0f707d911702e3cb54b8e",
"score": "0.608266",
"text": "def render_status\n (Resultline::STATUS.find_all{|disp, value| value == status}).map {|disp, value| disp}\n end",
"title": ""
},
{
"docid": "adb95f49ae2da9570e03fd555f75cc44",
"score": "0.6061441",
"text": "def to_s\n @status.to_s\n end",
"title": ""
},
{
"docid": "61cddcec5ded9507666899d2ee59bfdf",
"score": "0.6060146",
"text": "def status\n\t\t@status.to_s\n\tend",
"title": ""
},
{
"docid": "94438c97e66a5bb6e1267b8d066896d5",
"score": "0.60570425",
"text": "def get_status_details(statuses)\r\n\r\n return statuses.map { |key, value|\r\n \"#{key}: #{value}\" if value > 0\r\n }.join(' ')\r\n\r\nend",
"title": ""
},
{
"docid": "dbd888c89dacffe12f63f46d920f337e",
"score": "0.6033747",
"text": "def example_status_string(status)\n if status == 'passed'\n status.ljust(COLUMN_WIDTH).colorize :green\n elsif status == 'failed'\n status.ljust(COLUMN_WIDTH).colorize :red\n else\n status.ljust(COLUMN_WIDTH).colorize :blue\n end\n end",
"title": ""
},
{
"docid": "51a71f4ba4d2f1b9c26ff2767ad17fa9",
"score": "0.6033004",
"text": "def to_status( input )\n case input\n when 0\n return \"In Progress\"\n when 1\n return \"Complete\"\n when 2\n return \"Rated\"\n end\n end",
"title": ""
},
{
"docid": "35044bdfecbe80656c190a84cd804f59",
"score": "0.6031953",
"text": "def statuses\n {\n available: \"Disponível\",\n ordered: \"Em análise\",\n approved: \"Aprovada\",\n rejected_aux: \"Rejeitada\",\n cancelled: \"Cancelada\",\n on_date: \"A vencer\",\n due_today: \"Vence hoje\",\n waiting_liquidation: \"Aguardando liquidação\",\n expected_liquidation_today: \"Liquidação esperada\",\n overdue: \"Em atraso\",\n paid: \"Liquidada\",\n pdd: \"Perdida\",\n }\n end",
"title": ""
},
{
"docid": "0b8818f0892d272cff952bd78d7e8003",
"score": "0.6020439",
"text": "def convert_status\n case status\n when 0\n return \"New\"\n when 1\n return \"Outstanding\"\n when 2\n return \"Completed\"\n end\n end",
"title": ""
},
{
"docid": "4fc1fb44a1a4f30c299afc6449f54022",
"score": "0.6003456",
"text": "def formatted\n audit_formatter.format\n end",
"title": ""
},
{
"docid": "6d463a0ef67fbbe57aba54a60674473c",
"score": "0.5991405",
"text": "def status_s; Statuses[status] end",
"title": ""
},
{
"docid": "6d463a0ef67fbbe57aba54a60674473c",
"score": "0.5991405",
"text": "def status_s; Statuses[status] end",
"title": ""
},
{
"docid": "ad143949abe19ecf27667799f6515220",
"score": "0.5974288",
"text": "def next_issue_status_options\n\n\t\t#get current status w/o comments and description edits\n\t\tcurrent_status = self.issue_trackers.where.not(\n\t\t\t:new_status_id => IssueStatus.where(:name => ['Description Modified', 'Additional Comments'] ).pluck(:id)\n\t\t).order(:created_at => :desc).first.new_status.name\n\n\t\tif (current_status == 'Open') then\n\t\t\treturn IssueStatus.where(:name => ['Acknowledged'])\n\t\telsif (current_status == 'Acknowledged') then\n\t\t\treturn IssueStatus.where(:name => ['Assigned'])\n\t\telsif (current_status == 'Assigned') then\n\t\t\treturn IssueStatus.where(\n\t\t\t\t:name => ['User Uncontactable', 'Escalate To Vendor', 'Resolved', 'Re-assigned', 'In Progress']\n\t\t\t)\n\t\telsif (current_status == 'Re-assigned') then\n\t\t\treturn IssueStatus.where(\n\t\t\t\t:name => ['User Uncontactable', 'Escalate To Vendor', 'Resolved', 'Re-assigned', 'In Progress']\n\t\t\t)\n\t\telsif (current_status =='User Uncontactable') then\n\t\t\treturn IssueStatus.where(\n\t\t\t\t:name => ['User Uncontactable', 'Escalate To Vendor', 'Resolved', 'Re-assigned', 'In Progress']\n\t\t\t)\n\t\telsif (current_status =='Escalate To Vendor') then\n\t\t\treturn IssueStatus.where(\n\t\t\t\t:name => ['User Uncontactable', 'Escalate To Vendor', 'Resolved', 'Re-assigned', 'In Progress']\n\t\t\t)\n\t\telsif (current_status =='In Progress') then\n\t\t\treturn IssueStatus.where(\n\t\t\t\t:name => ['User Uncontactable', 'Escalate To Vendor', 'Resolved', 'Re-assigned', 'In Progress']\n\t\t\t)\n\t\telsif (current_status =='Resolved') then\n\t\t\treturn IssueStatus.where(:name => ['Closed', 'Reopen'])\n\t\telsif (current_status =='Reopen') then\n\t\t\treturn IssueStatus.where(:name => ['Assigned'])\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend",
"title": ""
},
{
"docid": "d8d9ca2745b127e003969d54714b35af",
"score": "0.596728",
"text": "def normalize(status)\n # convert strings and arrays to status hashes\n if status.instance_of? String or status.instance_of? Array\n status = {data: status}\n end\n\n # convert symbols to strings\n status.keys.each do |key|\n status[key.to_s] = status.delete(key) if key.instance_of? Symbol\n end\n\n # normalize data\n if status['data'].instance_of? Hash\n # recursively normalize the data structure\n status['data'].values.each {|value| normalize(value)}\n elsif not status['data'] and not status['mtime']\n # default data\n status['data'] = 'missing'\n status['level'] ||= 'danger'\n end\n\n # normalize time\n if status['mtime'].instance_of? Time\n status['mtime'] = status['mtime'].gmtime.iso8601\n end\n\n # normalize level (filling in title when this occurs)\n if status['level']\n if not LEVELS.include? status['level']\n status['title'] ||= \"invalid status: #{status['level'].inspect}\"\n status['level'] = 'danger'\n end\n else\n if status['data'].instance_of? Hash\n # find the values with the highest status level\n highest = status['data'].\n group_by {|key, value| LEVELS.index(value['level']) || 9}.max ||\n [9, []]\n\n # adopt that level\n status['level'] = LEVELS[highest.first] || 'danger'\n\n group = highest.last\n if group.length != 1\n # indicate the number of item with that status\n status['title'] = \"#{group.length} #{ISSUE_TYPE[status['level']]}\"\n\n if group.length <= 4\n status['title'] += ': ' + group.map(&:first).join(', ')\n end\n else\n # indicate the item with the problem\n key, value = group.first\n if value['title']\n status['title'] ||= \"#{key} #{value['title']}\"\n else\n status['title'] ||= \"#{key} #{value['data'].inspect}\"\n end\n end\n else\n # default level\n status['level'] ||= 'success'\n end\n end\n\n status\n end",
"title": ""
},
{
"docid": "12982de04c4f8bb375991b256d468a08",
"score": "0.5946399",
"text": "def status\r\n\t\t\t%w{experience energy stamina hunger thirst}.map do |attr|\r\n\t\t\t\tval = \"%6s\" % (\"%6.2f\" % self.send( attr.to_sym ))\r\n\t\t\t\t\"%12s = %s\" % [attr.capitalize, val]\r\n\t\t\tend\r\n\t\tend",
"title": ""
},
{
"docid": "6fd43023e0ea283be6b984b3f329466e",
"score": "0.5945323",
"text": "def status_string\n [\"Pending\", \"Approved\", \"Denied\"].at(status)\n end",
"title": ""
},
{
"docid": "d7243fa6a3030ca40f338eb71e6061c5",
"score": "0.5934861",
"text": "def format_issue_list(issues)\n formatted = Hash.new\n\n issues.each do |issue|\n epic_id = issue.fields['customfield_10106']\n if formatted.has_key?(epic_id)\n formatted[epic_id][:issues].push(issue)\n else\n formatted[epic_id] = {\n id: epic_id,\n summary: \"\",\n issues: [issue]\n }\n end\n end\n\n formatted_keys = formatted.keys.reject{ |key| key.nil? || key.empty? }\n if formatted_keys.length\n fetched_epics = @client.Issue.jql(\"key IN(#{formatted_keys.join(',')})\")\n fetched_epics.each do |epic|\n epic_key = epic.key\n formatted[epic_key][:summary] = epic.fields['summary']\n end\n end\n\n formatted\nend",
"title": ""
},
{
"docid": "f0806efbb4b4a879ecad9fcf8295e6ae",
"score": "0.59291714",
"text": "def prepare_status(value,options={})\n\n case value.to_s\n when 'success'\n @status[0] = message_success(color: options[:color])\n when 'failed'\n @status[0] = message_failure(color: options[:color])\n else\n @status[0] = message_failure(color: options[:color])\n end\n\n @status\n end",
"title": ""
},
{
"docid": "2674734920783cc158ac3f0eb7fd91c7",
"score": "0.5910918",
"text": "def status_to_symbol_and_color(status)\n case status\n when 'up-to-date'\n return TICK_MARK, 'green'\n when'out-of-date'\n return X_MARK, 'red'\n else\n return '', 'white'\n end\n end",
"title": ""
},
{
"docid": "294b24bc48f91fdffd3d2771d34fc270",
"score": "0.59051746",
"text": "def update_issue_status\n issues = Issue.all :conditions => { :project_id => @project.id,\n :tracker_id => @tracker.id,\n :subject => params[:subject] }\n if issues.size > 1\n @project = nil\n @tracker = nil\n @status = nil\n render_error({:message => :error_cws_ambiguous_query, :status => 400}) \n elsif issues.size == 0\n render_404\n else\n issue = issues[0]\n if !issue.new_statuses_allowed_to(User.current).include? @status\n render_403\n else\n if issue.status.id != @status.id\n issue.init_journal(User.current)\n issue.status = @status\n if issue.save\n if Setting.notified_events.include?('issue_updated')\n Mailer.deliver_issue_edit(issue.current_journal)\n end\n respond_to do |format|\n format.json { render :json => issue }\n format.xml { render :xml => issue }\n end\n else\n render_403\n end\n else\n # Return unchanged issue\n respond_to do |format|\n format.json { render :json => issue }\n format.xml { render :xml => issue }\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f75a9322dfe0d5f7e0c13cd52e9348b1",
"score": "0.5901824",
"text": "def status_text\n return @@status_values[self.status]\n end",
"title": ""
},
{
"docid": "bfc6c328913329cfdba55aa5f2553cd0",
"score": "0.5863363",
"text": "def status_message\n ret = ''\n\n hash = status\n if hash\n if hash.pct_complete\n ret += \"#{hash.pct_complete}%\"\n if hash.message\n ret += \": \"\n end\n end\n if hash.message\n ret += hash.message\n end\n end\n\n ret\n end",
"title": ""
},
{
"docid": "d68ba6827cf2597be3b99d121b698323",
"score": "0.5863183",
"text": "def format_binary_status(status, trueval)\n status = status.nil? ? [\"gray\", \"fa fa-question\"] :\n (status == trueval) ? [\"green\", \"fa fa-arrow-up\"] :\n [\"red\", \"fa fa-arrow-down\"]\n return %{<span class='#{status[0]}'>\n <i class='#{status[1]}'></i></span>\n </span>}.html_safe\n end",
"title": ""
},
{
"docid": "470b6618dbd04bc01fbe9d45681a7056",
"score": "0.5860203",
"text": "def status\n case self[:status]\n when \"O\"\n \"❌\"\n when \"F\"\n \"✔️\"\n end\n end",
"title": ""
},
{
"docid": "d5e422bd356983eb9d6420d36f4cb54d",
"score": "0.5857894",
"text": "def formatted_value\n self.class.formatted_value(@value)\n end",
"title": ""
},
{
"docid": "789713266e9f6bf07bb7b743e41980a2",
"score": "0.58573675",
"text": "def status_report_header( format = StatusCat::Checkers::Base::FORMAT )\n name = I18n.t( :name, :scope => :status_cat )\n value = I18n.t( :value, :scope => :status_cat )\n status = I18n.t( :status, :scope => :status_cat )\n return sprintf( format, name, value, status )\n end",
"title": ""
},
{
"docid": "9cd13d8fc0f53e5e745d2cfef5068772",
"score": "0.5849316",
"text": "def status_str\n case object.status\n when 1\n \"Ordered\"\n when 2\n \"In Inventory\"\n when 3\n \"Scheduled Install\"\n when 4\n \"Operational\"\n when 5\n \"Scheduled Replacement\"\n when 6\n \"Removed\"\n when 7\n \"In Maintenance\"\n else\n \"Unknown\"\n end\n end",
"title": ""
},
{
"docid": "0aa5ff7ddce17a8f6b6739f8d4fcb752",
"score": "0.58461225",
"text": "def status_report_format( checkers )\n name_max = checkers.map { |c| c.name.to_s.length }.max\n value_max = checkers.map { |c| c.value.to_s.length }.max\n status_max = checkers.map { |c| c.status.to_s.length }.max\n\n format = \"%#{name_max}s | %#{value_max}s | %#{status_max}s\\n\"\n length = name_max + 3 + value_max + 3 + status_max\n\n return format, length\n end",
"title": ""
},
{
"docid": "7db19c46fc2ba468731c0d9ee0f921a6",
"score": "0.58395123",
"text": "def status_string(*) end",
"title": ""
},
{
"docid": "a6d237f14dea993f09740297a65dfc3b",
"score": "0.58292675",
"text": "def convert_status(status)\n case status\n when 'pending' then 'В ожидании'\n when 'shipped' then 'Отправлен'\n when 'completed' then 'Завершен'\n when 'cancelled' then 'Отменен'\n end\n end",
"title": ""
},
{
"docid": "6246fc6715d0268761e4372c76f3dd04",
"score": "0.5826815",
"text": "def escape_status(model, status = nil)\n status = model.class::STATUSES.invert[(status || model.status)]\n t(\"#{model.class.name.downcase}.statuses.#{status.to_s}\")\n end",
"title": ""
},
{
"docid": "65dcceaa3e2cf64e9f178edb08a6e445",
"score": "0.57967913",
"text": "def status_text status = @ole.status\n P2::CS_MESSAGES.map { |k, v| (k & status).zero? ? nil : v }.compact.join(', ')\n end",
"title": ""
},
{
"docid": "3db4c22bae48c6eeb3d6f7df25dc583f",
"score": "0.5795406",
"text": "def new_status\n c = details.detect {|detail| detail.prop_key == 'status_id'}\n (c && c.value) ? IssueStatus.find_by_id(c.value.to_i) : nil\n end",
"title": ""
},
{
"docid": "f30337b55c691520b00890db73fb09c8",
"score": "0.5786429",
"text": "def format_violation(violation)\n violation.to_s\n end",
"title": ""
},
{
"docid": "a21db4173de2dd260c334cf6520a499b",
"score": "0.5769522",
"text": "def to_s\n @error_status.to_s\n end",
"title": ""
},
{
"docid": "a21db4173de2dd260c334cf6520a499b",
"score": "0.5769522",
"text": "def to_s\n @error_status.to_s\n end",
"title": ""
},
{
"docid": "1d3039df44c55e2eee93327de1a0b3b0",
"score": "0.57615405",
"text": "def update_status\n # Get POST value\n card_id = params[:card_id]\n field_id = params[:field_id]\n comment = params[:comment]\n \n # Target issue ID\n issue_array = card_id.split(\"-\")\n issue_id = issue_array[1].to_i\n\n # Status ID to change status\n field_array = field_id.split(\"-\")\n status_id = field_array[1].to_i\n \n # User ID to change assignee\n if field_array.length == 3 then \n user_id = field_array[2].to_i\n else\n user_id = nil\n end\n\n # Target Issue\n issue = Issue.find(issue_id)\n\n # Status IDs allowed to change\n allowd_statuses = issue.new_statuses_allowed_to\n allowd_statuses_array = []\n allowd_statuses.each {|status|\n allowd_statuses_array << status.id\n }\n\n # Declaring variable to return\n result_hash = {}\n\n # Change status and assignee\n if allowd_statuses_array.include?(status_id) == true then\n if (issue.status_id != status_id) || (issue.assigned_to_id != user_id) then\n begin\n # Update issue\n old_status_id = issue.status_id\n old_done_ratio = issue.done_ratio\n old_assigned_to_id = issue.assigned_to_id\n issue.status_id = status_id\n issue.assigned_to_id = user_id\n issue.save!\n # Create and Add a journal\n note = Journal.new(:journalized => issue, :notes => comment, user: User.current)\n note.details << JournalDetail.new(:property => 'attr', :prop_key => 'status_id', :old_value => old_status_id,:value => status_id)\n note.details << JournalDetail.new(:property => 'attr', :prop_key => 'done_ratio', :old_value => old_done_ratio,:value => issue.done_ratio)\n note.details << JournalDetail.new(:property => 'attr', :prop_key => 'assigned_to_id', :old_value => old_assigned_to_id,:value => user_id)\n note.save!\n result_hash[\"result\"] = \"OK\"\n result_hash[\"user_id\"] = issue.assigned_to_id\n rescue => error\n result_hash[\"result\"] = \"NG\"\n end\n else\n result_hash[\"result\"] = \"NO\"\n end\n else\n result_hash[\"result\"] = \"NG\"\n end\n\n render json: result_hash\n end",
"title": ""
},
{
"docid": "cca8b9f7007d74fc4df9416d5fd7125d",
"score": "0.5752237",
"text": "def format_status(status, bg)\n user = status.user.screen_name\n \"[ em(\n link(\\\"#{user}\\\", :click => \\\"http://twitter.com/#{user}\\\",\n :underline => false,\n :stroke => \\\"#bfd34a\\\",\n :fill => \\\"#{bg}\\\") ,\n :size => 7 ),\n em(\\\": \\\", :size => 7, :stroke => white),\n \" + format_text(status.text, bg) + \", \n em(\\\" (\" + rel_time(status.created_at) + \") \\\", :size => 7, :stroke => white)\n ]\"\n end",
"title": ""
},
{
"docid": "633439faa51791e44ca9689ead2298dd",
"score": "0.5735241",
"text": "def normalize(status)\n # convert strings and arrays to status hashes\n if status.instance_of? String or status.instance_of? Array\n status = {data: status}\n end\n\n # normalize data\n if status[:data].instance_of? Hash\n # recursively normalize the data structure\n status[:data].values.each {|value| normalize(value)}\n elsif not status[:data] and not status[:mtime]\n # default data\n status[:data] = 'missing'\n status[:level] ||= 'danger'\n end\n\n # normalize time\n # If the called monitor wants to compare status hashes it should store the correct format\n if status[:mtime].instance_of? Time\n status[:mtime] = status[:mtime].gmtime.iso8601\n end\n\n # normalize level (filling in title when this occurs)\n if status[:level]\n if not LEVELS.include? status[:level]\n status[:title] ||= \"invalid status: #{status[:level].inspect}\"\n status[:level] = 'fatal'\n end\n else\n if status[:data].instance_of? Hash\n # find the values with the highest status level\n highest = status[:data].\n group_by {|key, value| LEVELS.index(value[:level]) || 9}.max ||\n [9, []]\n\n # adopt that level\n status[:level] = LEVELS[highest.first] || 'fatal'\n\n group = highest.last\n if group.length != 1\n # indicate the number of item with that status\n status[:title] = \"#{group.length} #{ISSUE_TYPE[status[:level]]}\"\n\n if group.length <= 4\n status[:title] += ': ' + group.map(&:first).join(', ')\n end\n else\n # indicate the item with the problem\n key, value = group.first\n if value[:title]\n status[:title] ||= \"#{key} #{value[:title]}\"\n else\n status[:title] ||= \"#{key} #{value[:data].inspect}\"\n end\n end\n else\n # default level\n status[:level] ||= 'success'\n end\n end\n\n status\n end",
"title": ""
},
{
"docid": "0a34039c0761e788cd397bad0988f7b7",
"score": "0.57346624",
"text": "def status=(new_status)\n super new_status.to_s\n end",
"title": ""
},
{
"docid": "0a34039c0761e788cd397bad0988f7b7",
"score": "0.57346624",
"text": "def status=(new_status)\n super new_status.to_s\n end",
"title": ""
},
{
"docid": "50bf43c235033cd84cbd8065db6b49c2",
"score": "0.5734607",
"text": "def status_text\n STATUS_TEXT[self.status]\n end",
"title": ""
},
{
"docid": "aa0deca2e3b36904050c98b71f7cc214",
"score": "0.5733424",
"text": "def item_status_txt(item)\n entry = last_item_status(item)\n entry&.status_txt || StatusEnum.values.first\n end",
"title": ""
},
{
"docid": "d0643bb3bb9783cf82a318fdef84cb4d",
"score": "0.57265854",
"text": "def status_line\n if self.unowned?\n \"open\"\n elsif self.waiting?\n \"waiting for a code fix\" # should be followed by link to code ticket\n elsif self.waiting_on_admin?\n \"waiting for an admin\"\n elsif self.spam?\n \"spam\"\n elsif self.closed? && self.support_identity_id.nil?\n \"closed by owner\"\n elsif self.closed? && self.code_ticket_id\n \"fixed in release\" # should be followed by link to release note\n elsif self.closed? && self.faq_id\n \"answered by FAQ\" # should be followed link to faq\n else\n \"#{self.status} by #{self.support_identity.name}\"\n end\n end",
"title": ""
},
{
"docid": "b16d9bc19111effef0bf543c96a8c960",
"score": "0.5719879",
"text": "def github_status_messages; end",
"title": ""
},
{
"docid": "5bc49895b8baf06ece4cee433aff6fff",
"score": "0.5700799",
"text": "def api_status_description\n status_description.downcase.tr(' ', '_')\n end",
"title": ""
},
{
"docid": "d683932bcdc05d168ccd7cd2ffdb3830",
"score": "0.5695281",
"text": "def to_s\n {\n ORDER_NOT_PLACED => \"Order not placed\",\n WAITING_FOR_PAYMENT => \"Waiting for payment\",\n PAYMENT_RECEIVED => \"Payment received\",\n PAYMENT_ON_ACCOUNT => \"Payment on account\",\n QUOTE => \"Quote\",\n PRO_FORMA => \"Pro forma invoice\",\n PAY_BY_PHONE => \"Paying by phone\",\n CANCELED => \"Canceled\",\n NEEDS_SHIPPING_QUOTE => \"Needs shipping quote\"\n }[@status]\n end",
"title": ""
},
{
"docid": "85f36174636363c1996a134f5f575287",
"score": "0.5679201",
"text": "def status_message\n OrderItem::Status.message(status)\n end",
"title": ""
},
{
"docid": "b6a4846454d1197db1c0c11029aee45b",
"score": "0.56697744",
"text": "def status_display item\n return \"Overdue\" if item['overdue'] == 'true'\n end",
"title": ""
},
{
"docid": "56de95ca0891e6a79d97050039fea6a1",
"score": "0.56597865",
"text": "def human_readable_status(status)\n HUMAN_READABLE_STATUS[status]\n end",
"title": ""
},
{
"docid": "cdc9f61f28a5849f0b203689e252b1ef",
"score": "0.565774",
"text": "def redmine_status\n if status_id == 1\n IssueStatus.find_by_name(\"New\")\n elsif status_id == 2\n IssueStatus.find_by_name(\"Closed\")\n else\n IssueStatus.find_by_name(\"Deleted\")\n end\n end",
"title": ""
},
{
"docid": "acd0deb2e21bfd7910fc3783c09f2ef7",
"score": "0.565146",
"text": "def convert_status\n status ? \"Completed\" : \"Pending\"\n end",
"title": ""
},
{
"docid": "31d6465ac3cca1fae0c926f0d42fb28c",
"score": "0.56485283",
"text": "def status_text\n end",
"title": ""
},
{
"docid": "dfca6647ea5130677740755254083731",
"score": "0.56438494",
"text": "def get_status_text(statuses)\r\n\r\n return \"Failed\" if statuses['failed'] > 0\r\n return \"Blocked\" if statuses['blocked'] > 0\r\n return \"Skipped\" if statuses['skipped'] > 0\r\n return \"Work in progress\" if statuses['wip'] > 0 || statuses['undefined'] > 0\r\n return \"Retest\" if statuses['retest'] > 0\r\n return \"Passed\" if statuses['passed'] > 0\r\n\r\n return \"Unknown\"\r\n\r\nend",
"title": ""
},
{
"docid": "c5ad154098863bc17f9d6af681d00d78",
"score": "0.5628926",
"text": "def status_en\n case status\n when NEW_STATUS\n return \"New\"\n when IN_TRANSIT_TO_YOU_STATUS\n return \"In transit to you\"\n when IN_TRANSIT_TO_TVC_STATUS\n return \"In transit to us\"\n when IN_STORAGE_STATUS\n return \"In Storage\"\n when BEING_PREPARED_STATUS\n return \"Being prepared by you\"\n when RETURN_REQUESTED_STATUS\n return \"Return requested\"\n when RETURNED_STATUS\n return \"Returned on #{return_requested_at.strftime('%b %d, %Y')}\"\n else\n raise \"Invalid status \" << status\n end\n end",
"title": ""
},
{
"docid": "7af617b19485febcf35b94cefc78dea7",
"score": "0.5625448",
"text": "def github_status_summary; end",
"title": ""
},
{
"docid": "dd74608642ff39f18bc21e41eeab4bc0",
"score": "0.5623677",
"text": "def retun_time_entry_msg(slatime)\n new_status = slatime.issue_sla_status.issue_status.name\n pre_status = slatime.old_status.issue_status.name #unless slatime.count == 1\n pre_status = pre_status == new_status ? 'New' : pre_status\n \"Status was changed from #{pre_status} to #{new_status}\"\n end",
"title": ""
},
{
"docid": "dd74608642ff39f18bc21e41eeab4bc0",
"score": "0.5623677",
"text": "def retun_time_entry_msg(slatime)\n new_status = slatime.issue_sla_status.issue_status.name\n pre_status = slatime.old_status.issue_status.name #unless slatime.count == 1\n pre_status = pre_status == new_status ? 'New' : pre_status\n \"Status was changed from #{pre_status} to #{new_status}\"\n end",
"title": ""
},
{
"docid": "9c463ad08a7806fe7be60d3fa520b587",
"score": "0.5623528",
"text": "def status_description()\n s = ''\n approvals.each do |a|\n s<< \"#{a.ip.short_fqdn}: #{a.display_status}<br/>\"\n end\n s.html_safe\n end",
"title": ""
},
{
"docid": "d51d9a161815c865c5e93e5b594a217c",
"score": "0.5608436",
"text": "def status_text\n status == 1 ? 'Accepted' : 'TBD'\n end",
"title": ""
},
{
"docid": "0860f0b96e706af38f59ec933dda70f0",
"score": "0.5607297",
"text": "def css_classes\n s = \"issue tracker-#{id} status-#{status}\"\n s << ' closed' if closed?\n s << ' overdue' if overdue?\n s << ' weeked' if weeked?\n s << ' private' if is_private?\n s << ' created-by-me' if User.current.logged? && user_id == User.current.id\n s\n end",
"title": ""
},
{
"docid": "b39cc35ba7ea4ba4f03f6b7b8d4d5f83",
"score": "0.56067544",
"text": "def status\n @status.to_sym\n end",
"title": ""
},
{
"docid": "77b42c05b4faceea8349acf97ada0810",
"score": "0.5605662",
"text": "def convert_status_to_view(status)\n return Util.green '*' if status.start_with? 'completed'\n return Util.red '*'\n end",
"title": ""
},
{
"docid": "a5929e3c96aa68cc6d78cf29fcb5a21e",
"score": "0.5604225",
"text": "def format_priority(priority)\n value = \" ⇧\".colorize(:red) if priority == \"high\"\n value = \" ⇨\".colorize(:light_yellow) if priority == \"medium\"\n value = \" ⇩\".colorize(:blue) if priority == \"low\"\n value = \"\" if !priority\n return value\n end",
"title": ""
},
{
"docid": "c90acc8793f749887f6673acbecd7372",
"score": "0.5603756",
"text": "def status_label\n label = self.status.to_s.gsub('created', 'working').gsub(/_/, ' ').capitalize\n label << '...' unless self.done?\n label << '!' if self.success? == false\n return label\n end",
"title": ""
},
{
"docid": "c90acc8793f749887f6673acbecd7372",
"score": "0.5603756",
"text": "def status_label\n label = self.status.to_s.gsub('created', 'working').gsub(/_/, ' ').capitalize\n label << '...' unless self.done?\n label << '!' if self.success? == false\n return label\n end",
"title": ""
},
{
"docid": "802103907ddfe7a7cb794c15aaaa2198",
"score": "0.5594074",
"text": "def format_index_health(val, return_color=cyan)\n # hrmm\n status_string = val.to_s.downcase # || 'green'\n if status_string == 'warning' || status_string == 'yellow'\n \"#{yellow}WARNING#{cyan}\"\n elsif status_string == 'error' || status_string == 'red'\n \"#{red}ERROR#{cyan}\"\n elsif status_string == 'ok' || status_string == 'green'\n \"#{green}OK#{cyan}\"\n else\n # hrmm\n it['status']\n end\n end",
"title": ""
},
{
"docid": "0db20e25eba6a8af7910a1921b070a6a",
"score": "0.5589574",
"text": "def nice_status(status)\n status ||= ''\n css_class = 'badge'\n case status\n when 'created'\n css_class = 'badge badge-warning'\n when 'confirming'\n css_class = 'badge badge-warning'\n when 'received'\n css_class = 'badge badge-primary'\n when 'accepted'\n css_class = 'badge badge-success'\n when 'rejected'\n css_class = 'badge danger-danger'\n end\n content_tag('span', status.to_s.capitalize, class: css_class.to_s)\n end",
"title": ""
},
{
"docid": "a4638dec77f94aeea8fba71d1e1e8aff",
"score": "0.55889416",
"text": "def status=(value)\n title,body,icon = value\n time = Time.now.strftime(\"%H:%M:%S\")\n new_body = body.tr(\"\\n\",\" \")\n @status_list << [\"#{time}\",\"<b>#{title}</b> #{new_body}\"]\n @status = value\n end",
"title": ""
},
{
"docid": "7d077ad599e23104beced71540442821",
"score": "0.5585315",
"text": "def status\n status_code.to_sym\n end",
"title": ""
},
{
"docid": "dea780bddb15eaccb45826351c2df3f9",
"score": "0.5582219",
"text": "def format_value(prop,value)\n case prop\n when :creation_time\n date(value)\n when :scales_from,:scales_to\n (value == -1 ? \"available gears\" : value)\n when :aliases\n value.join ' '\n else\n value\n end\n end",
"title": ""
},
{
"docid": "6d9435cd956af86221d241ceb4b8895a",
"score": "0.5581187",
"text": "def passing_status_and_class\n sts = 'ERROR'\n cls = 'text-danger'\n if @test_case_commit.status == 0\n sts = 'Passing'\n cls = 'text-success'\n elsif @test_case_commit.status == 1\n sts = 'Failing'\n cls = 'text-danger'\n elsif @test_case_commit.status == 2\n sts = 'Checksum mismatch'\n cls = 'text-primary'\n elsif @test_case_commit.status == 3\n sts = 'Mixed'\n cls = 'text-warning'\n elsif @test_case_commit.status == -1\n sts = 'Not yet run'\n cls = 'text-info'\n end\n return sts, cls\n end",
"title": ""
},
{
"docid": "7e82816ea82f843321eb303130dbc73c",
"score": "0.55797434",
"text": "def status_msg\n raw_presence[:status_msg]\n end",
"title": ""
},
{
"docid": "3b3d07660446347111ea9d90e23209d9",
"score": "0.55793077",
"text": "def format_value(val)\n case val\n when AmazonFlexPay::Model\n val.to_hash\n\n when Time\n val.utc.strftime('%Y-%m-%dT%H:%M:%SZ')\n\n when TrueClass, FalseClass\n val.to_s.capitalize\n\n when Array\n val.join(',')\n\n else\n val.to_s\n end\n end",
"title": ""
},
{
"docid": "d11d9de30c3a6ec6bbe348f7af831a0d",
"score": "0.55777806",
"text": "def status\n if passed?\n if pending_count > 0\n \"pending\"\n elsif omission_count > 0\n \"omission\"\n elsif notification_count > 0\n \"notification\"\n else\n \"pass\"\n end\n elsif error_count > 0\n \"error\"\n elsif failure_count > 0\n \"failure\"\n end\n end",
"title": ""
},
{
"docid": "2ba41c067f633bb8bae7601d8be3f2f7",
"score": "0.55762446",
"text": "def to_format; end",
"title": ""
},
{
"docid": "f244e48fd992fe4104bbc3586672a7a0",
"score": "0.55720687",
"text": "def formatting\n attributes.fetch(:formatting)\n end",
"title": ""
},
{
"docid": "102e8e9d06f0800d4aef16e6ba118d33",
"score": "0.55713",
"text": "def status_label\n STATUS.keys[STATUS.values.index(status)].to_s\n end",
"title": ""
},
{
"docid": "bd3f230245b4bdec3d4a600e9d0831c8",
"score": "0.5564769",
"text": "def update_status!\n s = case\n when !submitted? then :in_progress\n when requires_approval? && submitted? && !approved? then :pending\n when submitted? && approved? && !checked_out? && !checked_in? then :approved\n when checked_out? && late? then :late\n when checked_out? then :checked_out\n when checked_in? && late? then :returned_late\n when checked_in? && !checkin_ok? then :returned_damaged\n when checked_in? then :returned\n else :unknown\n end\n self.status = s.to_s\n end",
"title": ""
},
{
"docid": "f3601ee36b54549331eb5f2301277eda",
"score": "0.5558742",
"text": "def update\n error = \"\"\n @title = params[:title]\n respond_to do |format|\n if (!['Task', 'Bug','Enhancement','Proposal'].include? params[:category])\n error += \"Invalid on category. \"\n end\n if (!['Trivial', 'Minor','Major','Critical','Blocker'].include? params[:priority] )\n error += \"Error on priority. \"\n end\n if (!['Opened', 'Closed','Resolved','On holded','Duplicated','Invalid','Wontfixed'].include? params[:status] )\n error += \"Error on status. \"\n end\n if (!User.find_by(name: params[:assignee]))\n error += \"Unexisting user to assign the issue. \"\n end\n if error != \"\"\n format.html { \n @issue.update(issue_params)\n @issue.update(issue: @title)\n redirect_to @issue, notice: 'Issue was successfully updated.'\n }\n format.json { render :json => {:error => error, :status => 400}, :status => :bad_request }\n else\n @issue.update(issue_params)\n @issue.update(issue: @title)\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue }\n end\n end\n end",
"title": ""
},
{
"docid": "5e4efbb61c0b77d9db3a479bc8f67dee",
"score": "0.5554391",
"text": "def get_status\n case status\n when 1\n \"Pass\"\n when 0\n \"Warning\"\n when -1\n \"Fail\"\n else\n \"Error\"\n end\n end",
"title": ""
},
{
"docid": "d55b1db90227943932a8ad3ee4d4d68c",
"score": "0.55518585",
"text": "def formatted_status\n \"<b>STDERR:</b><pre>\" + (self.stderr.nil? ? '' : self.stderr)+ \"</pre>\\n<b>STDOUT</b>:<pre>\" + (self.stdout.nil? ? '' : self.stdout) + \"</pre>\"\n end",
"title": ""
},
{
"docid": "246dc5b6eac4f9d835bce4847c81c795",
"score": "0.5550514",
"text": "def status_class\n if status >= 3\n \"danger\" \n elsif status == 2\n \"warning\"\n elsif status == 1\n \"info\"\n end \n end",
"title": ""
},
{
"docid": "5e38b33862a11c919d8632adb992e832",
"score": "0.55463296",
"text": "def issue_state(cell_value)\n due_date = CustomFields::IssueTracking.cell_due_date(cell_value)\n original_date = CustomFields::IssueTracking.cell_original_date(cell_value)\n completed_date = CustomFields::IssueTracking.cell_completed_date(cell_value)\n\n now = Time.now.strftime('%Y-%m-%d').to_date\n if (completed_date != Date.null_date)\n :completed\n elsif original_date == Date.null_date\n :unscheduled\n elsif due_date == Date.null_date\n :cancelled\n elsif due_date < now\n :delayed\n elsif due_date == now\n :dued\n elsif due_date != original_date\n :rescheduled\n else\n :scheduled\n end \n end",
"title": ""
},
{
"docid": "9a7580af168c24f18bd3944f06d15a9f",
"score": "0.5536527",
"text": "def status_color\n if complete?\n 'success'\n elsif pending?\n 'default'\n elsif partially?\n 'warning'\n elsif sent?\n 'danger'\n end\n end",
"title": ""
}
] |
4950b8e690e8c336367a809b0869ba93 | DISPLAY Draws the player tile on the map based on the tile index view | [
{
"docid": "3572889b758c8ed83b364411a3f89610",
"score": "0.62473106",
"text": "def display_player(index_x, index_y)\n x = @data[\"player_x\"] - get_camera_range(\"x\", \"down\")\n y = @data[\"player_y\"] - get_camera_range(\"y\", \"down\")\n\n\n if x == index_x && y == index_y\n player \n return true\n end\n\n return false\n end",
"title": ""
}
] | [
{
"docid": "76248b7570f7311148f66dda006f78bd",
"score": "0.7016381",
"text": "def draw\r\n\r\n # Attach the camera location to the player\r\n @player.draw(@camera_x, @camera_y,1)\r\n\r\n # Cycle thru each map level...\r\n for l in 0...@level.size\r\n\r\n # ... and cycle thru each y coord ...\r\n for y in 0...@level[l].size\r\n \r\n # ... and cycle thru each x coord\r\n for x in 0...@level[l][y].size\r\n\r\n # Check if this is the first level\r\n if l == 1 then\r\n\r\n # If this is a hidden tile location...\r\n if @hidden_tiles.include?([x,y]) then\r\n @tileset[@level[l][y][x]].draw((x*16)-@camera_x,\r\n (y*16)-@camera_y,\r\n l+1,\r\n 1,\r\n 1,\r\n Gosu::Color.new(160,255,255,255))\r\n\r\n # Otherwise just a normal location\r\n else\r\n @tileset[@level[l][y][x]].draw((x*16)-@camera_x,\r\n (y*16)-@camera_y,\r\n l+1)\r\n end\r\n\r\n # Otherwise just default to the start location\r\n else\r\n @tileset[@level[l][y][x]].draw((x*16)-@camera_x,\r\n (y*16)-@camera_y,\r\n l+1)\r\n end\r\n end\r\n end\r\n end\r\n\r\n # For the given camera location, draw all entites present in that\r\n # location\r\n @entities.each{|en| en.draw(@camera_x, @camera_y)}\r\n\r\n # Draw the score counter onto the game window\r\n $text.draw_text(\"< #{@score} >\", 16, 16, 10)\r\n end",
"title": ""
},
{
"docid": "5bf4b98f3e369707e3330f2d8dd8b579",
"score": "0.68489224",
"text": "def draw\n super\n return if map.nil?\n\n map.draw(origin.x, origin.y, 1)\n\n # Check where we were on the map\n tile_x = (mouse_point.x - origin.x) / map.tile_set.width\n tile_y = (mouse_point.y - origin.y) / map.tile_set.height\n\n if tile_x >= 0 && tile_x <= map.width && tile_y >= 0 && tile_y <= map.height\n tile_point = Entities::Point.new(tile_x.to_i, tile_y.to_i)\n\n if @drawing\n map.place_track(tile_point)\n elsif @removing\n map.remove_track(tile_point)\n end\n\n tile_corner_x = tile_x.to_i * map.tile_set.width + origin.x\n tile_corner_y = tile_y.to_i * map.tile_set.height + origin.y\n \n # TODO Colour based on validity\n Gosu.draw_rect(tile_corner_x, tile_corner_y, map.tile_set.width,\n map.tile_set.height, 0x77FFFF00, 10) if controls_enabled? \n end\n\n # Draw the station colour indicators\n map.tile_objects.each do |obj|\n next unless obj.is_a?(Entities::StationObject)\n\n tile_corner_x = obj.point.x * map.tile_set.width + origin.x + 18\n tile_corner_y = obj.point.y * map.tile_set.height + origin.y + 10\n\n colour = Entities::StationObject::BACKGROUND_COLORS[obj.number]\n Gosu.draw_rect(tile_corner_x, tile_corner_y, 28, 22, colour, 9)\n end\n end",
"title": ""
},
{
"docid": "01a876252934bd6c30ab0e2f65f8e12a",
"score": "0.66927826",
"text": "def render_player x, y \n \tboxsize = 16\n \tgrid_x = (1280 - (@grid_w * boxsize)) / 2\n \tgrid_y = (720 - ((@grid_h - 2) * boxsize)) / 2\n\t\t@args.outputs.sprites << [ grid_x + (x * boxsize), (grid_y) + (y * boxsize), boxsize, boxsize, \"sprites/debug.png\"]\n\tend",
"title": ""
},
{
"docid": "177f917010313fd52178619a1e17d7a6",
"score": "0.6685758",
"text": "def draw_map\n x = 18\n\n # draw box\n @scr.box x, 0, @scr.w-x-1, @scr.h-3\n t = ' ' + _('World Map') + ' '\n @scr.puts ((@scr.w-x-1)/2 - t.length/2) + x, 0, \"<title>#{t}\"\n\n # draw tiles\n (1..(@scr.h-4)).each do |y|\n @scr.x = x+1\n @scr.y = y\n (1..(@scr.w-x-2)).each do |x|\n tx = x - @rx - 1\n ty = y - @ry - 1\n if tx >= 0 and ty >= 0 and tx < @game.map_w and ty < @game.map_h\n @scr.print \"[tile #{tx} #{ty}]\" if @game[tx,ty]\n #elsif tx == -1 or ty == -1 or tx == (@game.map_w) or ty == (@game.map_h)\n # @scr.print '#'\n else\n @scr.print ' '\n end\n end\n end\n\n # set focus\n if @driver.focused\n return @driver.focused.x+x, @driver.focused.y\n else\n return nil\n end\n\n end",
"title": ""
},
{
"docid": "2c9b0169aa49a0216e502854f7f70ab6",
"score": "0.6671842",
"text": "def draw_map game_map\r\n tiles = game_map.tiles # 2d array of the tiles set!\r\n wooden_plank_image = game_map.wooden_plank # image of the wooden plank \r\n i = 0\r\n j = 0\r\n unit_width = 20\r\n unit_height = 20\r\n\r\n # drawing the background image of the game map\r\n #game_map.background.draw(0,0,0) # 0: for x position, 0: for y position, 0: for ZOrder\r\n\r\n height = tiles.length\r\n width = tiles[0].length\r\n\r\n while i < height\r\n j = 0\r\n while j < width\r\n if(tiles[i][j]==1 || tiles[i][j]==3)\r\n x = j * unit_width\r\n y = i * unit_height\r\n draw_plank(x, y, wooden_plank_image)\r\n j+=4 # increment the value of the j by 4 to skip the next 4 blocks\r\n end\r\n j+=1\r\n end\r\n i+=1\r\n end\r\n\r\nend",
"title": ""
},
{
"docid": "b8aa78c950f664ebec8f0cbfe6fd6baa",
"score": "0.6644065",
"text": "def draw_board\n\t\tfor i in 0..9\n\t\t\t@tile_Array[i].draw\n\t\tend\n\tend",
"title": ""
},
{
"docid": "05af983f8db2f6c2075e456933675acf",
"score": "0.66233575",
"text": "def draw\n @headers[@game_state_model::players[@game_state_model.player_turn_state]::player_color].draw(@x, @y, 35)\n\n if @game_state_model.player_turn_state == 0\n @ico_one.draw(@x + 143, @y + 20, 35)\n elsif @game_state_model::players[@game_state_model.player_turn_state]::ai == nil\n @ico_two.draw(@x + 143, @y + 20, 35)\n else \n @ico_ai.draw(@x + 143, @y + 20, 35)\n end\n\n @tiles[@game_state_model::players[0]::player_color].draw(@x + 10, @y + 8, 35)\n @tiles[@game_state_model::players[1]::player_color].draw(@x + 10, @y + 48, 35)\n # @block_purple.draw(@x + 10, @y + 5, 1)\n # @block_green.draw(@x + 10, @y + 45, 1)\n @question.draw\n @cancel.draw\n @font.draw(\"#{@game_state_model::players[0]::name}\", 50, @y + 7, 35, 1.0, 1.0, 0xff_ffffff)\n @font.draw(\"Wins: #{@game_state_model::players[0]::score}\", 50, @y + 22, 35, 1.0, 1.0, 0xff_ffffff)\n @font.draw(\"#{@game_state_model::players[1]::name}\", 50, @y + 47, 35, 1.0, 1.0, 0xff_ffffff)\n @font.draw(\"Wins: #{@game_state_model::players[1]::score}\", 50, @y + 62, 35, 1.0, 1.0, 0xff_ffffff)\n end",
"title": ""
},
{
"docid": "7b37272b630718478ad283661a9ed992",
"score": "0.6580671",
"text": "def draw(viewport)\n viewport.map! { |p| p / @tile_size }\n x0, x1, y0, y1 = viewport.map(&:to_i)\n\n # restrict to prevent re-rendering\n x0 = 0 if x0.negative?\n x1 = @width - 1 if x1 >= @width\n y0 = 0 if y0.negative?\n y1 = @height - 1 if y1 >= @height\n\n (x0..x1).each do |x|\n (y0..y1).each do |y|\n @layers[:tile_layers].each do |_, tiles|\n next unless tiles[y][x]\n\n tiles[y][x].draw(x * @tile_size, y * @tile_size) if tiles[y][x].id != 0\n # tiles[y][x].x = x\n # tiles[y][x].y = y\n end\n end\n end\n end",
"title": ""
},
{
"docid": "d5b527b7b7030d567111da19435eb161",
"score": "0.64771837",
"text": "def draw\n\t\tif @is_blown\n\t\t\tis_facing_left = face_left?\n\n\t\t\tangle = draw_angle(is_facing_left)\n\t\t\tidx = is_facing_left ? 0 : 1\n\n\t\t\timg = @@tiles[idx]\n\t\t\timg.draw_rot(@x + PARTY_HORN_TILE_WIDTH/2.0, \n\t\t\t\t\t\t @y + PARTY_HORN_TILE_HEIGHT/2.0, \n\t\t\t\t\t\t PARTY_HORN_Z + @player.z, \n\t\t\t\t\t\t angle)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "10b177ef6bbbc91581229f74501f3ba2",
"score": "0.64685315",
"text": "def draw()\n\t\t# convert integer array to X and O\n\t\tplayer_moves = @gameplay_positions.map do |n|\n\t\t\tcase n\n\t\t\twhen 1\n\t\t\t \"X\"\n\t\t\twhen 2\n\t\t\t \"O\"\n\t\t\telse\n\t\t\t \" \"\n\t\t\tend\n\t\tend\n\n\t\tprintMap(player_moves)\n\t\t\n\tend",
"title": ""
},
{
"docid": "08985653644249992a37553167be38c0",
"score": "0.63736427",
"text": "def draw_player_pieces args\n #$gtk.log \"INFO: RENDERING GAME PIECES...\"\n args.state.player.pieces.each do |p|\n if p[:onboard]\n args.outputs.primitives << {\n x: args.state.board.x + args.state.tiles[p[:tile]][:x],\n y: args.state.board.y + args.state.tiles[p[:tile]][:y],\n w: 100,\n h: 100,\n path: \"sprites/circle-indigo.png\"\n }.sprite\n \n args.outputs.primitives << {\n x: args.state.board.x + args.state.tiles[p[:tile]][:x] + 35,\n y: args.state.board.y + args.state.tiles[p[:tile]][:y] + 75,\n text: p[:order],\n size_enum: 16,\n alignment_enum: 0,\n r: 0,\n g: 0,\n b: 0,\n a: 255\n }.label\n end\n end\nend",
"title": ""
},
{
"docid": "2ffd77f9502b79b276d3c2dc660d2ecd",
"score": "0.6338987",
"text": "def update_tile_graphic\r\n map_data = Yuki::MapLinker.map_datas\r\n if !map_data || map_data.empty?\r\n self.bitmap = RPG::Cache.tileset($game_map.tileset_name)\r\n tile_id = @tile_id - 384\r\n tlsy = tile_id / 8 * 32\r\n max_size = 4096 # Graphics::MAX_TEXTURE_SIZE\r\n src_rect.set((tile_id % 8 + tlsy / max_size * 8) * 32, tlsy % max_size, 32, @height = 32)\r\n else\r\n x = @character.x\r\n y = @character.y\r\n # @type [Yuki::Tilemap::MapData]\r\n event_map = map_data.find { |map| map.x_range.include?(x) && map.y_range.include?(y) } || map_data.first\r\n event_map.assign_tile_to_sprite(self, @tile_id)\r\n @height = 32\r\n end\r\n self.zoom = TILE_ZOOM # _x=self.zoom_y=(16*$zoom_factor)/32.0\r\n self.ox = 16\r\n self.oy = 32\r\n @ch = 32\r\n end",
"title": ""
},
{
"docid": "a50f9fa27ebe26a8db5cc069e6eeeebc",
"score": "0.6322068",
"text": "def draw\n @player.draw\n Graphics.render_tail\n Graphics.draw_tiles(@font)\n Graphics.display_centered_title(@message.join(\"\"), @small_font)\n Graphics.display_lives(@small_font)\n Graphics.show_emoticon(Settings.mailbox, @font) if @message.join(\"\") == @completed \n if Position.collide?(@active_tile, @player)\n Graphics.erase_emoticon\n Graphics.show_emoticon(Settings.failbox, @font) \n end\n end",
"title": ""
},
{
"docid": "ee737c49f4a671e576080e4cc0f05e48",
"score": "0.63178396",
"text": "def render\n\n # Sets a black background on the screen (Comment this line out and the background will become white.)\n # Also note that black is the default color for when no color is assigned.\n outputs.solids << grid.rect\n\n # The position, size, and color (white) are set for borders given to the world collection.\n # Try changing the color by assigning different numbers (between 0 and 255) to the last three parameters.\n outputs.borders << state.world.map do |x, y|\n [x * state.tile_size,\n y * state.tile_size,\n state.tile_size,\n state.tile_size, 255, 255, 255]\n end\n\n # The top, bottom, and sides of the borders for collision_rects are different colors.\n outputs.borders << state.world_collision_rects.map do |e|\n [\n [e[:top], 0, 170, 0], # top is a shade of green\n [e[:bottom], 0, 100, 170], # bottom is a shade of greenish-blue\n [e[:left_right], 170, 0, 0], # left and right are a shade of red\n ]\n end\n\n # Sets the position, size, and color (a shade of green) of the borders of only the player's\n # box and outputs it. If you change the 180 to 0, the player's box will be black and you\n # won't be able to see it (because it will match the black background).\n outputs.borders << [state.x,\n state.y,\n state.tile_size,\n state.tile_size, 0, 180, 0]\n end",
"title": ""
},
{
"docid": "40d9a35aaa327d7f3c006f552629a078",
"score": "0.62496424",
"text": "def render_board\n\n\t\t# So, we'll rebuild the render target from scratch\n\t\t(0...@height).each do |row|\n\t\t\t(0...@width).each do |col|\n\n\t\t\t\t# Save myself some typing, and some math cycles...\n\t\t\t\tcell_idx = (row*@width)+col\n\n\t\t\t\t# Check to see if this cell is covered\n\t\t\t\tif @cell_status[cell_idx] == :status_covered\n\t\t\t\t\tcell = @cover_png\n\t\t\t\telsif @cell_status[cell_idx] == :status_gold\n\t\t\t\t\tcell = @gold_png\n\t\t\t\telse\n\t\t\t\t\tif @dragons[cell_idx] == DRAGON\n\t\t\t\t\t\tcell = @dragon_png\n\t\t\t\t\telse\n\t\t\t\t\t\tcell = @cell_png[@dragons[cell_idx]]\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# We know what to draw, so draw it\n\t\t\t\t$gtk.args.render_target( :board ).width = @board_w\n\t\t\t\t$gtk.args.render_target( :board ).height = @board_h\n\t\t\t\t$gtk.args.render_target( :board ).sprites << {\n\t\t\t\t\tx: (col*@cell_size), y: (row*@cell_size),\n\t\t\t\t\tw: @cell_size, h: @cell_size, path: cell,\n\t\t\t\t}\n\n\t\t\tend\n\n\t\tend\n\n\tend",
"title": ""
},
{
"docid": "e9a180115470d9db5fc35ef791fa8882",
"score": "0.62394524",
"text": "def display_tile_image\n generate_tile unless @i.nil?\n display_image = @i.scale(8.0)\n display_image.display\n end",
"title": ""
},
{
"docid": "79b91432226da8b25ea2ba7fa2717e12",
"score": "0.62217325",
"text": "def draw\n\tsuper\n\t\n\tif Game.scene.selected_tower\n\t position = grids_to_pixels(Game.scene.selected_tower.position)\n\t \n\t @surface.drawFilledCircle(position[0], position[1], Game.scene.selected_tower.range * Config.part_size[0], Screen.handle.format.mapRGB(0xbb, 0xbb, 0xbb))\n\tend\n\t\n\tposition = Config.monsters_start_at\n\tposition[0] += 1\n\tposition = grids_to_pixels(position)\n\tposition[0] -= 20\n\tposition[1] -= 20\n\tImage.draw(\"images/arrow.png\", @surface, *position)\n\t\n\tposition = Config.monsters_end_at\n\tposition[0] -= 1\n\tposition = grids_to_pixels(position)\n\tposition[0] -= 20\n\tposition[1] -= 20\n\tImage.draw(\"images/arrow.png\", @surface, *position)\n\t\n\tConfig.map_size[1].times do |y|\n Config.map_size[0].times do |x|\n @surface.draw_rect(Config.part_size[0]*x,Config.part_size[1]*y,Config.part_size[0],Config.part_size[1],Screen.handle.format.mapRGB(0x88, 0x88, 0x88))\n end\n end\n\t\n\tGame.scene.get_drawable_objects.each do |i|\n\t position = grids_to_pixels(i.position)\n\t if i.class <= Model::Monster # Drawing HP lines\n\t color = Screen.handle.format.mapRGB(0xaa, 0xaa, 0xaa)\n\t if i.poisoned\n\t color = Screen.handle.format.mapRGB(0xff, 0x00, 0xff)\n\t end\n\t @surface.draw_line(position[0]-12, position[1]-18, position[0]+12, position[1]-18, color)\n\t @surface.draw_line(position[0]-12, position[1]-17, position[0]+12, position[1]-17, color)\n\t \n\t line_len = i.hp * 24 / i.max_hp\n\t \n\t color = Screen.handle.format.mapRGB(0x00, 0xff, 0x00)\n\t if i.frozen\n\t color = Screen.handle.format.mapRGB(0x00, 0xff, 0xff)\n\t end\n\t @surface.draw_line(position[0]-12, position[1]-18, position[0]-12+line_len, position[1]-18, color)\n\t @surface.draw_line(position[0]-12, position[1]-17, position[0]-12+line_len, position[1]-17, color)\n\t end\n\t position[0] -= i.image_size[0]/2\n\t position[1] -= i.image_size[1]/2\n\t \n\t Image.draw(i.image, @surface, *position)\n\tend\n end",
"title": ""
},
{
"docid": "1b32c2f2ec296a97af67305227338b6b",
"score": "0.6220156",
"text": "def worlddisplay\r\n\t\t\t$game.world.map.display\r\n\t\tend",
"title": ""
},
{
"docid": "31787660882a8f1a61bd9da8da559a09",
"score": "0.6217252",
"text": "def draw_grid\n case view\n when :south_east\n size_y.times do |y|\n size_x.times do |x|\n draw_tile(x, y, x, y)\n end\n end\n when :south_west\n size_x.times do |y|\n size_y.times do |x|\n draw_tile(x, y, size_x - 1 - y, x)\n end\n end\n when :north_west\n size_y.times do |y|\n size_x.times do |x|\n draw_tile(x, y, size_x - 1 - x, size_y - 1- y)\n end\n end\n when :north_east\n size_x.times do |y|\n size_y.times do |x|\n draw_tile(x, y, y, size_y - 1 - x)\n end\n end\n else\n throw Exception.new(\"view was out of bounds!\")\n end\n\n end",
"title": ""
},
{
"docid": "59a717e6653049dc762dce8e9b127555",
"score": "0.6210045",
"text": "def draw \n 0.upto(3) do |i| \n if @playing[i]\n if @winner == i\n @labels[i].draw_rel(\" Winner\", 540, 80+i*40, 1, 0.5, 0.5, 1, 1, 0xff0000ff, :default) \n else\n @labels[i].draw_rel(@score[i].to_s()+\" 000 $\", 540, 80+i*40, 1, 0.5, 0.5, 1, 1, 0xffffffff, :default)\n end\n else\n @labels[i].draw_rel(\" out\", 540, 80+i*40, 1, 0.5, 0.5, 1, 1, 0xdddddddd, :default)\n end\n \n @@players_icons[i].draw(450, 70+i*40, 1, 1, 1)\n end \n end",
"title": ""
},
{
"docid": "293c08b5668eb8f4b3eb49775332b2cc",
"score": "0.6193497",
"text": "def draw\r\n (0..@w).each do |x|\r\n (0..@h).each do |y|\r\n @map[x][y].draw\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "2455b29d81e4d05e70f564bb6f8d1b14",
"score": "0.61710775",
"text": "def update_graphics\r\n @tile_id = @character.tile_id\r\n @character_name = @character.character_name\r\n self.visible = !@character_name.empty? || @tile_id > 0\r\n if @tile_id >= 384\r\n update_tile_graphic\r\n else\r\n self.bitmap = RPG::Cache.character(@character_name, 0)\r\n @cw = bitmap.width / 4\r\n @height = @ch = bitmap.height / 4\r\n self.ox = @cw / 2\r\n self.oy = @ch\r\n self.zoom = 1 if zoom_x != 1\r\n src_rect.set(@character.pattern * @cw, (@character.direction - 2) / 2 * @ch, @cw, @ch)\r\n @pattern = @character.pattern\r\n @direction = @character.direction\r\n end\r\n end",
"title": ""
},
{
"docid": "da3070449a9bfe798dda3ab8b09c108a",
"score": "0.6156626",
"text": "def display_board\n @board.map.with_index do |playermove, index|\n if index == 0 && playermove.nil?\n print(\"#{index} |\") \n elsif index == 2 && playermove.nil?\n print(\"| #{index}\")\n elsif index == 3 && playermove.nil?\n print(\"#{index} |\") \n elsif index == 5 && playermove.nil?\n print(\"| #{index}\")\n elsif index == 6 && playermove.nil?\n print(\"#{index} |\")\n elsif index == 8 && playermove.nil?\n print(\"| #{index}\")\n elsif playermove.nil?\n print(\" #{index} \")\n else\n print(\" #{playermove} \")\n end\n if (index + 1) % 3 == 0 && index < 7\n print \"\\n---------\\n\"\n end\n end\n end",
"title": ""
},
{
"docid": "479d018e9ac2a2eb6b111ad74f58a760",
"score": "0.6155744",
"text": "def render\n #puts \"current state of the grid:\"\n grid.each do |row|\n row.map do |tile|\n print tile\n end\n puts\n end\n end",
"title": ""
},
{
"docid": "cab1ed00c0551b7f64553a5d5a4acb53",
"score": "0.614903",
"text": "def draw\n\t\t@party_horn.draw\n\t\tangle = draw_angle(face_left?)\n\t\tprawn_img = @@tiles[@tile_idx]\n\t\tprawn_img.draw_rot(@x+TILE_WIDTH/2, \n\t\t\t\t\t\t @y+TILE_HEIGHT/2, \n\t\t\t\t\t\t PRAWN_Z + @player.z, \n\t\t\t\t\t\t angle)\n\n\t\tprawn_skin = @@skins[@tile_idx] \n\t\tprawn_skin.draw_rot(@x + TILE_WIDTH/2, \n\t\t\t\t\t\t @y + TILE_HEIGHT/2, \n\t\t\t\t\t\t PRAWN_Z + @player.z, \n\t\t\t\t\t\t angle, \n\t\t\t\t\t\t 0.5, # Default center_x \n\t\t\t\t\t\t 0.5, # Default center_y\n\t\t\t\t\t\t 1, # Default scale_x\n\t\t\t\t\t\t 1, # Default scale_y\n\t\t\t\t\t\t @player.colour)\n\tend",
"title": ""
},
{
"docid": "e4de7ba137114e33ee28ee31197100ec",
"score": "0.61265266",
"text": "def draw\n #Updates the map if necessary.\n update\n #If the level is completed, draws a black screen with text on it. Also returns to prevent uncessary updates.\n if @victory and !@win\n @victoryScreen.draw(0, 0, 0)\n return\n #Same but for if the player wins the game.\n elsif @victory and @win\n @winScreen.draw(0, 0, 0)\n return\n end\n #Draws background image. Note that it is drawn using the modulus operator. This is to ensure that the background \"scrolls\"\n #through the screen, and does not only go through once. Further, the position is negative, and is offset by 600. This is to\n #make the background move backwards while the player appears to move forwards. The division by 4 creates parallax\n #scrolling, as the background moves at a slower pace than the camera does.\n @background_image.draw(-((camera.camX + 400) / 4 % 1600) + 600, 0, 0)\n #Draws each DYNAMIC object in the map.\n @DobjectArray.each do |object|\n object.draw\n end\n #Draws each PROJECTILE object in the map.\n @PobjectArray.each do |object|\n object.draw\n end\n #Draws each Static object in the map.\n @SobjectArray.each do |object|\n object.draw\n end\n #Draws each EFFECT object in the map.\n @EobjectArray.each do |object|\n object.draw\n end\n #Draws healthbar last.\n @healthBar.draw\n #If the game is fading in/out, a mask draws on the screen to emulate washing in/out.\n if @fadingIn\n @mask.draw(0, 0, 0, 1, 1, getAlphaIn)\n elsif @fadingOut\n @mask.draw(0, 0, 0, 1, 1, getAlphaOut)\n end\n end",
"title": ""
},
{
"docid": "995c8000908791849510ed30af80da78",
"score": "0.61192024",
"text": "def endgame_render\n self.grid.flatten.each {|space| space.visible = true }\n render\n end",
"title": ""
},
{
"docid": "a0f04abd166a874ebfd9db3d403d9b0c",
"score": "0.611841",
"text": "def visible_tiles\n frame_x = (((@width - Config::TileWidth) / Config::TileWidth) ).to_i\n frame_y = (((@height - Config::TileHeight) / Config::TileHeight) ).to_i\n \n \n start_x = player.location.x - (frame_x / 2).to_i\n start_y = player.location.y - (frame_y / 2).to_i\n \n if start_x < 0\n start_x = 0\n end\n if start_y < 0\n start_y = 0\n end\n \n tiles = Array.new\n \n frame_x.times do |i|\n frame_y.times do |j|\n if (start_x + i < game.map.width ) && (start_y + j < game.map.height )\n # puts(\"start_x is #{start_x} and start_y is #{start_y} and i is #{i} and j is #{j}\")\n tiles << game.map.locations[start_x + i, start_y + j]\n end\n end\n end\n \n tiles\n \n end",
"title": ""
},
{
"docid": "b1c2d4eadbd4f9cbf36d4abe0e59f98e",
"score": "0.6115435",
"text": "def view_turn\n Display.draw_board(@cur_board, @player_white, @player_black)\n Display.move_info(@turn, @player_to_move, FileReader.get_move(\"#{@turn}#{@player_to_move}\", @data))\n end",
"title": ""
},
{
"docid": "2303ae04c0cc16ae2701ef6b74495f94",
"score": "0.61085683",
"text": "def draw_game_replay_presenter(window, state)\n state[:player_record][state[:level]][0].each do |grid_row|\n grid_row.each do |cell|\n draw_cell(window, cell, cell == state[:player], grid_row.length)\n end\n end\n\n instructions = 'Press Space to navigate back. Use ← → keys to go back and forth levels.'\n instructions_font = Gosu::Font.new(18, options={italic: true})\n instructions_width = instructions_font.text_width(instructions)\n instructions_font.draw_text(instructions, (window.width - instructions_width) / 2, 10, 1, 1, 1, Gosu::Color.argb(LIGHT_GREEN_COLOR))\n end",
"title": ""
},
{
"docid": "7d88354134849751460c00e398a42cff",
"score": "0.6105845",
"text": "def render\n puts \" #{(0..8).to_a.join(\" \")}\"\n grid.each_with_index do |row, i|\n arr = []\n row.each do |tile|\n if tile.revealed == true\n arr << tile.display_value\n elsif tile.flagged == true\n arr << \"F\"\n else\n arr << \"*\"\n end\n end\n\n puts \"#{i} #{arr.join(\" \")}\"\n end\n end",
"title": ""
},
{
"docid": "760483e5c87b00a5b27b21345793de36",
"score": "0.60913366",
"text": "def show_user_board\n puts @player_board.render(true)\n end",
"title": ""
},
{
"docid": "7e3770386774152ccae19f93e1bcb948",
"score": "0.60754484",
"text": "def render\n canvas = Vips::Image.grey(@width, @height)\n\n @tiles.each do |tile|\n canvas = canvas.insert(tile.image, tile.offset.x, tile.offset.y) # rubocop:disable Style/RedundantSelfAssignment\n end\n\n # add attribution image to bottom corner if available & attribution fits into image\n if add_attribution?\n options = { x: canvas.width - attribution.width, y: canvas.height - attribution.height }\n canvas = canvas.composite2(attribution, :over, **options)\n end\n\n canvas\n end",
"title": ""
},
{
"docid": "aabf89e4de41ac16a1fe03e254d96272",
"score": "0.6072245",
"text": "def show\n @started = true\n @viewport.color = Color.white\n @sprites[\"trainer\"].color.alpha = 0\n for key in @sprites.keys\n @sprites[key].visible = true\n end\n end",
"title": ""
},
{
"docid": "91c110347ef3f1c7c72b15209e57d8a3",
"score": "0.6070791",
"text": "def render(neighbors)\n @sprites[neighbors]\n end",
"title": ""
},
{
"docid": "aaceb43057ff779f319a4ca72adc24b2",
"score": "0.6066687",
"text": "def board_visualization\n @players.each do |racer|\n in_front = @length - @position[racer]\n # track = \"|\" * 30\n # p track.insert(@position[racer, racer.to_s)\n p \" |\" * @position[racer] + racer.to_s + \"|\" + \" |\" * in_front\n end\n end",
"title": ""
},
{
"docid": "df09b71a8a5db80a9d95bd191b739845",
"score": "0.6046127",
"text": "def draw_tile(x_pos, y_pos, x, y)\n return unless is_tile_at?(x, y)\n position = get_tile_position(x_pos, y_pos)\n type = get_tile_type(x, y)\n\n tile_image = assets.get_asset(type)\n\n tile_image.draw_layer(:content,\n position.x,\n position.y,\n is_tile_flipped_h?(x, y),\n is_tile_flipped_v?(x, y),\n ((debug ? get_debug_tile_color(x, y) : get_tile_color(x, y))),\n view,\n :all,\n debug)\n\n\n tile_image.draw_layer(:content,\n position.x,\n position.y,\n is_tile_flipped_h?(x, y),\n is_tile_flipped_v?(x, y),\n ((debug ? get_debug_tile_color(x, y) : get_tile_color(x, y))),\n view,\n get_tile_rotation(x, y),\n debug)\n\n end",
"title": ""
},
{
"docid": "134d11c55ff19261377ec1016f14f645",
"score": "0.60423017",
"text": "def draw\n @updated_blocks.each do |block|\n block.draw(self, [@x_viewport, @y_viewport].to_vec2d)\n end\n @player.draw(self, [@x_viewport, @y_viewport].to_vec2d)\n @font.draw(\"Score: #{@player.score}\", 10, 10, ZOrder::UI,\n 1.0, 1.0, Gosu::Color::WHITE)\n end",
"title": ""
},
{
"docid": "75ab8e952ebd629eaf72fccbececdaa9",
"score": "0.6027961",
"text": "def tile\n tile_at(@position)\n end",
"title": ""
},
{
"docid": "972c0363abe6a81d1fcb3a25026fecdb",
"score": "0.60180753",
"text": "def draw\n @map.draw\n end",
"title": ""
},
{
"docid": "50ed3b0b9f1a7f7fcdd9823cd07e7468",
"score": "0.6010624",
"text": "def draw\n @game.state.views.each do |view|\n view.draw\n end\n end",
"title": ""
},
{
"docid": "b86be706e471a5f01c91334e9ab66b60",
"score": "0.6009809",
"text": "def render\n (\"A\"..\"H\").each { |col| print \" #{col}\"}\n print \"\\n\\n\"\n\n (0...8).each do |row|\n # Start counting downwards - rows are upside down in ChessBoard\n row_idx = (7 - row) % @board.rows.count + 1\n print \"#{row_idx} \"\n\n (0...8).each do |col|\n pos = [row, col]\n render_piece(pos)\n end\n\n print \"\\n\\n\"\n end\n\n debug_info if @debug\n print_controls\n end",
"title": ""
},
{
"docid": "3da3d5713be747026f16f3098a9f510f",
"score": "0.59909827",
"text": "def render\n @board.rows.each_with_index do |row, i|\n row.each_with_index do |tile, j|\n if i == 0 || i == 7\n if j == 0 || j == 7\n print \" R \"\n elsif j == 1 || j == 6\n print \" Kn\"\n elsif j == 2 || j == 5\n print \" B \"\n else\n print \" T \"\n end\n elsif i == 1 || i == 6\n print \" p \"\n else\n print \" X \".colorize(:blue)\n end\n end\n puts\n end\n return nil\n end",
"title": ""
},
{
"docid": "cf8585453b2d0125ab136c4adc132beb",
"score": "0.59900737",
"text": "def render\n\t\tputs `clear` #this clears the terminal to keep the playing space clean\n\t\tfor i in 0...@@board.length\n\t\t\tmapping_array = @@board[i].map { |e| renderHelper(e) }\n\t\t\tputs mapping_array.join('|')\n\t\tend\n\tend",
"title": ""
},
{
"docid": "85b096c490aae16e82ee20d8132f91ed",
"score": "0.59794426",
"text": "def draw\n return if map.nil?\n\n # Draw overall score\n scores = Gameplay::Scoring.scores_for_map(map)\n @previous_valid_total_score = scores.values.min if scores.values.all?\n\n IO::FontManager.font(30).draw_text('SCORE', 50, 18, 1, 1.0, 1.0,\n Gosu::Color::BLACK)\n IO::FontManager.font(70).draw_text(@previous_valid_total_score,\n 50, 50, 1, 1.0, 1.0,\n scores.values.all? ? Gosu::Color::BLACK : Gosu::Color::GRAY)\n\n # Draw individual station scores\n scores.each.with_index do |(station, score), i|\n Gosu.draw_rect(i * 50 + 170, 70, 40, 40,\n Entities::StationObject::BACKGROUND_COLORS[station], 10)\n\n @previous_valid_scores[station] = score unless score.nil?\n\n IO::FontManager.font(25).draw_text_rel(@previous_valid_scores[station],\n i * 50 + 190, 90, 10, 0.5, 0.5,\n 1, 1, !score.nil? \\\n ? Entities::StationObject::TEXT_COLORS[station]\n : Entities::StationObject::INACTIVE_TEXT_COLORS[station])\n end\n\n # Draw a medal for the overall score\n medal = map.metadata.medal_for(@previous_valid_total_score) || 'none'\n medal_img = IO::ImageManager.image(\"medal_#{medal}\".to_sym)\n\n medal_img.draw(170, 10, 10)\n\n # Draw the next level button, if necessary\n if medal != 'none'\n @next_level_button.draw_element(10)\n @next_level_button.enabled = true\n IO::FontManager.font(25).draw_text(\"Next\\nLevel\",\n @next_level_button.point.x + 10, 25, 10, 1, 1, 0xFF000000)\n else\n @next_level_button.enabled = false\n end\n end",
"title": ""
},
{
"docid": "8d799ffce43710d0d65ebd0cdca7c17b",
"score": "0.5948924",
"text": "def draw_tile\n\t@tile_bag.delete_at(rand (@tile_bag.length))\n\n end",
"title": ""
},
{
"docid": "e122c0bdd93bc4d6ac08e6a45db9d261",
"score": "0.5937343",
"text": "def draw_map\n draw_map_cells($map.x, $map.y)\n end",
"title": ""
},
{
"docid": "d43d1ec2ca7fddaab44b5d8cb2c5e2cb",
"score": "0.5915963",
"text": "def draw\n # draw background first\n 0.upto(LEVEL_WIDTH - 1) do |x|\n (LEVEL_HEIGHT - 1).downto(0) do |y|\n if @tiles[x + @x_offset + LEVEL_WIDTH * (y + @y_offset)] == :background\n # choose background terrain\n image = @terrain[1]\n # actual top left coordinates\n px = x * 32 * SCALE\n py = y * 25 * SCALE - 25 * SCALE\n # draw to the screen scaled to size\n image.draw(px, py, 0, SCALE, SCALE)\n elsif @tiles[x + @x_offset + LEVEL_WIDTH * (y + @y_offset)] == :background2\n # choose background terrain\n image = @terrain[3]\n # actual top left coordinates\n px = x * 32 * SCALE\n py = y * 25 * SCALE - 25 * SCALE\n # draw to the screen scaled to size\n image.draw(px, py, 0, SCALE, SCALE)\n elsif @tiles[x + @x_offset + LEVEL_WIDTH * (y + @y_offset)] == :none\n image = @terrain[2]\n # actual top left coordinates\n px = x * 32 * SCALE\n py = y * 25 * SCALE - 25 * SCALE\n # draw to the screen scaled to size\n image.draw(px, py, 0, SCALE, SCALE)\n end\n end\n end\n\n # draw platforms on top of the background\n 0.upto(LEVEL_WIDTH - 1) do |x|\n (LEVEL_HEIGHT - 1).downto(0) do |y|\n if @tiles[x + @x_offset + LEVEL_WIDTH * (y + @y_offset)] == :platform\n # choose platform terrain\n image = @terrain[0]\n # actual top left coordinates\n px = x * 32 * SCALE\n py = y * 25 * SCALE - 25 * SCALE\n # draw to the screen scaled to size\n image.draw(px, py, 0, SCALE, SCALE)\n end\n end\n end\n\n for enemy in @enemies do\n enemy.draw SCALE, @x_offset * 32 * SCALE, @y_offset * 25 * SCALE\n end\n\n for candy in @candies do\n candy.draw SCALE, @x_offset * 32 * SCALE, @y_offset * 25 * SCALE\n end\n\n Gosu::Image.from_text(self, @current_selection.to_s, \"Times New Roman\", 24).draw(5, 5, 0, 1, 1, 0xffffffff)\n\n @player_image[0].draw(@player[0] * SCALE - @x_offset * 32 * SCALE, @player[1] * SCALE - @y_offset * 25 * SCALE, 1, SCALE, SCALE) unless @player.nil?\n @door_image[0].draw(@door[0] * SCALE - @x_offset * 32 * SCALE, @door[1] * SCALE - @y_offset * 25 * SCALE, 1, SCALE, SCALE) unless @door.nil?\n\n @target[0].draw(mouse_x, mouse_y, 2, SCALE, SCALE) if @current_type == :candies\n end",
"title": ""
},
{
"docid": "57ddca084b4d0c147fe7d6047afc06f2",
"score": "0.59146523",
"text": "def show\n #show the game grid\n #determine the current player symbol given the fact that first player will always get (X) symbol\n @current_player_symbol = @game.current_round.current_player == @game.first_player ? \"X\" : \"O\"\n end",
"title": ""
},
{
"docid": "86bade1fc39f6af08f035c871d1c71bd",
"score": "0.59047115",
"text": "def render_player\n state.player_sprite = [state.player.x,\n state.player.y,\n 4 * 3,\n 8 * 3, \"sprites/player-#{animation_index(state.player.created_at_elapsed)}.png\"] # string interpolation\n outputs.sprites << state.player_sprite\n\n # Outputs a small red square that previews the angles that the player can attack in.\n # It can be moved in a perfect circle around the player to show possible movements.\n # Change the 60 in the parenthesis and see what happens to the movement of the red square.\n outputs.solids << [state.player.x + state.player.attack_angle.vector_x(60),\n state.player.y + state.player.attack_angle.vector_y(60),\n 3, 3, 255, 0, 0]\n end",
"title": ""
},
{
"docid": "14668c89a722c9d47c61eca882fdbe0b",
"score": "0.5901809",
"text": "def show_image\n temp_floor_tile = Image.new('tiles\\tile_floor_1.png')\n hex_width = temp_floor_tile.width - 6\n hex_height = temp_floor_tile.width - 4\n temp_floor_tile.remove\n @hexArray.each_with_index do | line, x |\n bottom_y = hex_height * 11\n y_start = bottom_y - (11 - line.size) * (hex_height / 2)\n line.each_with_index do | hex, y |\n cur_x = x * hex_width\n cur_y = y_start - y * hex_height\n\n case hex.type\n when Hex::FLOOR_TYPE\n Image.new('tiles\\tile_floor_1.png', x:cur_x, y:cur_y)\n when Hex::LAVA_TYPE\n Image.new('tiles\\tile_liquid_1.png', x:cur_x, y:cur_y)\n when Hex::EXIT_TYPE\n Image.new('tiles\\tile_base.png', x:cur_x, y:cur_y)\n Image.new('tiles\\dung_ladderdown.png', x:cur_x, y:cur_y)\n else\n Image.new('tiles\\tile_base.png', x:cur_x, y:cur_y)\n end\n if hex.contained_object != nil && hex.contained_object.type == MovingObject::PLAYER_TYPE\n Image.new('tiles\\player.png', x:cur_x, y:cur_y)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "a18c27b4792c8fb2cdc8e680b8071952",
"score": "0.5895928",
"text": "def player_render_and_report(player_select_coordinate)\n if @computer_board.cells[player_select_coordinate].render == \"X\"\n puts \"You shot at #{selected_coord} GET SUNK.\"\n elsif @computer_board.cells[player_select_coordinate].render == \"H\"\n puts \"I shot at #{selected_coord} and it's a hit. I'm gonna win.\"\n elsif @computer_board.cells[player_select_coordinate].render == \"M\"\n puts \"You missed but I'm not throwing away my SHOT.\"\n end\n end",
"title": ""
},
{
"docid": "f9ae88938927de3075b30a8a9837dde0",
"score": "0.5894967",
"text": "def draw_cell(window, cell, is_player, grid_length)\n cell_width = window.width / grid_length\n cell_draw_x = cell.grid_x * cell_width\n cell_draw_y = cell.grid_y * cell_width\n\n\n window.draw_rect(cell_draw_x, cell_draw_y, cell_width, cell_width, Gosu::Color.argb(DARK_GRAY_COLOR)) if cell.show_base_background\n\n if cell.grid_y == grid_length - 1 && cell.grid_x == grid_length - 1\n window.draw_rect(cell_draw_x + PLATFORM_MARGIN,\n cell_draw_y + PLATFORM_MARGIN,\n cell_width - + PLATFORM_MARGIN * 2,\n cell_width - PLATFORM_MARGIN * 2,\n Gosu::Color.argb(LIGHT_GREEN_COLOR))\n end\n\n if is_player\n window.draw_rect(cell_draw_x + PLAYER_MARGIN,\n cell_draw_y + PLAYER_MARGIN,\n cell_width - PLAYER_MARGIN * 2,\n cell_width - PLAYER_MARGIN * 2,\n Gosu::Color.argb(PLAYER_COLOR))\n end\n\n draw_cell_walls(window, cell, cell_width, MAZE_WALL_THICKNESS, Gosu::Color.argb(LIGHT_GRAY_COLOR))\n\nend",
"title": ""
},
{
"docid": "c236923e0255e48b37180eb2c9f4c9e4",
"score": "0.5886538",
"text": "def render\n @board_array.each_with_index do |row, row_index|\n row.each_with_index do |cell, col_index|\n if @position_hash[[row_index, col_index]].hidden\n print '______'\n else\n print cell.to_s\n end\n end\n print \"\\n\"\n end\n end",
"title": ""
},
{
"docid": "98a5550460186807e3567d2da5762876",
"score": "0.5878952",
"text": "def draw\r\n @image_player.bmp.draw(@x, @y, ZOrder::TOP)\r\n end",
"title": ""
},
{
"docid": "5b47bea16902ca1e81887c6bcf22686e",
"score": "0.5855984",
"text": "def display_maze_with_png(grid)\n \nend",
"title": ""
},
{
"docid": "f11a213d19ab4b9728fda12f55a78014",
"score": "0.5852154",
"text": "def create_region_display_tilemap\n # Create Region Tileset\n Cache.create_region_tileset_bitmap \n # Create Region Tilemap\n @region_tilemap = Tilemap.new(@viewport1)\n @region_tilemap.map_data = $game_map.data.dup\n @region_tilemap.flags = Table.new(8192)\n # Make Region Tilemap Invisible\n @region_tilemap.visible = false\n # Set Region Tilemap Flags (Over Character [?])\n 64.upto(128) {|n| @region_tilemap.flags[n] = 0x10} \n # Go Through Game Map Tiles\n $game_map.data.xsize.times {|x|\n $game_map.data.ysize.times {|y|\n # Clear Region Tilemap Info\n 4.times {|z| @region_tilemap.map_data[x, y, z] = 0}\n # Get Region ID\n region_id = $game_map.region_id(x, y)\n # Get Passability Flags\n flag1 = $game_map.tileset.flags[$game_map.data[x, y, 2]] \n # If Region ID is 0 or more\n if region_id > 0\n next @region_tilemap.map_data[x, y, 2] = 64 + region_id if flag1 > 16 and flag1 & 0x10 != 0\n @region_tilemap.map_data[x, y, 2] = region_id \n else \n next @region_tilemap.map_data[x, y, 2] = 64 if flag1 > 16 and flag1 & 0x10 != 0\n next @region_tilemap.map_data[x, y, 1] = 64 \n end \n }\n }\n # Set Region Tilemap Bitmap (Tile B)\n @region_tilemap.bitmaps[5] = Cache.region_tileset_bitmap\n # Update Region Tilemap\n update_region_tilemap\n end",
"title": ""
},
{
"docid": "768fa9182f30598380dbb465fc7bfe85",
"score": "0.58325607",
"text": "def display\n \"\\n=============COMPUTER BOARD=============\\n\" +\n \"#{@npc.board.render}\\n\" +\n \"==============PLAYER BOARD==============\\n\" +\n \"#{@user_board.render(true)}\\n\"\n end",
"title": ""
},
{
"docid": "3c92cef8054b4b279247cc224721cd76",
"score": "0.5821897",
"text": "def draw\n @grid.draw\n show_info\n end",
"title": ""
},
{
"docid": "15026ad94c3f06abf1d1dfc3befccca9",
"score": "0.5819774",
"text": "def draw_tiles(num)\n random_tiles = @tiles.sample(num)\n random_tiles.each do |letter|\n @tiles.slice!(@tiles.index(letter))\n end\n return random_tiles\n end",
"title": ""
},
{
"docid": "8a2e7b1bcb9833abf9c34e9df4e06b9c",
"score": "0.5807986",
"text": "def render\n print \" #{(1..9).to_a.join(\" \")}\".light_green.bold\n puts\n puts\n @grid.each.with_index do | row, row_indx |\n print \"#{row_indx + 1} \".light_green.bold\n row.each do | tile |\n if tile.revealed\n print \"#{VALUE_EMOJIS[tile.value]} \"\n elsif tile.flagged\n print \"#{FLAG} \"\n else \n print \"#{HIDDEN} \"\n end\n end\n puts\n puts\n end\n end",
"title": ""
},
{
"docid": "794c4001221602015d660fce7c60de82",
"score": "0.5800675",
"text": "def draw_tiles(tile_bag)\n tile_bag = Scrabble::TileBag.new\n @tiles = tile_bag.draw_tiles(7)\n end",
"title": ""
},
{
"docid": "d506a3c2b55812778563f8252f157337",
"score": "0.5791625",
"text": "def display\n system 'clear'\n print \"\\n\"\n i = 0\n @size.times do |y|\n @size.times do |x|\n print \"#{tile_to_s(i)} \"\n i += 1\n end\n print \"\\n\"\n end\n print \"\\n\"\n end",
"title": ""
},
{
"docid": "43452d3cd3c0a71533cafc4f359d1e29",
"score": "0.5789605",
"text": "def draw_item(index)\n actor_id = $game_party.positions[index]\n return unless actor_id\n actor = $game_actors[actor_id]\n enabled = $game_party.battle_members.include?(actor)\n rect = item_rect(index)\n draw_item_background(index)\n #if actor.back_row?\n # draw_actor_face(actor, rect.x + 20, rect.y + 1, enabled)\n #else\n # draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)\n #end\n draw_actor_face(actor, rect.x + 1, rect.y + 1, enabled)\n draw_actor_simple_status(actor, rect.x + 108, rect.y + line_height / 2)\n end",
"title": ""
},
{
"docid": "8b34badefafc809bae672d8156c5c68f",
"score": "0.57844174",
"text": "def matchTile(ind)\n\t\t@tile_Array[ind].set_match\n\tend",
"title": ""
},
{
"docid": "8e6f9a3e9980bc3f33b832341ffac7aa",
"score": "0.577717",
"text": "def board_visualization\n @players.each do |player|\n before = 0\n after = @length\n puts \" | \"*(before += @position[player]) + \"#{player}\" + \" | \"*(after -= @position[player])\n end\n nil\n end",
"title": ""
},
{
"docid": "ca6e4fd342bdda8d6eb8f3cd8f6b1ff3",
"score": "0.57758075",
"text": "def render\n outputs.solids << [grid.rect, 100, 100, 100]\n render_zombies\n render_killed_zombies\n render_player\n render_flash\n end",
"title": ""
},
{
"docid": "0fbac8918be9681add7c518e97728ea9",
"score": "0.57720244",
"text": "def show_grid=(value)\n old = @show_grid\n @show_grid = value\n if old != @show_grid\n @array.each do |tile|\n if @show_grid\n if !tile.sprites[999]\n tile.sprites[999] = Sprite.new($visuals.viewport, {special: true})\n tile.sprites[999].set_bitmap(GRIDBITMAP)\n tile.sprites[999].x = tile.sprites[0].x\n tile.sprites[999].y = tile.sprites[0].y\n tile.sprites[999].z = 999\n end\n else\n if tile.sprites[999]\n tile.sprites[999].dispose\n tile.sprites.delete(999)\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "cff953fc4a020434889331eba1a0c793",
"score": "0.5771171",
"text": "def display_board\n puts \"\\n---------------\\n\".center(5)\n @board.play_area[0..2].each { |square| print square.to_s.center(5) }\n puts \"\\n\\n\"\n @board.play_area[3..5].each { |square| print square.to_s.center(5) }\n puts \"\\n\\n\"\n @board.play_area[6..8].each { |square| print square.to_s.center(5) }\n puts \"\\n---------------\\n\".center(5)\n end",
"title": ""
},
{
"docid": "02b5ae16ae6cdf8b261ad14f8b41e4fb",
"score": "0.5757348",
"text": "def board_visualization\n\n tracks = player_positions.collect { |player, position| player_on_track(position, player).join(\" |\") }\n puts tracks.join(\"\\n\")\n\n end",
"title": ""
},
{
"docid": "7ebeebe676f13ee4138175965e452081",
"score": "0.57523173",
"text": "def draw\n\t\t# Loop through and draw each player\n\t\t@players.each do |player|\n\t\t\tplayer.draw\n\t\tend\n\n\t\t# Loop through and draw each projectile\n\t\t@projectiles.each do |projectile|\n\t\t\tprojectile.draw\n\t\tend\n\tend",
"title": ""
},
{
"docid": "ec41c9c30cb5da27aa330b5842bb44c0",
"score": "0.5751651",
"text": "def draw_map_position(x, y)\n contents.fill_rect(x, y, 3, 3, Color.new(255, 0, 0))\n end",
"title": ""
},
{
"docid": "edaf92fdddb431d021102b971e8fbada",
"score": "0.5750002",
"text": "def draw_opponent_field_map\n\t\t@opponent_field_map.draw\n\tend",
"title": ""
},
{
"docid": "eff8634d83878a21211b36249b62af4a",
"score": "0.57456815",
"text": "def render()\n # Display text \n puts \"Current Board: \"\n\n # array of blank strings, initialized before adding content\n render_rows = [\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]\n\n # Loop through to build the rows to render\n # Display number of rows corresponding to tower height\n # Display a column for each tower (split into rows for rendering)\n 0.upto(@no_of_discs) do |row|\n 1.upto(3) do |column|\n # Display a blank area for \"nil\" \"tower spots\"\n if @towers[column].tower_size <= row\n # Shovel a blank piece into the render row\n render_rows[row] << tower_piece(0,no_of_discs)\n else\n # Set piece size to the corresponding board value\n piece_size = @towers[column].tower[row].size\n # Shovel the corresponding piece into the render row\n render_rows[row] << tower_piece(piece_size,no_of_discs)\n end\n end\n end\n\n #Render in reverse order (top to bottom) so it appears correctly\n render_rows.reverse_each do |row|\n puts row\n end\n\n #Label line - Display a row with column labels on it under the towers\n puts \"[[[[[[[ 1 ]]]]]]][[[[[[[ 2 ]]]]]]][[[[[[[ 3 ]]]]]]]\"\n end",
"title": ""
},
{
"docid": "73ca7b9ab0cb430fc30b346ec20460e2",
"score": "0.57431",
"text": "def draw\n\t\t@player.draw\n\t\t@background_img.draw(0, 0, 0)\n\t\t@stars.each{|star| star.draw}\n\t\t@font.draw(\"Score:#{@player.score}\", 10, 10, ZOrder::UI, 1.0, 1.0, 0xff_ffff00)\n\tend",
"title": ""
},
{
"docid": "6930046f02d9a254c3889fc1d815b346",
"score": "0.57425666",
"text": "def display(z=0)\r\n\t\t\tdrawmap(self, z)\r\n\t\tend",
"title": ""
},
{
"docid": "60bcbdefcfb9c8e8018c4210a2d23f54",
"score": "0.57422847",
"text": "def draw_tiles(tile_bag)\n if @players_plaque.length < MAX_NUM_OF_TILES_ALLOWED\n add_tiles = MAX_NUM_OF_TILES_ALLOWED - @players_plaque.length\n @players_plaque.concat(tile_bag.draw_tiles(add_tiles))\n end\n end",
"title": ""
},
{
"docid": "20f7b79e78fcd978c655e6062eb408c8",
"score": "0.5741801",
"text": "def draw\n \t #\n\t # Draw the \"top\" line.\n\t #\n\t puts \" \" + \"_\" * (@width * 2 - 1)\n\n\t #\n\t # Draw each of the rows.\n\t #\n\t @height.times do |y|\n\t \tprint \"|\"\n\t\t@width.times do |x|\n\t\t # TODO --> remote \"grid\" references??\n\t\t # render \"bottom\" using \"S\" switch\n\t\t print( (@grid[y][x] & @@S != 0) ? \" \" : \"_\" )\n\n\t\t # render \"side\" using \"E\" switch\n\t\t if @grid[y][x] & @@E != 0\n\t\t print( ( (@grid[y][x] | @grid[y][x+1]) & @@S != 0 ) ? \" \" : \"_\" )\n\t\t else\n\t\t print \"|\"\n\t\t end\n\t\tend\n\t\tputs\n\t end\n\n \t #\n\t # Output maze metadata.\n\t #\n\t puts \"#{$0} #{@width} #{@height} #{@seed}\"\n end",
"title": ""
},
{
"docid": "f34b21e580da6d17bf9bfe01117690b5",
"score": "0.5738085",
"text": "def render\n @board.height.times do |x|\n @board.width.times do |y|\n cell = @board.read_cell(x, y)\n print @piece_renderer.render(cell)\n end\n puts\n end\n end",
"title": ""
},
{
"docid": "1c30909f1e1ef7e6e977ddd41ca3c172",
"score": "0.5737864",
"text": "def draw_board\n clear_screen\n print_logo\n put_column_headers\n @rows.each do |row|\n row_string = \"\"\n slots_filled_in_row = 0\n row.each do |slot|\n if slot\n color_code = slot\n if @players.size == 2\n slot = \"X\" if slot == 1\n slot = \"O\" if slot == 2\n end\n color_code = COLOR_CODES[color_code]\n slot = slot.to_s.colorize(color_code)\n slots_filled_in_row += 1\n else\n slot = '.'\n end\n row_string << (slot + \" \")\n end\n center_puts((' ' * 11 * slots_filled_in_row) + row_string)\n end\n put_column_headers\n end",
"title": ""
},
{
"docid": "898178948533f500a4b0d54a7800dbc6",
"score": "0.57365835",
"text": "def actuMap()\n 0.upto(@map.rows-1) do |x|\n 0.upto(@map.cols-1) do |y|\n\n if (@map.accessAt(x,y).value == 1)\n\n if @map.accessAt(x,y).color != nil\n if (@map.accessAt(x,y).color == @nbHypo + 1)\n @timePress[x][y] = 1\n @map.accessAt(x,y).color = @nbHypo\n end\n changeImage(@buttonTab[x][y],@tabCase[@map.accessAt(x,y).color])\n else\n changeImage(@buttonTab[x][y],\"../images/cases/blanc.png\" )\n @timePress[x][y] = 0\n end\n elsif @map.accessAt(x,y).value == 2\n changeImage(@buttonTab[x][y],\"../images/cases/croix.png\" )\n @timePress[x][y] = 0\n\n else\n ajoutLimitation(x,y)\n\n end\n\n end\n\n end\n end",
"title": ""
},
{
"docid": "3573a0a33e62821d4c616cea9d0c80bc",
"score": "0.5734227",
"text": "def render\n \"\".tap do |output|\n (1..height).each do |y|\n (1..width).each do |x|\n object = objects_at(Locatable::Point.new(x: x, y: y)).first\n\n output << (object.nil? ? \" \" : object.sprite)\n end\n\n output << \"\\n\"\n end\n end\n end",
"title": ""
},
{
"docid": "7562605a0a38c4fbd47b53f9b52f506d",
"score": "0.57340825",
"text": "def render_grid\n\t\t@grid_w.times.with_index do |x|\n\t\t\t@grid_h.times.with_index do |y|\n\t\t\t\tif !@has_enviroment_rendered\n \t \t\trender_wall x, y if @grid[x][y]==1\n\t\t\t\tend\n\t\t \trender_player x, y if @grid[x][y]==2\n \tend\n end\n #each_cell do |x, y, v|\n # render_wall x, y if !@has_environment_rendered && v == 1 \n # render_player x, y if v == 2\n #end\n\t\t@has_enviroment_rendered = true\n\tend",
"title": ""
},
{
"docid": "ba454d419c10fea55f0976ffd4d5f550",
"score": "0.57335114",
"text": "def set_display_pos(x, y)\n @display_x = (x + @map.width * 256) % (@map.width * 256)\n @display_y = (y + @map.height * 256) % (@map.height * 256)\n @parallax_x = x\n @parallax_y = y\n end",
"title": ""
},
{
"docid": "3844af97889bb37c7bf46ba6203ba2a0",
"score": "0.5727388",
"text": "def draw_tiles(num)\n if num <= tiles_remaining\n our_tiles = display_all_tiles.sample(num)\n tile_removal(our_tiles)\n return our_tiles\n else\n print \"Sorry, there are only #{tiles_remaining} left.\"\n our_tiles = display_all_tiles.sample(tiles_remaining)\n tile_removal(our_tiles)\n return our_tiles\n end\n end",
"title": ""
},
{
"docid": "8c4c13ca473a1155e87dd97a9f71f9d4",
"score": "0.5719051",
"text": "def init_tiles\n # Determine how many frames of animation this autotile has\n for i in 0..6\n bm = @autotiles[i]\n if bm.nil?\n @total_frames = 1\n elsif bm.height > 32\n @total_frames[i] = bm.width / 256\n else\n @total_frames[i] = bm.width / 32\n end\n @current_frame[i] = 0\n end\n # Turn on flag that the tilemap sprites have been initialized\n @tilemap_drawn = true\n \n @animating_tiles.clear\n # Create a sprite and viewport to use for each priority level.\n (0...((SCREEN[0]/32+2) * (SCREEN[1]/32+2))*3).each{|i|\n @tile_sprites[i/3] = [] if @tile_sprites[i/3].nil?\n @tile_sprites[i/3][i%3] = Sprite.new(@viewport) unless @tile_sprites[i/3][i%3].is_a?(Sprite)\n # Rename to something shorter and easier to work with for below\n tile = @tile_sprites[i/3][i%3]\n # Assign tile's respective ID value\n tile.tile_sprite_id = i\n # Draw sprite at index location (ex. ID 0 should always be the top-left sprite)\n tile.x = (i % ((SCREEN[0]/32+2)*3) / 3 * 32) - 32 + (@ox % 32)\n tile.y = (i / ((SCREEN[0]/32+2)*3) * 32) - 32 + (@oy % 32)\n\n map_x, map_y = (tile.x+@ox)/32, (tile.y+@oy)/32\n @corner_tile_loc = [map_x, map_y] if i == 0\n # If the tile happens to be drawn along the outside borders of the map\n if map_x < 0 || map_x >= $game_map.width || map_y < 0 || map_y >= $game_map.height\n tile.z = 0\n tile.bitmap = RPG::Cache.picture('')\n tile.src_rect.set(0,0,0,0)\n else # Tile is actually on the map\n tile_id = @map_data[map_x,map_y,i%3]\n if @priorities[tile_id] == 0\n tile.z = 0\n else\n tile.z = tile.y + @priorities[tile_id] * 32 + 32\n end\n # No tile exists here\n if tile_id == 0\n tile.bitmap = RPG::Cache.picture('')#@tileset\n tile.src_rect.set(0,0,0,0)\n elsif tile_id >= 384 # non-autotile\n tile.bitmap = @tileset\n tile.src_rect.set(((tile_id - 384) % 8)*32,((tile_id - 384) / 8)*32, 32, 32)\n else # autotile\n tile.bitmap = @autotiles[tile_id/48-1]\n tile.src_rect.set(((tile_id % 48) % 8)*32,((tile_id % 48) / 8)*32, 32, 32)\n @animating_tiles[i] = tile if tile.bitmap.width > 256\n end\n end\n }\n # Sprite ID located at top left corner (ranges from 0..map_width * map_height\n @corner_index = 0\n end",
"title": ""
},
{
"docid": "6b18d1bfbc382b59b47edea1aafbbc26",
"score": "0.5711819",
"text": "def draw_tiles (num)\n tiles_drawn = @bag_of_tiles.sample(num)\n tiles_drawn.each do | tile |\n @bag_of_tiles.slice!(@bag_of_tiles.index(tile))\n end\n return tiles_drawn\n end",
"title": ""
},
{
"docid": "9bde74a6651549205d4e148cb764baef",
"score": "0.570989",
"text": "def display_board\n row_idx = -1\n numera = [1,2,3,4,5,6,7,8,9]\n @display = @grid.map do |row|\n \n col_idx = -1\n row_idx += 1 \n row.map do |col| \n col_idx += 1 \n if @flag_pair.include? ((row_idx.to_s) + (col_idx.to_s))\n col = 'F'.orange\n elsif col == :B\n col = 'H'.green\n elsif (@known_empty.include? ((row_idx.to_s) + (col_idx.to_s))) && (numera.include? col)\n col = col.to_s.red\n elsif @known_empty.include? ((row_idx.to_s) + (col_idx.to_s))\n col = 'O'.blue\n else\n col = 'H'.green\n end \n end \n end\n end",
"title": ""
},
{
"docid": "407d6bb8fad2c04ff0e219190d1da561",
"score": "0.5698784",
"text": "def draw size, x_offset=0, y_offset=0\n x_offset -= 320 * size / 2\n y_offset -= 250 * size / 2\n x_offset += 6 * size\n y_offset += 15 * size\n # draw background first\n 0.upto(WIDTH - 1) do |x|\n (HEIGHT - 1).downto(0) do |y|\n if @tiles[x + WIDTH * y] == :background\n # choose background terrain\n image = @terrain[1]\n # actual top left coordinates\n px = x * TILE_WIDTH * size\n py = y * TILE_HEIGHT * size - TILE_HEIGHT * size\n # draw to the screen scaled to size\n image.draw(px - x_offset, py - y_offset, 0, size, size)\n elsif @tiles[x + WIDTH * y] == :background2\n # choose background terrain\n image = @terrain[3]\n # actual top left coordinates\n px = x * TILE_WIDTH * size\n py = y * TILE_HEIGHT * size - TILE_HEIGHT * size\n # draw to the screen scaled to size\n image.draw(px - x_offset, py - y_offset, 0, size, size)\n end\n end\n end\n\n # draw platforms on top of the background\n 0.upto(WIDTH - 1) do |x|\n (HEIGHT - 1).downto(0) do |y|\n if @tiles[x + WIDTH * y] == :platform\n # choose platform terrain\n image = @terrain[0]\n # actual top left coordinates\n px = x * TILE_WIDTH * size\n py = y * TILE_HEIGHT * size - TILE_HEIGHT * size\n # draw to the screen scaled to size\n image.draw(px - x_offset, py - y_offset, 0, size, size)\n end\n end\n end\n\n for enemy in @enemies\n enemy.draw size, x_offset, y_offset\n end\n\n for candy in @candies\n candy.draw size, x_offset, y_offset\n end\n\n @door.draw size, x_offset, y_offset\n end",
"title": ""
},
{
"docid": "50ee206fffd9e046a078ca2235058002",
"score": "0.56889457",
"text": "def print_board\n reputs\n @hash.each do |player, position|\n puts \" |\" * (position - 1) + player + \"|\" + \" |\" * (length - position)\n end\n end",
"title": ""
},
{
"docid": "982759c8fafd5dea82f99646ddac94a4",
"score": "0.56853294",
"text": "def update_view\n end_offsets = []\n color_sign = ((@color == :black) ? -1 : 1)\n \n end_offsets = []\n \n @legal_moves = end_offsets\n if color == :black\n if @coordinates.first == 6\n end_offsets << [5, @coordinates.last]\n end_offsets << [4, @coordinates.last]\n else\n end_offsets << [@coordinates.first + color_sign, @coordinates.last] unless @board.tiles[@coordinates.first + color_sign, @coordinates.last] \n end\n else\n if @coordinates.first == 1\n end_offsets << [2, @coordinates.last]\n end_offsets << [3, @coordinates.last]\n else\n end_offsets << [@coordinates.first + color_sign, @coordinates.last] unless @board.tiles[@coordinates.first + color_sign, @coordinates.last]\n end\n end\n # p \"updateview\"\n # p @board\n # p @coordinates.last + 1\n # # p @board.tiles[1,0]\n # p @board.tiles[@coordinates.first - 1][@coordinates.last + 1]\n \n if inside_bounds?([@coordinates.first + color_sign, @coordinates.last - 1])\n left_corner = @board.tiles[@coordinates.first + color_sign][@coordinates.last - 1]\n if (!left_corner.nil? && left_corner.color != color)\n end_offsets << left_corner.coordinates\n end\n end\n\n if inside_bounds?([@coordinates.first + color_sign, @coordinates.last + 1])\n # p [@coordinates.first + color_sign, @coordinates.last + 1]\n # if !@board.tiles[@coordinates.first + color_sign, @coordinates.last + 1].nil?\n \n # p \"right corner: #{@board.tiles[@coordinates.first + color_sign][@coordinates.last + 1]}\"\n right_corner = @board.tiles[@coordinates.first + color_sign][@coordinates.last + 1]\n if (!right_corner.nil? && right_corner.color != color)\n end_offsets << right_corner.coordinates\n end\n end\n @legal_moves = end_offsets\n \n end",
"title": ""
},
{
"docid": "3c08a846851d99284f1299829567e5e7",
"score": "0.56827205",
"text": "def update\n # Can't update anything if the ox and oy have not yet been set\n return if @ox_oy_set != [true, true]\n # If the tilemap sprites have not been initialized, GO DO IT\n if !@tilemap_drawn\n init_tiles\n end\n \n # If made any changes to $game_map.data, the proper graphics will be drawn\n if @map_data.updated\n @map_data.updates.each{|item|\n x,y,z,tile_id = item\n # If this changed tile is visible on screen\n if x.between?(@corner_tile_loc[0], @corner_tile_loc[0]+(SCREEN[0]/32 + 1)) and\n y.between?(@corner_tile_loc[1], @corner_tile_loc[1]+(SCREEN[1]/32 + 1))\n \n x_dif = x - @corner_tile_loc[0]\n y_dif = y - @corner_tile_loc[1]\n \n id = @corner_index + x_dif\n id -= SCREEN[0]/32+2 if id/(SCREEN[0]/32+2) > @corner_index/(SCREEN[0]/32+2)\n \n id += y_dif * (SCREEN[0]/32+2)\n id -= (SCREEN[0]/32+2)*(SCREEN[1]/32+2) if id >= (SCREEN[0]/32+2)*(SCREEN[1]/32+2)\n \n tile = @tile_sprites[id][z]\n @animating_tiles.delete(tile.tile_sprite_id)\n #Figure out its z-coordinate based on priority\n if @priorities[tile_id] == 0\n tile.z = 0\n else\n tile.z = 32 + (tile.y/32) * 32 + @priorities[tile_id] * 32\n end\n # If empty tile\n if tile_id == 0\n tile.bitmap = RPG::Cache.picture('')\n tile.src_rect.set(0,0,0,0)\n # If not an autotile\n elsif tile_id >= 384\n tile.bitmap = @tileset\n tile.src_rect.set(((tile_id - 384) % 8) * 32,((tile_id - 384) / 8) *32, 32, 32)\n else # Autotile\n auto_id = tile_id/48-1\n tile.bitmap = @autotiles[auto_id]\n tile.src_rect.set(((tile_id % 48) % 8)*32 + @current_frame[auto_id] * 256,((tile_id % 48) / 8)*32, 32, 32)\n @animating_tiles[tile.tile_sprite_id] = tile if @total_frames[auto_id] > 1\n end\n end\n }\n @map_data.updates = []\n end\n \n # Update the sprites.\n if Graphics.frame_count % $game_map.autotile_speed == 0\n # Increase current frame of tile by one, looping by width.\n for i in 0..6\n @current_frame[i] = (@current_frame[i] + 1) % @total_frames[i]\n end\n @animating_tiles.each_value{|tile|\n frames = tile.bitmap.width\n tile.src_rect.set((tile.src_rect.x + 256) % frames, tile.src_rect.y, 32, 32)\n }\n end\n end",
"title": ""
},
{
"docid": "011ab0a089acff5ec5b02b62d5d061cd",
"score": "0.5677371",
"text": "def show\n @sprites[\"sel\"].visible = false\n @sprites[\"bg\"].y -= @sprites[\"bg\"].bitmap.height/4\n for i in 0...@indexes.length\n next if !@sprites[\"b#{i}\"]\n @sprites[\"b#{i}\"].y -= 10\n end\n end",
"title": ""
},
{
"docid": "0617cc6a288400e42d8f7a5de7dcb13b",
"score": "0.56759286",
"text": "def print_tile(coords)\n if ((@location.first == coords.first) && (@location.second == coords.second))\n print \"¶ \"\n else\n print @map.tiles[coords.first][coords.second].to_s\n end\n end",
"title": ""
},
{
"docid": "8110e6477ae88e39e301b2611efc1a62",
"score": "0.567579",
"text": "def draw\n\t\t\tlastpixel = Pixel.new(rand(255), rand(255), \".\")\n\t\t\t@map = Marshal.load( Marshal.dump( @smap )) # Deep copy\n\n\t\t\t# get all the objects\n\t\t\t@objects.each do |o|\n\t\t\t\tnext if o.x.nil? or o.y.nil?\n\t\t\t\to.each do |ri,ci,pixel|\n\t\t\t\t\tif !pixel.nil? and o.y+ri >= 0 and o.x+ci >= 0 and o.y+ri < @map.size and o.x+ci < @map[0].size\n\t\t\t\t\t\t# -1 enables a \"transparent\" effect\n\t\t\t\t\t\tif pixel.bg == -1\n\t\t\t\t\t\t\tpixel.bg = @map[o.y + ri][o.x + ci].bg if !@map[o.y + ri][o.x + ci].nil?\n\t\t\t\t\t\t\tpixel.bg = Theme.get(:background).bg if pixel.bg == -1\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif pixel.fg == -1\n\t\t\t\t\t\t\tpixel.fg = @map[o.y + ri][o.x + ci].fg if !@map[o.y + ri][o.x + ci].nil?\n\t\t\t\t\t\t\tpixel.fg = Theme.get(:background).fg if pixel.fg == -1\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\t@map[o.y + ri][o.x + ci] = pixel\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tout = \"\" # Color.go_home\n\t\t\t# and DRAW!\n\t\t\t@map.each do |line|\n\t\t\t\tline.each do |pixel|\n\t\t\t\t\tif lastpixel != pixel\n\t\t\t\t\t\tout << RuTui::Ansi.clear_color if lastpixel != 0\n\t\t\t\t\t\tif pixel.nil?\n\t\t\t\t\t\t\tout << \"#{RuTui::Ansi.bg(@default.bg)}#{RuTui::Ansi.fg(@default.fg)}#{@default.symbol}\"\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tout << \"#{RuTui::Ansi.bg(pixel.bg)}#{RuTui::Ansi.fg(pixel.fg)}#{pixel.symbol}\"\n\t\t\t\t\t\tend\n\t\t\t\t\t\tlastpixel = pixel\n\t\t\t\t\telse\n\t\t\t\t\t\tif pixel.nil?\n\t\t\t\t\t\t\tout << @default.symbol\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tout << pixel.symbol\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# draw out\n\t\t\tprint out.chomp\n\t\t\t$stdout.flush\n\t\tend",
"title": ""
},
{
"docid": "d2a7c6336104849dc6519a7b0e8fb6ec",
"score": "0.5675779",
"text": "def display_board\n puts \"#{human.name}: #{human.marker}, #{computer.name}: #{computer.marker}\"\n puts \"Round #{@round}.\"\n puts \"Score: #{human.score} - #{computer.score}\"\n puts \"\"\n board.draw\n puts \"\"\n end",
"title": ""
},
{
"docid": "4d340ee2ff2abacdcca829bd5330c9d9",
"score": "0.56716526",
"text": "def draw_tiles(tile_bag)\n until tiles.length == 7\n tiles.concat(tile_bag.draw_tiles(1)) #because draw_tiles returns an array\n\n end\n end",
"title": ""
},
{
"docid": "a54a15380ab55c1f52bdca82bf675fc5",
"score": "0.5669487",
"text": "def initialize(save_file=nil)\n super()\n\n @tiles = Gosu::Image.load_tiles(\n RES_DIR.join(\"tiled-icons-16x16.png\").to_s, \n 16, 16,\n retro: true)\n\n @letters = Gosu::Image.load_tiles(\n RES_DIR.join(\"tiled-font-8x16.png\").to_s,\n 8, 16,\n retro: true)\n\n @tile_scale = Size[2,2]\n @grid_size = Size[32,32]\n @map_size = Size[25,19]\n @window = Window.new(size: Size[800,608])\n @window.on_input= self.method(:on_input)\n @window.on_update= self.method(:on_update)\n @window.on_draw= self.method(:on_draw)\n\n @prng = Random.new\n\n sword = {\n tile_index: 5,\n card_type: :weapon,\n description: \"sword\",\n cooldown: 3,\n cooldown_timer: -1\n }\n\n magic_missile = {\n tile_index: 6,\n card_type: :spell,\n description: \"magic missile\",\n contamination: 3,\n }\n\n meat = {\n tile_index: 4,\n card_type: :item,\n description: \"hunk of meat\",\n }\n\n @player = { \n name: \"Player\",\n tile_index: 0,\n action: nil,\n position: Point[1,1],\n movement: nil,\n card_state: {\n contaminated: true,\n weapon: sword,\n spell: magic_missile,\n item: meat,\n deck: [],\n }\n }\n\n goblin = {\n name: \"Goblin\",\n tile_index: 1,\n action: nil,\n position: Point[3,3],\n movement: nil,\n ai_method: :goblin_ai,\n }\n\n walls = Bitmap.new(MAP_SIZE).from_s(WALLS).active_coords.map do |pt|\n {\n tile_index: 2,\n position: pt,\n obstructing: true\n }\n end\n\n @movement = [@player, goblin]\n @with_cards = [@player]\n @ai_method = [goblin]\n @action = [@player, goblin]\n @visible = [@player, goblin, *walls]\n\n @map = {\n size: Size[20,20],\n index: {\n @player[:position] => [@player],\n goblin[:position] => [ goblin],\n },\n }\n\n @map[:index].default_proc = Proc.new do |hash, key|\n hash[key]= []\n end\n\n walls.each do |entity|\n pos = entity[:position]\n @map[:index][pos] << entity\n end\n end",
"title": ""
},
{
"docid": "f317af54908718f23f4b83afe9bff129",
"score": "0.56680375",
"text": "def draw_tiles(num)\n player_hand = []\n # array will return tiles to player. Needs much refactoring.\n return nil if num > tiles_remaining\n #to account for test, returns nil if more tiles are drawn than tiles remain.\n while player_hand.length != num\n new_tile = rand(@default_set.size)\n starting_hand = 0\n\n @default_set.each do |letter, letter_quantity|\n #Need to continue working on, this is becoming harder to read. TODO: REFACTOR!\n # if the amount of tiles drawn(starting at 0) is the same as the amount of new tiles drawn,\n if starting_hand == new_tile && letter_quantity != 0\n #if the condition above, and the total tiles isnt 0, add the new tile (letter), to all of the tiles (player_hand array)\n # if letter_quantity != 0\n player_hand << letter\n #Then subtract the letter from the tilebag, reducing the total amount of tiles by 1, and reducing the letter by one specifically from the letters.\n @default_set[letter] = letter_quantity - 1\n else\n new_tile = rand(@default_set.size)\n \n end\n #increases the amount of tiles had by player plus one, each time a tile is drawn\n starting_hand += 1\n end\n end\n #returns array of all tiles to player\n return player_hand\n end",
"title": ""
},
{
"docid": "009351b5cc3c450157f4f7eff332545b",
"score": "0.5663485",
"text": "def draw_map(x,y)\n object = @room[x][y]\n @ui.place_text(object, x+2, y+6, DungeonOfDoom::C_YELLOW_ON_RED)\n #check of object shown in a monster, if so, activate it. only activate one at a time\n @ui.place_text(\"MONSTER STRENGTH: #{@mon_strength.round}\".ljust(20),1,5,DungeonOfDoom::C_BLACK_ON_YELLOW) if @monster_detected\n if CHAR_MONST.include?(object) && !@monster_detected\n @monster_detected = true\n @mon_x, @mon_y = x,y\n @mon_type = object\n @mon_attack = CHAR_MONST.index(object)+1\n @mon_strength = @mon_attack*12\n end\n end",
"title": ""
}
] |
990137f38e64aa79a5e6e21783c44e68 | ActiveSupportpresent? and other related protocols depend on this semantically indicating the number of results from the query | [
{
"docid": "ad933dd1f92b20c8e1668cb31d42b465",
"score": "0.0",
"text": "def empty?\n total_count == 0\n end",
"title": ""
}
] | [
{
"docid": "79fa78f61e103a4d61478156cc37bfc2",
"score": "0.70812315",
"text": "def more_results?()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "c0a4d2ac190a1d325bb968fc84c23299",
"score": "0.68472254",
"text": "def pagination_needed?\n # Using #to_a stops active record trying to be clever\n # by converting queries to select count(*)s which then need to be repeated.\n @pagination_needed ||= primary_records.to_a.size > API_PAGE_SIZE\n end",
"title": ""
},
{
"docid": "8174de764078cec44c957afd8d413e6d",
"score": "0.6498308",
"text": "def has_results?\n true\n end",
"title": ""
},
{
"docid": "5efe814fb24f1e060c1836c06055324b",
"score": "0.64291394",
"text": "def numberOfResults\n @@numberOfResults\n end",
"title": ""
},
{
"docid": "a0c0703e0e331413a550365ac367dded",
"score": "0.63495755",
"text": "def total_results\n records&.size || 0\n end",
"title": ""
},
{
"docid": "75dc6256adb7f7868cdfea04ba236951",
"score": "0.6332408",
"text": "def query_len; (x = @hits.first) ? x.query_len : nil; end",
"title": ""
},
{
"docid": "ef8230e4a614cca92e15bd8a546edf63",
"score": "0.6273127",
"text": "def length; return @results.length; end",
"title": ""
},
{
"docid": "cbad51bad0ae9890270dc4f24877153c",
"score": "0.6269822",
"text": "def query_len; query.size; end",
"title": ""
},
{
"docid": "a3d7989625adc6d659cc74df59e4eba8",
"score": "0.62530065",
"text": "def count\n @count ||= @query.count\n end",
"title": ""
},
{
"docid": "17424bc3628d63e49438a23d2c818a60",
"score": "0.6245337",
"text": "def retrieved_records\n results.count\n end",
"title": ""
},
{
"docid": "114f03f63ac0827bdd89db4803481415",
"score": "0.62394804",
"text": "def complete_result?\n @result_count < 1000\n end",
"title": ""
},
{
"docid": "3f56cba72e0bf5011bfa53f88c43c905",
"score": "0.619943",
"text": "def query_7\n document_ids = Perpetuity[Document].select {|document| document.id}.to_a\n return document_ids.size\nend",
"title": ""
},
{
"docid": "a195314eb8c62c1a8d4437c17d176c5e",
"score": "0.61923677",
"text": "def satisfied?\n @options[:limit] > 0 && @count >= @options[:limit]\n end",
"title": ""
},
{
"docid": "adc24e4a328c2159b9a778a82d034801",
"score": "0.616497",
"text": "def has_records? results\n not results.nil? and results.fetch('SearchResult', {}).fetch('Data', {}).fetch('Records', []).count > 0\n end",
"title": ""
},
{
"docid": "5af1b4ffa540187d45236c1d0fd8ee8f",
"score": "0.61513674",
"text": "def present?\n results.any?\n end",
"title": ""
},
{
"docid": "4dce1566e2ad7ff186a286e3709e7660",
"score": "0.60854924",
"text": "def pred_count\n results['predicates'].present? ? results['predicates'].size : 0\n end",
"title": ""
},
{
"docid": "c642053fe5b894840ead4fc51d82b3bb",
"score": "0.60615695",
"text": "def search_result_page_existed?\r\n displayed?\r\n end",
"title": ""
},
{
"docid": "22168eef45f9b8e295b84639694d5e0c",
"score": "0.60571647",
"text": "def page_length\n return 0 if self.elements[:results].nil?\n self.elements[:results].length\n end",
"title": ""
},
{
"docid": "d6ac127254035e0d3c8a0adb1cecade9",
"score": "0.6056704",
"text": "def count\n query.count\n end",
"title": ""
},
{
"docid": "d6ac127254035e0d3c8a0adb1cecade9",
"score": "0.6056704",
"text": "def count\n query.count\n end",
"title": ""
},
{
"docid": "f78dd413a819b0b31f2295b5f4d0e1d3",
"score": "0.60500157",
"text": "def data_loaded?\n get_query_params.length > 0\n end",
"title": ""
},
{
"docid": "3f2146c16df66d9845b8e82d93444e6a",
"score": "0.60348856",
"text": "def small_result_set?\n @result_set.size <= @options[:minimum_result_set_size]\n end",
"title": ""
},
{
"docid": "0decee6f4a9128bc1cee690bcc0d9f39",
"score": "0.5989072",
"text": "def length\n @results_list.count\n end",
"title": ""
},
{
"docid": "762c4fc1c3799fba780a280d5f32a5a0",
"score": "0.5968949",
"text": "def total_results\n numberOfRecords\n end",
"title": ""
},
{
"docid": "762c4fc1c3799fba780a280d5f32a5a0",
"score": "0.5968949",
"text": "def total_results\n numberOfRecords\n end",
"title": ""
},
{
"docid": "563f14fdd64bb0411cc58cc11167cd0a",
"score": "0.5967228",
"text": "def length\n @queries.length\n end",
"title": ""
},
{
"docid": "cc6a4716046829cea61550fac50f520a",
"score": "0.59627336",
"text": "def query_len; seq1.len; end",
"title": ""
},
{
"docid": "8af511f8ba569ffc73a14496dd8d00a7",
"score": "0.59520566",
"text": "def count(layer_idx=0, options={})\n return nil unless self.metadata[\"capabilities\"] =~ /Query/\n query(layer_idx, options.merge(:returnCountOnly => true))\n end",
"title": ""
},
{
"docid": "bd0e946e76689a74957cc4ee84d12c5a",
"score": "0.5910676",
"text": "def query_for_data\n if self.record_klass < ActiveRecord::Base\n self.dataset = self.record_klass.find(:all, self.query)\n \n count_query = self.query.reject do |k, v| \n [:limit, :offset, :order].include?(k.to_sym )\n end\n self.resultcount = self.record_klass.count(:all, count_query)\n \n elsif self.record_klass < ActiveResource::Base\n self.dataset = self.record_klass.find(:all, :params => self.query)\n self.resultcount = self.dataset.delete_at(self.dataset.length - 1).total\n else\n raise \"Unable to query for data. Supported base classes are 'ActiveRecord::Base' and 'ActiveResource::Base' but '#{self.record_klass}' was given\"\n end\n \n self.resultcount = self.resultcount.length if self.resultcount.respond_to?(:length)\n end",
"title": ""
},
{
"docid": "62c4601b27f2fd193c76c61d605c7469",
"score": "0.59007597",
"text": "def is_countable?(collection)\n collection.total_pages\n rescue ::StandardError\n false\n end",
"title": ""
},
{
"docid": "0d23a928f68a7c538890e351068971b0",
"score": "0.58932096",
"text": "def more_results\n @server_status & SERVER_MORE_RESULTS_EXISTS != 0\n end",
"title": ""
},
{
"docid": "d905d24b7a0d5d8957062d9069da8c34",
"score": "0.588988",
"text": "def hasResults?\n ! @results.empty?\n end",
"title": ""
},
{
"docid": "8060d9e67250157eaed6de35a058a50e",
"score": "0.5887654",
"text": "def large_results?\n val = @gapi.configuration.query.allow_large_results\n return false if val.nil?\n val\n end",
"title": ""
},
{
"docid": "d260da49b65d97aab7b6b19b28f96a55",
"score": "0.5885839",
"text": "def present_count\n __present__(*planets_and_counts { |p| p.connection(format) })\n end",
"title": ""
},
{
"docid": "ce1927be6f4d51a2bdb6b5865730cea0",
"score": "0.5883439",
"text": "def query_len; @hit.mrna.len; end",
"title": ""
},
{
"docid": "f6e71265e242fe1a803ac8fd1cef0189",
"score": "0.5882898",
"text": "def more_pages?\n return false if start_index == 0\n (self.start_index + self.page_length) -1 < self.total_result_count\n end",
"title": ""
},
{
"docid": "4ee42e5a550e68a9ea993d75e3135d24",
"score": "0.58760136",
"text": "def responses_count\n @responses_count ||= self.responses.visible.count || 0\n end",
"title": ""
},
{
"docid": "5667e8a9fc1a0a9f29b9d5580d5ff8c7",
"score": "0.5865344",
"text": "def smartRankingEnabled?\n smart_ranking_element.count > 0 \n end",
"title": ""
},
{
"docid": "963f78a5279fa21ba4edebef43470a3c",
"score": "0.585899",
"text": "def get_resultcount\n\t\treturn @resultcount || Afasgem.default_results\n\tend",
"title": ""
},
{
"docid": "93400f147244b8aedd319e80421eac45",
"score": "0.5835702",
"text": "def be_compatible\n @size = if @results.class == Array\n @results.size\n else\n @results.values.size\n end\n end",
"title": ""
},
{
"docid": "32ac0d827c4197504b9ee0609f54981a",
"score": "0.5813725",
"text": "def has_search_result_count?(expected_count)\n has_css?(\".property-item\", count: expected_count)\n # search_result_list.count.eql? expected_count\n end",
"title": ""
},
{
"docid": "022c9b7bfd050c762a6813bf7c49eb19",
"score": "0.57833445",
"text": "def all_hits_count\n return @all_results.length || 0\n end",
"title": ""
},
{
"docid": "4db6a323a347284865ba0fae511499b2",
"score": "0.578206",
"text": "def all_pagination_is_present\n return unless pagination && count.nil?\n\n errors.add(:count, ErrorMessage[\"should be present if pagination is being used\", \"6.4\"])\n end",
"title": ""
},
{
"docid": "0731a4ead789b33eb640b78936c2bd15",
"score": "0.5771594",
"text": "def filtered_hits_count\n return @filtered_results.length || 0\n end",
"title": ""
},
{
"docid": "f8b5f13b0a7283e9d10562ddfcc9c0d7",
"score": "0.5753524",
"text": "def expects_none?\n count_specified? ? matches_count?(0) : false\n end",
"title": ""
},
{
"docid": "510703ab9d15e1bf9c4485657edd7fc3",
"score": "0.57438815",
"text": "def no_more?\n more_results == :NO_MORE_RESULTS\n end",
"title": ""
},
{
"docid": "2ecce1225d99d5ef31da8020f7e3e34e",
"score": "0.57343376",
"text": "def test_count\n sparql = SparqlTest.handle\n (1..100).each do |i|\n sparql.insert([ SparqlTest.urn( __method__ ), 'me:num', i ])\n end\n check = sparql.count([ SparqlTest.urn( __method__ ), 'me:num', :o ])\n sparql.empty( :all )\n assert_equal( 100, check )\n end",
"title": ""
},
{
"docid": "d7e9f2adf281a6e779eec1653ec457f9",
"score": "0.573291",
"text": "def paginated?\n page_count > 1\n end",
"title": ""
},
{
"docid": "e7ff99b76e01ab7b0a5f75c37c709dc5",
"score": "0.57322586",
"text": "def nqueries\n @nqueries ||= section_names.select {|name| name =~ /query/ }.length\n end",
"title": ""
},
{
"docid": "d631186d5cc6e92aba8f8c89e0e4f685",
"score": "0.5726062",
"text": "def size\n\n fetch_all(:count => true)\n end",
"title": ""
},
{
"docid": "e72dc00ae920dbf40cd0359bdc3d2c7b",
"score": "0.5724938",
"text": "def paginated?\n @choices.size > page_size\n end",
"title": ""
},
{
"docid": "53419b439879b376f927373137372bdd",
"score": "0.56904423",
"text": "def available?\n self.available_count > 0\n end",
"title": ""
},
{
"docid": "9b3bb4e3ec56351f5c06659b452d016a",
"score": "0.56867546",
"text": "def size\n @set['includedResults'].to_i\n end",
"title": ""
},
{
"docid": "ed5d831d072c571d28b6f326bc9de906",
"score": "0.56771934",
"text": "def nqueries\n @query_index_ar.size - 1\n end",
"title": ""
},
{
"docid": "bb16fba7f6fd45cc30c8359b4c2d3288",
"score": "0.5666595",
"text": "def num_results(_args = {})\n @num_results ||= result_ids&.count || 0\n end",
"title": ""
},
{
"docid": "8d4043304dd322a83f1364a3c0164ea4",
"score": "0.56647336",
"text": "def how_many?\n return default_article_sync if articles.length == 0\n last_db = articles.last.published\n count = 0\n feed.entries.each do |entry|\n count += 1 if entry.published > last_db\n end\n count > 20 ? 20 : count\n end",
"title": ""
},
{
"docid": "579db4342b4e63bc4c988045d48d9098",
"score": "0.56587386",
"text": "def results_complete?(max_results)\n return @snp_list.results_complete?(max_results)\n end",
"title": ""
},
{
"docid": "4c374a94ebd7ebc2b8781de20cdca8ab",
"score": "0.56578016",
"text": "def num_records\n num_urls + num_docs\n end",
"title": ""
},
{
"docid": "4c374a94ebd7ebc2b8781de20cdca8ab",
"score": "0.56578016",
"text": "def num_records\n num_urls + num_docs\n end",
"title": ""
},
{
"docid": "1725510ed6a7a3008207d1a47611aa9a",
"score": "0.56577194",
"text": "def query_len; mrna.len; end",
"title": ""
},
{
"docid": "709ed09e3d89d56199da92d092741b83",
"score": "0.5652938",
"text": "def total_results_available\n self.to_json[\"ResultSet\"][\"totalResultsAvailable\"].to_i\n end",
"title": ""
},
{
"docid": "3ec714871677a4f680f9cefc2940da8d",
"score": "0.5651463",
"text": "def just_shown_results?\n return true if get[just_shown_key]\n end",
"title": ""
},
{
"docid": "9d1fc21d341465327900e0b221a5eb2b",
"score": "0.5640952",
"text": "def paginated?(result)\n PAGINATION_PROXY_INTERFACE.each do |meth|\n result.send(meth)\n end\n true\n rescue NoMethodError\n false\n end",
"title": ""
},
{
"docid": "955cd70fa96c9b6fa9e218301ea89f8e",
"score": "0.56279075",
"text": "def smartRecsEnabled?\n smart_recs_element.count > 0 \n end",
"title": ""
},
{
"docid": "32c97fbed678eada93262facd8cc55d5",
"score": "0.56208",
"text": "def count\n if paginated?\n to_hash['results'].nil? ? 0 : to_hash['results'].size\n else\n to_hash['count']\n end\n end",
"title": ""
},
{
"docid": "9533d06df2b1528e62778c2bec62ae63",
"score": "0.56156373",
"text": "def show_pagination? response = nil\n response ||= @response\n response.limit_value > 0 && response.total_pages > 1\n end",
"title": ""
},
{
"docid": "9533d06df2b1528e62778c2bec62ae63",
"score": "0.56156373",
"text": "def show_pagination? response = nil\n response ||= @response\n response.limit_value > 0 && response.total_pages > 1\n end",
"title": ""
},
{
"docid": "dcb9c23c6143b99eeb6fecc1a71df69e",
"score": "0.5611436",
"text": "def empty?\n return @records.empty? if loaded?\n\n if limit_value == 0\n true\n else\n # FIXME: This count is not compatible with #select('authors.*') or other select narrows\n c = count\n c.respond_to?(:zero?) ? c.zero? : c.empty?\n end\n end",
"title": ""
},
{
"docid": "e2ea92e94fc6a723a00a4039b8caed66",
"score": "0.5610484",
"text": "def result_count\n result_ids.size\n end",
"title": ""
},
{
"docid": "a3ae0c66f3b83f48a6cc30ad82820df7",
"score": "0.55998605",
"text": "def more_songs\n get_songs\n return @page_size && @songs.count == @page_size\n end",
"title": ""
},
{
"docid": "2969b942d8713102fbf952bab2d1be55",
"score": "0.5592981",
"text": "def n_responses\n if Rails.configuration.comments_active then\n\t self.comments.count\n else\n 0\n end\n end",
"title": ""
},
{
"docid": "4a11fbe9aac4a5491328590a2799b1be",
"score": "0.55776876",
"text": "def response?\n !self.query?\n end",
"title": ""
},
{
"docid": "527d1488aaefa35b1d34b0ef62851c46",
"score": "0.5569655",
"text": "def results?() ! find(locator(:no_results_message)) end",
"title": ""
},
{
"docid": "a5f957d8558468d8bc786022c122a13e",
"score": "0.5560011",
"text": "def records_filtered_count\n (records.blank? ? 0 : records.first['filtered_count']) || records_total_count\n end",
"title": ""
},
{
"docid": "6bdb9095d832866dfc0c9f31b106e384",
"score": "0.5559674",
"text": "def paginable?\n @refined_scope.respond_to?(:total_pages)\n end",
"title": ""
},
{
"docid": "48ad54c830ded8373fbdb393cf354721",
"score": "0.5557926",
"text": "def more_after_limit?\n more_results == :MORE_RESULTS_AFTER_LIMIT\n end",
"title": ""
},
{
"docid": "e30dc3cf0fb511d4adccdf39f70aa5d4",
"score": "0.55566496",
"text": "def size\n @obj['results'].length\n end",
"title": ""
},
{
"docid": "f0532041d3ab77ad38314d6b8063e658",
"score": "0.55513835",
"text": "def paginable?\n return @refined_scope.respond_to?(:total_pages)\n end",
"title": ""
},
{
"docid": "6194d74ef0a6cf3a253237a7268a1838",
"score": "0.55505526",
"text": "def num_hits; @hits.size; end",
"title": ""
},
{
"docid": "6194d74ef0a6cf3a253237a7268a1838",
"score": "0.55505526",
"text": "def num_hits; @hits.size; end",
"title": ""
},
{
"docid": "6194d74ef0a6cf3a253237a7268a1838",
"score": "0.55505526",
"text": "def num_hits; @hits.size; end",
"title": ""
},
{
"docid": "add98dac64c9c8bc5a93e7b26ff5eed5",
"score": "0.55503905",
"text": "def total_count\n @total_count ||= self.query.count\n end",
"title": ""
},
{
"docid": "6c0277ba5266d64ef6d2e5eea87e03f9",
"score": "0.55467296",
"text": "def hit_count()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "5b5104ad67600e913aaa2d97d2dab20d",
"score": "0.55452645",
"text": "def query_yields_solutions?\n true\n end",
"title": ""
},
{
"docid": "e9a1dd2abf5363889aa3bc6d3c5726ec",
"score": "0.55399853",
"text": "def page_count()\n if @pages >= 500\n return true\n end\n else\n return false\n end",
"title": ""
},
{
"docid": "bf8dd752c5cc42e904ebb340b0886827",
"score": "0.55381024",
"text": "def expected_count?\n return !!expected_count\n end",
"title": ""
},
{
"docid": "d5d9e00bb87fcdebc3b101de7aeadae5",
"score": "0.55231273",
"text": "def paginated?\n false\n end",
"title": ""
},
{
"docid": "9077b053867faeb564b6fe61b59b5cf7",
"score": "0.5519363",
"text": "def count\n @options[:select] = \"COUNT\"\n @options.delete(:attributes_to_get)\n\n response = run\n\n while continue?(response)\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n end\n\n response.count\n end",
"title": ""
},
{
"docid": "3b7d7474787402e08264c1c060ba2110",
"score": "0.55048233",
"text": "def request_count; end",
"title": ""
},
{
"docid": "42b523c4a795353ecaa5ff499e8aa99c",
"score": "0.55037934",
"text": "def returned_count\n reply.documents.length\n end",
"title": ""
},
{
"docid": "d814008d8601121da699df831c365b35",
"score": "0.5501398",
"text": "def count\n @count ||=\n begin\n # self.sql sets self.model_class.\n this_sql = sql(:count => true)\n model_class.connection.\n query(this_sql).\n first.first\n end\n end",
"title": ""
},
{
"docid": "e4bd5c1ee358ac949c5f1056695c5e68",
"score": "0.54935557",
"text": "def fully_fetched\n true\n end",
"title": ""
},
{
"docid": "bf0148a8cb34b6fd6a42975dab51ea80",
"score": "0.5490369",
"text": "def paginatable?\n raise NotImplemented\n end",
"title": ""
},
{
"docid": "6d7a9c91e591e76cf8642cdcedf1331a",
"score": "0.5486158",
"text": "def count\n load_page(1) if @num_records.nil? # load pagination metadata\n @num_records\n end",
"title": ""
},
{
"docid": "0c4ac735f61e4b5c576236c16c8bea19",
"score": "0.5473018",
"text": "def count\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "b3618094e6497f6e8ad1301a8d58d2ff",
"score": "0.5462892",
"text": "def length\n @results.keys.length\n end",
"title": ""
},
{
"docid": "fcb7fc54ef79915266f74031848669d2",
"score": "0.5461768",
"text": "def unknown_count\n (select &:unknown?).count\n end",
"title": ""
},
{
"docid": "6b647e7edbf9d516027870ea00265e5c",
"score": "0.5458486",
"text": "def count\n raw_history['num_results']\n end",
"title": ""
},
{
"docid": "a3b65263864f30611c2d43b8c7ce541f",
"score": "0.54583424",
"text": "def next_page?\n return (@query[:startPage] * (@query[:count] + 1)) < @total_results\n end",
"title": ""
},
{
"docid": "a773e4a15a3181a378877fbc2b0b11b9",
"score": "0.54578215",
"text": "def available?()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "55cc1ca4b73193a92222d3f1d6e9f18b",
"score": "0.5454148",
"text": "def count_maybe\n rsvp.maybe.count\n end",
"title": ""
}
] |
c3c0c1375d3ade6060a90c071dfe2f93 | plain_texts_path end def new_text_path new_plain_text_path end | [
{
"docid": "fd456ed797163c570712a8e89f7a3e20",
"score": "0.0",
"text": "def register user, password\n visit '/signup'\n fill_in 'Name', :with => user\n fill_in 'Password', :with => password\n fill_in 'Confirm Password', :with => password\n click_button 'Connect'\nend",
"title": ""
}
] | [
{
"docid": "4fff9892adb65456eb42ae27cdb79f46",
"score": "0.6869084",
"text": "def new_text; end",
"title": ""
},
{
"docid": "4fff9892adb65456eb42ae27cdb79f46",
"score": "0.6869084",
"text": "def new_text; end",
"title": ""
},
{
"docid": "4fff9892adb65456eb42ae27cdb79f46",
"score": "0.6869084",
"text": "def new_text; end",
"title": ""
},
{
"docid": "5b49fba327925bb19ec0c1c35b10d32f",
"score": "0.62560916",
"text": "def create\n respond_to do |format|\n if @text.save\n format.html { redirect_to expanded_modification_path(@text.modifications.first), flash: {success: t(\"texts.created\")} }\n format.json { render json: @text, status: :created, location: @text }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e8e2e4a2e493d3944e30a8ab50c63ff4",
"score": "0.612725",
"text": "def handle_new_text model, transfer\n default_label.text = transfer[:new_text]\n end",
"title": ""
},
{
"docid": "39293ecaab181c801dd60c30f30242b2",
"score": "0.6085159",
"text": "def text_edit_text; end",
"title": ""
},
{
"docid": "fbfecf34c7cf7799e439537528ef1867",
"score": "0.5977307",
"text": "def add_text path\n if File.exist?(path)\n if (@doc.root.elements[\"Texts/Text[@name='#{File.basename(path)}']\"] == nil)\n filename = File.basename(path)\n filepath = File.expand_path(path)\n element = Element.new \"Text\"\n element.add_attribute \"name\", filename\n element.add_attribute \"path\", filepath\n element.add_attribute \"p\", \"false\"\n\n @doc.root.elements[\"Texts\"].add_element element \n \n #some mehtod updates the treestore\n \n #saves the project\n save\n puts \"#{File.expand_path(path)} was added to project\"\n else\n #Algun metodo que muestre un mensaje de error\n puts \"The text is already in the project\"\n end\n else\n #Algun metodo que muestre un mensaje de error\n puts \"The file doesn't exists\"\n end\n end",
"title": ""
},
{
"docid": "19f1b9e9d29a57f180d9a3e1e677f05a",
"score": "0.5969617",
"text": "def new_text\n attributes.fetch(:newText)\n end",
"title": ""
},
{
"docid": "36fd73f424d35e014110fa283dc4e155",
"score": "0.5967647",
"text": "def add_text\n if @ok\n @image.enter_edit_mode current_user.id\n if @image.add_text extract_textareas_params(params)\n @new_url = @image.editing_url\n else\n @new_url = ''\n end\n else\n @new_url = ''\n end\n end",
"title": ""
},
{
"docid": "31c524d6bdb56c97df094dff1f4efeee",
"score": "0.59407383",
"text": "def handle_new_text(model, transfer)\n default_label.text = transfer[:new_text]\n end",
"title": ""
},
{
"docid": "389029fe3540c36ca6dcf8eef84ecc86",
"score": "0.5904462",
"text": "def create\n @textpage = Textpage.new(params[:textpage])\n\n respond_to do |format|\n if @textpage.save\n format.html { redirect_to textpages_url }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"title": ""
},
{
"docid": "95219740de71c73e0643e1b301e2d8a2",
"score": "0.5886496",
"text": "def create\n @text = Text.new(text_params)\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: t(:successful_created, scope: :texts) }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "87222d73f2b102e76b27480f5aef0c68",
"score": "0.58802897",
"text": "def new\n @textpage = Textpage.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"title": ""
},
{
"docid": "becda4f8510f2c02a83737cf10dcd02e",
"score": "0.5860373",
"text": "def text_edits; end",
"title": ""
},
{
"docid": "8c3c628760a0da003b17f97b68949891",
"score": "0.5827802",
"text": "def create\n @text = Text.new(text_params)\n\n @text.user_id = current_user.id\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: \"Text was successfully created.\" }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "35e5ba6de990637f5059eb4711e153c7",
"score": "0.5814877",
"text": "def create\n @text = Text.new(params[:text])\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: 'Text was successfully created.' }\n format.json { render json: @text, status: :created, location: @text }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9f795731bac4e7b51fa05f4253581e76",
"score": "0.5811444",
"text": "def create\n @text = Text.new(params[:text])\n @text.favorite = 99\n\t\texpire_fragment(\"texts_index_tab1\")\n respond_to do |format|\n if @text.save\n format.html { redirect_to(@text, :notice => 'Text was successfully created.') }\n format.xml { render :xml => @text, :status => :created, :location => @text }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @text.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f5bed566f1f4a6d407094a6afb88c48f",
"score": "0.5810977",
"text": "def text_edit; end",
"title": ""
},
{
"docid": "f5bed566f1f4a6d407094a6afb88c48f",
"score": "0.5810977",
"text": "def text_edit; end",
"title": ""
},
{
"docid": "54bcf41bfa5446f192d1a57278a98d91",
"score": "0.57748497",
"text": "def text\n #just returns view\n end",
"title": ""
},
{
"docid": "3fb9740aefddaa8319a5ec1f795a4538",
"score": "0.57406235",
"text": "def new\n @user_id = current_user.id\n @text = Text.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text }\n end\n end",
"title": ""
},
{
"docid": "b32748cc25559ef4e51ce2ffa68775b4",
"score": "0.5738132",
"text": "def rezm_link_to_create_message\n link_to \"Write\", new_message_path\n end",
"title": ""
},
{
"docid": "afe4aedf00f682d9937efe852923be36",
"score": "0.5724306",
"text": "def new_button(text, *args)\n link_to(\"New #{text}\", path(:new, *args), :class => 'button new')\n end",
"title": ""
},
{
"docid": "7c435462f72f496d39387a6a2dff8ee6",
"score": "0.57112545",
"text": "def add_text(text); end",
"title": ""
},
{
"docid": "7c435462f72f496d39387a6a2dff8ee6",
"score": "0.57112545",
"text": "def add_text(text); end",
"title": ""
},
{
"docid": "7c435462f72f496d39387a6a2dff8ee6",
"score": "0.57112545",
"text": "def add_text(text); end",
"title": ""
},
{
"docid": "ce7ef08a882e694cd73d8d2ca38394b5",
"score": "0.5699784",
"text": "def set_text\n @text = Text.find(params[:textinfo_id])\n end",
"title": ""
},
{
"docid": "e67c7822e8698dc4a95f75f81ef7fb2f",
"score": "0.5693524",
"text": "def new\n @text = Text.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @text }\n end\n end",
"title": ""
},
{
"docid": "3a12d178b43d41b7cfc74017ba16df58",
"score": "0.5690303",
"text": "def text=(newtext)\n\t\t@text = newtext\n\tend",
"title": ""
},
{
"docid": "3a12d178b43d41b7cfc74017ba16df58",
"score": "0.5690303",
"text": "def text=(newtext)\n\t\t@text = newtext\n\tend",
"title": ""
},
{
"docid": "a58c1d7a05518df6c0e09afe71383528",
"score": "0.56881595",
"text": "def additional_text_edits; end",
"title": ""
},
{
"docid": "a58c1d7a05518df6c0e09afe71383528",
"score": "0.56881595",
"text": "def additional_text_edits; end",
"title": ""
},
{
"docid": "a46aee9457f5f883b91dc937f729209f",
"score": "0.56799215",
"text": "def text(text)\r\n end",
"title": ""
},
{
"docid": "5053e9df5575a90e370b575d9e6d0c15",
"score": "0.56664795",
"text": "def link_to_new_window(text, path)\n link_to(text, path, :target => \"_blank\")\n end",
"title": ""
},
{
"docid": "75125b86725b5e8880274b6d5500532c",
"score": "0.5625399",
"text": "def create\n text_str = params[:text]\n text = Text.new entext: text_str\n text.save\n line = parsing text_str\n line_translate line, text.id\n respond_to do |format|\n format.html { redirect_to :back }\n end\n\n end",
"title": ""
},
{
"docid": "df6683d0ffab94900dc7da125baabae2",
"score": "0.5621321",
"text": "def text=(newtext)\n @text = newtext\n end",
"title": ""
},
{
"docid": "bc629193749bb7156c94ec9659552e77",
"score": "0.5619639",
"text": "def new\n @text = Text.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text }\n end\n end",
"title": ""
},
{
"docid": "bc629193749bb7156c94ec9659552e77",
"score": "0.5619639",
"text": "def new\n @text = Text.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text }\n end\n end",
"title": ""
},
{
"docid": "bc629193749bb7156c94ec9659552e77",
"score": "0.5619639",
"text": "def new\n @text = Text.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text }\n end\n end",
"title": ""
},
{
"docid": "ce0fc92768aa23dddd2877170f271e36",
"score": "0.5618333",
"text": "def create\n @text = Text.new(text_params)\n\n respond_to do |format|\n if @text.save\n format.json { render :show, status: :created, location: api_text_url(@text) }\n else\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "413290141b030195fd1f25fd8b0562ad",
"score": "0.561809",
"text": "def set_text\n @text = Text.find(params[:id])\n end",
"title": ""
},
{
"docid": "b2db155f96df74c4408e095a63d10ab9",
"score": "0.55796987",
"text": "def set_text\n @text = Text.find(params[:id])\n end",
"title": ""
},
{
"docid": "b2db155f96df74c4408e095a63d10ab9",
"score": "0.55796987",
"text": "def set_text\n @text = Text.find(params[:id])\n end",
"title": ""
},
{
"docid": "b2db155f96df74c4408e095a63d10ab9",
"score": "0.55796987",
"text": "def set_text\n @text = Text.find(params[:id])\n end",
"title": ""
},
{
"docid": "b2db155f96df74c4408e095a63d10ab9",
"score": "0.55796987",
"text": "def set_text\n @text = Text.find(params[:id])\n end",
"title": ""
},
{
"docid": "b2db155f96df74c4408e095a63d10ab9",
"score": "0.55796987",
"text": "def set_text\n @text = Text.find(params[:id])\n end",
"title": ""
},
{
"docid": "b2db155f96df74c4408e095a63d10ab9",
"score": "0.55796987",
"text": "def set_text\n @text = Text.find(params[:id])\n end",
"title": ""
},
{
"docid": "b2db155f96df74c4408e095a63d10ab9",
"score": "0.55796987",
"text": "def set_text\n @text = Text.find(params[:id])\n end",
"title": ""
},
{
"docid": "b2db155f96df74c4408e095a63d10ab9",
"score": "0.55796987",
"text": "def set_text\n @text = Text.find(params[:id])\n end",
"title": ""
},
{
"docid": "b2db155f96df74c4408e095a63d10ab9",
"score": "0.55796987",
"text": "def set_text\n @text = Text.find(params[:id])\n end",
"title": ""
},
{
"docid": "b2db155f96df74c4408e095a63d10ab9",
"score": "0.55796987",
"text": "def set_text\n @text = Text.find(params[:id])\n end",
"title": ""
},
{
"docid": "b2db155f96df74c4408e095a63d10ab9",
"score": "0.55796987",
"text": "def set_text\n @text = Text.find(params[:id])\n end",
"title": ""
},
{
"docid": "b2db155f96df74c4408e095a63d10ab9",
"score": "0.55796987",
"text": "def set_text\n @text = Text.find(params[:id])\n end",
"title": ""
},
{
"docid": "cf37e405232837c2a5b6c25bb7359463",
"score": "0.55737424",
"text": "def create\n @text = Text.new(text_params)\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to user_collection_path(@user, @collection), notice: 'Text was successfully created.' }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "81a6087f5c5a19981a0e0e0b124cc2c8",
"score": "0.5572636",
"text": "def folder_textes\n @folder_textes ||= folder_lib + 'texte'\n end",
"title": ""
},
{
"docid": "0c48247af556f19498c0e2b52b62544e",
"score": "0.5560357",
"text": "def sentence_form_path(sentence)\n if sentence.new_record?\n sentences_path(sentence.lexicon)\n else\n sentence_path(sentence)\n end\n end",
"title": ""
},
{
"docid": "c9271b901160dcec7c249ecbc9987452",
"score": "0.5560014",
"text": "def create\n @text = Text.new(params[:text])\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: 'Yeah, Square was successfully created.'}\n format.json { render json: @text, status: :created, location: @text }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3566ca33ae7203ed5903c4ea34326aa3",
"score": "0.5558251",
"text": "def text(text)\n @current_text = text\n end",
"title": ""
},
{
"docid": "3566ca33ae7203ed5903c4ea34326aa3",
"score": "0.5558251",
"text": "def text(text)\n @current_text = text\n end",
"title": ""
},
{
"docid": "11dfd1747e93576c34a4fa7eff20c345",
"score": "0.5548257",
"text": "def new_tweet(text)\n end",
"title": ""
},
{
"docid": "a506fef0550d01b7d1a99903a3925ac9",
"score": "0.55378896",
"text": "def insert_text; end",
"title": ""
},
{
"docid": "c36b1ee31bc8ab3097ba7c7ca2ae0c9b",
"score": "0.550586",
"text": "def text=(new_text)\n raise 'Only leafs can have a text entry' unless leaf?\n self.value = new_text\n end",
"title": ""
},
{
"docid": "89becb995973c4ed639e90a989b1c85a",
"score": "0.55055565",
"text": "def append_text(text)\n # Interface method\n end",
"title": ""
},
{
"docid": "cc40a20f273cace4fc1b0f152e951933",
"score": "0.55053324",
"text": "def create\n @textfile = Textfile.new(params[:textfile])\n @textfile.needs_fs_update = true\n @textfile.modified_at = Time.now\n\n respond_to do |format|\n if @textfile.save\n flash[:notice] = 'Textfile was successfully created.'\n format.html { redirect_to(@textfile) }\n format.xml { render :xml => @textfile, :status => :created, :location => @textfile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @textfile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1283fb02121e9351024a21e1cf84d008",
"score": "0.5502068",
"text": "def create\n @user_text = UserText.new(user_text_params_create)\n\n @user_text.user_id = current_user.id\n @user_text.text_id = user_text_params_create[:text_id]\n respond_to do |format|\n if @user_text.save\n format.html { redirect_to @user_text, notice: \"User text was successfully created.\" }\n format.json { render :show, status: :created, location: @user_text }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @user_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fb6c0229023310763d912ba5c859511b",
"score": "0.54812664",
"text": "def create\n @template_text = TemplateText.new(params[:template_text])\n\n respond_to do |format|\n if @template_text.save\n format.html { redirect_to(@template_text, :notice => 'Texto criado com sucesso.') }\n format.xml { render :xml => @template_text, :status => :created, :location => @template_text }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @template_text.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "493700874571632d928011c79aac1e2d",
"score": "0.547883",
"text": "def create\n @simpletext = Simpletext.new(params[:simpletext])\n\n respond_to do |format|\n if @simpletext.save\n flash[:notice] = 'Simpletext was successfully created.'\n format.html { redirect_to(@simpletext) }\n format.xml { render :xml => @simpletext, :status => :created, :location => @simpletext }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @simpletext.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ef29addc6f926d217fdce9919e133997",
"score": "0.5475223",
"text": "def update_text(id, data)\n put \"texts/#{id}\", data\n end",
"title": ""
},
{
"docid": "825f748d54b5dcfe5619565e1a24dffe",
"score": "0.54693973",
"text": "def _text(text); end",
"title": ""
},
{
"docid": "c20700c10b16fb2ba46d708fc3919442",
"score": "0.5467877",
"text": "def link_to_existing_page(page, text = nil, html_options = {})\r\n link_to(\r\n text || page.plain_name, \r\n {:action => 'show', :link => page.link, :only_path => true},\r\n html_options)\r\n end",
"title": ""
},
{
"docid": "ef53f4789526d2d907dc98f1e3a4c0a8",
"score": "0.5467425",
"text": "def new\n @simpletext = Simpletext.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @simpletext }\n end\n end",
"title": ""
},
{
"docid": "04e785b9e93ab7258a391662cd89c751",
"score": "0.5464379",
"text": "def adjust_plain_text(plain_text, content_at_file, config)\n appendix = []\n\n # Append id contents only if file has id\n if content_at_file.contents.index('.id_paragraph')\n add_rt_id_paragraph_environment_contents(appendix, content_at_file, config)\n end\n\n\n # Append RtIdRecording if it is to be included\n if @options[:include_id_recording]\n appendix << convert_latex_to_plain_text(config.setting(:pdf_export_id_recording, false))\n end\n # Append RtIdSeries\n if (rtids = config.setting(:pdf_export_id_series, false))\n appendix << convert_latex_to_plain_text(rtids)\n # The RtIdParagraph may not be in the content AT file but in the\n # id_series setting. If so, then we need to append additional content\n # here.\n if rtids.index('RtIdParagraph')\n add_rt_id_paragraph_environment_contents(appendix, content_at_file, config)\n end\n end\n\n # Remove nils, join with space before and between each segment\n r = plain_text + ' ' + appendix.compact.join(' ')\n # squeeze whitespace runs (e.g., \"\\n \")\n r.gsub(/\\s{2,}/, ' ')\n end",
"title": ""
},
{
"docid": "33fe56e7aee7894247caa47479a2bfca",
"score": "0.54581565",
"text": "def shellescaped_text\n case @text\n when File, Tempfile\n \"@#{@text.path.shellescape}\"\n when Pathname\n \"@#{@text.to_s.shellescape}\"\n else\n @text.to_s.shellescape\n end\n end",
"title": ""
},
{
"docid": "4f2f1a11e7047e9f19587e760e62272d",
"score": "0.54534316",
"text": "def from_file\n @text = Text.new\n\t\t@text.fyle_id = params[:id]\n\t\trender :new\n\tend",
"title": ""
},
{
"docid": "1354ada03f8da26bc55ec53bb6745fa5",
"score": "0.54481876",
"text": "def set_text\n @text = Text.find(params[:id])\n end",
"title": ""
},
{
"docid": "793a51f70bb1d04eda06bec8ed8fa92b",
"score": "0.5447705",
"text": "def set_text_document\n @text_document = TextDocument.find(params[:id])\n end",
"title": ""
},
{
"docid": "8d53e847011f036e5459e60145e4f4ff",
"score": "0.544718",
"text": "def create\n @body_text = BodyText.new(body_text_params)\n\n respond_to do |format|\n if @body_text.save\n format.html { redirect_to @body_text, notice: 'Body text was successfully created.' }\n format.json { render :show, status: :created, location: @body_text }\n else\n format.html { render :new }\n format.json { render json: @body_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9406249beebfe04733d6996fcf51e6ce",
"score": "0.5443424",
"text": "def build_new_text(client)\n repository.build_new(client.id, type: 'text')\n end",
"title": ""
},
{
"docid": "6c212cbf16716cba9acbcefd4312680d",
"score": "0.5434978",
"text": "def append_text(text)\n self.make_dirname.open(\"a\"){|f| f.write(text) }\n self\n end",
"title": ""
},
{
"docid": "73d53f2e223d3e1941c2a1f899390902",
"score": "0.54344225",
"text": "def update\n respond_to do |format|\n if @text.update(text_params)\n format.html { redirect_to @text, notice: t(:successful_updated, scope: :texts) }\n format.json { render :show, status: :ok, location: @text }\n else\n format.html { render :edit }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "373731004e2e70257b4438eba6dad391",
"score": "0.54300714",
"text": "def update\n respond_to do |format|\n if @text.update(text_params)\n format.json { render :show, status: :ok, location: @text }\n else\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d95b558decb24cd6cca98b68b67e2eb2",
"score": "0.54292005",
"text": "def new\n @textfile = Textfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @textfile }\n end\n end",
"title": ""
},
{
"docid": "81230884699b4e2624ac477d6ce4d2dd",
"score": "0.54282284",
"text": "def update_text(node, new_text) #:doc:\n node.send(:native_content=, new_text)\n end",
"title": ""
},
{
"docid": "81230884699b4e2624ac477d6ce4d2dd",
"score": "0.54282284",
"text": "def update_text(node, new_text) #:doc:\n node.send(:native_content=, new_text)\n end",
"title": ""
},
{
"docid": "cc0c3b98d8a7006cb483fb0f16fca56d",
"score": "0.5427248",
"text": "def create\n @info_text = InfoText.new(info_text_params)\n\n respond_to do |format|\n if @info_text.save\n format.html { redirect_to @info_text, notice: 'Text skapad' }\n format.json { render action: 'show', status: :created, location: @info_text }\n else\n format.html { render action: 'new' }\n format.json { render json: @info_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e4824c766f28c052534e7b7a9ddb92ad",
"score": "0.5422189",
"text": "def create\n @licenses = License.all\n @text = Text.create(params[:text])\n\n respond_to do |format|\n if @text.save\n format.html { redirect_to texts_url, :notice => 'Successfully created' }\n format.json { render :json => @text, :status => :created, :location => @text }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @text.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "28f5f7c46d60384b8f3186b636ce152d",
"score": "0.5421124",
"text": "def text_document; end",
"title": ""
},
{
"docid": "28f5f7c46d60384b8f3186b636ce152d",
"score": "0.5421124",
"text": "def text_document; end",
"title": ""
},
{
"docid": "28f5f7c46d60384b8f3186b636ce152d",
"score": "0.5421124",
"text": "def text_document; end",
"title": ""
},
{
"docid": "28f5f7c46d60384b8f3186b636ce152d",
"score": "0.5421124",
"text": "def text_document; end",
"title": ""
},
{
"docid": "28f5f7c46d60384b8f3186b636ce152d",
"score": "0.5421124",
"text": "def text_document; end",
"title": ""
},
{
"docid": "28f5f7c46d60384b8f3186b636ce152d",
"score": "0.5421124",
"text": "def text_document; end",
"title": ""
},
{
"docid": "28f5f7c46d60384b8f3186b636ce152d",
"score": "0.5421124",
"text": "def text_document; end",
"title": ""
},
{
"docid": "28f5f7c46d60384b8f3186b636ce152d",
"score": "0.5421124",
"text": "def text_document; end",
"title": ""
},
{
"docid": "28f5f7c46d60384b8f3186b636ce152d",
"score": "0.5421124",
"text": "def text_document; end",
"title": ""
},
{
"docid": "28f5f7c46d60384b8f3186b636ce152d",
"score": "0.5421124",
"text": "def text_document; end",
"title": ""
},
{
"docid": "28f5f7c46d60384b8f3186b636ce152d",
"score": "0.5421124",
"text": "def text_document; end",
"title": ""
},
{
"docid": "28f5f7c46d60384b8f3186b636ce152d",
"score": "0.5421124",
"text": "def text_document; end",
"title": ""
},
{
"docid": "28f5f7c46d60384b8f3186b636ce152d",
"score": "0.5421124",
"text": "def text_document; end",
"title": ""
},
{
"docid": "f42e364d7ad6b5fb05c54f7be58ed0b6",
"score": "0.5415505",
"text": "def text_params\n params.require(:text).permit(:teacher, :univ, :user_id, :textinfo_id, :lecture_name, :textbook_name, :price, :comment, :file, :status)\n end",
"title": ""
},
{
"docid": "a49cd03520378a8e4479e29e4d9222c5",
"score": "0.54044574",
"text": "def share_text\n dropbox_folder = \"~/Dropbox/text_source/\"\n FileUtils.mkdir_p(target_folder) unless File.directory?(target_folder)\n text_path = path + \"/#{id}.md\"\n system(\"cp #{text_path} #{dropbox_folder}/\") if File.exist?(text_path)\n end",
"title": ""
}
] |
0cd45ff018efb24c0ff33234a8514a79 | Convert a string representation of a unit into an array of terms | [
{
"docid": "3ecfe7604c99841a19e454488c526220",
"score": "0.0",
"text": "def decompose(expression)\n Decomposer.parse(expression)\n end",
"title": ""
}
] | [
{
"docid": "7ed70388dcb1658c9dcc9f79d8fa823a",
"score": "0.6292385",
"text": "def word_to_array(word)\n word.downcase.scan /[a-pr-z]|qu/\n end",
"title": ""
},
{
"docid": "bf02beb4cd94fd4255e23bbc1da50e74",
"score": "0.62525743",
"text": "def word_to_array(word)\n word.downcase.scan /[a-pr-z]|qu|q/\n end",
"title": ""
},
{
"docid": "8fdafbcd27198d2a2b1cb0b65c982977",
"score": "0.6231948",
"text": "def term_to_array(term)\n term = term.join(' ') if term.is_a?(Array)\n term.downcase!\n term.gsub!(/\\Wand\\W|\\Wor\\W/u, ' ')\n term.gsub!( /[^\\w\\s]/u, '' )\n term.gsub!(/\\s+/u, ' ' )\n return [] if term.empty?\n terms = term.split(/\\s/)\n terms.reject{|t| t.nil? or t.empty?}\n end",
"title": ""
},
{
"docid": "e46a3e9dd147ab40ea714738de3c5e32",
"score": "0.61976063",
"text": "def terms\n unit.terms\n end",
"title": ""
},
{
"docid": "e46a3e9dd147ab40ea714738de3c5e32",
"score": "0.61976063",
"text": "def terms\n unit.terms\n end",
"title": ""
},
{
"docid": "1d8ee64ac5bcca07e5ea67d4494e0396",
"score": "0.6072096",
"text": "def get_unit_names\n units = \"\"\n current = \"\"\n\n @si_string.chars.each do |char|\n next if char == \" \" # Skip if the character is a white space\n\n # Handles the case if the character is an operator \"*\", \"/\", \"(\", or \")\"\n if [\"/\", \"*\", \"(\", \")\"].include?(char)\n units += @si_counter_part[current][:unit] if current.length > 0\n units += char\n current = \"\" # Reset the current to \"\"\n else # Append the character to the current (name or symbol)\n current += char\n end\n end\n\n # append the last unit from current (name, or symbol)\n units += @si_counter_part[current][:unit] if current.length > 0\n units\n end",
"title": ""
},
{
"docid": "1031e514e4859a747604bcba798ed1e6",
"score": "0.5689043",
"text": "def to_array\n word.chars\n end",
"title": ""
},
{
"docid": "8d79a6c26d6e9530c4680ca22afad23f",
"score": "0.5570377",
"text": "def terms\n to_quad.map {|t| t.respond_to?(:terms) ? t.terms : t}.flatten.compact\n end",
"title": ""
},
{
"docid": "e06c8099b50347757f9567b9b1a2b549",
"score": "0.556323",
"text": "def decomp_term(term_string)\n\n term_list = term_string.split(/\\n/)\n return term_list\nend",
"title": ""
},
{
"docid": "098251032b9f55e997569371ad8ab0db",
"score": "0.54823154",
"text": "def terms\n string = @description\n grammar = description_grammar\n\n # trim last part of description, if necessary\n if grammar[:trim_after]\n string = string.split(grammar[:trim_after])[0]\n end\n\n # split into terms, remove any unnecessary expressions\n terms = string.split(grammar[:dividers])\n .map {|t| t.sub(grammar[:trim_expressions], '')\n .strip\n .capitalize }\n .select {|t| t.match(/\\w/) }\n\n # attempt to translate to English if necessary\n if grammar[:language] != 'en'\n terms.map! {|t| Translator.instance.translate(t, grammar[:language], terms) }\n end\n\n terms\n end",
"title": ""
},
{
"docid": "58227060755a2dea4c36c3d63087c8e5",
"score": "0.5482124",
"text": "def units\n return \"\" if @numerator == UNITY_ARRAY && @denominator == UNITY_ARRAY\n return @unit_name unless @unit_name.nil?\n output_n = []\n output_d =[] \n num = @numerator.clone.compact\n den = @denominator.clone.compact\n if @numerator == UNITY_ARRAY\n output_n << \"1\"\n else\n num.each_with_index do |token,index|\n if token && @@PREFIX_VALUES[token] then\n output_n << \"#{@@OUTPUT_MAP[token]}#{@@OUTPUT_MAP[num[index+1]]}\"\n num[index+1]=nil\n else\n output_n << \"#{@@OUTPUT_MAP[token]}\" if token\n end\n end\n end\n if @denominator == UNITY_ARRAY\n output_d = ['1']\n else\n den.each_with_index do |token,index|\n if token && @@PREFIX_VALUES[token] then\n output_d << \"#{@@OUTPUT_MAP[token]}#{@@OUTPUT_MAP[den[index+1]]}\"\n den[index+1]=nil\n else\n output_d << \"#{@@OUTPUT_MAP[token]}\" if token\n end\n end\n end\n on = output_n.reject {|x| x.empty?}.map {|x| [x, output_n.find_all {|z| z==x}.size]}.uniq.map {|x| (\"#{x[0]}\".strip+ (x[1] > 1 ? \"^#{x[1]}\" : ''))}\n od = output_d.reject {|x| x.empty?}.map {|x| [x, output_d.find_all {|z| z==x}.size]}.uniq.map {|x| (\"#{x[0]}\".strip+ (x[1] > 1 ? \"^#{x[1]}\" : ''))}\n out = \"#{on.join('*')}#{od == ['1'] ? '': '/'+od.join('*')}\".strip \n @unit_name = out unless self.kind == :temperature\n return out\n end",
"title": ""
},
{
"docid": "eed3b4504a487212f8473ed500f8b1a1",
"score": "0.5476864",
"text": "def tokens(str)\n token_string = []\n operations = [\"+\", \"-\", \"*\", \"/\"]\n str.split(\" \").each do |element|\n if operations.include?(element)\n token_string.push(element.to_sym)\n else\n token_string.push(element.to_i)\n end\n end\n token_string\n end",
"title": ""
},
{
"docid": "7d848aeeb8079e74418d93ea503eec90",
"score": "0.5474031",
"text": "def test_parse_tricky_units\n unit1 = Unit.new('1 mm') #sometimes parsed as 'm*m'\n assert_equal ['<milli>','<meter>'], unit1.numerator\n unit2 = Unit.new('1 cd') # could be a 'centi-day' instead of a candela\n assert_equal ['<candela>'], unit2.numerator\n unit3 = Unit.new('1 min') # could be a 'milli-inch' instead of a minute\n assert_equal ['<minute>'], unit3.numerator\n unit4 = Unit.new('1 ft') # could be a 'femto-ton' instead of a foot\n assert_equal ['<foot>'], unit4.numerator\n unit5 = \"1 atm\".unit\n assert_equal ['<atm>'], unit5.numerator\n unit6 = \"1 doz\".unit\n assert_equal ['<dozen>'], unit6.numerator\n end",
"title": ""
},
{
"docid": "c5f2779cd1fee2acdfecec575bb6054e",
"score": "0.5424117",
"text": "def split_to_parts(str)\n parts = []\n loop do\n coefficient, unit, remains = str.partition(Regexp.union(DELIMITERS.keys))\n parts.push([coefficient, unit])\n str = remains\n break if str == \"\"\n end\n parts\n end",
"title": ""
},
{
"docid": "70e4fe248c4bc2ac9934b9f0d00377d8",
"score": "0.54118335",
"text": "def unit\n letters(parts[3])\n end",
"title": ""
},
{
"docid": "4147f1677b7db96152243e5f317dcff3",
"score": "0.54061055",
"text": "def dc_eval_to_array(expression)\n expression.split(/\\ |\\,|\\(|\\)/).delete_if {|e| e.blank? }.map {|e| e.gsub(/\\'|\\\"/,'').strip }\nend",
"title": ""
},
{
"docid": "9ee84aa8bb45c0a04dc7f91739290610",
"score": "0.53973496",
"text": "def parse_record_into_array(string, index, length_range = nil)\n chunk = nth_chunk(index, string)\n raise \"No chunk for index #{index}\" unless chunk\n actual_word_length = chunk.unpack(\"C\")[0]\n if !length_range || length_range.include?(actual_word_length)\n # returns [word, frequency]\n chunk.unpack(\"xa#{actual_word_length}@#{@word_length}N\")\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "f7a4256ae6e830f4566ddc509851be1e",
"score": "0.53934926",
"text": "def input_to_array(string)\n array = string.scan(/./)\n array = array.map do |element|\n if element =~ /[1-9]/\n element.to_i\n else\n nil\n end\n end\n model = []\n model[0] = array[0..8]\n model[1] = array[9..17]\n model[2] = array[18..26]\n model[3] = array[27..35]\n model[4] = array[36..44]\n model[5] = array[45..53]\n model[6] = array[54..62]\n model[7] = array[63..71]\n model[8] = array[72..80]\n model\nend",
"title": ""
},
{
"docid": "c95ec91b9e91d3549da6b1af58d3de9d",
"score": "0.539004",
"text": "def parse_terms_array(obj)\n array = obj.is_a?(Array) ? obj : Array(obj[:terms])\n\n array.map do |a| \n Hashie::Mash.new.tap do |t|\n t.start_date = a[:start]\n t.end_date = a[:end]\n t.senate_class = a[:class]\n t.state = a[:state]\n t.district = a[:district]\n t.chamber = Chamber a[:type]\n t.party = PoliticalParty a[:party]\n end\n end\n end",
"title": ""
},
{
"docid": "d623d1c1efaff3bc0996508a9453e1f9",
"score": "0.5389232",
"text": "def convert_line_to_array(line)\n line.scan /\\w/\n end",
"title": ""
},
{
"docid": "498a111217b8a5acb7ac57c3c82d02d9",
"score": "0.5353455",
"text": "def unit(name, symbol, quantity, options={})\n type = UnitType.new(self, name, symbol, quantity, options)\n type.terms.each do |key|\n next if /\\W/ =~ key.to_s # can't use non-words characters\n types[key.to_sym] = type\n end\n\n # define au conversions\n au_conversion(type)\n end",
"title": ""
},
{
"docid": "a048d7cbab70bce24f609a24b1cb9654",
"score": "0.53522503",
"text": "def words_to_arrays(words)\n constructor = ArrayConstructor.new\n words.sort.each do |word|\n constructor.add(word)\n end\n constructor.show\n constructor.dump\n end",
"title": ""
},
{
"docid": "754d61a5c9674954529fb853ebea4d84",
"score": "0.5344146",
"text": "def string_to_array\n\nend",
"title": ""
},
{
"docid": "9372ce36bd88e60c51c10bb7619b7423",
"score": "0.53430426",
"text": "def string_to_array(string)\n string.split(\" \")\nend",
"title": ""
},
{
"docid": "ed59c1f1940c2323ae72ace0b5442f5e",
"score": "0.53423613",
"text": "def string_to_array(names_to_string)\n \tnames_to_string.split(\"\")\nend",
"title": ""
},
{
"docid": "ed59c1f1940c2323ae72ace0b5442f5e",
"score": "0.53423613",
"text": "def string_to_array(names_to_string)\n \tnames_to_string.split(\"\")\nend",
"title": ""
},
{
"docid": "fff8a76043fa220034ff86cae1e360dc",
"score": "0.5323309",
"text": "def split_units(input, **options)\n options.reverse_merge!({\n input_language: \"ENGLISH\",\n output_language: \"ARABIC\"\n })\n options.symbolize_keys!\n\n # input = \"0.5l of Milk with 10gm Sugar\"\n # input = \"0.5l of Milk\"\n\n matches = input.scan(UNIT_REGEX)\n # e.g: [[\"0.5\", \"l\"]]\n return nil if matches.empty?\n\n # e.g: [[\"0.5\", \"l\"]].first.first => \"0.5\"\n amount = matches[0][0] #.try(:strip)\n return nil unless amount\n\n possible_unit = matches[0][2] #.try(:strip)\n return nil unless possible_unit\n\n # FIXME - need to populate the dict for units from database\n # Right now it is hardcoded at the top of this module\n possible_units = Translation::UNITS.map{|u| [MarkovChainTranslatorAlgo2.probability_match(possible_unit, u), u]}\n\n # Sorting the Score List\n sorted_possible_units = possible_units.sort_by {|x| x[0]}\n\n score_hash = {}\n translation = translate_word_from_database(possible_unit, options)\n unit_score = sorted_possible_units[0].first # the score of the unit word\n\n # if options[:input_language].upcase == \"ARABIC\"\n # unit_word = [possible_unit, ' ', amount].compact.join('').strip\n # else\n # unit_word = [amount, ' ', possible_unit].compact.join('').strip\n # end\n unit_word = [amount, ' ', possible_unit].compact.join('').strip\n\n # if options[:output_language].upcase == \"ARABIC\"\n # unit_translation = [translation, ' ', amount].compact.join('').strip\n # else\n # unit_translation = [amount, ' ', translation].compact.join('').strip\n # end\n unit_translation = [amount, ' ', translation].compact.join('').strip\n\n score_hash[unit_word] = {score: unit_score, translation: unit_translation}\n\n # e.g of score_hash = {\"grams\"=>{:score=>0, :translation=>\"جرامات\"}, \"10\"=>{:score=>0}, \"Corn\"=>{:score=>0, :translation=>\"ذرة\"}}\n\n return score_hash\n end",
"title": ""
},
{
"docid": "8e50a9193439697dc3105fa3ab78bc25",
"score": "0.5284485",
"text": "def to_array(word)\n\tarr = []\n\tword.each_char do |x|\n\t\tarr << x \t\t\t#appending to array arr[]\n\tend\n\treturn arr\nend",
"title": ""
},
{
"docid": "748f977116fca7b2ef3057a6d7916595",
"score": "0.5279718",
"text": "def str2array(str)\n main_arr = []\n str = str.gsub(/\\r/, '')\n str_arr = str.split(/\\n/)\n str_arr.each do |s|\n node = s.split(': ')\n sim_arr = [node[0], node[1].strip] \n main_arr << sim_arr\n end\n return main_arr\n end",
"title": ""
},
{
"docid": "b8018c11caf6ae05f55d2b13a050c10d",
"score": "0.52775913",
"text": "def get_equation_array(equation_string)\n build_equation = EquationBuilder.new\n equation_string.each_char do |char|\n # char must be one of the following: 0123456789+-/^*%.()adsubtrcmulipyvowe\n # If build_equation only checks for invalid characters and does NOT check\n # for invalid equations.\n if !build_equation.has_allowable_character(char)\n puts \"👎 #{char} is not allowed! 🙅\\n\\n\"\n return []\n end\n build_equation.add_char(char)\n end\n return build_equation.get_equation_array\nend",
"title": ""
},
{
"docid": "95f65de12792bd95415c0166eccee78a",
"score": "0.52523845",
"text": "def parse(passed_unit_string = '0')\n unit_string = passed_unit_string.dup\n unit_string = \"#{Regexp.last_match(1)} USD\" if unit_string =~ /\\$\\s*(#{NUMBER_REGEX})/\n unit_string.gsub!(\"\\u00b0\".force_encoding('utf-8'), 'deg') if unit_string.encoding == Encoding::UTF_8\n\n unit_string.gsub!(/[%'\"#]/, '%' => 'percent', \"'\" => 'feet', '\"' => 'inch', '#' => 'pound')\n\n if defined?(Complex) && unit_string =~ COMPLEX_NUMBER\n real, imaginary, unit_s = unit_string.scan(COMPLEX_REGEX)[0]\n result = self.class.new(unit_s || '1') * Complex(real.to_f, imaginary.to_f)\n copy(result)\n return\n end\n\n if defined?(Rational) && unit_string =~ RATIONAL_NUMBER\n sign, proper, numerator, denominator, unit_s = unit_string.scan(RATIONAL_REGEX)[0]\n sign = sign == '-' ? -1 : 1\n rational = sign * (proper.to_i + Rational(numerator.to_i, denominator.to_i))\n result = self.class.new(unit_s || '1') * rational\n copy(result)\n return\n end\n\n unit_string =~ NUMBER_REGEX\n unit = self.class.cached.get(Regexp.last_match(2))\n mult = Regexp.last_match(1).nil? ? 1.0 : Regexp.last_match(1).to_f\n mult = mult.to_int if mult.to_int == mult\n\n if unit\n copy(unit)\n @scalar *= mult\n @base_scalar *= mult\n return self\n end\n\n while unit_string.gsub!(/(<#{self.class.unit_regex})><(#{self.class.unit_regex}>)/, '\\1*\\2')\n # collapse <x><y><z> into <x*y*z>...\n end\n # ... and then strip the remaining brackets for x*y*z\n unit_string.gsub!(/[<>]/, '')\n\n if unit_string =~ TIME_REGEX\n hours, minutes, seconds, microseconds = unit_string.scan(TIME_REGEX)[0]\n raise ArgumentError, 'Invalid Duration' if [hours, minutes, seconds, microseconds].all?(&:nil?)\n\n result = self.class.new(\"#{hours || 0} h\") +\n self.class.new(\"#{minutes || 0} minutes\") +\n self.class.new(\"#{seconds || 0} seconds\") +\n self.class.new(\"#{microseconds || 0} usec\")\n copy(result)\n return\n end\n\n # Special processing for unusual unit strings\n # feet -- 6'5\"\n feet, inches = unit_string.scan(FEET_INCH_REGEX)[0]\n if feet && inches\n result = self.class.new(\"#{feet} ft\") + self.class.new(\"#{inches} inches\")\n copy(result)\n return\n end\n\n # weight -- 8 lbs 12 oz\n pounds, oz = unit_string.scan(LBS_OZ_REGEX)[0]\n if pounds && oz\n result = self.class.new(\"#{pounds} lbs\") + self.class.new(\"#{oz} oz\")\n copy(result)\n return\n end\n\n # stone -- 3 stone 5, 2 stone, 14 stone 3 pounds, etc.\n stone, pounds = unit_string.scan(STONE_LB_REGEX)[0]\n if stone && pounds\n result = self.class.new(\"#{stone} stone\") + self.class.new(\"#{pounds} lbs\")\n copy(result)\n return\n end\n\n # more than one per. I.e., \"1 m/s/s\"\n raise(ArgumentError, \"'#{passed_unit_string}' Unit not recognized\") if unit_string.count('/') > 1\n raise(ArgumentError, \"'#{passed_unit_string}' Unit not recognized\") if unit_string =~ /\\s[02-9]/\n\n @scalar, top, bottom = unit_string.scan(UNIT_STRING_REGEX)[0] # parse the string into parts\n top.scan(TOP_REGEX).each do |item|\n n = item[1].to_i\n x = \"#{item[0]} \"\n if n >= 0\n top.gsub!(/#{item[0]}(\\^|\\*\\*)#{n}/) { x * n }\n elsif n.negative?\n bottom = \"#{bottom} #{x * -n}\"\n top.gsub!(/#{item[0]}(\\^|\\*\\*)#{n}/, '')\n end\n end\n if bottom\n bottom.gsub!(BOTTOM_REGEX) { \"#{Regexp.last_match(1)} \" * Regexp.last_match(2).to_i }\n # Separate leading decimal from denominator, if any\n bottom_scalar, bottom = bottom.scan(NUMBER_UNIT_REGEX)[0]\n end\n\n @scalar = @scalar.to_f unless @scalar.nil? || @scalar.empty?\n @scalar = 1 unless @scalar.is_a? Numeric\n @scalar = @scalar.to_int if @scalar.to_int == @scalar\n\n bottom_scalar = 1 if bottom_scalar.nil? || bottom_scalar.empty?\n bottom_scalar = if bottom_scalar.to_i == bottom_scalar\n bottom_scalar.to_i\n else\n bottom_scalar.to_f\n end\n\n @scalar /= bottom_scalar\n\n @numerator ||= UNITY_ARRAY\n @denominator ||= UNITY_ARRAY\n @numerator = top.scan(self.class.unit_match_regex).delete_if(&:empty?).compact if top\n @denominator = bottom.scan(self.class.unit_match_regex).delete_if(&:empty?).compact if bottom\n\n # eliminate all known terms from this string. This is a quick check to see if the passed unit\n # contains terms that are not defined.\n used = \"#{top} #{bottom}\".to_s.gsub(self.class.unit_match_regex, '').gsub(%r{[\\d*, \"'_^/$]}, '')\n raise(ArgumentError, \"'#{passed_unit_string}' Unit not recognized\") unless used.empty?\n\n @numerator = @numerator.map do |item|\n self.class.prefix_map[item[0]] ? [self.class.prefix_map[item[0]], self.class.unit_map[item[1]]] : [self.class.unit_map[item[1]]]\n end.flatten.compact.delete_if(&:empty?)\n\n @denominator = @denominator.map do |item|\n self.class.prefix_map[item[0]] ? [self.class.prefix_map[item[0]], self.class.unit_map[item[1]]] : [self.class.unit_map[item[1]]]\n end.flatten.compact.delete_if(&:empty?)\n\n @numerator = UNITY_ARRAY if @numerator.empty?\n @denominator = UNITY_ARRAY if @denominator.empty?\n self\n end",
"title": ""
},
{
"docid": "91414002a810af8e4f3f87778436b3a9",
"score": "0.5250337",
"text": "def strand_to_array(s)\n s.respond_to?(:to_a) ? s.to_a : s.split('')\n end",
"title": ""
},
{
"docid": "fe15e1ba719905c5fe24d9d533c4c440",
"score": "0.5246191",
"text": "def to_metric(str)\n num, unit = str.split\n to_numeric(num).send(unit.to_sym)\nend",
"title": ""
},
{
"docid": "152268021c4af965a466f4afa8e19c8c",
"score": "0.524557",
"text": "def build_units(units)\n units.map do |unit|\n if Unit.exists?(name: unit['name'])\n Unit.find_by(name: unit['name'])\n else\n Unit.new(unit)\n end\n end\n end",
"title": ""
},
{
"docid": "9949358fb8da62b81df37ac9e473f3db",
"score": "0.524324",
"text": "def convert_string_to_array(input_string)\r\n\tinput_string.split(\"\")\r\nend",
"title": ""
},
{
"docid": "c01c3b495efdad03addcb7c001924c07",
"score": "0.52426034",
"text": "def parse(str, locale = Locale.default)\n elements = str.to_s.scan(NUMERIC_REGEXP).map do |(v, us)|\n unit = us.nil? ? default : find_unit(us, locale)\n raise ArgumentError, \"Unit cannot be determined (#{us})\" unless unit\n value = Integer(v) rescue Float(v)\n new(value, unit)\n end\n # Coalesce the elements into a single Measure instance in \"expression base\" units.\n # The expression base is the first provided unit in an expression like \"1 mile 200 feet\"\n elements.inject do |t, e|\n raise ArgumentError, \"Inconsistent units in compound metric\" unless t.unit.system == e.unit.system\n converted_value = e.convert(t.unit)\n new(t + converted_value, t.unit)\n end\n end",
"title": ""
},
{
"docid": "32459b29d682c4a02a0c5d166f830b93",
"score": "0.52412826",
"text": "def generate_array\n array = @string.scan(/.../) \n array.join.scan(/........./)\n end",
"title": ""
},
{
"docid": "b101a28d2041c0c686398886f850b60c",
"score": "0.5231909",
"text": "def unit_list=(unit_string)\n if type == \"list\"\n self.unit = unit_string.split(',').map(&:strip)\n elsif type == \"boolean\"\n self.unit = \"\"\n else\n self.unit = unit_string\n end\n end",
"title": ""
},
{
"docid": "f9d15761a1773721397722ac3809341e",
"score": "0.5226582",
"text": "def nem12_uom\r\n return [\r\n\r\n# Unit of power\r\n 'wh',\r\n 'kwh',\r\n 'mwh',\r\n\r\n 'varh',\r\n 'kvarh',\r\n 'mvarh',\r\n\r\n 'vah',\r\n 'kvah',\r\n 'mvah',\r\n\r\n# Unit of something else\r\n 'w',\r\n 'kw',\r\n 'mw',\r\n\r\n 'var',\r\n 'mvar',\r\n 'kvar',\r\n\r\n 'va',\r\n 'kva',\r\n 'mva',\r\n\r\n 'v',\r\n 'kv',\r\n\r\n 'a',\r\n 'ka',\r\n\r\n 'pf'\r\n ]\r\n end",
"title": ""
},
{
"docid": "15a37c0f9e94a385a2c1551b5e88888a",
"score": "0.5221994",
"text": "def terms(line)\n col = 0\n line.scan(/(\\s+|[-+]?\\d+\\.?\\d*|-+|\\w+|.)/).flatten.collect { |s| [s,col...(col+=s.length)] }\n end",
"title": ""
},
{
"docid": "ffe6c90e90dc95609b392bd99c58b178",
"score": "0.52187073",
"text": "def polynom_parser(str)\n copy_str = str.clone\n sgn_array = [] # Array of signs\n if copy_str[0] != '-'\n sgn_array.push('+')\n else\n sgn_array.push('-')\n copy_str[0] = ''\n end\n token = copy_str.split(/[-+]/)\n (0..copy_str.size-1).each do |i|\n sgn_array.push(copy_str[i]) if copy_str[i] == '-' || copy_str[i] == '+'\n end\n size = token.size - 1\n coeff = [] # Array of coefficients\n (0..size).each do |i|\n degree = token[i].split('*') # Split by '*' to get coefficient and degree\n degree[0] == 'x' ? coeff[i] = 1.0 : coeff[i] = degree[0].to_f\n coeff[i] *= -1 if sgn_array[i] == '-'\n end\n coeff\n end",
"title": ""
},
{
"docid": "ac5f6425abbd7218ae7109e0db39b87f",
"score": "0.5217838",
"text": "def tokenize(str = '')\n puts \"STRING: #{str}\"\n tokens = [ ]\n\n n = 0\n m = 0\n while (n < str.length)\n char = str[n]\n\t # puts \"Checking character '#{char}' (index #{n})\"\n\n if (char == ' ')\n\t # puts \"Character is space. Skipping.\"\n n += 1\n elsif (char == '(')\n\t # puts \"Character is open parens.\"\n tokens.push({:type => :paren, :val => '('})\n n += 1\n elsif (char == ')')\n\t # puts \"Character is close parens.\"\n tokens.push({:type => :paren, :val => ')'})\n n += 1\n elsif ((char == '\"') || (char == \"'\"))\n\t # puts \"Character is a quote.\"\n val = str[(n + 1), (str.length - (n + 1))].collect_to(lambda { |c| (c == char) })\n tokens.push({:type => :term, :val => val})\n n += (val.length + 2) # Skip the quote characters.\n\t # puts \"Got term: #{tokens}\"\n elsif (char == '@')\n\t # puts \"Character is an attribute marker.\"\n val = str[(n + 1), (str.length - (n + 1))].collect_to(lambda { |c| ['(', ' '].include?(c) })\n tokens.push({:type => :attribute, :val => val})\n n += (val.length + 1) # Discard the `@`\n\t # puts \"Got attribute: #{tokens}\"\n else\n\t # puts \"Character is a character.\"\n val = str[n, (str.length - n)].collect_to(lambda { |c| [' ', '(', ')', '@'].include?(c) })\n tokens.push({:type => self.get_term_type(val), :val => val})\n n += val.length\n\t # puts \"Got term: #{tokens}\"\n end\n\n # Just to prevent infinite loops.\n if (n == m)\n puts \"BREAKING TOKENIZE WHILE LOOOP\"\n break\n else\n m = n\n end\n end\n\n\t puts \"TOKENS: #{tokens}\"\n return tokens\n end",
"title": ""
},
{
"docid": "923df728ea87c3892daeaeedda666358",
"score": "0.52082795",
"text": "def tokens(x)\n token_array = []\n\n x.split.each do |z| \n if z[/\\d+/] # if number\n token_array << z.to_i\n elsif z[/(\\+|\\-|\\*|\\/)/] # if one of those operators\n token_array << z.to_sym\n end\n end\n\n token_array\n end",
"title": ""
},
{
"docid": "ed0faa6979bb62dc9803059132e073b9",
"score": "0.52027655",
"text": "def find_unit text, number\n if not text.empty?\n partition = text.partition %r{^[a-zA-Z]{,3}?[ ]?[/]?[ ]?[a-zA-Z]{,3}[ |.|,|:|;]*}\n\n if not partition[1].empty?\n partition = text.partition %r{^[a-zA-Z]{,3}?[ ]?[/]?[ ]?[a-zA-Z]{,3}}\n\n if partition[1].is_unit?\n\n ts = partition[0] + @unit_rgx.gsub('x', number.to_s)\n return [partition[1], ts, partition[2]]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "07e24b536e418c1a846e323a83d006c6",
"score": "0.5198647",
"text": "def store_formula(string)\n string.split(/(\\$?[A-I]?[A-Z]\\$?\\d+)/)\n end",
"title": ""
},
{
"docid": "07e24b536e418c1a846e323a83d006c6",
"score": "0.5198647",
"text": "def store_formula(string)\n string.split(/(\\$?[A-I]?[A-Z]\\$?\\d+)/)\n end",
"title": ""
},
{
"docid": "a101a3e6bcfd60604404ce5518723ed6",
"score": "0.51923764",
"text": "def parse_array(array_str, element_metadata)\n components = array_str.scan(/\\{(.*)\\}/).last.first.split(',')\n components.map do |component|\n case element_metadata[:data_type].downcase.to_sym\n when :integer\n Integer(component)\n when :numeric\n Float(component)\n else\n component\n end\n end\n end",
"title": ""
},
{
"docid": "6fb81ca9a5feb20dbb492266ea60bf7e",
"score": "0.5185737",
"text": "def string_to_array(lat_dis_string)\n spl = lat_dis_string.split(\"|\")\n @@lat_dis_array.push(spl)\n return @@lat_dis_array \t\t\n end",
"title": ""
},
{
"docid": "b228d024691267fdec765bb43ed57cdd",
"score": "0.5183376",
"text": "def parse(input_string)\n operand_list = input_string.split(/[,|\\n|\\\\n]/)\n operand_list\n end",
"title": ""
},
{
"docid": "cf67e937cec4f7419764edda71c61c20",
"score": "0.51644874",
"text": "def get_string_array(readstring, header)\n if readstring =~ category_regexp(header)\n return string_array($1)\n end\n end",
"title": ""
},
{
"docid": "ee894de7e3b93d0c7a09ea399cae670e",
"score": "0.5159415",
"text": "def sentence_to_array(sentence)\n sentence.split(\" \")\nend",
"title": ""
},
{
"docid": "aa70b8cd2caa444a4e5d6e08f222fdc8",
"score": "0.51505154",
"text": "def rad2unit_vect; end",
"title": ""
},
{
"docid": "8144617c3bb31ee9f7701c6d364c2a3a",
"score": "0.5147173",
"text": "def string_to_array(string)\n if string.kind_of?(String)\n return string.gsub(\" \",\"\").split(\",\")\n else\n return string\n end\n end",
"title": ""
},
{
"docid": "f2fa9501ae8cd52ee051c1259646106d",
"score": "0.5145361",
"text": "def nt_to_array \n return_array = []\n self.each_char.each do |base|\n base_array = base.to_list\n return_array.append base_array\n end\n return return_array\n end",
"title": ""
},
{
"docid": "098a879833702f60b307140a45ce98fd",
"score": "0.5145108",
"text": "def tokenize\n ret = []\n\n @value.gsub(/\\(/, \" ( \").gsub(/\\)/, \" ) \").split.each do |token|\n case token\n when \"(\", \")\"\n ret << token\n else\n ret << Atom.new(token)\n end\n end\n\n Sequence.new ret\n end",
"title": ""
},
{
"docid": "e5be09d334b01fa24d6d7d3f858443fa",
"score": "0.51124334",
"text": "def toArray\n @@grammerToArray = @@inputGrammer.split()\n #puts @@grammerToArray\n\n grammerChecker\n\n\nend",
"title": ""
},
{
"docid": "e31afee3f7bfd094d58fcd5cc5d6bb8e",
"score": "0.51093364",
"text": "def to_array(full_name)\n full_name.split(' ')\nend",
"title": ""
},
{
"docid": "88f933b0029a59fcb547643a12442871",
"score": "0.5102818",
"text": "def transform_number_to_array_of_arrays_of_ascii\n number.to_s.chars.map { |digit| send :\"make#{digit}\" }\n end",
"title": ""
},
{
"docid": "8c07ab96555f3a85e9e8bcfea8546ced",
"score": "0.509606",
"text": "def parse_ions(str)\n ions = []\n current = []\n \n scan_ions(str) do |num, end_point|\n current << num.to_f\n \n if end_point\n ions << current\n current = []\n end\n end\n ions\n end",
"title": ""
},
{
"docid": "0e36dfc34d27593d18c6632c8cbeedd6",
"score": "0.5078576",
"text": "def parse(str)\n eval_array = str.reverse.split # reverse (prefix notation with reversed numbers), then split by whitespace\n eager_eval(eval_array)\n end",
"title": ""
},
{
"docid": "57657f06e39fa5f9c09559e197e64079",
"score": "0.50768965",
"text": "def to_tokens( s )\n\t\t# s.strip.split.map { |e| to_token( e ) }\n\t\t@lexer.to_tokens( s)\n end",
"title": ""
},
{
"docid": "0240eddffea2bf31b7f8ac8975273e1a",
"score": "0.50753886",
"text": "def to_array_from_story\n self.split(/,? and |, /).map do |value|\n ToFooFromStory::fix_value(value)\n end\n end",
"title": ""
},
{
"docid": "7377c37a61489f1d9c1e5d6da8226608",
"score": "0.50731486",
"text": "def phrase_to_features(phrase)\n # TODO: unpack/pack - hack still needed?\n # TODO: Umlaute & shit\n phrase.\n unpack('C*').\n pack('U*').\n downcase.\n gsub(/[\\.,-_\\?!#\\s(){}|\\<\\>\\\"\\']/, \" \").\n split.\n inject([]){|data, w| data << w}.\n uniq\n end",
"title": ""
},
{
"docid": "77331ffdbdb4afa23a6a5a7b3a25c606",
"score": "0.506146",
"text": "def tokens(string)\n \t(string.split.map { |i| i.match(/\\d+/) ? i.to_i : i.to_sym})\n end",
"title": ""
},
{
"docid": "e1636f1a679518d0ce7a2798034c3dca",
"score": "0.50611705",
"text": "def convert_to_matrix( string )\n lines = string.split(\"\\n\")\n matrix = []\n lines.each do |line|\n matrix.push( line.split(\", \") )\n end\n return matrix\nend",
"title": ""
},
{
"docid": "b4d9e4c206f1079cd12587ffe556f368",
"score": "0.5060572",
"text": "def convert_input_string_into_array\n self.input.split('-')\n end",
"title": ""
},
{
"docid": "6b55168fbee34098066b8ce2da58a4f1",
"score": "0.5059931",
"text": "def parse_to_array(string)\n\tclues = string.split(\",\")\n\tfinal_return = []\n clues.each do |clue|\n\t\tif clue.include?(\"-\") == false\n\t\t\tfinal_return << clue\n\t\telse\n\t\t\trange = clue.split(\"-\")\t\n\t\t\tmin,max = range[0].to_i, range[-1].to_i\n\t\t\tfinal_return << (min..max).to_a.map(&:to_s)\n\t\tend\n end\n final_return.flatten\nend",
"title": ""
},
{
"docid": "cd70fd31cb51f7ac4fc6f8507a1473f7",
"score": "0.5054785",
"text": "def strType2Arr (str_type)\n args = str_type.scan(/\\w+\\s:\\s\\{[^\\}]+\\}|[\\?\\w]+ : \\([\\?\\(\\w<\\-> ]+\\)|[\\?\\w]+ : [\\w<>\\.]+|\\b[A-Z][\\w<>\\.]*|\\([^\\)]+\\)/)\n args.map!{|n| n == 'Void' ? '' : n} # get rid of Void values\n args.map!{|n| n.sub(/[a-z]\\w*\\.([A-Z]+)/, '\\1')} # get rid of parameterized type prefixes \n args.map!{|n| n.sub(/\\}/,'\\\\\\}')} # fix for parameters involving anonyomous typedefs\n return args\nend",
"title": ""
},
{
"docid": "6aff2cd9723008f233f4d0efce234788",
"score": "0.5045969",
"text": "def process_recurrence(str)\n \t\tresult = Array.new\n\t\tif str[0] == 49\n\t\t\tresult.push(\"SU\")\n\t\tend\n\t\tif str[1] == 49\n\t\t\tresult.push(\"MO\")\n\t\tend\n\t\tif str[2] == 49\n\t\t\tresult.push(\"TU\")\n\t\tend\n\t\tif str[3] == 49\n\t\t\tresult.push(\"WE\")\n\t\tend\n\t\tif str[4] == 49\n\t\t\tresult.push(\"TH\")\n\t\tend\n\t\tif str[5] == 49\n\t\t\tresult.push(\"FR\")\n\t\tend\n\t\tif str[6] == 49\n\t\t\tresult.push(\"SA\")\n\t\tend\n\t\treturn result\n end",
"title": ""
},
{
"docid": "6623862645b451e87c045b96780dd528",
"score": "0.5030761",
"text": "def to_unit(unit)\n fail UnknownUnitError.new(unit) unless JOULES[unit]\n joule / JOULES[unit]\n end",
"title": ""
},
{
"docid": "acd985258c3097b0a7f84b166bf3a7a5",
"score": "0.50297236",
"text": "def parse_to_array(string)\n s = StringScanner.new(string)\n match = array_open(s)\n raise \"Unexpected character in array at: #{s.rest}\" if match.nil?\n\n array_content = array_values(s)\n\n match = array_close(s)\n raise \"Unexpected character in array at: #{s.rest}\" if match.nil? || !s.empty?\n\n array_content\n end",
"title": ""
},
{
"docid": "e8cecc84a7fef2e8059b01fc4b827a04",
"score": "0.5027903",
"text": "def string2arr(string)\n string.split(\",\").map{|x| x.strip}\n end",
"title": ""
},
{
"docid": "1e29536149ef73d11576b13f9a72980b",
"score": "0.50126135",
"text": "def convertToArray(title)\n\t\tif/[^' ']/.match(title)\n\t\t\twords = title.split\n\t\t\t#p words # prints arrays populated with song title\n\t\t\treturn words\n\t\tend\nend",
"title": ""
},
{
"docid": "139d122e0170d151054c9d7ccda946ca",
"score": "0.5011094",
"text": "def split_to_array\n @input = @input.delete(\" \")\n @input_as_array = @input.split(/(\\*|\\+|\\/|-)/)\n end",
"title": ""
},
{
"docid": "1b86e30ed82076571619187fe7a78398",
"score": "0.4993688",
"text": "def units\n squares.each_with_object([]) do |square, array|\n square.units.each { |unit| array << unit }\n end\n end",
"title": ""
},
{
"docid": "7467aa65ae2b3bc6aa1c969ed595ed72",
"score": "0.49822286",
"text": "def ids_str_to_array(string)\n string.first.split ','\n end",
"title": ""
},
{
"docid": "f914d3b06a95cd82318dcfdb812c592e",
"score": "0.49743968",
"text": "def to_formatted_array(x)\n x = x.split(/\\s*,\\s*/) if x.is_a?(String) # split multiple forms of a comma separated list\n\n # features aren't case sensitive so let's compare in lowercase\n x.map(&:downcase)\n end",
"title": ""
},
{
"docid": "e23ac900563fd4379020e4cdf31dfda4",
"score": "0.49698296",
"text": "def traceUnits(units)\n firstCampus = nil\n campuses = Set.new\n departments = Set.new\n journals = Set.new\n series = Set.new\n\n done = Set.new\n units = units.clone # to avoid trashing the original list\n while !units.empty?\n unitID = units.shift\n if !done.include?(unitID)\n unit = $allUnits[unitID]\n if !unit\n puts \"Warning: skipping unknown unit #{unitID.inspect}\"\n next\n end\n if unit.type == \"journal\"\n journals << unitID\n elsif unit.type == \"campus\"\n firstCampus ||= unitID\n campuses << unitID\n elsif unit.type == \"oru\"\n departments << unitID\n elsif unit.type =~ /series$/\n series << unitID\n end\n units += $unitAncestors[unitID]\n end\n end\n\n return [firstCampus, campuses.to_a, departments.to_a, journals.to_a, series.to_a]\nend",
"title": ""
},
{
"docid": "69a04e038816da81c0ffb83b5f2880e2",
"score": "0.4959212",
"text": "def parse_array(name); end",
"title": ""
},
{
"docid": "1e0e4a134eebc95b04d7d2482ee60548",
"score": "0.49584708",
"text": "def to_array(str,separater=\",\")\n ary=[]\n str.each_line do |line|\n ary << line.chomp.split(separater)\n end\n ary\n end",
"title": ""
},
{
"docid": "182a38fc11da0a61ac1c3d742ad76575",
"score": "0.4958372",
"text": "def tokify(input)\n tagger = EngTagger.new\n tagged = tagger.get_readable(input)\n tag_array = tagged ? tagged.split(\" \") : []\n\n tokens = []\n tag_array.each do |tok|\n tokens << tok.split(\"/\")[1]\n end\n\n return tokens\nend",
"title": ""
},
{
"docid": "d96e94329d41a35bb35a9f0585c200f3",
"score": "0.49571246",
"text": "def name_array(name)\n\tname.split(' ')\nend",
"title": ""
},
{
"docid": "59269126a98f34d6fe6a644d5f1d0c36",
"score": "0.49461082",
"text": "def unit_str\n rv = @numerator_units.sort.join(\"*\")\n if @denominator_units.any?\n rv << \"/\"\n rv << @denominator_units.sort.join(\"*\")\n end\n rv\n end",
"title": ""
},
{
"docid": "59269126a98f34d6fe6a644d5f1d0c36",
"score": "0.49461082",
"text": "def unit_str\n rv = @numerator_units.sort.join(\"*\")\n if @denominator_units.any?\n rv << \"/\"\n rv << @denominator_units.sort.join(\"*\")\n end\n rv\n end",
"title": ""
},
{
"docid": "83b3742443cf5619cdd2d6e211bab7d0",
"score": "0.4944999",
"text": "def xtoy(s)\n objs = \"['\" + s + \"']\"\n while (objs[\"_\"])\n objs[\"_\"] = \"']['\"\n end\n return objs\n end",
"title": ""
},
{
"docid": "26b7d63de05edebadafac7a90c33fce4",
"score": "0.49386132",
"text": "def scan\n output = []\n @lines.each do |line|\n term_array = line.scan(INDEX_TERM_REGEX)\n output << term_array\n end\n @term_array = output.flatten.map{ |e| e.sub('((','').sub('))','') }\n end",
"title": ""
},
{
"docid": "a5dd1a8b1c2a7a4d42ebd1d532ea53b0",
"score": "0.49371707",
"text": "def to_array(value)\n values = value.gsub(/('|\\(|\\))/, \"\").split(',')\n type = [:is_i?, :is_f?].find(Proc.new { :is_s? }) { |t| send(t, values.first) }\n values.map { |v| v.send(TYPE_MAP[type]) }\n end",
"title": ""
},
{
"docid": "84a6c241948e1a4bfa7ffb721d887eee",
"score": "0.4935162",
"text": "def get_symbol_list(input)\n return nil if input == nil\n\n list = []\n input.split(\",\").each do |val|\n list << val.intern\n end\n return list\nend",
"title": ""
},
{
"docid": "53b7034ad168d37336a491fb0818f5d9",
"score": "0.49322745",
"text": "def extracting_nums_to_arr(str)\n str_nums = str.gsub(/[^0-9. ]/, ' ')\n str_nums.split(' ')\nend",
"title": ""
},
{
"docid": "be96bb166b5e5d314d20065198341a3c",
"score": "0.4930956",
"text": "def tokenize\n\t\t\treturn [] unless numeric?\n numbers = to_s.dup\n\n numbers.gsub!(/\\s*,\\s*/, ', ')\n numbers.gsub!(/\\s*-\\s*/, '-')\n numbers.gsub!(/\\s*&\\s*/, ' & ')\n\n numbers.split(/(\\s*[,&-]\\s*)/)\n end",
"title": ""
},
{
"docid": "c9f454f2950e854b6297185f8f6de0ca",
"score": "0.49305418",
"text": "def test_parse_arr_multiple\n token_parser = TokenParser.new\n arr = ['LET','x','10']\n assert_equal '421', token_parser.parse_arr(arr)\n end",
"title": ""
},
{
"docid": "c50ac848c11eac0024174461b3f59513",
"score": "0.49291128",
"text": "def buildVocabulary unitHash, txnHash\n\t\tunitHash.keys.each { |code|\n\t\t\t@vocabArray.push(code)\n\t\t}\n\n\t\ttxnHash.keys.each { |key|\n\t\t\tkey.split(\" \").each { |code|\n\t\t\t\tunless unitHash.has_key?(code)\n\t\t\t\t\t@vocabArray.push(code)\n\t\t\t\tend\n\t\t\t}\n\t\t}\n\t\treturn @vocabArray\n\tend",
"title": ""
},
{
"docid": "b38eb7110ca0acb797f70a28e252e4e9",
"score": "0.49259576",
"text": "def terms(unique: true)\n unless unique\n enum_statement.\n map(&:terms).\n flatten.\n compact\n else\n enum_term.to_a\n end\n end",
"title": ""
},
{
"docid": "d0ddf09bb01d77b216f4600c6186c4d0",
"score": "0.49149606",
"text": "def numbers_str_to_array(str)\n str.split(\",\").map { |num| num.to_i }\n end",
"title": ""
},
{
"docid": "d0ddf09bb01d77b216f4600c6186c4d0",
"score": "0.49149606",
"text": "def numbers_str_to_array(str)\n str.split(\",\").map { |num| num.to_i }\n end",
"title": ""
},
{
"docid": "d0ddf09bb01d77b216f4600c6186c4d0",
"score": "0.49149606",
"text": "def numbers_str_to_array(str)\n str.split(\",\").map { |num| num.to_i }\n end",
"title": ""
},
{
"docid": "eed7a53a8103d97f7c8d10c097e6cf5f",
"score": "0.49120757",
"text": "def convert_input_to_array\n\t\t\titems = gets.chomp.to_s.split(',')\n\t\t items.collect{|e| e.strip}\n\t\tend",
"title": ""
},
{
"docid": "a441eeb541211d8a56aecc406b0ee508",
"score": "0.49089208",
"text": "def to_array(word)\n\tletters = []\n\t# each character gets one slot in the array\n\tword.each_char do |c|\n\t\tletters << c\n\tend\n\treturn letters\nend",
"title": ""
},
{
"docid": "4a61310c7dc3553a310d32923327b9af",
"score": "0.49052417",
"text": "def tokens(string)\n\t\tstring.split(\" \").map { |x|\n\t\t\tif x =~ /[*+-\\/]/\n\t\t\t\tx.to_sym\n\t\t\telse\n\t\t\t\tx.to_i\n\t\t\tend\n\t\t}\n\tend",
"title": ""
},
{
"docid": "d34918d6e22e5743bb9c9bda7e43bfbf",
"score": "0.4896231",
"text": "def generate_array(text)\n text = text.gsub(/[^0-9A-Za-z]/, ' ') unless @include_special\n raise \"No valid characters to work with.\" if text == \"\"\n text.downcase! unless @case_sensitive\n\n if @words_instead\n splitter = \" \"\n else\n splitter = \"\"\n end\n text.split(splitter).sort\n end",
"title": ""
},
{
"docid": "015736ebc3cce74392a09604e439ee7a",
"score": "0.48961928",
"text": "def returnUnitsAsArray\n return [@UUnits, @DBUnits] if isUnits\n []\n end",
"title": ""
}
] |
13f2d0aea6632f765d1ebe20688e9b62 | if post is over 30 days old, produces this format: Thursday 25 May 2006 1:08 PM | [
{
"docid": "a9b1a38a212376edcb785a1ec9b55403",
"score": "0.6551084",
"text": "def nice_date(date)\n dt = DateTime.new(date.year, date.month, date.mday)\n diff = DateTime.now - dt\n if diff.to_i > 30\n h date.strftime(\"%A %d %B %Y - %H:%M %p\")\n else\n return time_ago_in_words(date)+\" ago\"\n end\n end",
"title": ""
}
] | [
{
"docid": "83bf1e69cb84ad8e65f0ca2c7c1a56ce",
"score": "0.6647225",
"text": "def updated_on(post)\n title = post[:title].gsub(\" \", \"\")\n # so that we don't have two posts on the same date :D\n minutes = title[0].chr.downcase[0] - 87\n seconds = title[1].chr.downcase[0] - 87\n \"#{post[:written_on]}T12:#{minutes}:#{seconds}Z\"\n end",
"title": ""
},
{
"docid": "bbdc43ba6593b32b99a02d5827ce0394",
"score": "0.6468833",
"text": "def review_published_time\n ammount_of_day = (Date.today - self.created_at.to_date).to_i\n if ammount_of_day < 1\n \"Posted today\"\n elsif ammount_of_day == 1\n \"Posted #{ammount_of_day} day ago\"\n else\n \"Posted #{ammount_of_day} days ago\"\n end\n end",
"title": ""
},
{
"docid": "c9d5de2e3ff6893d2200d89f31c410f9",
"score": "0.6337053",
"text": "def how_long_ago(date)\r\n if date[2..4].downcase == \"day\"\r\n post_date = DateTime.now - date[0].to_i\r\n elsif date[2..5].downcase == \"week\"\r\n post_date = DateTime.now - (date[0].to_i * 7)\r\n end\r\nend",
"title": ""
},
{
"docid": "8f2c67641c7c9c3e7319dabf35f8260a",
"score": "0.62271094",
"text": "def published_from(now)\n\t\ttimespan = now - published\n\n\t\t# If less than 60 seconds, say 'Now'\n\t\tif timespan < 60 then\n\t\t\t'Now'\n\n\t\t# If less than 60 minutes, say 'dd minutes ago'\n\t\telsif timespan < 3600 then\n\t\t\t\"#{(timespan / 60).to_i} minutes ago\"\n\n\t\t# If less than 12 hours, say 'hh hours ago'\n\t\telsif timespan < 43200 then\n\t\t\t\"#{(timespan / 3600).to_i} hours ago\"\n\n\t\t# If less than 24 hours and same day, say 'Today 12:34'\n\t\telsif timespan < 86400 and now.day == published.day then\n\t\t\tpublished.strftime 'Today %H:%M'\n\n\t\t# If less than 48 hours and yesterday, say 'Yesterday 12:34'\n\t\telsif timespan < 172800 and (now.day - 1) == published.day then\n\t\t\tpublished.strftime 'Yesterday %H:%M'\n\n\t\t# If less than 7 days, say 'Sunday 12:34'\n\t\telsif timespan < 604800 then\n\t\t\tpublished.strftime '%A %H:%M'\n\n\t\t# Else say '18 January, 12:34'\n\t\telse\n\t\t\tpublished.strftime '%-d %B, %H:%M'\n\t\tend\n\tend",
"title": ""
},
{
"docid": "4095216ed223e8a5c7c89d4b6fbe6c1e",
"score": "0.61914104",
"text": "def post_title(p)\n length = (p.created_at > (7.days/NOTIFY_FREQUENCY).ago) ? 32 : 38\n truncate(p.title, length)\n end",
"title": ""
},
{
"docid": "e7fe269540cb6d571ee551843672464c",
"score": "0.61346424",
"text": "def smart_date_printer(my_date)\n if my_date > 7.days.ago \n my_date.strftime(\"%A, %H:%M \")\n else\n my_date.to_s(:long)\n end\n end",
"title": ""
},
{
"docid": "a2fcf5f937db0d46fc79ed0068880cf8",
"score": "0.60769606",
"text": "def posted_on(article)\n if article\n \"Posted #{time_ago_in_words(article.created_at)} ago by #{article.user.username}\"\n end\n end",
"title": ""
},
{
"docid": "6572ef00c56490972c168316131cb4bb",
"score": "0.60737866",
"text": "def pretty_posted_time_string(date_time)\n\t\t\" on \" + pretty_time_string(date_time) + \" (#{time_ago_in_words(date_time)} ago)\"\n\tend",
"title": ""
},
{
"docid": "35d175892c92caac4e11c20e8856e7e7",
"score": "0.60407305",
"text": "def posted_at(post)\n published_at = post.published_at\n\n post_date = published_at.strftime(\"%B %e, %Y at %l:%M %p\")\n post_datetime = published_at.strftime(\"%FT%T%:z\")\n\n content_tag(:time, post_date, pubdate: \"\", datetime: post_datetime)\n end",
"title": ""
},
{
"docid": "74e21e11aff5c6b46f1827673c10704e",
"score": "0.60212696",
"text": "def mark_as_new(post_date:, inline_style: false)\n if post_date > (7.days / Settings.notify_frequency).seconds.ago\n return raw('<span style=\"font-size: 10px; font-weight: bold; color: #ffffff; background-color: #009900; padding: 1px 3px 1px 3px; margin: 0 0 0 4px;\">new</span>') if inline_style\n return raw('<span class=\"new\">new</span>')\n end\n end",
"title": ""
},
{
"docid": "2f13322bc28b2715e01c7d36a4865490",
"score": "0.5982262",
"text": "def post_published_at\n self.published_at.strftime(\"%b %d, %Y %I:%M %p\")\n end",
"title": ""
},
{
"docid": "2f13322bc28b2715e01c7d36a4865490",
"score": "0.5982262",
"text": "def post_published_at\n self.published_at.strftime(\"%b %d, %Y %I:%M %p\")\n end",
"title": ""
},
{
"docid": "ce0841d93e6cf351bc6149763c4a958e",
"score": "0.59160334",
"text": "def posted_time(options = {})\n options.reverse_merge! format: '%A %b %-d, %Y %H:%M' # set the default time as \"Thursday Sep 19, 2013 22:32\"\n created_at.strftime(options[:format])\n end",
"title": ""
},
{
"docid": "e407b12d29cf3e85a2a460a9b889bc33",
"score": "0.58964205",
"text": "def time_ago_in_words_or_date(date,options={})\n return nil unless date\n if (Time.now-date)/60/60/24 < 7\n time_ago_in_words(date) + \" ago\"\n elsif date.year == Time.now.year\n options[:short] ? date.strftime(\"%m/%d %I:%M%p\") : date.to_s(:short)\n else\n options[:short] ? date.strftime(\"%m/%d/%y\") : date.to_s(:medium)\n end\n end",
"title": ""
},
{
"docid": "2958fb163aa8a166fb720f2663b4527c",
"score": "0.58806705",
"text": "def posted\n created_at.in_time_zone(\"America/Chicago\").strftime(\"Posted: %b %e, %l:%M %p\")\n end",
"title": ""
},
{
"docid": "923c227c218c1457537f4b5368dd47e8",
"score": "0.58707243",
"text": "def photo_published_time\n ammount_of_day = (Date.today - self.created_at.to_date).to_i\n if ammount_of_day < 1\n \"Uploaded today\"\n elsif ammount_of_day == 1\n \"Uploaded #{ammount_of_day} day ago\"\n else\n \"Uploaded #{ammount_of_day} days ago\"\n end\n end",
"title": ""
},
{
"docid": "187ac37f56ab87cd72e3cf26fa2a3695",
"score": "0.586993",
"text": "def time_in_words(date)\n date = date.to_date\n date = Date.parse(date, true) unless /Date.*/ =~ date.class.to_s\n days = (date - Date.today).to_i\n\n return 'today' if days >= 0 and days < 1\n return 'tomorrow' if days >= 1 and days < 2\n return 'yesterday' if days >= -1 and days < 0\n\n return \"in #{days} days\" if days.abs < 60 and days > 0\n return \"#{days.abs} days ago\" if days.abs < 60 and days < 0\n\n return date.strftime('%A, %B %e') if days.abs < 182\n return date.strftime('%A, %B %e, %Y')\n end",
"title": ""
},
{
"docid": "fdb31b971ae1bbf09ae544ed9d4eebbb",
"score": "0.5868326",
"text": "def display_event_time(event)\n if event and event.created_at\n dis = distance_of_time_in_words_to_now(event.created_at).gsub(/about /,'')\n if dis.split(' ').include?(\"day\")\n return \"Yesterday #{event.created_at.strftime(\"%I:%S%p\")}\"\n elsif dis.split(' ').include?(\"days\")\n return \"#{event.created_at.strftime(\"%m/%d/%y %I:%S%p\")}\"\n elsif (dis.split(' ').include?(\"less\") && dis.split(' ').include?(\"than\"))\n return dis\n else\n return dis+\" ago\"\n end\n else\n return \"\"\n end\n end",
"title": ""
},
{
"docid": "405e08bd08f993ab0e84de28c01ec59b",
"score": "0.58534193",
"text": "def last_post_date\n last_post.to_date.to_s :long\n end",
"title": ""
},
{
"docid": "1d771ae0ca11d58794f2e5c13390bd34",
"score": "0.58145326",
"text": "def display_friendly_date(date)\n time_ago_in_words(date)\n end",
"title": ""
},
{
"docid": "9563fe80d58b4c51e3130e80f116ac25",
"score": "0.57860917",
"text": "def time_in_words(date)\n date = date.to_date\n date = Date.parse(date, true) unless /Date.*/ =~ date.class.to_s\n days = (date - Date.today).to_i\n\n return 'today' if days >= 0 and days < 1\n return 'tomorrow' if days >= 1 and days < 2\n return 'yesterday' if days >= -1 and days < 0\n\n return \"in #{days} days\" if days.abs < 60 and days > 0\n return \"#{days.abs} days ago\" if days.abs < 60 and days < 0\n\n return date.strftime('%A, %B %e') if days.abs < 182\n return date.strftime('%A, %B %e, %Y')\n end",
"title": ""
},
{
"docid": "521571ca8ee33573951e4c6fd3eae620",
"score": "0.57849413",
"text": "def publish_date_and_explanation\n bold = publish_date_explanation == 'custom'\n html = ''\n html << '<div class=\"compact\">'\n html << '<b>' if bold\n html << [publish_date_for_display,\"<small style='color:#888'>(#{publish_date_explanation})</small>\"].compact.join('<br/>')\n html << '</b>' if bold\n html << '</div>'\n html.html_safe\n end",
"title": ""
},
{
"docid": "70da4df496409e149d43b35553e9fff9",
"score": "0.57616484",
"text": "def nice_time_ago_in_words(time)\n case\n when !time then ''\n when time < 7.days.ago then time.strftime(\"%b %d, %Y\")\n when time < 60.seconds.ago then time_ago_in_words(time) + \" ago\"\n else\n \"Seconds ago\"\n end\n end",
"title": ""
},
{
"docid": "f0156e07fe71de17c195f89f42b2c27e",
"score": "0.57495743",
"text": "def post_date\n @post_date = Time.local(*[0]*3+post_time.to_a[3...10]) unless @post_date or post_time.nil?\n \n @post_date\n end",
"title": ""
},
{
"docid": "088a6c7eaf507aca03b98afbdc61801a",
"score": "0.573465",
"text": "def tidy_at(date, use_article)\n ret = nil\n if date\n article = \"on\"\n if Time.now.to_date == date.to_date\n if (Time.now - date).to_i < 60\n article = \"\"\n ret = \"less than one minute ago\"\n else\n article = \"today at\"\n ret = date.strftime(\"%l:%M %P\").strip\n end\n elsif Time.now.year == date.year\n ret = date.strftime(\"%b #{date.day.ordinalize}\").squeeze\n else\n ret = date.strftime(\"%Y-%m-%d\")\n end\n if use_article\n ret = \"#{article} #{ret}\"\n end\n end\n ret\n end",
"title": ""
},
{
"docid": "62683c4587440c1ae12f7b30170ab3fb",
"score": "0.56864554",
"text": "def format_feed_date(datetime)\n return \"\" if datetime.nil?\n dt = datetime.in_time_zone\n #date = string_date(dt)\n #return \"Today\" if date == string_date(Time.now)\n #return \"Yesterday\" if date == string_date(1.day.ago)\n dt.strftime(\"%B %d\") \n end",
"title": ""
},
{
"docid": "e1049e63e85cfb7c782bc657da0988f5",
"score": "0.567504",
"text": "def published_date\n date_hash = {\n \"1\" => \"Jan\",\n \"2\" => \"Feb\",\n \"3\" => \"Mar\",\n \"4\" => \"Apr\",\n \"5\" => \"May\",\n \"6\" => \"Jun\",\n \"7\" => \"Jul\",\n \"8\" => \"Aug\",\n \"9\" => \"Sep\",\n \"10\" => \"Oct\",\n \"11\" => \"Nov\",\n \"12\" => \"Dec\"\n }\n \n month = date_hash[self.created_at.month.to_s]\n day = self.created_at.day.to_s\n \n return month + \" \" + day\n end",
"title": ""
},
{
"docid": "d0c5139dab2cd2e553b24c3e31398c3f",
"score": "0.56538546",
"text": "def posted_ago(user)\n\t\tpost_time = ((Time.now - @user.created_at) / (60 * 24 * 24)).round()\n\tend",
"title": ""
},
{
"docid": "26fa1b2a6c583ab8744e8c16ee671867",
"score": "0.562564",
"text": "def when_string\n day_diff = day_diff(Time.now)\n\n #p \"day_diff: #{day_diff}\"\n\n if day_diff == 0\n strftime(\"%-l:%M %P\") # eg, \"1:35 pm\"\n\n elsif day_diff == -1 \n \"Tomorrow\"\n \n elsif day_diff == 1\n \"Yesterday\"\n\n elsif day_diff <= 7 \n strftime(\"%A\") # eg, \"Monday\"\n\n else\n strftime(\"%-m/%-e/%y\") # eg, 5/30/1968\n\n end\n\n end",
"title": ""
},
{
"docid": "dc2a036d5f555146b0b2c0e5ec1e970b",
"score": "0.56132716",
"text": "def date_time_linked(post, separator = \"at\")\n return \"<a href=\\\"#{Post.permalink(post)}\\\" title=\\\"Permalink for this post\\\">#{post.created_at.strftime(Preference.get_setting('date_format'))} #{separator} #{post.created_at.strftime(Preference.get_setting('time_format'))}</a>\"\n end",
"title": ""
},
{
"docid": "52be3ee9b80cbad796289ad675c37107",
"score": "0.5612608",
"text": "def nice_date(date)\n # nice_date = (date||Time.now).strftime(\"%D\")\n nice_date = I18n.localize((date || Time.now), format: :short)\n how_many_days = (Time.now - date) / 1.day\n if how_many_days < 1\n nice_date += ' ' + content_tag('span', I18n.translate('time.new'), class: 'badge alert-success')\n elsif how_many_days < 10\n nice_date += ' ' + content_tag('span', I18n.translate('time.recent'), class: 'badge alert-info')\n end\n content_tag('span', nice_date.html_safe, class: 'date')\n end",
"title": ""
},
{
"docid": "0daee14e79dc9fca9a6a0342e3ab3680",
"score": "0.5589835",
"text": "def format_article_date(datetime, short=true, format='%I:%M %p')\n return nil unless datetime\n now = Time.now\n if short\n if datetime.today?\n datetime.strftime('%I:%M %p')\n elsif now.yesterday.beginning_of_day < datetime && datetime < now.yesterday.end_of_day\n \"#{I18n.t('time.yesterday')} #{datetime.strftime(format)}\"\n elsif format != '%I:%M %p'\n datetime.strftime(format)\n else\n \"#{I18n.t('date.abbr_month_names')[datetime.month]} #{datetime.day}, #{datetime.year}\"\n end\n else\n I18n.l(datetime)\n end\n end",
"title": ""
},
{
"docid": "ec66ec0a4d4e81fa4f32c67589d03e84",
"score": "0.5563639",
"text": "def post_date(post)\n post_link = post.xpath(\"h2/a\").first.attribute(\"href\").to_s\n\n if post_link =~ /lizards\\.opensuse\\.org\\/([0-9]{4}\\/[0-9]{2}\\/[0-9]{2})\\//\n return Date.parse(Regexp.last_match[1])\n end\n\n nil\n end",
"title": ""
},
{
"docid": "c139ff5014487de316cd5075f58b0dcf",
"score": "0.5562719",
"text": "def didwhen(old_time) # stolen from http://snippets.dzone.com/posts/show/5715\n val = Time.now - old_time\n if val < 10 then\n result = 'just a moment ago'\n elsif val < 40 then\n result = 'less than ' + (val * 1.5).to_i.to_s.slice(0,1) + '0 seconds ago'\n elsif val < 60 then\n result = 'less than a minute ago'\n elsif val < 60 * 1.3 then\n result = \"1 minute ago\"\n elsif val < 60 * 50 then\n result = \"#{(val / 60).to_i} minutes ago\"\n elsif val < 60 * 60 * 1.4 then\n result = 'about 1 hour ago'\n elsif val < 60 * 60 * (24 / 1.02) then\n result = \"about #{(val / 60 / 60 * 1.02).to_i} hours ago\"\n else\n result = old_time.strftime(\"%H:%M %p %B %d, %Y\")\n end\n return \"#{result}\"\n end",
"title": ""
},
{
"docid": "af85fef11e279095f21443781b575392",
"score": "0.5548168",
"text": "def apphelp_date( date )\n date_strfmt = I18n::t( 'uk.org.pond.trackrecord.generic_messages.date' )\n date_format = \"<span class=\\\"nowrap\\\">#{ date_strfmt }</span>\"\n\n if ( date.is_a?( Date ) )\n return date.strftime( date_format ).html_safe()\n else\n time_strfmt = I18n::t( 'uk.org.pond.trackrecord.generic_messages.time' )\n time_format = \"<span class=\\\"nowrap\\\">#{ time_strfmt }</span>\"\n return date.strftime(\n I18n::t(\n \"uk.org.pond.trackrecord.generic_messages.date_and_time\",\n { :date => date_format, :time => time_format }\n )\n ).html_safe()\n end\n end",
"title": ""
},
{
"docid": "ac35b07877da825efff9c7ccc73be95b",
"score": "0.55305636",
"text": "def summarize_post(post)\n\t\t# author\n\t\t# [time in seconds]\n\t\t# id\n\t\t# [LocalTime]; UTC [Time]\n\t\t# title\n\t\t# selftext on one line\n\t\t# \n\t\tstr = post.author.name + \"\\n\"\n\t\tsecs = post.created_utc.to_i\n\t\tstr += secs.to_s + \"\\n\"\n\t\tstr += post.id + \"\\n\"\n\t\tstr += local_and_utc(secs) + \"\\n\"\n\t\tstr += post.title + \"\\n\"\n\t\tstr += post.selftext.gsub(/\\n/, \"\") + \"\\n\"\n\t\tstr += \"\\n\"\n\t\treturn str\n\tend",
"title": ""
},
{
"docid": "c29398d9a3a0ecf8d1cb24ac379da616",
"score": "0.5526147",
"text": "def post_date\n if md = /^(\\d\\d\\d\\d-\\d\\d-\\d\\d)/.match(filename)\n Time.parse(md[1]).strftime(settings.date_format)\n end\n end",
"title": ""
},
{
"docid": "ccf860139482faad937383339d4ac599",
"score": "0.5524917",
"text": "def formatted_time_in_words(given_time, options = {})\n return \"\" if given_time.nil?\n given_time = given_time.getlocal\n\n # If the time is within last 24 hours, show as \"...ago\" string.\n if (1.day.ago..Time.now) === given_time && !options[:no_ago]\n time_ago_in_words(given_time) + \" ago\"\n else\n format_str = \"%B\"\n format_str << \" %d,\" unless options[:no_date]\n format_str << \" %Y\"\n format_str << \" at %I:%M %p\" unless options[:no_time]\n given_time.strftime(format_str)\n end\n end",
"title": ""
},
{
"docid": "170a741a93415f76a196ba19b730d2f1",
"score": "0.5498489",
"text": "def date_published\n created_at.localtime.strftime(\"%A, %B %-d, %Y at %l:%M %p\")\n end",
"title": ""
},
{
"docid": "0a0ef971cd6405fa158d6a9d10b6c5cf",
"score": "0.5486462",
"text": "def formated_title_for(post)\n return formated_date_for(post) if post.nil? || post.title.nil?\n \"#{formated_date_for(post)} - #{post.title}\"\n end",
"title": ""
},
{
"docid": "1551e4bdda349d49fb69544bf3ed3966",
"score": "0.5483877",
"text": "def formatted_published_time(object)\n object.published_at.blank? ? \"Not yet published\" : l(object.published_at, :format => :long)\n end",
"title": ""
},
{
"docid": "dec9c610243077763b273dd209ceb95a",
"score": "0.54834545",
"text": "def time_ago\n if self > Date.today.to_time\n output = humanize(Time.now - self)\n \"#{output} ago\"\n elsif self > (Date.today - 1).to_time\n \"Yesterday at #{strftime('%_I:%M:%S%P')}\"\n elsif self > (Date.today - 6).to_time\n strftime('%a %I:%M:%S%P')\n elsif self.year == Date.today.year\n strftime('%m/%d %I:%M:%S%P')\n else\n strftime('%m/%d/%Y %I:%M:%S%P')\n end\n end",
"title": ""
},
{
"docid": "6222b64e517f2af551d41a337bc4edb0",
"score": "0.5478524",
"text": "def date_published\n created_at.localtime.strftime(\"%B %-d, %Y\")\n end",
"title": ""
},
{
"docid": "8323d9f220b94da0a005298f8fc6ff34",
"score": "0.5468665",
"text": "def post_time\n unless @post_time\n cursor = html_head.at 'hr' if html_head\n cursor = cursor.next until cursor.nil? or POST_DATE.match cursor.to_s\n @post_time = Time.parse $1 if $1\n end\n \n @post_time\n end",
"title": ""
},
{
"docid": "6fc62b68da4a1fa0a273730c8dd4f2d9",
"score": "0.54672265",
"text": "def post_created_at\n self.created_at.strftime(\"%b %d, %Y %I:%M %p\")\n end",
"title": ""
},
{
"docid": "6fc62b68da4a1fa0a273730c8dd4f2d9",
"score": "0.54672265",
"text": "def post_created_at\n self.created_at.strftime(\"%b %d, %Y %I:%M %p\")\n end",
"title": ""
},
{
"docid": "9841bab46be06dac2a9ae4f07f1f55fc",
"score": "0.5456063",
"text": "def pretty_date\r\n self.published_at? ? self.published_at.strftime(\"%A, %B %d, %Y\") : \"\"\r\n end",
"title": ""
},
{
"docid": "799676ea949e5c076c91adbdf5871898",
"score": "0.54554963",
"text": "def the_title\n \"Your Ad created on #{created_at.strftime('%d/%m/%Y at %H:%M')}\"\n end",
"title": ""
},
{
"docid": "38c9c0e61dd404cd2e047fa600691c44",
"score": "0.5453359",
"text": "def relative_date_in_words(date)\n a = (Time.now - date).to_i\n\n case a\n when 0..86400 then 'today' \n when 86401..172800 then 'yesterday'\n when 172801..518400 then ((a+800)/(60*60*24)).to_i.to_s+' days ago'\n when 518400..1036800 then 'a week ago'\n else ((a+180000)/(60*60*24*7)).to_i.to_s+' weeks ago'\n end\nend",
"title": ""
},
{
"docid": "50818d78f44b83b5d50afec854696349",
"score": "0.54499346",
"text": "def pretty_time\r\n self.published_at? ? self.published_at.strftime(\"%I:%M %p\").gsub(/^0/,'') : \"\"\r\n end",
"title": ""
},
{
"docid": "e163da35129f5bbcbb38806e2f38b163",
"score": "0.54373145",
"text": "def humanize_join_date(date_time)\n return date_time.strftime(\"%B %d, %Y\") \n end",
"title": ""
},
{
"docid": "a8cdd28d18c71150dcb7cac4f25a8c8e",
"score": "0.5435402",
"text": "def day_name\r\n self.published_at? ? self.published_at.strftime(\"%A\") : \"\"\r\n end",
"title": ""
},
{
"docid": "113ef7bdd40398c6634530c625d4e7c1",
"score": "0.54146683",
"text": "def date_text(date, reference_date)\n if date == reference_date\n \"today\"\n elsif date == reference_date - 1\n \"yesterday\"\n elsif date > reference_date - 7\n \"on #{date.strftime '%A'}\"\n else\n \"on #{date.strftime '%e %b'}\"\n end\n end",
"title": ""
},
{
"docid": "3ba70ef602c4802bfaa4a94a43138480",
"score": "0.54128116",
"text": "def ts_in_words tm\r\n time_ago_in_words(tm).gsub('about','') + ' ago' if tm\r\n end",
"title": ""
},
{
"docid": "0e3e50b8744b3da249c8b3159be607ab",
"score": "0.54094166",
"text": "def nice_timestamp_for_grandma\n self.created_at.strftime(\"Ordered on %A, %B %e, %Y, %I:%M%p\")\n end",
"title": ""
},
{
"docid": "ebecae831389b6354847da513bc19a63",
"score": "0.54031706",
"text": "def post_summary(post, length_limit)\n \"#{post[:post_id]}. <news>#{post[:author]}</>: #{post[:title][0, length_limit]}\"\n end",
"title": ""
},
{
"docid": "7bf135d88438ff111eefb8dcde3fbef2",
"score": "0.5399248",
"text": "def stringify_date(event)\n if event.next.date.today?\n if event.start_time.hour > Time.parse(\"5pm\").hour\n 'tonight'\n else\n 'today'\n end\n elsif event.next.date == Date.current.tomorrow\n if event.start_time.hour > Time.parse(\"5pm\").hour\n 'tomorrow night'\n else\n 'tomorrow'\n end\n else\n 'on ' + event.date.strftime(\"%A, %B #{event.date.day.ordinalize}\")\n end\n end",
"title": ""
},
{
"docid": "da928f96cda09cddf96714c032bfb67b",
"score": "0.5390331",
"text": "def format_as_date_time_distance(datetime)\n dist = distance_of_time_in_words_to_now(datetime)\n if Time.current > datetime\n dist = dist + \" ago\"\n end\n return dist\n end",
"title": ""
},
{
"docid": "da928f96cda09cddf96714c032bfb67b",
"score": "0.5390331",
"text": "def format_as_date_time_distance(datetime)\n dist = distance_of_time_in_words_to_now(datetime)\n if Time.current > datetime\n dist = dist + \" ago\"\n end\n return dist\n end",
"title": ""
},
{
"docid": "2e50ff23e05b8136905be03872ca312d",
"score": "0.53882444",
"text": "def humanized_time_ago\n time_ago_in_seconds = Time.now - self.created_at\n time_ago_in_minutes = time_ago_in_seconds / 60\n \n #TODO CHECK FOR SINGLE UNITS AND REMOVE THE S\n case time_ago_in_minutes\n when 0..1\n \"#{time_ago_in_seconds.round} seconds ago\"\n when 1..59\n \"#{time_ago_in_minutes.round} minutes ago\"\n when 60..1439\n \"#{(time_ago_in_minutes / 60.0).round} hours ago\"\n when 1440..10079\n \"#{(time_ago_in_minutes / 1440.0).round} days ago\"\n when 10080..88292039\n \"#{(time_ago_in_minutes / 10080.0).round} weeks ago\"\n else\n \"#{(time_ago_in_minutes / 525600.0).round} years ago\"\n end\n end",
"title": ""
},
{
"docid": "7a1dccb1abc97d52e025b35d4332a1ce",
"score": "0.5384234",
"text": "def day\r\n self.published_at? ? self.published_at.day.to_s.rjust(2,\"0\") : \"\"\r\n end",
"title": ""
},
{
"docid": "267347438a80f21d15d11d091b4575d6",
"score": "0.5382595",
"text": "def time_ago_in_words(t)\n seconds_ago = (Time.now - t)\n in_future = seconds_ago <= 0\n distance = seconds_ago.abs\n amt, unit, fmt = case distance\n when (0..SEC_PER_MIN) then [distance, 'second', '%.0f']\n when (SEC_PER_MIN..SEC_PER_HOUR) then [distance/SEC_PER_MIN, 'minute', '%.1f']\n when (SEC_PER_HOUR..SEC_PER_DAY) then [distance/SEC_PER_HOUR, 'hour', '%.1f']\n when (SEC_PER_DAY..SEC_PER_WEEK) then [distance/SEC_PER_DAY, 'day', '%.1f']\n else [distance/SEC_PER_WEEK, 'week', '%.1f']\n end\n number = ((amt.round - amt).abs < 0.1) ? amt.round : fmt.t(amt)\n noun = ('1' == number.to_s) ? unit : unit.pluralize\n %{#{number} #{noun} #{in_future ? 'from now' : 'ago'}}\n end",
"title": ""
},
{
"docid": "afeedad2c7ae7855c5e63746064494a9",
"score": "0.53820807",
"text": "def formatted_time\n\t\t\t\t\tresult = \"\"\n\t\t\t\t\tdays = [\"monday\", \"tuesday\", \"wednesday\", \"thursday\", \"friday\", \"saturday\", \"sunday\"]\n\t\t\t\t\tif self.period == \"week\"\n\t\t\t\t\t\tday = days[self.from.to_datetime.cwday - 1]\n\t\t\t\t\t\tresult += I18n.t(\"date.days.#{day}\") + \" \"\n\t\t\t\t\telsif self.period == \"odd_week\"\n\t\t\t\t\t\tday = days[self.from.to_datetime.cwday - 1]\n\t\t\t\t\t\tresult += I18n.t(\"date.days.odd_#{day}\") + \" \"\n\t\t\t\t\telsif self.period == \"even_week\"\n\t\t\t\t\t\tday = days[self.from.to_datetime.cwday - 1]\n\t\t\t\t\t\tresult += I18n.t(\"date.days.even_#{day}\") + \" \"\n\t\t\t\t\telsif self.period == \"month\"\n\t\t\t\t\t\tresult += self.from.strftime(\"%-d. \")\n\t\t\t\t\telsif self.period == \"once\"\n\t\t\t\t\t\tresult += self.from.strftime(\"%-d. %-m. %Y \")\n\t\t\t\t\tend\n\t\t\t\t\tresult += self.from.strftime(\"%k:%M\") + \" - \" + self.to.strftime(\"%k:%M\")\n\t\t\t\t\treturn result\n\t\t\t\tend",
"title": ""
},
{
"docid": "69b9a122680ceef40a12e8b067078fd0",
"score": "0.5381178",
"text": "def to_s_with_formatted_as_word(format = :default)\n if format == :word\n case self.to_date\n when ::Time.now.to_date\n return 'Today'\n when 1.day.ago.to_date\n return 'Yesterday'\n when 1.day.from_now.to_date\n return 'Tomorrow'\n when 10.days.ago.to_date..::Time.now.to_date\n return time_ago_in_words(self) + ' ago '\n else\n return to_date.to_s(:long)\n end\n else\n to_s_without_formatted_as_word(format)\n end\n end",
"title": ""
},
{
"docid": "91c615160410434383c40cba9e4746f3",
"score": "0.5379882",
"text": "def pretty_due\n due.localtime.try(:strftime, \"%a, %e %b %Y %l:%M %p\")\n end",
"title": ""
},
{
"docid": "67fc43ba16c15e889561ba35a391c0e7",
"score": "0.536103",
"text": "def tweet_event(event, date)\n\n title_max_len = 45\n\n same_mon_year = Time.now.month == date.month && Time.now.year == date.year\n\n same_day = same_mon_year && Time.now.day == date.day\n\n tomorrow = same_mon_year && Time.now.day+1 == date.day\n\n\n if same_day\n\n day = \"Hoy\"\n\n elsif tomorrow\n\n n = \"\\u00F1\" # n with acent\n\n day = \"Ma#{n}ana\"\n\n else\n\n day = \"el #{date.day}/#{date.month}/#{date.year} \"\n\n end\n\n title_max_len-= day.length\n\n\n title = ensure_max_length(event.title,title_max_len)\n\n url = short_url(event.html_link)\n\n message = \"#{day} a las #{Time.parse(event.start_time).hour} horas se realizara el evento #{title}, mas informacion en #{url} #EventosTICBOG\" # /#EventosTICBOG\"\n\n tweet(message)\n\n end",
"title": ""
},
{
"docid": "1ff18b7d942846a357d7ba04fafdaa48",
"score": "0.53585845",
"text": "def publish_date_explanation\n if status == State::DROPPED_NO_SHIP\n 'never released'\n elsif status == State::SHIPPED_LIVE\n 'shipped date'\n elsif batch.try(:is_active?)\n 'batch'\n elsif publish_date_override.present?\n 'custom'\n else\n 'default'\n end\n end",
"title": ""
},
{
"docid": "fc5cf75d2a4f1e897ac5757aa1836102",
"score": "0.5355006",
"text": "def expires_in_words\n unless self.expires.nil?\n time_ago_in_words(self.expires).humanize\n else\n \"The end of time\"\n end\n end",
"title": ""
},
{
"docid": "7b8d1b65a8fddef9db3eef822c50f5ee",
"score": "0.53526914",
"text": "def how_long_ago(date)\n if date.to_date == Date.today\n return 'today'\n elsif date.to_date == Date.yesterday\n return 'yesterday'\n else\n return time_ago_in_words(date)+' ago'\n end\n end",
"title": ""
},
{
"docid": "7f2ea1e26567334f44e949aaa7f0d42a",
"score": "0.53475666",
"text": "def apphelp_date_plain( date )\n date_strfmt = I18n::t( 'uk.org.pond.trackrecord.generic_messages.date' )\n\n if ( date.is_a?( Date ) )\n return date.strftime( date_strfmt )\n else\n time_strfmt = I18n::t( 'uk.org.pond.trackrecord.generic_messages.time' )\n return date.strftime(\n I18n::t(\n \"uk.org.pond.trackrecord.generic_messages.date_and_time\",\n { :date => date_strfmt, :time => time_strfmt }\n )\n )\n end\n end",
"title": ""
},
{
"docid": "46b567c37defcbca9798891cc7ff3d5f",
"score": "0.53374726",
"text": "def humanized_time_ago\n time_ago_in_seconds = Time.now - self.created_at \n #equivalent to calling .created_at on the object itself\n time_ago_in_minutes = time_ago_in_seconds / 60\n \n time_ago_in_hours = time_ago_in_minutes / 60\n \n time_ago_in_days = time_ago_in_hours / 24\n \n time_ago_in_weeks = time_ago_in_days / 7\n \n time_ago_in_years = time_ago_in_weeks / 52\n \nif time_ago_in_weeks >= 52\n \"#{(time_ago_in_years).to_i} years ago\"\nelsif time_ago_in_days >= 7\n \"#{(time_ago_in_weeks).to_i} weeks ago\"\nelsif time_ago_in_hours >= 24\n \"#{(time_ago_in_days).to_i} days ago\"\nelsif time_ago_in_minutes >= 60\n \"#{(time_ago_in_hours).to_i} hours ago\"\nelsif time_ago_in_minutes <= 60\n \"#{(time_ago_in_minutes).to_i} minutes ago\"\nelsif time_ago_in_seconds <= 60\n \"#{(time_ago_in_minutes).to_i} <1 minute ago\"\nend\n\n end",
"title": ""
},
{
"docid": "3d73483af49a72294d9451604faddebe",
"score": "0.5333886",
"text": "def published_date\n t = Time.at(@published / 1000)\n t.strftime \"%Y-%m-%d\"\n end",
"title": ""
},
{
"docid": "6ee18facd649c317b7479f01791ab2c8",
"score": "0.53229517",
"text": "def smart_datetime(datetime, format=nil)\n if happened_today?(datetime)\n time_ago_in_words(datetime) + ' ago'\n else\n datetime.strftime(format || DATETIME_FORMATS[:pretty_datetime])\n end\n end",
"title": ""
},
{
"docid": "5699ab1bbe3139af3dc4045440ce21b5",
"score": "0.53188765",
"text": "def timeago(timestamp)\n time_ago_in_words(timestamp)\n end",
"title": ""
},
{
"docid": "c1e8270cd7bf62d75f71916172c15fe9",
"score": "0.53144664",
"text": "def date_parsed\n published && published_at.present? ? published_at.strftime(\"%d %B %Y\") : \"\"\n end",
"title": ""
},
{
"docid": "64ac3cddf14761c8f294dc33c38aec9c",
"score": "0.5296138",
"text": "def get_post_date(doc)\n span = doc.search(\"span.post-date\")[0]\n span.content\n end",
"title": ""
},
{
"docid": "409f8db33caa467be8b91cb52ae65feb",
"score": "0.5295964",
"text": "def date_time_comment_linked(comment, post)\n return \"<a href=\\\"#{Post.permalink(post)}\\#c#{comment.id.to_s}\\\" title=\\\"Permalink for this comment\\\">#{comment.created_at.strftime(Preference.get_setting('date_format'))} at #{comment.created_at.strftime(Preference.get_setting('time_format'))}</a>\"\n end",
"title": ""
},
{
"docid": "1543039957f4de1d5105ad95ffb7019e",
"score": "0.52934104",
"text": "def post_date_string\n return unless post_url_data\n\n yyyy = post_url_data[:yyyy]\n mm = post_url_data[:mm]\n dd = post_url_data[:dd]\n\n \"#{yyyy}-#{mm}-#{dd}\"\n end",
"title": ""
},
{
"docid": "5cf2ed83b33635a1b552f5fca646c209",
"score": "0.528823",
"text": "def formatted_date_in_words(date_obj, options = {})\n return \"\" if date_obj.nil?\n formatted_time_in_words(date_obj.to_time,\n options.merge(:no_time => true, :absolute => true))\n end",
"title": ""
},
{
"docid": "ee93a958c70521605e3021334ecaab39",
"score": "0.5287691",
"text": "def scheduled_date_text\n\t\tif self.date.nil?\n\t\t\t'N/A'\n\t\telse\n\t\t\tself.date.strftime(\"%B %e, %Y <br /><small>%A @ %l:%M %p</small>\").html_safe\n\t\tend\n\tend",
"title": ""
},
{
"docid": "3f615884eca2fae1d411f63efabd9a6d",
"score": "0.5287474",
"text": "def show\n @post = Post.where(created_at: 30.days.ago..Time.now).find(params[:id])\nend",
"title": ""
},
{
"docid": "34aadc84a2405215f6b886e983015d44",
"score": "0.5278772",
"text": "def time_since_created_at_in_words\n time_ago_in_words(self.created_at) + \" ago\"\n end",
"title": ""
},
{
"docid": "34aadc84a2405215f6b886e983015d44",
"score": "0.5278772",
"text": "def time_since_created_at_in_words\n time_ago_in_words(self.created_at) + \" ago\"\n end",
"title": ""
},
{
"docid": "90c976f1e6ebd1fee86804aa875d9042",
"score": "0.5273606",
"text": "def shortened_tweet_truncator(post)\n short_tweet = word_substituter(post)\n if short_tweet.length > 140\n short_tweet[0..136] + \"...\"\n else\n post\n end\nend",
"title": ""
},
{
"docid": "6ba971f94ffa3172b1ffd2baccb3d09a",
"score": "0.5271797",
"text": "def shorter_time_ago_in_words(time)\n distance = Time.now.to_i - time.to_i\n case distance\n when 0..59\n \"#{distance}s\"\n when 60..3599\n \"#{distance / 60}m\"\n when 3600..86399\n \"#{distance / 60 / 60}h\"\n else\n \"#{distance / 60 / 60 / 24}d\"\n end\n end",
"title": ""
},
{
"docid": "6eccd0faec160e09722084139e94a101",
"score": "0.52699363",
"text": "def died_long_date\n if self.died.present? == true\n \"died #{self.died.strftime('%A, %B %-d, %Y')}\"\n else\n \"\"\n end\n end",
"title": ""
},
{
"docid": "2c4312a305dfe6cf68fa248fd29b957b",
"score": "0.52655345",
"text": "def time_since_created(time_created)\n str = \"ERROR\"\n age = (Time.now.to_i - time_created.to_i)\n case age\n when 0..60\n str = \"Posted just now\" \n return str\n when 60..3600\n str = \"Posted #{age / 60} minutes ago\"\n return str\n when 3600..86400\n str = \"Posted #{age / 3600} hours ago\"\n return str\n when 86400..(86400 * 30)\n str = \"Posted #{age / 86400} days ago\" \n return str\n when (86400 * 30)..(86400 * 365)\n str = \"Posted #{age / (86400 * 30)} months ago\"\n return str\n else\n str = \"Posted #{age / (86400 * 365)} years ago\"\n return str\n end\n return str\n end",
"title": ""
},
{
"docid": "4989a96f9513f526ddcda4b05010a30b",
"score": "0.5263915",
"text": "def extract_post_created_at post\n post.identifier[%r{/(\\d+-\\d+-\\d+)[\\w-]+/?$}, 1]\n end",
"title": ""
},
{
"docid": "c89c2524b3f752c019f43ee4226cd581",
"score": "0.5261533",
"text": "def responded_time(thought)\n if thought.sort_date < 10.days.ago\n thought.sort_date.to_formatted_s(:short_ordinal)\n else\n \"#{time_ago_in_words(thought.sort_date)} ago\"\n end\n end",
"title": ""
},
{
"docid": "1a38345b842d8a0418e8c0c1f600f911",
"score": "0.52579165",
"text": "def formatted_data\n # post&.data&.date&.strftime('%b %d, %Y')\n date_to_string(post&.data&.date, 'ordinal', 'US')\n end",
"title": ""
},
{
"docid": "541967acd79ecd2cdd8c6a2067e67842",
"score": "0.5249201",
"text": "def to_s() \"#{day} #{weekstr} (#{date.day} #{month})\" end",
"title": ""
},
{
"docid": "d1b0922903848f46c49cbc8e440e8d70",
"score": "0.5245564",
"text": "def humanize_expires_on\n I18n.localize(expires_on, :format => :long) if expires_on\n end",
"title": ""
},
{
"docid": "e8f6986429862dba4e4bbfbfb91d8045",
"score": "0.52435166",
"text": "def ago_time(time)\n ago = Time.now - time\n if ago < 3600\n return \"#{ago.div(1)} minutes ago\"\n elsif ago < 3600 * 12\n return \"#{ago.div(3600)} hours ago\"\n elsif ago < 3600 * 24\n return \"Yesterday\"\n elsif ago < 3600 * 24 * 7\n return \"#{time.strftime('%A')}\"\n else \n return \"#{time.strftime('%A %-d %B %Y')}\"\n end \nend",
"title": ""
},
{
"docid": "7175b4ae0d9c7e5f069ab6c623894160",
"score": "0.52397156",
"text": "def date_taken( )\n months = [\"Januari\", \"Februari\", \"Maart\", \"April\", \"Mei\", \"Juni\", \"Juli\", \"Augustus\", \"September\", \"Oktober\", \"November\", \"December\"]\n @data['exif'][:date_time_original].to_s.empty? ? \"\" : \"#{months[@data['exif'][:date_time_original].month-1]} #{@data['exif'][:date_time_original].day}, #{@data['exif'][:date_time_original].year}\"\n end",
"title": ""
},
{
"docid": "595f6f6381fba72f834acf08c341920f",
"score": "0.5233663",
"text": "def render_date(time)\n time.strftime(\"%-d %b %Y\")\n end",
"title": ""
},
{
"docid": "d9dce891522be7b5509a5a81710e3783",
"score": "0.5232558",
"text": "def date_message(human_attribute_name, check_date)\n # Date can only be in future or past\n days_in_future = date_in_future(check_date)\n if days_in_future\n t('.date_in_future', attribute_name: human_attribute_name, count: days_in_future)\n else\n days_in_past = date_in_past(check_date)\n return unless days_in_past\n\n t('.date_in_past', attribute_name: human_attribute_name, count: days_in_past)\n\n end\n end",
"title": ""
},
{
"docid": "d48121ed1eb4a5ef3cf8f83629274f36",
"score": "0.52300143",
"text": "def post(title, image, datetime)\n date_object = datetime.to_time\n date_human_readable = date_object.strftime('%B %d, %Y')\n \"\n <article class='panel'>\n <div class='panel-heading'>\n <h1>#{title}</h1>\n </div>\n <div class='panel-body'>\n <img src='/#{images_dir}/#{image}'>\n </div>\n <div class='panel-footer'>\n <time datetime='#{datetime}'>#{date_human_readable}</time>\n </div>\n </article>\n \"\n end",
"title": ""
},
{
"docid": "f044e4bf32db3e808891f12a2e15c093",
"score": "0.5226481",
"text": "def created_at\n helpers.content_tag :span, class: 'time' do\n post.created_at.strftime(\"%a %m/%d/%y\")\n end\n end",
"title": ""
},
{
"docid": "4976f533d1799a36858e34dc273bba28",
"score": "0.52197045",
"text": "def eng\n strftime('%B %-d, %Y')\n end",
"title": ""
},
{
"docid": "88137f330464d60a0036ab9f6da72157",
"score": "0.5212145",
"text": "def convert_created_at_to_created_on\n all_posts.each do |post|\n metadata = post.piece.metadata.raw_yaml\n\n unless metadata['created_at']\n puts \"skipping post: #{post.piece.name}\"\n next\n end\n\n created_at = Time.at(metadata['created_at'])\n if created_at <= latest_date_in_eastern_timezone\n # puts \"Using Eastern Time for #{post.piece.title}\"\n created_on = created_at.to_datetime.in_time_zone('Eastern Time (US & Canada)').to_date\n elsif created_at > latest_date_in_eastern_timezone && created_at <= latest_date_in_mountain_timezone\n # puts \"Using Mountain Time for #{post.piece.title}\"\n created_on = created_at.to_datetime.in_time_zone('Mountain Time (US & Canada)').to_date\n else\n # puts \"Using Pacific Time for #{post.piece.title}\"\n created_on = created_at.to_datetime.in_time_zone('Pacific Time (US & Canada)').to_date\n end\n\n metadata['created_on'] = created_on\n post.piece.metadata.raw_yaml = metadata\n post.piece.metadata.save_yaml\n end\n\n 'done'\n end",
"title": ""
}
] |
bcfa540a6786ecad4b72bd2557645253 | Add to or remove tag values from the filter. | [
{
"docid": "9f1dd610f85c16990e6b056253536847",
"score": "0.0",
"text": "def process_filter\n # Create the session variable if necessary.\n unless session.has_key?(:filter)\n session[:filter] = Array.new\n end\n\n start_size = session[:filter].length\n \n # Adding to the filter?\n if params.has_key?(:add_to_filter)\n session[:filter] << params[:add_to_filter]\n end\n\n # Removing from the filter?\n if params.has_key?(:remove_from_filter)\n session[:filter].delete_at(session[:filter].index(params[:remove_from_filter]))\n end\n \n # Clearing the filter?\n if params.has_key?(:clear_filter)\n session[:filter].clear\n end\n # If the filter was added to or removed from the size will have changed.\n return session[:filter].length != start_size\n end",
"title": ""
}
] | [
{
"docid": "e034befbd327c01eb0c4cce4ab13455a",
"score": "0.65148705",
"text": "def add_filter_taggings\n filter = self.canonical? ? self : self.merger\n if filter\n Work.with_any_tags([self, filter]).each do |work|\n work.filter_taggings.find_or_create_by_filter_id(filter.id)\n end\n end\n end",
"title": ""
},
{
"docid": "53e17d7de76b3118fd0d618e33145e2f",
"score": "0.6458628",
"text": "def tags_to_add\n local_tags.reject { |t, v| aws_tags.include?(t) and aws_tags[t] == v }\n end",
"title": ""
},
{
"docid": "11f6c44b5c30e929337ebed4be33fa2a",
"score": "0.64144695",
"text": "def add_tag_filters\n return if options[:filter_ids].blank?\n options[:filter_ids].each do |filter_id|\n body.filter(:term, filter_ids: filter_id)\n end\n end",
"title": ""
},
{
"docid": "a29a489bf0d9a1ef2511409cbf66021b",
"score": "0.6159259",
"text": "def tags_for_filter(current:)\n if filtered_by_tag?(current)\n tags_from_params - Array(current.name)\n else\n tags_from_params.push(current.name)\n end.uniq.join(\",\")\n end",
"title": ""
},
{
"docid": "2568c5b38dbfffce91f8db9b17db55b5",
"score": "0.61406296",
"text": "def tags_to_add=(value)\n @tags_to_add = value\n end",
"title": ""
},
{
"docid": "c3633443268a426e3a11718da31b6905",
"score": "0.6131166",
"text": "def filter_on(values)\n @filters << values\n end",
"title": ""
},
{
"docid": "1b48c3c29e14c36702aa2b61404581fa",
"score": "0.6006059",
"text": "def filtered_tags=(filtered_tags)\n assert_unloaded\n @filtered_tags = names_to_tags(filtered_tags)\n end",
"title": ""
},
{
"docid": "85483fb49e1442de72b9c3dcecd405b6",
"score": "0.5976555",
"text": "def add_filter\n @filter = true \n end",
"title": ""
},
{
"docid": "b0be47fffa62c2a17139c29c2f0023ba",
"score": "0.58761925",
"text": "def tags_to_add\n current_tags - linked_tags\n end",
"title": ""
},
{
"docid": "baa938c903aff1008083854309855922",
"score": "0.5857989",
"text": "def tags_to_remove=(value)\n @tags_to_remove = value\n end",
"title": ""
},
{
"docid": "6345e5c1090056395ee7c1102b3dc1f7",
"score": "0.58300626",
"text": "def add_tags\n \tunless tags_field.blank?\n\t\t\ttags = tags_field.split(\",\")\n\t\t\ttags.each do |tag|\n self.tags << Tag.find_or_initialize_by_name(tag.strip)\n\t\t\tend\n\t\tend\t\n end",
"title": ""
},
{
"docid": "b6226982d680c82749d5824645a56dab",
"score": "0.5745665",
"text": "def filters=( args )\n @filters.clear\n add_filters(*args)\n end",
"title": ""
},
{
"docid": "539ba7be0dc861952487808adb8b6941",
"score": "0.57317066",
"text": "def update_tags_value\n feature_value = FeatureValue.find(params[:feature_value_id])\n tag_id = params[:tag_id].to_i\n current_value = feature_value.value_genuine || []\n if current_value.include?(tag_id)\n current_value.delete(tag_id)\n else\n current_value << tag_id\n end\n feature_value.set_value(current_value, nil, nil, current_user)\n render :update do |page| end\n end",
"title": ""
},
{
"docid": "73dd3084f70880641de4537a09973e6a",
"score": "0.57043195",
"text": "def set_attributes(attrs)\n if attrs.has_key?(\"filters\")\n attrs = attrs.merge(attrs[\"filters\"])\n end\n super(attrs)\n end",
"title": ""
},
{
"docid": "3aff639b68967ce4f5126f3be186a4c7",
"score": "0.56830674",
"text": "def add_or_remove_tags(task)\n if params[:task][:tags].respond_to? 'each'\n params[:task][:tags].each do |tag|\n if tag[:status] == 'remove'\n task.tags.destroy(current_user_tags.find_by(name: tag[:name]))\n task.touch\n elsif tag[:status] == 'new'\n new_tag = Tag.find_or_initialize_by name: tag[:name], user_id: task.user_id\n if new_tag.new_record?\n new_tag.save\n task.tags << new_tag\n task.touch\n elsif !task.tags.exists?(name: new_tag.name)\n task.tags << new_tag\n task.touch\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "3a776e2aebb5eaf1dae6b0cb80d98fbf",
"score": "0.5675608",
"text": "def filter_attr_values(audited_changes: {}, attrs: [], placeholder: \"[FILTERED]\")\n attrs.each do |attr|\n next unless audited_changes.key?(attr)\n\n changes = audited_changes[attr]\n values = changes.is_a?(Array) ? changes.map { placeholder } : placeholder\n\n audited_changes[attr] = values\n end\n\n audited_changes\n end",
"title": ""
},
{
"docid": "c46f8a5c3269168b91e2c3ac25e9e4e3",
"score": "0.5670245",
"text": "def tag_list= value\n self.tags = value.split(',').map(&:strip)\n end",
"title": ""
},
{
"docid": "c46f8a5c3269168b91e2c3ac25e9e4e3",
"score": "0.5670245",
"text": "def tag_list= value\n self.tags = value.split(',').map(&:strip)\n end",
"title": ""
},
{
"docid": "4e6a938aafa6c7582b1367a74e6acd56",
"score": "0.5650135",
"text": "def add_filters(filters); end",
"title": ""
},
{
"docid": "952a1eb88e4d0ea86fed76f30fb7cee9",
"score": "0.56402713",
"text": "def update_tags!\n return unless @params.key?(:tags)\n\n tags_to_remove.each do |tag_title|\n TaskTag.where(task: task).joins(:tag).merge(Tag.where(title: tag_title)).destroy_all\n end\n\n tags_to_add.each do |tag_title|\n TaskTag.where(task: task, tag: tag_from_title(tag_title)).first_or_create!\n end\n end",
"title": ""
},
{
"docid": "7fe5fbc9a0b0033b24677dc9e891616c",
"score": "0.5635517",
"text": "def tags(tags)\n rules.last.tags += tags\n end",
"title": ""
},
{
"docid": "b4177984531bcaf7007f397563a308ae",
"score": "0.56292",
"text": "def product_tags=(values)\n self.tag_list = values\n end",
"title": ""
},
{
"docid": "676ef2cac1d5b9feb94bc28597491f91",
"score": "0.56286466",
"text": "def add_tags(tag)\n remove_previous_tags\n if @page.find(input_elements[:tag_input_field]).present?\n @page.find(input_elements[:tag_input_field]).set(tag)\n else\n @page.find(input_elements[:tag_input_field2]).set(tag)\n end\n @page.find(input_elements[:tag_selected]).click\n @used_tag = tag\n end",
"title": ""
},
{
"docid": "f57cc8f691e7bdd7c4034ebca4cbeaf2",
"score": "0.56108326",
"text": "def _UNDO_setTags(iNewTags)\n # Remove Tags that are not part of the new list\n @Tags.delete_if do |iTag, iNil|\n !iNewTags.has_key?(iTag)\n end\n # Add Tags that are not part of the current list\n iNewTags.each do |iTag, iNil|\n @Tags[iTag] = nil\n end\n end",
"title": ""
},
{
"docid": "f845382d1f244c003396d1b51c81a1a2",
"score": "0.56011933",
"text": "def add_filter(filter)\n @filters = (@filters << filter).sort_by do |f|\n f.respond_to?(:weight) ? f.weight : DEFAULT_WEIGHT\n end.reverse!\n end",
"title": ""
},
{
"docid": "112732aaf4fde2be724baf67865e64a2",
"score": "0.5600066",
"text": "def update_tags\n return unless tag_string\n new_tag_names = tag_string.split(\",\").map { |t| t.strip.downcase }\n current_tag_names = tags.collect(&:name)\n new_tag_names.each do |tag_name| \n unless current_tag_names.include? tag_name\n tag = Tag.where(name: tag_name)[0]\n tag = Tag.create! name: tag_name unless tag\n self.tags << tag \n end\n end\n tags.each { |t| (tags.remove t) unless (new_tag_names.include? t.name) }\n end",
"title": ""
},
{
"docid": "c51f941f77fc12b914993a6a8a558314",
"score": "0.559315",
"text": "def tag *tags\n @tags += tags\n self\n end",
"title": ""
},
{
"docid": "0ad87eb7f8b429d1c2c25738356e7215",
"score": "0.5585892",
"text": "def update!(**args)\n @composite_filter = args[:composite_filter] if args.key?(:composite_filter)\n @value_filter = args[:value_filter] if args.key?(:value_filter)\n end",
"title": ""
},
{
"docid": "0ad87eb7f8b429d1c2c25738356e7215",
"score": "0.5585892",
"text": "def update!(**args)\n @composite_filter = args[:composite_filter] if args.key?(:composite_filter)\n @value_filter = args[:value_filter] if args.key?(:value_filter)\n end",
"title": ""
},
{
"docid": "a06de53eff09511399db6df08a5ecae3",
"score": "0.55788445",
"text": "def apply_tag_filter\n return if params[:tag].blank?\n params[:tag].tap do |tag|\n @posts = @posts.tagged_with tag\n add_breadcrumb \"by tag \\\"#{tag}\\\"\"\n end\n end",
"title": ""
},
{
"docid": "f4eea0f18a764572f66ced024899abfa",
"score": "0.5565964",
"text": "def add_tag(tag, *values)\n tag.upcase!\n @selected_files.each { |file| file.add_values(tag, *values) }\n self\n end",
"title": ""
},
{
"docid": "2b959ea32417f80b7e8b35f8bd70c390",
"score": "0.5548278",
"text": "def tag_names=(rhs)\n self.tags = rhs.strip.split(/\\s*,\\s*/).map do |tag_name|\n Tag.find_or_initialize_by(name: tag_name)\n end\n end",
"title": ""
},
{
"docid": "b73d5f8c9b439101d11f1b8d379867b4",
"score": "0.55411303",
"text": "def update_filters_for_merger_change\n if self.merger_id_changed?\n if self.merger && self.merger.canonical?\n self.add_filter_taggings\n end\n old_merger = Tag.find_by_id(self.merger_id_was)\n if old_merger && old_merger.canonical?\n self.remove_filter_taggings(old_merger)\n end\n end \n end",
"title": ""
},
{
"docid": "735397009ff1eafdb4d06fbb03a3bb1a",
"score": "0.5525435",
"text": "def handle_adding_tag(tag, tags)\n if tags.include?(tag)\n puts \"Warning: duplicate tag #{tag} detected\"\n else\n tags.push(tag)\n end\n return tags\n end",
"title": ""
},
{
"docid": "735397009ff1eafdb4d06fbb03a3bb1a",
"score": "0.5525435",
"text": "def handle_adding_tag(tag, tags)\n if tags.include?(tag)\n puts \"Warning: duplicate tag #{tag} detected\"\n else\n tags.push(tag)\n end\n return tags\n end",
"title": ""
},
{
"docid": "f4efb1a38c3cc433756f230bcb731228",
"score": "0.5520409",
"text": "def tag_names=(rhs)\n self.tags = rhs.strip.split(/\\s*,\\s*/).map do |tag_name|\n Tag.find_or_initialize_by(name: tag_name)\n end\n end",
"title": ""
},
{
"docid": "9c329f792bf95560f5f02ef3b27f8c4c",
"score": "0.5513731",
"text": "def add_tags(new_tags)\n new_tags.each do |k, v|\n self.tags[k.to_s] = v\n end\n self\n end",
"title": ""
},
{
"docid": "3f1d7495d5a856e01168e503d5a851e5",
"score": "0.55051994",
"text": "def add_filter(filter)\n @filters << filter\n end",
"title": ""
},
{
"docid": "b4aa5adea0993d115840962df06f2b82",
"score": "0.54973876",
"text": "def remove_tag_params(tag, source_params=params)\n new_params = source_params.dup\n\n # need to dup the facet values too,\n # if the values aren't dup'd, then the values\n # from the session will get remove in the show view...\n new_params[:t] = (new_params[:t] || {}).dup\n new_params.delete :page\n new_params.delete :id\n new_params.delete :counter\n new_params.delete :commit\n new_params[:t].delete(tag)\n\n # Force action to be index.\n new_params[:controller] = \"catalog\"\n new_params[:action] = \"index\"\n new_params\n end",
"title": ""
},
{
"docid": "204908c7246b650088714957e6665b19",
"score": "0.5490815",
"text": "def apply_filter\n end",
"title": ""
},
{
"docid": "648d330664845baef5c2b0d02a0e6d01",
"score": "0.5488275",
"text": "def filter(filter)\n tl = AlienTagList.new\n\n self.each do |ele|\n if ele.tag =~ filter\n tl.add_tag(ele)\n end\n end\n\n return tl\n end",
"title": ""
},
{
"docid": "ff731ea253419e87be2dd371a6c697f3",
"score": "0.54878783",
"text": "def set_tag(key, value)\n sanitized_value = valid_tag_value?(value) ? value : value.to_s\n @tags = @tags.merge(key.to_s => sanitized_value)\n end",
"title": ""
},
{
"docid": "88b661a538d148171e0747e636fb8b68",
"score": "0.5474126",
"text": "def SetFilter(attribute, values, exclude = false)\n assert { attribute.instance_of? String }\n assert { values.instance_of? Array }\n assert { !values.empty? }\n\n if values.instance_of?(Array) && values.size > 0\n values.each do |value|\n assert { value.instance_of? Fixnum }\n end\n \n @filters << { 'type' => SPH_FILTER_VALUES, 'attr' => attribute, 'exclude' => exclude, 'values' => values }\n end\n end",
"title": ""
},
{
"docid": "d49e638b19399e52e5d93aa56b44948f",
"score": "0.5467757",
"text": "def post_tags(*value)\n @value[:post_tags] = value.flatten\n end",
"title": ""
},
{
"docid": "f993d375fcfeb93a5938ce101f404ff1",
"score": "0.5462551",
"text": "def tag_names=(rhs)\n self.tags = rhs.strip.split(/\\s*,\\s*/).map do |tag_name| \n # Finds the first record with the given attributes, or\n # initializes a record (Tag.new) with the attributes\n # if one is not found \n Tag.find_or_initialize_by(name: tag_name)\n # If a tag with name tag_name is not found,\n # it will call Tag.new(name: tag_name)\n end\n end",
"title": ""
},
{
"docid": "b01261ac1eef657f751511d695de9839",
"score": "0.5462485",
"text": "def tag_names=(rhs)\n self.tags = rhs.strip.split(/\\s*,\\s*/).map do |tag_name|\n # Finds the first record with the given attributes, or\n # initializes a record (Tag.new) with the attributes\n # if one is not found.\n Tag.find_or_initialize_by(name: tag_name)\n # If a tag with name tag_name is not found,\n # it will call Tag.new(name: tag_name)\n end\n end",
"title": ""
},
{
"docid": "eaae2de36cce183f56b2daf34db53117",
"score": "0.5460942",
"text": "def filter(field, value)\n @filters << [field, value]\n @loaded = false\n self\n end",
"title": ""
},
{
"docid": "cadeb46af0d75b87f804590644b9a903",
"score": "0.5443976",
"text": "def add_filter(filter_argument = T.unsafe(nil), &filter_proc); end",
"title": ""
},
{
"docid": "06f136c23af307af7be0eca7e076d0f4",
"score": "0.54401535",
"text": "def selected_tags=(data)\n self.tags.clear\n data.split('tag').each { |id| self.tags << Tag.find(id) if id.length > 0 }\n end",
"title": ""
},
{
"docid": "1bcf3b15c257b8c953e7b20d3a7b808f",
"score": "0.5422443",
"text": "def additional_tags=(value)\n @additional_tags = value\n end",
"title": ""
},
{
"docid": "7bef7d74a48e518957052b02e8802601",
"score": "0.5417488",
"text": "def apply_filter(scope, value)\n branches = normalize_filters(value).reduce { |a, b| a.or(b) }\n scope.merge branches\n end",
"title": ""
},
{
"docid": "7bef7d74a48e518957052b02e8802601",
"score": "0.5417488",
"text": "def apply_filter(scope, value)\n branches = normalize_filters(value).reduce { |a, b| a.or(b) }\n scope.merge branches\n end",
"title": ""
},
{
"docid": "7bef7d74a48e518957052b02e8802601",
"score": "0.5417488",
"text": "def apply_filter(scope, value)\n branches = normalize_filters(value).reduce { |a, b| a.or(b) }\n scope.merge branches\n end",
"title": ""
},
{
"docid": "7bef7d74a48e518957052b02e8802601",
"score": "0.5417488",
"text": "def apply_filter(scope, value)\n branches = normalize_filters(value).reduce { |a, b| a.or(b) }\n scope.merge branches\n end",
"title": ""
},
{
"docid": "ceecfd083ab2840ac9a4fdefb3b36618",
"score": "0.5417362",
"text": "def tag_names=(rhs)\n self.tags = rhs.strip.split(/\\s*,\\s*/).map do |tag_name|\n # Finds the first record with given\n # attributes, or initializes a record\n # (Tag.new) with attributes if one is\n # not found.\n Tag.find_or_initialize_by(name: tag_name)\n end\n end",
"title": ""
},
{
"docid": "c1a84ce5c8bf6e5d9b7f001e6a2c7662",
"score": "0.54153585",
"text": "def add_filter_param(param, value)\n @mg_params[filter_param_name.to_sym][param] = value unless @mg_params[filter_param_name.to_sym].key?(param)\n end",
"title": ""
},
{
"docid": "fc94ce32132b42c120e6c2cf9cb70fc2",
"score": "0.53907937",
"text": "def add_alternation( filter )\n\t\t\t@filterlist << filter\n\t\tend",
"title": ""
},
{
"docid": "8505629a39bf998bb3a2b57bbbac81b8",
"score": "0.53868884",
"text": "def dedup_tags!\n tags = read_attribute(tags_field)\n tags = tags.reduce([]) do |uniques, tag|\n uniques << tag unless uniques.map(&:downcase).include?(tag.downcase)\n uniques\n end\n write_attribute(tags_field, tags)\n end",
"title": ""
},
{
"docid": "875f2b1bf28074028b4214939ae311b1",
"score": "0.5377342",
"text": "def process_tags(data)\n @tagmap.each do |id, tag|\n data.gsub!(id, process_tag(tag))\n end\n data\n end",
"title": ""
},
{
"docid": "2dc899ba6b73e89af6e50cbd4a7323fb",
"score": "0.5375753",
"text": "def filter!(filter)\n self.delete_if { |ele| !(ele.tag =~ filter)}\n return self\n end",
"title": ""
},
{
"docid": "bfa27af025301cad64af942dbec95680",
"score": "0.5367814",
"text": "def added_tags=(value)\n @added_tags = value\n end",
"title": ""
},
{
"docid": "20f9a4ebc6bb37882419c3a36f228dfa",
"score": "0.53628504",
"text": "def tagging_tags\n filtered_tags(:tagtype_x => [11, :Collection, :List])\n end",
"title": ""
},
{
"docid": "e772f244d7ab91614f8a813b261e619c",
"score": "0.536021",
"text": "def add_or_filters(fields, operators, values)\n if fields.present? && operators.present?\n fields.each do |field|\n # Smile specific #340206 Filtre additifs\n add_or_filter(field, operators[field], values && values[field])\n end\n end\n end",
"title": ""
},
{
"docid": "a3de172426ac1b6f304395f562473f75",
"score": "0.53475046",
"text": "def set_filters(value)\n valid = []\n value.each do |filter|\n if (!filter['name'].blank? && !filter['to'].blank? && !filter['from'].blank?)\n valid << filter\n elsif (filter['name'] && filter['values'])\n # Hack to accept both an array of values or a JSON\n filter['values'] = if filter['values'].is_a? String\n JSON.parse(filter['values'])\n else\n filter['values']\n end\n valid << filter\n end\n end\n self.write_attribute :filters, valid.to_json\n end",
"title": ""
},
{
"docid": "7dbd223e878683ab0f18acd11f073aa0",
"score": "0.53417563",
"text": "def apply_filter(scope, value)\n branches = normalize_filters(value).reduce { |a, b| a.or(b) }\n scope.merge branches\n end",
"title": ""
},
{
"docid": "b73b815c30dead375ec5664cc6f86372",
"score": "0.53299826",
"text": "def filter_items=(values)\n values.each do |value|\n filter_items << Filter.new(value)\n end\n end",
"title": ""
},
{
"docid": "0bb0c8687f9bd364d3f4e32ebb3b95d3",
"score": "0.5327076",
"text": "def set_tag_for_search(tag)\n @page.all(input_elements[:entries])\n @page.find(input_elements[:tag_filter_field]).set(tag)\n @page.find(input_elements[:tag_selected]).click\n @used_tag = tag\n end",
"title": ""
},
{
"docid": "e094e3d5d26ab34da328d17fb27df06c",
"score": "0.5323669",
"text": "def add_tag_params(tag)\n new_params = params.dup\n new_params[:t] = {tag => '✓'}\n new_params\n end",
"title": ""
},
{
"docid": "436eae8828151f276ad68e4f8f94dd72",
"score": "0.5318434",
"text": "def process_tags(data)\n @tagmap.each do |id, tag|\n data.gsub!(id, process_tag(tag))\n end\n data\n end",
"title": ""
},
{
"docid": "a4d2331d9dd83a5205c19007a8c71ed5",
"score": "0.5314044",
"text": "def tags=(value)\n if value.kind_of?(String)\n @tags = value.split(\",\").uniq.map(&:strip)\n elsif value.kind_of?(Array)\n @tags = value.uniq.map(&:strip)\n end\n end",
"title": ""
},
{
"docid": "cd2eabad8c015faa497291e7907f1041",
"score": "0.5312937",
"text": "def add_tag!(tag)\r\n tag = add_tag(tag)\r\n tag.save\r\n end",
"title": ""
},
{
"docid": "8b683e57c143b9c9751dc0df7b46c419",
"score": "0.53082067",
"text": "def tags_to_add\n return @tags_to_add\n end",
"title": ""
},
{
"docid": "41ad30e5e6ef08fc6665ceaeeacd79ce",
"score": "0.5304961",
"text": "def add_tag(tag)\n\n (h.fields['__tags__'] ||= []) << tag\n end",
"title": ""
},
{
"docid": "f922e90c2b5cbd9030268050e2c2f615",
"score": "0.5302412",
"text": "def tag_filter_control(tag, options = {})\n class_names = [dom_id(tag), \"tag\"]\n class_names << \"subscribed\" if tag.user_id != current_user.id\n class_names << \"has_subscriptions\" if !tag.tag_subscriptions.empty?\n class_names << \"public\" if tag.public? # && tag.user_id == current_user.id\n class_names << \"archived\" if !tag.tag_subscriptions.empty? && tag.user == User.find_by_login(\"archive\")\n class_names << \"archive_account\" if current_user.login == \"archive\"\n\n content_tag(:li, \n content_tag(:div, \"\", :class => \"context_menu_button\", :'tag-id' => tag.id) +\n content_tag(:span, \n content_tag(:span, \n tag_name_uniqued(tag, options),\n :class => \"name\", \n :id => dom_id(tag, \"name\"), \n :\"data-sort\" => tag.sort_name),\n :class => \"filter\"),\n :id => dom_id(tag), \n :class => class_names.join(\" \"),\n :name => tag.name,\n :pos_count => tag.positive_count,\n :neg_count => tag.negative_count,\n :item_count => tag.feed_items_count,\n :title => tag_tooltip(tag))\n \n end",
"title": ""
},
{
"docid": "d966a5ef178b47e20e09963e4f28ee05",
"score": "0.5301377",
"text": "def remove_filter_taggings(old_filter=nil)\n if old_filter\n potential_duplicate_filters = [old_filter] + old_filter.mergers - [self]\n self.works.each do |work|\n if (work.tags & potential_duplicate_filters).empty?\n filter_tagging = work.filter_taggings.find_by_filter_id(old_filter.id)\n filter_tagging.destroy if filter_tagging\n end\n end \n else\n self.filter_taggings.destroy_all\n end \n end",
"title": ""
},
{
"docid": "189a52af93ccc3e0ab2d2b59cf94d86e",
"score": "0.52969533",
"text": "def push_filter(filter)\r\n filter.line_end_format = @current_format\r\n @current_filter.append(filter)\r\n @current_filter = filter\r\n end",
"title": ""
},
{
"docid": "d6d120d97d704b8640dd7c77c4591a32",
"score": "0.5294833",
"text": "def tag_names=(list)\n # Throw away extra space and blank tags\n list = list.map {|x| x.strip}.reject {|x| x.blank?}\n \n # Re-use any tags that already exist\n self.tags = device.account.tags.all(:conditions => {:name => list})\n tag_names = self.tags.map(&:name)\n \n # Create new tags for any names left in the list\n list.reject! {|x| tag_names.find {|name| name.casecmp(x) == 0}}\n self.tags += device.account.tags.create(list.map {|n| {:name => n}}).select(&:valid? )\n end",
"title": ""
},
{
"docid": "6deabf2d3fa390e423714c5139b63d75",
"score": "0.5293101",
"text": "def add_tags(*tags)\n @hash_tags.concat(tags.flatten)\n end",
"title": ""
},
{
"docid": "060c014578becf8977ec7dd8e449fe4b",
"score": "0.529267",
"text": "def tags=(value)\n @tags = value.is_a?(String) ? value.gsub(', ', ',').split(',') : value\n end",
"title": ""
},
{
"docid": "0853f0be34926adc8353111f09af672a",
"score": "0.5287885",
"text": "def tag_list=(my_tags)\n\t\t_new_tags = my_tags.split(',').map { |t| t.strip }.uniq\n\t\t_recent_tags = self.tags.map { |tag| tag.name }\n\n\t\t(_recent_tags - _new_tags).each { |tag| self.tags.where(name: tag).first.destroy } unless _recent_tags.blank?\n\t\tself.tags << (_new_tags - _recent_tags).map { |tag| Tag.find_or_create_by(name: tag) } unless _new_tags.blank?\n\t\t@tag_list = nil\n\tend",
"title": ""
},
{
"docid": "8f8f26424adb7c1ff2f38ec3f0133741",
"score": "0.5285811",
"text": "def set_tag(key, value)\n [key, value]\n end",
"title": ""
},
{
"docid": "b01caded8b16684724a4608ba21e3cb5",
"score": "0.5282413",
"text": "def tag_list=(tags)\n new_tags = tags.is_a?(String) ? tags.split(',') : tags\n location_tags = [self.location, self.city, self.state, self.country]\n updated_tags = [location_tags, new_tags].flatten.compact.reject{|n| n.blank?}.map{|n| n.strip}.uniq.join(', ')\n super updated_tags\n end",
"title": ""
},
{
"docid": "a9d0bf97082ad54e16ad5ad3f3c05105",
"score": "0.5279175",
"text": "def add_filters\n add_term_filters\n add_terms_filters\n add_range_filters\n end",
"title": ""
},
{
"docid": "fb7c27e23d843db2e3a7fa49c04fb7bc",
"score": "0.52790284",
"text": "def add_tag_exclusions\n return if options[:excluded_tag_ids].blank?\n options[:excluded_tag_ids].each do |exclusion_id|\n body.must_not(:term, filter_ids: exclusion_id)\n end\n end",
"title": ""
},
{
"docid": "6a349a515db79422aa96e0640291e600",
"score": "0.5267846",
"text": "def tags!(str)\n str.strip!\n tags = str.split(\",\").map { |tag|\n self.tags.find_or_create_by_value(tag.strip.downcase)\n }\n self.tags << tags\n end",
"title": ""
},
{
"docid": "f9a301e793f0c9828a7f396df3145fcd",
"score": "0.5257215",
"text": "def add_tags(tags, remove: false)\n title = dup\n tags = tags.to_tags\n tags.each { |tag| title.tag!(tag, remove: remove) }\n title\n end",
"title": ""
},
{
"docid": "4b0e2d08f2e0ceff41385dfa1394e34b",
"score": "0.5253018",
"text": "def filter_ids\n (tags.map { |tag| tag[:id] } + filters.map(&:id)).uniq\n end",
"title": ""
},
{
"docid": "06839534a0f9381e18450de72309d192",
"score": "0.524991",
"text": "def update!(**args)\n @or_filters_for_segment = args[:or_filters_for_segment] if args.key?(:or_filters_for_segment)\n end",
"title": ""
},
{
"docid": "ddf287017da62d137e4354705efdc498",
"score": "0.5248482",
"text": "def add_filters(fields, operators, values)\n fields.each do |field|\n add_filter(field, operators[field], values[field])\n end\n end",
"title": ""
},
{
"docid": "43b19159d4ec258f382beacb84c76b2d",
"score": "0.5246559",
"text": "def tag(*tags)\n attribute 'tags' do |existing_tags|\n existing_tags ||= []\n tags.each do |tag|\n if !existing_tags.include?(tag.to_s)\n existing_tags << tag.to_s\n end\n end\n existing_tags\n end\n end",
"title": ""
},
{
"docid": "ce627599ca9722d998ad227c0a27d1c5",
"score": "0.52381945",
"text": "def filtered_params\n params.require(:tag).permit(:name, :description)\n end",
"title": ""
},
{
"docid": "f9966c0c3b19b91e4e6d178f08529e18",
"score": "0.5235345",
"text": "def consider_tag\n\n tag = attribute(:tag)\n\n return unless tag && tag.strip.size > 0\n\n h.tagname = tag\n h.full_tagname = applied_workitem.tags.join('/')\n\n return if h.trigger\n #\n # do not consider tags when the tree is applied for an\n # on_x trigger\n\n h.full_tagname = (applied_workitem.tags + [ tag ]).join('/')\n\n set_variable(h.tagname, h.fei)\n set_variable('/' + h.full_tagname, h.fei)\n\n applied_workitem.send(:add_tag, h.tagname)\n\n @context.storage.put_msg(\n 'entered_tag',\n 'tag' => h.tagname,\n 'full_tag' => h.full_tagname,\n 'fei' => h.fei,\n 'workitem' => h.applied_workitem)\n end",
"title": ""
},
{
"docid": "91dae591238003b69cb8f27a1d9f9ca6",
"score": "0.5235093",
"text": "def add_or_filter(field, operator, values=nil)\n # values must be an array\n return unless values.nil? || values.is_a?(Array)\n # check if field is defined as an available filter\n if available_filters.has_key? field\n filter_options = available_filters[field]\n or_filters[field] = {:operator => operator, :values => (values || [''])}\n end\n end",
"title": ""
},
{
"docid": "4be96d2fd0cb3b36f193501348aeece7",
"score": "0.5224632",
"text": "def add_token_filter(filter, **options)\n add_into(@token_filters, filter, **options)\n nil\n end",
"title": ""
},
{
"docid": "bda03585aeddbbd90e9d7340d6f5b676",
"score": "0.52221143",
"text": "def add_filter(filter)\n @filters << filter\n self\n end",
"title": ""
},
{
"docid": "58e986f1a59fb03a03e1cf24b87e9a90",
"score": "0.5220802",
"text": "def add_filter(filter_symbol)\n filters << filter_symbol\n end",
"title": ""
},
{
"docid": "c884ca1a903c7959fda23c398e0e6edc",
"score": "0.5220132",
"text": "def render_filter_element(facet, values, localized_params)\n # Overrride BL's render_filter_element\n # When creating remove filter links exclude the date range added parameters, if present\n # Otherwise the filter gets removed but the parameters stay in the URL\n if facet == 'sdateRange'\n excluded_params = [:year_from, :year_to]\n new_localized_params = localized_params.clone\n new_localized_params.except!(*excluded_params)\n\n super(facet, values, new_localized_params)\n else\n super(facet, values, localized_params)\n end\n end",
"title": ""
},
{
"docid": "cb7891f67dbeb7ec405084d4dd9e75f3",
"score": "0.5209152",
"text": "def apply_updates_tags(other)\n other.tags.each do |ot|\n tag = @tags.detect { |t| t.key == ot.key }\n next unless tag\n\n if ot.value.instance_of?(String)\n apply_updates_tags_string(ot)\n elsif ot.value.instance_of?(Array)\n apply_updates_tags_array(ot)\n elsif ot.value.instance_of?(FalseClass) || ot.value.instance_of?(TrueClass)\n apply_updates_tags_bool(ot)\n end\n end\n end",
"title": ""
},
{
"docid": "ce0376ed17d2dcebf412a313f80100c4",
"score": "0.5208126",
"text": "def tags_raw=(values)\n self.tags = []\n self.tags = values.split(\"\\n\").map(&:strip)\n end",
"title": ""
},
{
"docid": "30a0c768d5cc815491a57fb97f49eef0",
"score": "0.5199886",
"text": "def add_attribute filter, action\n @attributes[filter] << action\n end",
"title": ""
},
{
"docid": "67f3341d1bd434aaab0ea43affaba40d",
"score": "0.51959574",
"text": "def filters=(value)\n valid = []\n value.each do |filter|\n if !filter['name'].blank? && !filter['to'].blank? && !filter['from'].blank?\n valid << filter\n elsif filter['name'] && filter['values']\n # Hack to accept both an array of values or a JSON\n filter['values'] = if filter['values'].is_a? String\n JSON.parse(filter['values'])\n else\n filter['values']\n end\n valid << filter\n end\n end\n write_attribute :filters, valid.to_json\n end",
"title": ""
}
] |
738df1b13703ee7ecc8be10d754bc8f7 | Continue with current order as guest | [
{
"docid": "6037b9b096a0ccd0212c65fa79f52198",
"score": "0.65463316",
"text": "def guest\n @quote.customer_is_guest = true\n @user = User.new\n\n respond_to do |format|\n\n if @quote.update(quote_params)\n format.html { redirect_to after_checkout_login_path }\n format.json { render json: { result: true } }\n else # problem saving order\n format.html { render 'show' }\n format.json { render json: { result: false, errors: @quote.errors }, status: 422 }\n end\n end\n end",
"title": ""
}
] | [
{
"docid": "c1b268352264a6a09afedc20c9b08f5a",
"score": "0.67697805",
"text": "def start_guest_checkout\n add_mug_to_cart\n restart_checkout\n fill_in 'order_email', with: 'guest@example.com'\n click_button 'Continue' # On registration page\n expect(current_path).to match(/(checkout|address)$/)\n end",
"title": ""
},
{
"docid": "2457e279894a19d133ea839aebdc85bd",
"score": "0.6721787",
"text": "def edit\n @order = current_order || Order.incomplete.find_or_initialize_by(guest_token: cookies.signed[:guest_token])\n associate_user\n end",
"title": ""
},
{
"docid": "4257a62d8cb624c8bd66326d6621a588",
"score": "0.6706605",
"text": "def continue_with_order\n user.reload\n system 'clear'\n OrderHere.header\n puts \"\"\n puts \"Your current cart\"\n puts \" #{user_dishes_names}\"\n puts \"\"\n \n # puts \"You are here #{user_dishes_names}\"\n choosen_restaurant = choosen_restaurant\n chosen_dish = prompt.select(\"Choose your next dish\" ,Dish.all_dishes )\n \n Order.create(user_id: self.user.id, dish_id: chosen_dish, restaurant_id: choosen_restaurant)\n self.continue_order_menu\n end",
"title": ""
},
{
"docid": "189aa5692cbdbb921c8e340e45fda098",
"score": "0.65796757",
"text": "def edit\n @order = current_order || Spree::Order.incomplete.find_or_initialize_by(guest_token: cookies.signed[:guest_token])\n authorize! :read, @order, cookies.signed[:guest_token]\n associate_user\n end",
"title": ""
},
{
"docid": "242552f46cb25811c6106553c421ed43",
"score": "0.65086615",
"text": "def logging_in\n guest_orders = guest_user.orders.all\n guest_orders.each do |order|\n order.user_id = current_user.id\n order.save!\n end\n end",
"title": ""
},
{
"docid": "8d2bf3c67dfbbea50e9cb78299b17275",
"score": "0.64706606",
"text": "def logging_in\n guest_orders = guest_user.try{|user| user.orders.all}\n guest_orders.each do |order|\n order.client_id = current_user.id\n order.save!\n end\n end",
"title": ""
},
{
"docid": "113f56aff5b647aa4ed0f3b46f796a5c",
"score": "0.6438817",
"text": "def logging_in\n guest_orders = guest_customer.orders\n guest_orders.each do |line_item|\n order.customer_id = current_customer.id\n order.save!\n end\n end",
"title": ""
},
{
"docid": "97f80ec057eab94661cec6e87148ef4a",
"score": "0.63464046",
"text": "def hand_off_guest\n user_cart = Cart.find_by user_id: current_user\n guest_cart = Cart.find_by user_id: guest_user.id\n\n return if guest_cart.nil?\n destroy_guest and return if guest_cart.cart_line_items.empty?\n\n user_cart.destroy if user_cart\n guest_cart.user_id = current_user.id\n guest_cart.save\n session[:guest_user_id] = nil\n end",
"title": ""
},
{
"docid": "aa05bb2dd77ea3d7636e03fcfa27c78f",
"score": "0.6330044",
"text": "def confirm\n # Cannot do with guest account\n return unless current_user \n do_checkout\n end",
"title": ""
},
{
"docid": "bc1193935d627a60fba89245b1c6d192",
"score": "0.63230574",
"text": "def confirmation\n # Mark the order as \"ready to transmit\"\n if @order.state == \"shipment\"\n @order.next!\n end\n\n end",
"title": ""
},
{
"docid": "5e7ecc7daaa8b44820966d4c0ca1f77a",
"score": "0.63130647",
"text": "def edit\n @order = current_order || Order.incomplete.\n includes(line_items: [variant: [:images, :option_values, :product]]).\n find_or_initialize_by(guest_token: cookies.signed[:guest_token])\n associate_user\n end",
"title": ""
},
{
"docid": "7e96e6f92fb6e223d38df209f933d7b0",
"score": "0.63084316",
"text": "def current_guest_user\n \t@current_guest_user=Spree::GuestUser.find_by_email(current_order.try(:email))\tif current_order.present? && current_spree_user.blank?\n end",
"title": ""
},
{
"docid": "6e2631e243d007cd9b1dfb167520c359",
"score": "0.62988204",
"text": "def new_order(order)\n \t# lets make the order available inthe view\n \t@order = order\n \t@room = @order.room\n \t@user = @room.user\n\n \tmail to: @user.email, subject: \"You have a new order\"\n end",
"title": ""
},
{
"docid": "bcc05b245cbb7849a888d8faf6258acf",
"score": "0.62986994",
"text": "def serve_guest\n puts \"How can I be of service?\"\n puts \"1. Would you like to order a pizza?\"\n puts \"2. Would you like to leave?\"\n take_order(gets.chomp.to_i)\n end",
"title": ""
},
{
"docid": "73965166b8a77f86715bb14965cfbe09",
"score": "0.62974924",
"text": "def enable_guest_checkout\n self.guest = true\n self.save\n end",
"title": ""
},
{
"docid": "99a35daba1b09934df234c6dbe0cd9c6",
"score": "0.6283154",
"text": "def edit\n @order = current_order || Order.incomplete.\n includes(line_items: [variant: [:images, :option_values, :product]]).\n find_or_initialize_by(guest_token: cookies.signed[:guest_token])\n associate_user\n end",
"title": ""
},
{
"docid": "99a35daba1b09934df234c6dbe0cd9c6",
"score": "0.6283154",
"text": "def edit\n @order = current_order || Order.incomplete.\n includes(line_items: [variant: [:images, :option_values, :product]]).\n find_or_initialize_by(guest_token: cookies.signed[:guest_token])\n associate_user\n end",
"title": ""
},
{
"docid": "0a1fb35e8feb052cd724bced79fddcd2",
"score": "0.62814426",
"text": "def order_accepted(user, order)\n @user = user\n @order = order\n mail to: user.email, subject: \"Order Successful\"\n end",
"title": ""
},
{
"docid": "cf9994fdee9643d110143e8e3881cf0b",
"score": "0.62674206",
"text": "def guest!\n @is_guest = true\n self\n end",
"title": ""
},
{
"docid": "f78bd24538454be90da9667ed769970a",
"score": "0.62578344",
"text": "def create\n @customer_adress = current_user.adresses.shipping.first\n # create order through cart \n @order = current_cart.build_order(params[:order])\n \n session[:order_params].deep_merge!(params[:order]) if params[:order] \n @order = Order.new(session[:order_params]) \n @order.current_step = session[:order_step] \n @order.ip_address = request.remote_ip\n if params[:back_button] \n @order.previous_step \n elsif @order.last_step? \n @order.save if @order.all_valid? \n else \n @order.next_step \n end \n session[:order_step] = @order.current_step \n \n if @order.new_record? \n render 'new' \n else \n # order is saved and valid\n # try to transfer the money\n if @order.purchase\n # send confirmation email\n \n # TODO - put emails into background job\n @order.save_adress \n OrderMailer.order_confirmation(@order).deliver \n # reset session information about order\n session[:order_step] = session[:order_params] = nil\n # order went through gateway successfully\n # render :action => \"success\"\n flash[:notice] = \"Order saved.\" \n redirect_to @order \n else\n # gateway didn't authorize or error\n flash[:error] = \"There was a problem with the transaction.\" \n render :action => \"failure\"\n # delete??\n # @order.destroy\n end\n end\n end",
"title": ""
},
{
"docid": "99fc5b2e83fd0372d3a05b6f9dcb69fc",
"score": "0.62340784",
"text": "def associate_user\n if order = current_order and order.anonymous? and current_user\n order.associate_user!(current_user) #if session[:guest_token] == @order.user.persistence_token\n end\n end",
"title": ""
},
{
"docid": "5fbe1fc80bfd038522dfde294ae27b5e",
"score": "0.62299496",
"text": "def order_confirmation(order)\n @order = order\n @sandwich = order.sandwich\n\n mail to: \"make_sandwich@generalthings.com\", subject: \"New Order\"\n end",
"title": ""
},
{
"docid": "cd29de0f5e41641a894eec7e5c6ee0ee",
"score": "0.62170315",
"text": "def one_page_checkout\n @order = current_order\n if @order.present?\n\n associate_user\n if @order.present?\n @order.discount_for_designer!\n\n\n if @order.bill_address_id.blank?\n @order.bill_address ||= Spree::Address.default\n end\n if @order.ship_address.blank?\n @order.ship_address ||= Spree::Address.default\n end\n # before_delivery\n @order.payments.destroy_all if request.put?\n @order.update_totals\n @order.update(shipment_total: @order.shipments.sum(&:cost))\n @order.update(total: @order.item_total + @order.adjustment_total + @order.additional_tax_total + @order.shipment_total + @order.promo_total)\n\n else\n redirect_to cart_path\n end\n else\n redirect_to cart_path\n end\n end",
"title": ""
},
{
"docid": "714662d1d956de136bbe780007324e97",
"score": "0.6210617",
"text": "def set_order\n @order = current_user.orders.find(params[:id])\n raise 'unauthorized' until @order.user.id == current_user.id\n end",
"title": ""
},
{
"docid": "3a5c6918e9ba552e0f614cf25430a49a",
"score": "0.6188468",
"text": "def order_confirmation(order)\n @order = order\n\n mail to: order.email, subject: \"JSG photography order details\"\n end",
"title": ""
},
{
"docid": "8d7a20b266c5d7a4caeef46590af047f",
"score": "0.61587095",
"text": "def require_order\n @order = current_order\n\n return if @order\n\n redirect_to(\n {controller: \"basket\", action: \"index\"},\n notice: \"We couldn't find an order for you.\"\n )\n end",
"title": ""
},
{
"docid": "98cbb9e01a79a1eb41d0a2e76b653235",
"score": "0.6156984",
"text": "def pass(sender)\n reply \"Okay, if you say so... (foreveralone)\"\n\n add_to_hash(sender, \"Not ordering\", store['orders_hash'])\n end",
"title": ""
},
{
"docid": "f100fb837e83a56de07b6d074758ba70",
"score": "0.6138623",
"text": "def order_shipped(order)\n @order = order\n\n mail :to => order.email, :subject => 'Your Groceries Are Enroute'\n end",
"title": ""
},
{
"docid": "49af5b990438f97d76b70b61bf667eda",
"score": "0.61255676",
"text": "def order_confirmation (order, current_cart)\n @products = Product.all\n @line_items = LineItem.find(:all, :conditions => { :order_id => order.id })\n @order = order\n mail to: @order.email, subject: \"QLine Order Confirmation\"\n end",
"title": ""
},
{
"docid": "285e459bb5c1cc144c822791bf26d17a",
"score": "0.61219406",
"text": "def continue_order_menu\n user.reload\n puts \" #{self.user.name} You have completed your order\"\n system 'clear'\n OrderHere.header\n puts \"Your current cart\"\n puts \" #{user_dishes_names}\"\n prompt.select(\"Would you like to add another dish?\") do |menu|\n menu.choice \"Yes Please\", -> {continue_with_order}\n menu.choice \"No I am done\", -> {cart_checkout}\n end \n end",
"title": ""
},
{
"docid": "395dba83ca97a44f645092967dd1e04e",
"score": "0.61181796",
"text": "def orderActive(order, user)\n @order = order\n @user = user\n\n mail to: @user.email, subject: \"Order##{@order.id} Activated -- OSU Book Exchange\"\n end",
"title": ""
},
{
"docid": "6838329c86588485817d95d82cdc6f4f",
"score": "0.61175686",
"text": "def visit_payment_step(user: nil)\n @current_order = Spree::TestingSupport::OrderWalkthrough.up_to(:delivery, user: user)\n\n if user\n sign_in current_order.user\n else\n assign_guest_token current_order.guest_token\n end\n\n visit '/checkout/payment'\n end",
"title": ""
},
{
"docid": "738948815772d8e189e3c2b22ab28c39",
"score": "0.61158365",
"text": "def order_received(order)\n @order = order\n\t\t@cart_disabled = true #disable all line_item related actions\n mail :to => order.email, :subject => 'Pragmatic Store Order Confirmation'\n\tend",
"title": ""
},
{
"docid": "ffdef2b911f6673b8f98280db0412d98",
"score": "0.6110907",
"text": "def shipped(order)\n @order = order\n\n mail to: order.email, subject: 'Pragmatic Store Order Confirmation'\n end",
"title": ""
},
{
"docid": "1e85a7a412fe5d523a26e8622a485ab8",
"score": "0.60993624",
"text": "def show\n\n if !@order || @order.status == 'pending' || @order.user != @login_user\n render 'layouts/not_found', status: :not_found\n end\n\n if @login_user.provider == 'guest_login'\n session[:user_id] = nil\n end\n end",
"title": ""
},
{
"docid": "e43ee44d42d0a510be1ac5c1d8182270",
"score": "0.6099291",
"text": "def order_chipped(order)\n @greeting = \"Hi\"\n @order = order\n logger.info \"order_shipped to #{order.email}\"\n mail to: @order.email, :subject => 'pragma store order shipped'\n end",
"title": ""
},
{
"docid": "a51778d7d4aad84f0e305610c9927ad7",
"score": "0.60919625",
"text": "def move_guest_cart_to_user(user)\n orders.each do |order| \n order.update(user_id: user.id)\n end\n end",
"title": ""
},
{
"docid": "16d9e76a59d0fa832148d04673c671c5",
"score": "0.6083942",
"text": "def order_confirmation\n order = Order.first\n OrderMailer.order_confirmation(order)\n end",
"title": ""
},
{
"docid": "4269b6662cb58654f6333eae5c78ff9e",
"score": "0.6080206",
"text": "def complete_order\n @user = User.find(session[:user_id])\n end",
"title": ""
},
{
"docid": "46f2e295a3beb69845149cc9a1df19e6",
"score": "0.607972",
"text": "def new #if order(user_id) exists \"pending\", show else create new\n @order = Order.new #MAY NEED SESSION ID INPUT\n render :products #Assuming we've created new order for guest/created new account and are now logged in\n end",
"title": ""
},
{
"docid": "46f2e295a3beb69845149cc9a1df19e6",
"score": "0.607972",
"text": "def new #if order(user_id) exists \"pending\", show else create new\n @order = Order.new #MAY NEED SESSION ID INPUT\n render :products #Assuming we've created new order for guest/created new account and are now logged in\n end",
"title": ""
},
{
"docid": "155e3d9c50925d8d571b751adca36d00",
"score": "0.60781777",
"text": "def current_order\n @current_order ||= begin\n if has_order?\n @current_order\n else\n order = Shoppe::Order.create(:ip_address => request.ip, :billing_country => Shoppe::Country.where(:name => 'Sweden').first)\n session[:order_id] = order.id\n order\n end\n end\n end",
"title": ""
},
{
"docid": "33434582784d2154f43773d37bbc067a",
"score": "0.6075489",
"text": "def new_order(order)\n \t#lets make the order available in the view\n \t@order = order \n \t@venue = @order.venue\n \t@user = @venue.user\n\n \tmail to: @user.email, subject: \"You have a new order\"\n\n end",
"title": ""
},
{
"docid": "e6f56d3b85d7a2c62a13a4052e5b7304",
"score": "0.607432",
"text": "def current_order\n @current_order ||= begin\n if has_order?\n @current_order\n else\n order = Shoppe::Order.create(:ip_address => request.ip, :billing_country => Shoppe::Country.where(:name => \"United Kingdom\").first)\n session[:order_id] = order.id\n order\n end\n end\n end",
"title": ""
},
{
"docid": "50014d3a97e5e94701b661fdcc942cc4",
"score": "0.6073116",
"text": "def fill_guest_customer\n @browser.radio(:id, \"login:guest\").set\n @browser.div(:id, \"checkout-step-login\").button(:text, \"Continue\").click\n end",
"title": ""
},
{
"docid": "d576208013924293a42bac7765aaf7f3",
"score": "0.60640734",
"text": "def order_received(order)\n @order = order\n \n mail :to => order.email, :subject => 'Pragmatic Store Order Confirmation'\n end",
"title": ""
},
{
"docid": "a8e72fd0e384197784f6730fe86c012f",
"score": "0.60632366",
"text": "def new_order(order)\n @greeting = \"Hi\"\n @order = order\n\n mail to: \"service@fifthroomstorage.com\", subject: \"You received a new order\"\n end",
"title": ""
},
{
"docid": "c74e6225e9dacb2a3f6d022f019d0e6b",
"score": "0.606094",
"text": "def orders_show\n redirect_to home_path if current_user.id != Order.find(params[:id]).user_id\n end",
"title": ""
},
{
"docid": "35e52fd9667e911b6aa41bfbcaaf8e03",
"score": "0.6055093",
"text": "def guard_continue_shopping\n true\n end",
"title": ""
},
{
"docid": "604bfaf5fd4eb3ef8f42a687bbd457e9",
"score": "0.604859",
"text": "def new_order(order)\n @greeting = \"Hi\"\n @order = order\n\n mail to: order.user.email\n end",
"title": ""
},
{
"docid": "0251ee3d92a543ba11581fe0d1e0cd2f",
"score": "0.6046124",
"text": "def order_confirmation(current_user, order)\n @user = current_user\n @order = order\n mail(to: @user.email, subject: \"Your Order Has Been Placed! #{@order.id}\")\n end",
"title": ""
},
{
"docid": "067334b7a9a44840c15864053f2deaa3",
"score": "0.6040429",
"text": "def set_order\n @order = Order.find(params[:id])\n user = @order.user\n redirect_to(root_url) unless (current_user?(user) || admin_logged_in?)\n end",
"title": ""
},
{
"docid": "72c33d666017a3e63026712121c22f0e",
"score": "0.6039393",
"text": "def send_order_confirmation_to_grassy_owner(order)\n\t\t#@user = user\n\t\tgrassy_owner = 'hello@grassy.ca'\n\t\t@order = order\n\t\tmail(\n\t\t\t:to => grassy_owner,\n\t\t\t:subject => 'New Order on Grassy'\n\t\t) \n\t\t\n\tend",
"title": ""
},
{
"docid": "9a52c178a7df003ae9dd6785b68f8859",
"score": "0.6021763",
"text": "def send_dispute_initiated\n order = Order.where(status: \"disputed\").first\n OrderMailer.send_order(\n order: order,\n status: \"dispute_initiated\",\n email: \"orders@landingintl.com\", # send to brand/landing (currently just sending to Landing)\n subject: \"Order in Dispute\",\n title: \"Order in Dispute\"\n )\n end",
"title": ""
},
{
"docid": "b1c486905f482cd1cc8655e866ad1d02",
"score": "0.60190994",
"text": "def show\n authorize! :create_orders, current_user\n\n @order = find_or_create_order\n #@order = session_admin_cart.add_items_to_checkout(order) # need here because items can also be removed\n if f = next_admin_order_form()\n redirect_to f\n else\n if @order.order_items.empty?\n redirect_to admin_shopping_products_url() and return\n end\n form_info\n end\n end",
"title": ""
},
{
"docid": "bb19af465462259234d3e518a97fc6f3",
"score": "0.6017845",
"text": "def current_order\n\t\t@current_order ||= begin\n\t\t\tif has_order?\n\t\t\t\t@current_order\n\t\t\telse\n\t\t\t\torder = Shoppe::Order.create(:ip_address => request.ip, :billing_country => Shoppe::Country.where(:name => \"United Kingdom\").first)\n\t\t\t\tsession[:order_id] = order.id\n\t\t\t\torder\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "3d4353d8db959731b22500800172ba98",
"score": "0.6013459",
"text": "def place_order\n @browser.div(:id, \"checkout-step-review\").button(:text, \"Place Order\").click\n seconds = 0.10\n until @browser.text.include?(\"Your order has been received\") do\n sleep 0.10\n seconds += 0.5\n end\n puts \"[INFO] I waited #{seconds} seconds\"\n #final code dependant assertion\n assert(@browser.button(:title,'Continue Shopping').enabled?)\n assert_section 'success'\n end",
"title": ""
},
{
"docid": "b95704fbded808cb6242382552e67086",
"score": "0.6008865",
"text": "def current_order\n @current_order ||= begin\n if has_order?\n @current_order\n else\n # @TODO add country for order\n # order = Order.create(:ip_address => request.ip, :billing_country => Shoppe::Country.where(:name => \"United Kingdom\").first)\n order = Order.create(ip_address: request.ip)\n session[:order_id] = order.id\n order\n end\n end\n end",
"title": ""
},
{
"docid": "31563e3335773be2057d8378e2c5c830",
"score": "0.6007645",
"text": "def send_order_confirmation(order)\n\t\t#@user = user\n\t\t@order = order\n\t\tmail(\n\t\t\t:to => @order.user.email,\n\t\t\t:subject => 'Grassy Order Confirmation'\n\t\t) \n\t\t\n\tend",
"title": ""
},
{
"docid": "be130661778ff3ba56ce059d385d294d",
"score": "0.6007617",
"text": "def place_order!()\n order_template = virtual_guest_template\n order_template = yield order_template if block_given?\n\n virtual_server_hash = @softlayer_client[\"Virtual_Guest\"].createObject(order_template)\n SoftLayer::VirtualServer.server_with_id(virtual_server_hash[\"id\"], :client => @softlayer_client) if virtual_server_hash\n end",
"title": ""
},
{
"docid": "a0c98a0dee1e0606e158e5767c345bd2",
"score": "0.600634",
"text": "def received order\n @order = order\n @greeting = 'Hi!'\n mail to: order.email, subject: 'Order confirmation from Projject store'\n end",
"title": ""
},
{
"docid": "f752ded5d0c1e40ab82b704203dedcc8",
"score": "0.60062915",
"text": "def set_order\n @order = Order.find(params[:id])\n @invite = Invite.new\n\n end",
"title": ""
},
{
"docid": "7a0224a1a114ab62857f17807128102e",
"score": "0.6002758",
"text": "def shipped(order)\n @order = order\n\n mail to: order.email, subject: 'Подтверждение заказа в Vlad Store'\n end",
"title": ""
},
{
"docid": "75bdf52605d2dbc326c085c1804506a6",
"score": "0.60006344",
"text": "def order_start(order)\n @order = order\n @order_itens = OrderProduct.all(:conditions => ['order_id = ?', @order.id]) \n mail(:to=>\"vendas@dahliarosa.com.br\", :bcc => \"rmatuoka@korewa.com.br\", :subject => @order.user.nome + \" - Novo Pedido através do Site\")\n end",
"title": ""
},
{
"docid": "5a1a3593cb2d0dcbe7dfdc54b0724f37",
"score": "0.59995985",
"text": "def placed_order!\n raise Order::RecordNotFound unless current_order\n end",
"title": ""
},
{
"docid": "dded9463b7f85ccda3969bc2bb9ebe72",
"score": "0.5995951",
"text": "def fulfillment_new_order(order) \n @order = order\n sc = order.site.store_config\n mail(:to => sc.fulfillment_email, :subject => 'New Order')\n end",
"title": ""
},
{
"docid": "4d5868b13d2cc652aa2a358aed592b10",
"score": "0.5988327",
"text": "def order_received(order)\n @order = order\n\n mail to: order.email, :subject => \"Pragmatic Store Order Confirmation\"\n end",
"title": ""
},
{
"docid": "d89d429810928f37f43091ba89b54f46",
"score": "0.5985393",
"text": "def order_shipped\n @order = order\n mail to: '790372365@qq.com', subject: 'New order'\n end",
"title": ""
},
{
"docid": "1c74c5e5566cd4c67d11697698312cab",
"score": "0.5980183",
"text": "def accept\n if @order.invited?\n @order.accept!\n redirect_to edit_order_path(@order)\n elsif @order.declined?\n flash[:notice] = \"Sorry, you already declined that invitation\"\n redirect_to root_path\n else\n flash[:notice] = \"Sorry, you can only accept an invitation once\"\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "cde95054bfa8354e9ddc95448fd399ce",
"score": "0.5977579",
"text": "def order_shipped( order )\n @order = order\n\n mail to: order.email,\n subject: \"Expedovaná objednávka z Pragmatickej knižnice\"\n end",
"title": ""
},
{
"docid": "ec3911ec721fb6c4d558488294c163f7",
"score": "0.59616417",
"text": "def order_shipped(order)\n @order = order\n \n mail :to => order.email, :subject => 'Pragmatic Store Order Shipped'\n end",
"title": ""
},
{
"docid": "f77aa52fa91c2d3deac97d3c4db65899",
"score": "0.5960952",
"text": "def shipped(order)\n @order = order\n\n mail to: order.email, subject: 'Your Pragmatic order is on its way to you'\n end",
"title": ""
},
{
"docid": "f49749c374c00626c2d8a0ddcbea64f3",
"score": "0.595938",
"text": "def set_order\n @order = Order.includes(:order_items, order_items: [:order, :variation, :product ] ).find_by_token(params[:id])\n redirect_to request.env[\"HTTP_REFERER\"] unless @order.present?\n end",
"title": ""
},
{
"docid": "d7fb55955baa4635a998e4201da5e2b7",
"score": "0.59570843",
"text": "def order_received(order)\n @order = order\n # @greeting = \"Hi\"\n\n mail to: order.email, :subject => 'Pragmatic Store Order Confirmation'\n end",
"title": ""
},
{
"docid": "5758c03b91534ffd76f0f2048e55f02a",
"score": "0.59478784",
"text": "def order_confirmation(user, order)\n @user = user\n @order = order\n\n mail to: user.email, subject: \"Thanks #{user.profile.first_name}. Your order has been placed. \"\n end",
"title": ""
},
{
"docid": "7a9b1c9cd40d2ea1c9268c7c0ef13a92",
"score": "0.5940909",
"text": "def order_confirmation(order)\n @order = order\n\n mail to: @order.user.email, subject: \"Order confirmation #{@order.order_number}\"\n end",
"title": ""
},
{
"docid": "85bfbbd51e8af86a2b209553ee1786a3",
"score": "0.5932938",
"text": "def received(order)\n @order = order\n\n mail to: order.email, subject: \"Your Pragmatic order ##{order.id} confirmation\"\n end",
"title": ""
},
{
"docid": "7311f7867d0c3bf2f7ef0ea3f9e7b8da",
"score": "0.59325624",
"text": "def shipped(order)\n @order = order\n\t\t\n mail to: order.email, subject: 'Invio ordine Pasticceria Siciliana'\n end",
"title": ""
},
{
"docid": "772766d713b71eab1f69add49c8882ee",
"score": "0.5929805",
"text": "def purchase_confirmation(order)\n @order = order\n @delivery = @order.delivery\n if @delivery.address.blank?\n @address = \"Na loja\"\n else\n @address = @delivery.address\n end\n\n mail(to: @delivery.contact_email, subject: 'Confirmação de Encomenda - Pastelaria Bonjour')\n end",
"title": ""
},
{
"docid": "e7fc37761d2c9300b95e2142ada37183",
"score": "0.59250563",
"text": "def received (order)\n @order = order\n\n mail( to: order.emails, subject: 'Подтверждение заказа в Pragmatic Store')\n end",
"title": ""
},
{
"docid": "a26b88548ee67fbb67a0245ae0acfbe7",
"score": "0.5924674",
"text": "def new_order(order)\n # @greeting = \"Hi there is a new order\"\n @order = order\n\n mail to: \"antoinebe35@gmail.com\"\n end",
"title": ""
},
{
"docid": "35876d9bf59dd66f5917792462057a59",
"score": "0.5922117",
"text": "def order_shipped(order)\n @order = order\n\t\t@cart_disabled = true #disable all line_item related actions\n mail :to => order.email, :subject => 'Pragmatic Store Order Shipped'\n end",
"title": ""
},
{
"docid": "9c68d3ff051915116e87ee044100439c",
"score": "0.5921875",
"text": "def logging_in\n guest_carts = guest_user.carts.load\n \n guest_carts.each do |cart|\n #order.user_id = current_user.id\n #order.save!\n cart.update(user_id: current_user.id)\n end\n end",
"title": ""
},
{
"docid": "f217a1ea0fc35c33ced56ebe19aa50dc",
"score": "0.5917746",
"text": "def finalize_checkout_as_guest\n #@todo replace the sleep 4 with a custom wait (like until elemenet visible)\n @helper.fill_guest_customer\n @helper.fill_billing_information\n checkout_common end",
"title": ""
},
{
"docid": "5f06aac2bf3a11f61af5e510bfd0b189",
"score": "0.5917146",
"text": "def received(order)\n @order = order\n mail to: order.email, subject: 'Pragmatic Store Order Confirmation'\n end",
"title": ""
},
{
"docid": "dac999c387430c80cbd93bcbf065d10f",
"score": "0.59105766",
"text": "def shipping_order_ready(order)\n @order = order\n mail(:to => CabooseStore::shipping_email, :subject => 'Order ready for shipping')\n end",
"title": ""
},
{
"docid": "0d29163e5c7fb79f973a31185814e157",
"score": "0.5910018",
"text": "def make_ordrin_guest_order(rid, email, tray, tip, first_name, last_name, phone, zip, addr, addr2, city, state, card_name, card_number, card_cvc, card_expiry, card_bill_addr, card_bill_addr2, card_bill_city, card_bill_state, card_bill_zip, card_bill_phone)\n args = {\n \"rid\" => rid,\n \"email\" => email,\n \"tray\" => tray,\n \"tip\" => tip,\n \"first_name\" => first_name,\n \"last_name\" => last_name,\n \"phone\" => phone,\n \"zip\" => zip,\n \"addr\" => addr,\n \"addr2\" => addr2,\n \"city\" => city,\n \"state\" => state,\n \"card_name\" => card_name,\n \"card_number\" => card_number,\n \"card_cvc\" => card_cvc,\n \"card_expiry\" => card_expiry,\n \"card_bill_addr\" => card_bill_addr,\n \"card_bill_addr2\" => card_bill_addr2,\n \"card_bill_city\" => card_bill_city,\n \"card_bill_state\" => card_bill_state,\n \"card_bill_zip\" => card_bill_zip,\n \"card_bill_phone\" => card_bill_phone,\n \"delivery_date\" => \"ASAP\"\n }\n ordrin_api.order_guest(args)\n end",
"title": ""
},
{
"docid": "8f2c469d18f4c51023a93c5acdec56bb",
"score": "0.5908829",
"text": "def order_shipped(order)\n @order = order\n\n mail to: order.email,\n subject: 'Objednavka z Pragmaticke knihovny bolo odoslana'\n end",
"title": ""
},
{
"docid": "484310ae10ca0bc1a06a5197c5517843",
"score": "0.5908672",
"text": "def fulfillment_new_order(order)\n @order = order\n mail(:to => CabooseStore::fulfillment_email, :subject => 'New Order')\n end",
"title": ""
},
{
"docid": "c19e8a5966565d2c5c7171bfd109d522",
"score": "0.5905963",
"text": "def received(order)\n @order = order\n mail to: order.email, subject: 'Asian Online Shopping Order Confirmation'\n end",
"title": ""
},
{
"docid": "66bbba328003c08b5c4068fa7e8f1210",
"score": "0.59036446",
"text": "def shipped(order)\n @order = order\n\n mail to: order.email, subject: \"BookKeeper Online Store - Order Shipped \"\n end",
"title": ""
},
{
"docid": "8d91b046b7e03328d0ad7870af83b0a2",
"score": "0.5898846",
"text": "def order_received(order)\n @order = order\n @greeting = \"Hi\"\n logger.info \"order_received to #{order.email}\"\n mail to: @order.email, :subject => 'pragma store order confirmation'\n end",
"title": ""
},
{
"docid": "adeb41363e933b1bb3fe30be168fc60a",
"score": "0.58979154",
"text": "def received(order)\n @order = order\n mail to: order.email, subject: 'Pragmatic Store Order Confirmation'\n end",
"title": ""
},
{
"docid": "74b2103595d147b535680bd3c74f2948",
"score": "0.58977777",
"text": "def checkout\n @user = current_user\n @order_items = current_order.order_items\n @order = current_order \n end",
"title": ""
},
{
"docid": "1848402058040d2b48f6783950d57600",
"score": "0.5887029",
"text": "def received(order)\n @order = order\n\n mail to: order.email, subject: 'Pragmatic Store Order Confirmation'\n end",
"title": ""
},
{
"docid": "487d7617dd43a3c47398c5b035a4a1f0",
"score": "0.58867365",
"text": "def received(order)\n @order = order\n mail to: order.User.email, subject: 'Tickets Order Confirmation'\n end",
"title": ""
},
{
"docid": "7a00badcd50823feab8de3b37fa1ba63",
"score": "0.5881244",
"text": "def order_shipped\n @order = order\n @greeting = \"Hi\"\n\n mail to: order.email, :subject => \"Store wishlist generated order shipped.\"\n end",
"title": ""
},
{
"docid": "cc0e369c16034ed1473ca8869519782d",
"score": "0.58776855",
"text": "def received(order)\n @order = order\n mail to: order.email, subject: 'Wooden Store Order Confirmation'\n end",
"title": ""
},
{
"docid": "81f0147284a6df88aa9e3773b439f08f",
"score": "0.58757085",
"text": "def transaction_initiated(order)\n @order = order\n mail(:to => order.user.email, :subject => \"Transação Iniciada\")\n end",
"title": ""
},
{
"docid": "cd1c1d69bebf80d9cbad087b1790ad8c",
"score": "0.58693916",
"text": "def logging_in\n # For example:\n # guest_comments = guest_user.comments.all\n # guest_comments.each do |comment|\n # comment.user_id = current_user.id\n # comment.save!\n # end\n # puts \"---------------logging_in-----------------------\"\n current_order = guest_user.orders.first\n current_order.user = current_user\n current_order.save!\n # puts \"------------------------------------------------\"\n end",
"title": ""
}
] |
ba2fb15da69b431b829782678affe75f | POST /answers POST /answers.json | [
{
"docid": "700c8983eab7ff4392ac9d7a8d5f35cd",
"score": "0.6876082",
"text": "def create\n @answer = @question.answers.new(answer_params)\n if @answer.save\n redirect_to @answer.question\n else\n render plain: 'Error save'\n end\n end",
"title": ""
}
] | [
{
"docid": "1354a38154203916165c2441565c995f",
"score": "0.74338484",
"text": "def create\n @answer = Answer.new(params[:answer])\n\n if @answer.save\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "4fb766b7d5669e52678f47a2fa5931ab",
"score": "0.74065137",
"text": "def create\n answer = Answer.new(answer_params)\n if answer.save\n render json: answer\n else\n render json: answer.errors, status: 446\n end\n end",
"title": ""
},
{
"docid": "c24a136ba8c7dfffc2e792f54323378d",
"score": "0.7355127",
"text": "def send_answer()\n\t\turl = @base_address + \"/answer\"\n\t\tRestClient.post url, { 'answer' => @answer, 'question' => @question }.to_json, :content_type => :json, :accept => :json\n\tend",
"title": ""
},
{
"docid": "1b50c747bd84cb41eca29c14eecf6ab0",
"score": "0.73338604",
"text": "def create\n @answer = Answer.new(answer_params)\n if @answer.save\n render template: \"api/v1/answers/show\"\n else\n render json: { error: @answer.errors }, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f0290f252281cdcb8c8cd18702820527",
"score": "0.7233076",
"text": "def create\n @answer = @question.answers.new(params[:answer])\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to exam_questions_path(@exam), notice: 'Answer was successfully created.' }\n format.json { render json: exam_questions_path(@exam), status: :created, location: @answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: exam_questions_path(@exam).errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aac50a2128059b04ce71595ede2c3989",
"score": "0.711143",
"text": "def create\n @answer = Answer.new(user_id: current_user[:id], question_id: @@question.id, vote_score: 0, up_vote: 0, down_vote: 0, answer_context: answer_params[:answer_context], answer_body: answer_params[:answer_body])\n @@question.num_answers += 1\n @@question.save\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d3c3a368e9a630b07c63b057b179c394",
"score": "0.710958",
"text": "def create\n @test_answer = TestAnswer.new(test_answer_params)\n\n respond_to do |format|\n if @test_answer.save\n params[:questions].each do |question|\n answer = Answer.new\n answer.test_answer_id = @test_answer.id\n answer.question_id = question.first\n answer.value = question.second.to_i\n answer.save\n end\n format.html { redirect_to @test_answer, notice: 'Test answer was successfully created.' }\n format.json { render :show, status: :created, location: @test_answer }\n else\n format.html { render :new }\n format.json { render json: @test_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6686b8f0495de0417bda4c6e067f2252",
"score": "0.69994694",
"text": "def create\n @answer = @question.answers.build(answer_params)\n @answer.user = current_user\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @question, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { respond_to @question }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "362b4e3f4da289857ad208a250901e6d",
"score": "0.6996154",
"text": "def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "362b4e3f4da289857ad208a250901e6d",
"score": "0.6996154",
"text": "def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "362b4e3f4da289857ad208a250901e6d",
"score": "0.6996154",
"text": "def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6c4e0ffb654dc7646a70c83a64fe36ce",
"score": "0.69944996",
"text": "def create\n @answer = @question.answers.create(answer_params)\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @test, success: 'Answer was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"title": ""
},
{
"docid": "c9c9d722a777661a06c34b7bf2ceecea",
"score": "0.69551396",
"text": "def answer_params\n params.require(:question).permit(\n :answers\n )\n end",
"title": ""
},
{
"docid": "3fe6ebf88e905cc4a8ef5422b1d02184",
"score": "0.6936293",
"text": "def create\n\t\t@answer = Answer.new(answer_params)\n \tbegin\n\t\t\tuser = current_user\n\t\t\tquestion = Question.find(answer_params[ :question ])\n\t\t\tquestion.answers << @answer\n\t\t\tuser.answers_made << @answer\n\t\t\trespond_to do |format|\n\t\t\t\tif question.save and user.save\n\t\t\t\t\tformat.html { redirect_to question_path(question), notice: 'Answer was successfully created.' }\n\t\t\t\t\tformat.json { render :show, status: :created, location: @answer }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render :new }\n\t\t\t\t\tformat.json { render json: @answer.errors, status: :unprocessable_entity }\n\t\t\t\tend\n\t\t\tend\n\t\t\trescue Mongoid::Errors::DocumentNotFound => e\n\t\t\t\tflash[ :error ] = \"Invalid question\"\n\t\t\t\tredirect_to questions_path\n\t\tend\n\tend",
"title": ""
},
{
"docid": "81c5d6f506284ec78ba1d91a5cf2d3f1",
"score": "0.69348365",
"text": "def create\n @answer = @question.answers.build(answer_params)\n @answer.user = current_user\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @question, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "41cb7c5d46cb4a3b50037c86d3842e31",
"score": "0.690523",
"text": "def create\n responder_id = params[:responder_id] || rand.to_s[2,15]\n for ans in params[:answer].keys.select {|k| k =~ /^answer_to_question_/}\n Answer.create(:responder_id=>responder_id, :question_id=>ans[-2,2].to_i,\n :answer_text=>params['answer'][ans])\n end\n\n flash[:notice] = 'Answers were successfully created.'\n redirect_to(Poll.find(params['answer']['poll_id']))\n end",
"title": ""
},
{
"docid": "6e53cc0ef951223153d04082cda74fc8",
"score": "0.6902253",
"text": "def create\n @test_answer = TestAnswer.new(params[:test_answer])\n\n respond_to do |format|\n if @test_answer.save\n format.html { redirect_to @test_answer, :notice => 'Test answer was successfully created.' }\n format.json { render :json => @test_answer, :status => :created, :location => @test_answer }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @test_answer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5489cea6a2b172b731de1dac39354614",
"score": "0.68992156",
"text": "def create\n answer = Answer.new(answer_params)\n\n if answer.save\n return render json: {message: 'Answer was created succesfully'}\n else\n return render json: {message: 'Error: Answer was not created succesfully'}\n end\n end",
"title": ""
},
{
"docid": "4704a3c341fe55356c2fa4b73f06d889",
"score": "0.6895325",
"text": "def create\n params[:contextualization][:question].each do |k, v|\n answer = Answer.new\n answer.user_id = params[:contextualization][:user_id]\n answer.question_id = k;\n answer.answer = v;\n answer.save\n end\n respond_to do |format|\n format.html { redirect_to answers_path, notice: 'Questionário criado com sucesso.' }\n format.json { render :index, status: :created, location: @answer }\n end\n end",
"title": ""
},
{
"docid": "bc09114bd6e05e491a216ab7ddf8530c",
"score": "0.6880105",
"text": "def create\n\t\t@user = User.find(session[:user_id])\n puts \"X\" * 50\n puts params[:question_id]\n\t\t@question = Question.find(params[:question_id])\n puts @question\n\t\t@answer = Answer.new(answer_params)\n\t\t@question.answers << @answer\n\t\t@answer.update(responder_id: @user.id)\n @answer.update(user_id: @user.id)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n\n\tend",
"title": ""
},
{
"docid": "93de87386eaf0b732f9442569d4cf980",
"score": "0.6872811",
"text": "def create\n\n @answers = params[:answer].values.collect do |answer| \n unless answer[\"id\"].blank?\n answered = Answer.find_by_id(answer[\"id\"])\n answered.attributes = answer\n answered\n else\n current_user.answers.build(answer)\n end\n end\n\n if @answers.all?(&:valid?)\n @answers.each(&:save!)\n build_dna\n flash[:notice] = 'Answer was successfully saved.'\n redirect_to account_path\n else\n flash[:notice] = 'An error occured.'\n redirect_to :action => \"new\"\n end\n # \n # respond_to do |format|\n # if @answer.save\n # flash[:notice] = 'Answer was successfully created.'\n # format.html { redirect_to(@answer) }\n # format.xml { render :xml => @answer, :status => :created, :location => @answer }\n # else\n # format.html { render :action => \"new\" }\n # format.xml { render :xml => @answer.errors, :status => :unprocessable_entity }\n # end\n # end\n end",
"title": ""
},
{
"docid": "acb51d93d1baa9fe2157404884b8bdf9",
"score": "0.68722606",
"text": "def create\r\n @answer = current_tutor.answers.build(params[:answer])\r\n if @answer.save\r\n flash[:success] = \"Answer sent!\"\r\n redirect_to :back\r\n else\r\n render 'static_pages/bad'\r\n end\r\n end",
"title": ""
},
{
"docid": "09d615506e43277865611dffbe6e7b27",
"score": "0.68663776",
"text": "def create\n params[:human_resource][:question].each do |k, v|\n answer = Answer.new\n answer.user_id = params[:human_resource][:user_id]\n answer.question_id = k;\n answer.answer = v;\n answer.save\n end\n respond_to do |format|\n format.html { redirect_to answers_path, notice: 'Questionário criado com sucesso.' }\n format.json { render :index, status: :created, location: @answer }\n end\n end",
"title": ""
},
{
"docid": "2c25d1983db355c6f752feb9e3c7c712",
"score": "0.68653846",
"text": "def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to request.referer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7aafb53ba757fcda84d01fdec612ff87",
"score": "0.6862007",
"text": "def create\n @question = Question.find(params[:answer][:question_id])\n @answer = @question.answers.new(answer_params)\n @answer.user_id = current_user.id\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @question, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: [:question,@answer] }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a70ea55e8f2a67fc412963c0ba68b569",
"score": "0.6848249",
"text": "def create\n @survey = Survey.new(survey_params)\n # @survey.answers.build(params[:answers_attributes])\n\n respond_to do |format|\n if @survey.save\n format.html { redirect_to add_answer_survey_path(@survey) }\n format.json { render action: 'show', 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": "6e38eefea95a4f7002a25202d0d97740",
"score": "0.6844017",
"text": "def create\n @answer = Answer.new(params[:answer])\n @answer.save\n redirect_to set_answer_path(@answer)\n return\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, :notice => 'Answer was successfully created.' }\n format.json { render :json => @answer, :status => :created, :location => @answer }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "22e2df3244e2d11f5862438b2c4a0bc0",
"score": "0.6833528",
"text": "def answers\n params[:questions].each_with_index do |id, index|\n question = Question.find(id)\n answer_var = params[:answers][index]\n question.update(answer: answer_var)\n @questions = Question.order(:id)\n end\n render json: @questions\n end",
"title": ""
},
{
"docid": "c762c2aae485c6f7e3b6d19ec037e2f7",
"score": "0.6819176",
"text": "def create\n @answer = current_user.answers.build answer_params\n if @answer.save\n PointRepository.create @answer.user, @answer\n repo = ActivityFactory.new @answer\n repo.generate :create, owner: current_user, recipient: @answer.question.user\n render json: @answer\n else\n render json: { errors: @answer.errors.full_messages }, status: 422\n end\n end",
"title": ""
},
{
"docid": "fd21c2bc91ca2b7bb55cb6107bc61037",
"score": "0.68017817",
"text": "def create\n @survey_answer = SurveyAnswer.new(params[:survey_answer])\n\n respond_to do |format|\n if @survey_answer.save\n format.html { redirect_to @survey_answer, notice: 'Survey answer was successfully created.' }\n format.json { render json: @survey_answer, status: :created, location: @survey_answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fdc2f1ca6d1ac94de5e36333a6dd4315",
"score": "0.67975146",
"text": "def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to surveys_path, notice: \"Survey was successfully completed.\" }\n format.json { render :show, status: :created, location: @answer }\n else\n @survey = @answer.survey\n puts \"--------- #{@answer.inspect}\"\n puts \"--------- #{@answer.errors.inspect}\"\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cc88b89c3f45d61fa075e20699f5589b",
"score": "0.6786581",
"text": "def create\n @question = Question.find(params[:question_id])\n @answer = @question.answers.create(params[:answer])\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to(@question, :notice => 'Question was successfully created.') }\n format.xml { render :xml => @question, :status => :created, :location => @question }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dd4e0dca46c8312281053b408f086246",
"score": "0.678015",
"text": "def create\n @question = Question.new(params[:question])\n @answersLeft = 4-@question.answers.length\n\n @answersLeft.times do\n answer = @question.answers.build\n end\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to questions_path, notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fa6609c0d81f822c30a4696ea31f3c65",
"score": "0.677257",
"text": "def create \n\t\tquestion_id = params[:questionId]\n\t\tanswer = params[:answer]\n\t\tindex = params[:answerIndex]\n\t\tnum_answers = Integer(params[:numAnswers])\n\n\t\tparseAnswer = ParseAnswer.new(answer, question_id, index, '')\n\t\tputs parseAnswer.numAnswers\n\t\tparseAnswer.numAnswers = num_answers\n\n\t\tresponse = ParseManager.createQuestionAnswer(parseAnswer)\n\n\t\trender json: response\n\tend",
"title": ""
},
{
"docid": "cf837c89c6be9852ca28304e013f34fd",
"score": "0.6772406",
"text": "def create\n respond_to do |format|\n format.json {\n answer = Answer.new\n answer.author = current_user\n answer.question_id = extract_int params, :question_id\n answer.content = do_sanitize_qa_content params[:content]\n answer.accepted = false\n\n if !answer.valid?\n render :json => reply(false, t(:missing_params))\n else\n if answer.question.blank?\n render :json => reply(false, t(:answer_creation_invalid_question))\n elsif answer.save\n # on answer successfully posted, notify op\n notify_op_on_new_answer(answer)\n\n render :json => reply(true, t(:answer_creation_successful), 'answer_id', answer.id)\n else\n render :json => reply(false, t(:answer_creation_failed))\n end\n end\n }\n format.html {\n render :status => :method_not_allowed, :nothing => true\n return\n }\n end\n end",
"title": ""
},
{
"docid": "e68ef333075979faa0d4f875455959a5",
"score": "0.6765106",
"text": "def create\n params[:competitiveness][:question].each do |k, v|\n answer = Answer.new\n answer.user_id = params[:competitiveness][:user_id]\n answer.question_id = k;\n answer.answer = v;\n answer.save\n end\n respond_to do |format|\n format.html { redirect_to answers_path, notice: 'Questionário criado com sucesso.' }\n format.json { render :index, status: :created, location: @answer }\n end\n end",
"title": ""
},
{
"docid": "67b014662f37dea59f428ceeb22cae12",
"score": "0.6763078",
"text": "def create\n @question_answer = QuestionAnswer.new(params[:question_answer])\n\n respond_to do |format|\n if @question_answer.save\n format.html { redirect_to @question_answer, notice: 'Question answer was successfully created.' }\n format.json { render json: @question_answer, status: :created, location: @question_answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8d5f4f96365cce99c95ce9d18c516000",
"score": "0.67593503",
"text": "def create\n @tarot_answer = TarotAnswer.new(tarot_answer_params)\n\n if @tarot_answer.save\n render json: { status: :ok }\n else\n render json: { status: :internal_server_error }\n end\n end",
"title": ""
},
{
"docid": "1832bd94019cc3fc7abda35f57e046c3",
"score": "0.6755462",
"text": "def create\n @answer = @question.answers.new answer_params\n @answer.user = current_user\n @answer.score = 0\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @question, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2f51e15b20043d903863217801090517",
"score": "0.6747221",
"text": "def create\n @example_answer = ExampleAnswer.new(example_answer_params)\n\n respond_to do |format|\n if @example_answer.save\n format.html { redirect_to @example_answer, notice: 'Example answer was successfully created.' }\n format.json { render :show, status: :created, location: @example_answer }\n else\n format.html { render :new }\n format.json { render json: @example_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6933473e1841e6979bac2edee1f2c7a0",
"score": "0.6741009",
"text": "def index # http://localhost:3000/api/v1/answers.json?access_token=\n respond_with(@answers = Answer.all)\n end",
"title": ""
},
{
"docid": "663fbf0d7c86f60aed3942e3ecd1619d",
"score": "0.6731453",
"text": "def answer_params\n params.require(:answer).permit(:answer)\n end",
"title": ""
},
{
"docid": "663fbf0d7c86f60aed3942e3ecd1619d",
"score": "0.6731453",
"text": "def answer_params\n params.require(:answer).permit(:answer)\n end",
"title": ""
},
{
"docid": "550ad2abc1481846856e86d37f654f82",
"score": "0.67143387",
"text": "def create\n @api_v1_answer = Api::V1::Answer.new(api_v1_answer_params)\n\n respond_to do |format|\n if @api_v1_answer.save\n format.html { redirect_to @api_v1_answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_answer }\n else\n format.html { render :new }\n format.json { render json: @api_v1_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d2278cd98faa06199ac1ebb54541f774",
"score": "0.6705974",
"text": "def answer_params\n params.require(:answer).permit(:body, :correct)\n end",
"title": ""
},
{
"docid": "8fadde5af3cd05c752e7bdff5709f50c",
"score": "0.670149",
"text": "def create\n @answer = current_user.answers.new(params[:answer])\n unless @answer.question\n redirect_to questions_url\n return\n end\n\n respond_to do |format|\n if @answer.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.answer'))\n format.html { redirect_to question_answer_url(@answer.question, @answer) }\n format.json { render :json => @answer, :status => :created, :location => user_question_answer_url(@answer.question.user, @answer.question, @answer) }\n format.mobile { redirect_to question_url(@answer.question) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @answer.errors, :status => :unprocessable_entity }\n format.mobile { render :action => \"new\" }\n end\n end\n end",
"title": ""
},
{
"docid": "4782f27fef7fc9ea2862e319a4ad89b9",
"score": "0.6696213",
"text": "def create_answers(params, questions)\n params[:responses].each_pair do |k, v|\n score = Answer.where(response_id: @response.id, question_id: questions[k.to_i].id).first\n score ||= Answer.create(response_id: @response.id, question_id: questions[k.to_i].id, answer: v[:score], comments: v[:comment])\n score.update_attribute('answer', v[:score])\n score.update_attribute('comments', v[:comment])\n end\n end",
"title": ""
},
{
"docid": "acf0ac30da11e700121eb3ad86ffdc88",
"score": "0.669386",
"text": "def create\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(answer_params)\n flash[:notice] = 'Question was successfully added.' if @answer.save\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @question, notice: 'Answer was successfully added.' }\n format.json { render :'/questions/show', status: :created, location: @question }\n else\n @answers = Answer.where(question: @question).order(best_answer: :asc)\n format.html { render :'/questions/show' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d9911a14fb4db9062a0785e1860a5ba6",
"score": "0.66740924",
"text": "def create\n @users = User.all\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to question_path(Question.find(@answer.question_id))}\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "76f42775fcac0d3b8ec06a789300e16d",
"score": "0.6670179",
"text": "def index\r\n @answers = @question.answers\r\n render json: @answers\r\n end",
"title": ""
},
{
"docid": "4a11db9ec67acd13ecf8ae0a5a660bc8",
"score": "0.6664319",
"text": "def create\n @answer = Answer.new(answer_params)\n @answer.user = current_user\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "92b1245a9ced0e3c257b5024eb340b3f",
"score": "0.66628534",
"text": "def answer_params\n params.require(:answer).permit(:body, :correct, :question_id)\n end",
"title": ""
},
{
"docid": "9d12aa919224e92b1aab2d1fb6e5f391",
"score": "0.66589916",
"text": "def submit(answers={})\n if :get == method\n hal_client.get(target_url(answers))\n else\n hal_client.public_send(method, target_url(answers), body(answers), \"Content-Type\" => content_type)\n end\n end",
"title": ""
},
{
"docid": "1c7d671af02ceb034b8ca8873f2bf181",
"score": "0.665109",
"text": "def answer_params\n params.require(:answer).permit(:question, :answer)\n end",
"title": ""
},
{
"docid": "64c5530e9204e40f82e1cc9e9852c22f",
"score": "0.6648341",
"text": "def create\n event_id = params[:id]\n @answer = Answer.new(answer_params)\n authorize @answer\n\n @answer[:event_id] = event_id\n\n trainee = @answer[:trainee]\n\n solution = Solution.find_by event_id: event_id\n solution_text = solution ? solution.text : 'zzzz'\n logger.info \"------> solution: #{solution_text.inspect}\"\n logger.info \"------> answer: #{@answer.text.inspect}\"\n\n similarity = AnswersHelper::get_similarity(solution_text, @answer.text)\n\n @answer.score = similarity\n logger.info \"-----> Similarity Score: #{similarity}\"\n\n respond_to do |format|\n if @answer.save\n flash[:success] = 'Answer was successfully created.'\n if !logged_in?\n format.html { redirect_to root_path }\n end\n\n format.html { redirect_to \"/events\" }\n format.json { render :show, status: :created, location: @answer }\n else\n #format.html { render :new }\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "90da5cf1286f9275bd34b2856a5c35f3",
"score": "0.66445696",
"text": "def create\n params[:answer][:question_id] = @question.id\n params[:answer][:user_id] = current_user.id\n\n @answer = @question.answers.new(params[:answer])\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to [@category, @question], notice: 'Answer was successfully created.' }\n format.json { render json: @answer, status: :created, location: @answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "844e246f9b02b700327aebacad77ea73",
"score": "0.66400707",
"text": "def answer_params\n params.require(:answer).permit(:survey_id, :body)\n end",
"title": ""
},
{
"docid": "27b74e8e51e28895296a6c2ceec64f30",
"score": "0.6634002",
"text": "def answer\n params[:respondent_id] = current_user.id\n result = Question.answer params\n\n if result[:status] != 0\n render json: result\n else\n render json: { status: 0 }\n end\n end",
"title": ""
},
{
"docid": "9f3e2b2777a5c4c1ddbed9290fa9745b",
"score": "0.66206133",
"text": "def create\n @candidate = Candidate.new(candidate_params)\n @candidate.user_id = current_user.id\n\n parsedAnswers = JSON.parse(params[\"candidate\"][\"answers\"]) \n\n parsedAnswers.each do |item|\n @answer = Answer.new(:question_id => item[\"question_id\"].to_i, :body => item[\"body\"], :user_id => current_user.id)\n puts @answer\n puts item\n @answer.save\n end\n\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to :root, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n format.html { render :new }\n format.json { render json: :root, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "038939eb2f8179aa6c9d625bc6eaefc1",
"score": "0.66147166",
"text": "def create\n\t\t@question = Question.find(params[:question_id])\n @answer = current_user.answers.new(answer_params) # User_id\n\t\t@answer.question_id = @question.id\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to :back, notice: 'Answer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @answer }\n else\n format.html { redirect_to :back }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7ade3a89d8bb1c0662c5f44fd56d5b9a",
"score": "0.6602052",
"text": "def create\n @question = Question.find(params[:question_id])\n @answer = current_user.answers.build(answer_params)\n @answer.question_id = @question.id\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @question, notice: 'Answer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @answer }\n else\n format.html { render action: 'new' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "570516d15a3b5b4d85fe32889a6ee4a5",
"score": "0.6592623",
"text": "def create\n @survey_answer = SurveyAnswer.new(survey_answer_params)\n @survey_answer.survey_question_id = @survey_question_id\n\n respond_to do |format|\n if @survey_answer.save\n format.html { redirect_to survey_questions_path, notice: 'Survey answer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @survey_answer }\n else\n format.html { render action: 'new' }\n format.json { render json: @survey_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0d4952c40a2ea32dc426d61f63e6086e",
"score": "0.659051",
"text": "def new\n @question = Question.new\n\n 4.times do\n answer = @question.answers.build\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"title": ""
},
{
"docid": "bb7e2985c3ad5406443673a6099303f2",
"score": "0.65756035",
"text": "def answer_params\n params.require(:answer).permit(:body, :question_id)\n end",
"title": ""
},
{
"docid": "87dc5bfbbcf0bcf1b519d77e505a5215",
"score": "0.65739495",
"text": "def create\n @answer = Answer.new(answer_params)\n @answer.user_id = current_user.id\n @answer.bonus = AnswersHelper.calculateBonus(@answer)\n if @answer.save\n PuzzlesHelper.calculate_and_save_score_auto(@answer.puzzle_id)\n respond_to do |format|\n format.json { render :json => @answer }\n end\n else\n show_error ErrorCodeAnswerCannotCreate, \"Your answer can not create, please try again\"\n end\n end",
"title": ""
},
{
"docid": "c2c3cf17f95fde604837b606f2fd3f68",
"score": "0.65610564",
"text": "def create\n @answer = Answer.new(answer_params)\n @answer.user = current_user\n unless @answer.question\n redirect_to questions_url\n return\n end\n\n respond_to do |format|\n if @answer.save\n flash[:notice] = t('controller.successfully_created', model: t('activerecord.models.answer'))\n format.html { redirect_to @answer }\n format.json { render json: @answer, status: :created, location: answer_url(@answer) }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a7a6a9cd7a6d63654a00a62ddcc18bf2",
"score": "0.65590876",
"text": "def answer_params\n params.require(:answer).permit(:content, :correct)\n end",
"title": ""
},
{
"docid": "347382f2ae393f833f396f2e49ee112a",
"score": "0.6559017",
"text": "def answer_questions\n @project = Project.find(params[:id])\n @question_responses = []\n params[:question_responses].each do |question_id, response|\n @question_responses << QuestionResponse.create!(:question_id => question_id.to_i, :user => current_user, :response => response.to_i)\n end\n \n respond_to do |format|\n format.html { redirect_to @project, notice: 'Your answers have been saved. Thanks!' }\n format.json { render json: @question_responses, status: :created, location: @project }\n end\n end",
"title": ""
},
{
"docid": "2074f72677f2f9228c17f3bb35373664",
"score": "0.6553318",
"text": "def answer\n response = {:success => false}\n @answer = AnsweredQuestion.find_or_initialize_by(question_id: @question.id,user_id: current_user.id)\n @answer.answer_id = params[:answer_id]\n if @answer.save\n response[:success] = true\n else\n response[:errors] = @answer.errors.to_s\n end\n render json: response\n end",
"title": ""
},
{
"docid": "d8db33b990adc39c4e9ff24cca395b95",
"score": "0.6550546",
"text": "def create\n @answer = Answer.new(answer_params)\n @answer.client = @user.client\n @answer.question = @question\n\t\n\tif @answer.save\n\t\trespond_with @question\n\telse\n\t\trespond_using @answer, :new\n\tend\n end",
"title": ""
},
{
"docid": "d4b1d86dc848f18e10d0f92a6dd9e382",
"score": "0.6543599",
"text": "def create\n @answer = @question.answers.new(answer_params)\n\n if @answer.save\n redirect_to [:admin, @answer.question], notice: t('.success')\n else\n render :new\n end\n end",
"title": ""
},
{
"docid": "6b645b8c3312dd279fd4ddd49555229a",
"score": "0.65419173",
"text": "def answer_params\n params.require(:answer).permit(:body)\n end",
"title": ""
},
{
"docid": "7a77128330a78ff7c8c98e2a9c78fb07",
"score": "0.65325207",
"text": "def create\n @answer = Answer.new(answer_params)\n @answer.user = current_user\n @answer.quiz = @odai\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @answer }\n else\n format.html { render action: 'new' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8a9599bdf80bf671fa7a3977e89e2cab",
"score": "0.65323687",
"text": "def create\n @answer = Answer.new(answer_params)\n @poll_questions = PollQuestion.all\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8167300089ef0220ba27b5a087a19d98",
"score": "0.6526485",
"text": "def answer_params\n params.fetch(:answer).permit(:body, :correct)\n end",
"title": ""
},
{
"docid": "54d9879ea2f945e7670f976970c87e50",
"score": "0.65054375",
"text": "def create\n @answer = Answer.new(answer_params)\n @answer.user = current_user\n @answer.question = @question\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @question, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n format.js\n else\n @answers = @question.answers\n format.html { render 'questions/show' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7549380b1729d55dd3b524b448830f90",
"score": "0.6502563",
"text": "def create\n @question = Xmt::Test::Question.generate(question_params)\n respond_to do |format|\n if @question.save\n # params[:answer].values.each do |answer|\n # @question.answers.create(answer)\n # end\n format.html { redirect_to xmt_test_questions_url, notice: '添加成功.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "91f9f96e022c5bf2e62ad9d33994cc80",
"score": "0.64959663",
"text": "def create\n params[:answer][:question] = Question.find(params[:answer][:question_id])\n params[:answer].delete :question_id\n @answer = current_user.answers.create(params[:answer])\n authorize! :manage, @reaction\n respond_with( @answer, :layout => !request.xhr? )\n end",
"title": ""
},
{
"docid": "03b272795d55d47002336b883a5830d8",
"score": "0.64901227",
"text": "def answer_params\n params.require(:answer).permit(:title, :description)\n end",
"title": ""
},
{
"docid": "e1639e7038521e99476a345a6965d344",
"score": "0.64893925",
"text": "def create\n #@answer = current_user.answers.new(answer_params)\n @question = Question.find(params[:question_id])\n @answer = Answer.new(answer_params)\n @answer.user = current_user\n @answer.question = @question\n #@answer.question = @question\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer.question, notice: 'La respuesta fue creada correctamente.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "06ab586762291151fdeded5e8484c412",
"score": "0.64830166",
"text": "def answer_params\n params.require(:answer).permit(:question_id, :body)\n end",
"title": ""
},
{
"docid": "06ab586762291151fdeded5e8484c412",
"score": "0.64830166",
"text": "def answer_params\n params.require(:answer).permit(:question_id, :body)\n end",
"title": ""
},
{
"docid": "9e8192009d65e1c5843f483ebe62a23c",
"score": "0.6478972",
"text": "def create\n @answer_question = AnswerQuestion.new(answer_question_params)\n\n respond_to do |format|\n if @answer_question.save\n format.html { redirect_to @answer_question, notice: 'Answer question was successfully created.' }\n format.json { render :show, status: :created, location: @answer_question }\n else\n format.html { render :new }\n format.json { render json: @answer_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "efdb0e808e163b1de764bbba635a9ed9",
"score": "0.64780766",
"text": "def answer_params\n params.require(:answer).permit(:answer, :user_id, :challenge_id)\n end",
"title": ""
},
{
"docid": "0b4c92c9c8abd4c8600a93a4b520849d",
"score": "0.6474032",
"text": "def create\n @answer = @question.answers.new(answer_params)\n @answer.answerer = current_tutor\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to tutor_course_question_path(@tutor, @course, @question), notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a28d5f498bcb136eaae1acb639a6fff6",
"score": "0.64532155",
"text": "def create\n @answer = Answer.new(params[:answer])\n\n respond_to do |format|\n if @answer.save\n flash[:notice] = 'Answer was successfully created.'\n format.html { redirect_to(@answer) }\n format.xml { render :xml => @answer, :status => :created, :location => @answer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b6ad8e099d7ee4ed635bd8641676343d",
"score": "0.6451357",
"text": "def create\n @question = Question.find(params[:question_id])\n #has_manyでquestion.answersが使える\n @answer = @question.answers.build(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @question, notice: \"回答を送信しました\" }\n # format.json { render :show, status: :created, location: @answer }\n format.js {\n flash[:notice] = \"回答を送信しました\"\n }\n Notification.new(user_id: @question.user.id,message: \"#{@answer.user.username}さんが、あなたの質問に回答しました。\",\n url: \"/questions/#{@question.id}\").save\n else\n format.html { redirect_to @question , alert: \"回答を送信できませんでした。\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2ec3ceb87f7b5c7f845e54fe8be2aab3",
"score": "0.6450288",
"text": "def create\n @saju_answer = SajuAnswer.new(saju_answer_params)\n\n if @saju_answer.save\n render json: { status: :ok }\n else\n render json: { status: :internal_server_error }\n end\n end",
"title": ""
},
{
"docid": "8af8c3f919c1e9eee5f10369dd4b7228",
"score": "0.6446409",
"text": "def create\n @correct_answer = CorrectAnswer.new(correct_answer_params)\n\n respond_to do |format|\n if @correct_answer.save\n format.html { redirect_to @correct_answer, notice: 'Correct answer was successfully created.' }\n format.json { render :show, status: :created, location: @correct_answer }\n else\n format.html { render :new }\n format.json { render json: @correct_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "02b4efe86d1654a853471fe9fb3b316c",
"score": "0.6441911",
"text": "def answer_params\n params.require(:answer).permit(:question_id, :title, :content)\n end",
"title": ""
},
{
"docid": "411bb04ba20a2ff5ddf521b51a91baf4",
"score": "0.64332944",
"text": "def create\n @correct_answer = CorrectAnswer.new(correct_answer_params)\n\n respond_to do |format|\n if @correct_answer.save\n format.html { redirect_to @correct_answer, notice: \"Correct answer was successfully created.\" }\n format.json { render :show, status: :created, location: @correct_answer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @correct_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "534abdcbb0b441ee0af562a0f5df2aba",
"score": "0.6426224",
"text": "def answer_params\n params.require(:answer).permit(:text, :question_id)\n end",
"title": ""
},
{
"docid": "8dc4fd56138e2aebed243612ef8cc42d",
"score": "0.64235437",
"text": "def create\n @questionnaire = Questionnaire.new :comment => params[:questionnaire][:comment]\n @questionnaire.user = current_user\n @questionnaire.location = Location.find(params[:questionnaire][:location])\n Question.all.each_with_index do |question, index|\n user_answer = UserAnswer.new\n user_answer.question = question\n user_answer.location = @questionnaire.location\n user_answer.questionnaire = @questionnaire\n user_answer.value = params[:questionnaire][:user_answers][index.to_s][:value]\n @questionnaire.user_answers << user_answer\n end\n\n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully created.' }\n format.json { render json: @questionnaire, status: :created, location: @questionnaire }\n else\n format.html { render action: \"new\" }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "805f629587b05fba709d8231c806e6a3",
"score": "0.64227486",
"text": "def answer_params\n params.require(:answer).permit(:answer, :user_id, :question_id)\n end",
"title": ""
},
{
"docid": "3649ac7560f8af04549d7f388f1966af",
"score": "0.641957",
"text": "def create\n @user_answer = UserAnswer.new(user_answer_params)\n\n respond_to do |format|\n if @user_answer.save\n format.html { redirect_to user_answers_path(:mobject_id => @user_answer.answer.question.mobject.id), notice: (I18n.t :act_create) }\n format.json { render :show, status: :created, location: @user_answer }\n else\n format.html { render :new }\n format.json { render json: @user_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0f07e8d5ab944f1c4a9e4fed41da7957",
"score": "0.6412963",
"text": "def set_answers\n @answer = Answer.find(params[:id])\n end",
"title": ""
},
{
"docid": "6324976c53f1664bfe7aa7998020a3e9",
"score": "0.640944",
"text": "def answer_params\n params.require(:answer).permit(:question_id, :text)\n end",
"title": ""
},
{
"docid": "15e49f86c452faf7aa6f768a9760030a",
"score": "0.64067286",
"text": "def create\n @prompts_answer = PromptsAnswer.new(prompts_answer_params)\n\n respond_to do |format|\n if @prompts_answer.save\n format.html { redirect_to @prompts_answer, notice: \"Prompts answer was successfully created.\" }\n format.json { render :show, status: :created, location: @prompts_answer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @prompts_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8505f3a9b51e706686b3d1dab7c33ee8",
"score": "0.640342",
"text": "def create\n @text_answer = TextAnswer.new(text_answer_params)\n\n respond_to do |format|\n if @text_answer.save\n format.html { redirect_to @text_answer, notice: 'Text answer was successfully created.' }\n format.json { render :show, status: :created, location: @text_answer }\n else\n format.html { render :new }\n format.json { render json: @text_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "074a8493820e11200f205c10116e68d5",
"score": "0.64034134",
"text": "def answer_params\n params.require(:answer).permit(:title, :is_correct, :question_id)\n end",
"title": ""
}
] |
3cc8c6bbe9829707a120087bb6c125ae | input: integer output: star diamond rules: method that displays a 4pointed diamond in n x n grid n is an odd integer supplied in an argument to the method assume argument will always to be an odd integer algorithm: create a method to iterate through numbers create another method to print out the diamond shape print out the diamond | [
{
"docid": "ce4f0b0ee7159b613a25e06f1610fe24",
"score": "0.71142215",
"text": "def diamonds(num)\n diamond = \"*\"\n 1.upto(num-1) do |count|\n puts (diamond * count).center(num) if count.odd? \n end\n (num).downto(0) do |number|\n puts (diamond * number).center(num) if number.odd?\n end\nend",
"title": ""
}
] | [
{
"docid": "8cb0da93d3ea544833d9aef65a891866",
"score": "0.80931836",
"text": "def diamond(n) # where n is an odd integer\n halfway = n / 2 + 1\n diamonds = {}\n spaces = {}\n # Using math to build number of diamonds and spaces for half the lines\n 1.upto(halfway) do |num|\n diamonds[num] = 2*num - 1\n spaces[num] = (n - (2*num - 1)) / 2\n end\n # Displaying the top half of the diamond, including the center line\n 1.upto(halfway) do |num|\n puts \"#{' ' * spaces[num]}#{\"*\" * diamonds[num]}#{' ' * spaces[num]}\"\n end\n # Displaying the bottom half of the diamond, excluding the center line\n (halfway - 1).downto(1) do |num|\n puts \"#{' ' * spaces[num]}#{\"*\" * diamonds[num]}#{' ' * spaces[num]}\"\n end\nend",
"title": ""
},
{
"docid": "7fa11f5fad6b1ae2f532d2a2425c20e7",
"score": "0.8073428",
"text": "def diamond_outline(n) # where n is an odd integer\n halfway = n / 2 + 1\n inner_spaces = {}\n # Using math to build number of inner spaces for half the lines\n 1.upto(halfway) do |num|\n inner_spaces[num] = 2 * num - 3\n end\n # Displaying the top half of the diamond, including the center line\n 1.upto(halfway) do |num|\n if num == 1\n puts \"*\".center(n)\n else\n puts \"*#{' ' * inner_spaces[num]}*\".center(n)\n end\n end\n # Displaying the bottom half of the diamond, excluding the center line\n (halfway - 1).downto(1) do |num|\n if num == 1\n puts \"*\".center(n)\n else\n puts \"*#{' ' * inner_spaces[num]}*\".center(n)\n end\n end\nend",
"title": ""
},
{
"docid": "b366e661a48979bc0c130f719d140e6e",
"score": "0.8054071",
"text": "def diamond(n)\n odd_counts_to_n = (1..n).to_a.select { |num| num.odd? }\n row_stars = odd_counts_to_n + odd_counts_to_n.reverse[1..-1]\n \n row_stars.each do |star_for_row|\n half_row_space = (n - star_for_row) / 2\n puts \" \"*half_row_space + \"*\"*star_for_row + \" \"*half_row_space\n end\nend",
"title": ""
},
{
"docid": "d9c988ea808b9fac6d7aaf0db878b6c1",
"score": "0.801711",
"text": "def diamond(num)\n \nend",
"title": ""
},
{
"docid": "4d0886e85c4e5ea82a2063c8f6f53f31",
"score": "0.8013315",
"text": "def diamond(diameter)\n points = (1..diameter).to_a.select { |n| n if n.odd?}\n until points.first == points.last\n points.push(points.last - 2)\n end\n points.each do |p|\n puts \"#{('*' * p).center(diameter)}\"\n end\nend",
"title": ""
},
{
"docid": "5841e47f1fab73449023f0b3af7ec498",
"score": "0.8007491",
"text": "def diamond(n)\n half = n / 2\n line_num = 0\n half.times {\n line_num += 1\n space_num = half - line_num + 1\n star_num = 2 * line_num - 1\n puts \" \" * space_num + \"*\" * star_num\n }\n\n half = n / 2 + 1\n line_num = 0\n half.times {\n space_num = line_num\n star_num = n\n puts \" \" * space_num + \"*\" * star_num\n n = n - 2\n line_num += 1\n }\nend",
"title": ""
},
{
"docid": "30cf646c56ca2ec5ef3ae47a427970c0",
"score": "0.79840505",
"text": "def diamond(num)\n stars = []\n midpoint = num / 2\n counter = 0\n (1..num).each {|v| stars << v if v.odd? } # top half\n stars << stars.reverse[1..-1] # bottom half\n stars.flatten.each do |n|\n n2 = (counter <= midpoint) ? (midpoint - counter) : (counter - midpoint) \n puts (\" \" * n2) + (\"*\" * n)\n counter += 1\n end\nend",
"title": ""
},
{
"docid": "1b5d37873a807f38f01857c6e736769e",
"score": "0.7962712",
"text": "def diamond(n)\n n.times {|num| puts (\"*\" * num).center(n) if num.odd? }\n n.downto(1) {|num| puts (\"*\" * num).center(n) if num.odd?} \nend",
"title": ""
},
{
"docid": "120f5a161d03cd876a29e2ebf558dedf",
"score": "0.79349625",
"text": "def diamond(int)\n i = 1\n spaces = (int - 1) / 2\n loop do\n puts \" \" * spaces + \"*\" * i + \" \" * spaces \n i +=2\n spaces -= 1\n break if i > int\n end\n\n i -= 2\n spaces += 1 \n\n loop do \n i -= 2\n spaces += 1\n puts \" \" * spaces + \"*\" * i + \" \" * spaces\n break if i <= 1\n end\nend",
"title": ""
},
{
"docid": "37b65435fccb3205a43d0cf04f180ea2",
"score": "0.7932206",
"text": "def diamond(num)\n stars = []\n (1..num).each {|v| stars << v if v.odd? } # top half\n stars << stars.reverse[1..-1] # bottom half\n stars.flatten.each { |n| puts ('*' * n).center(num) }\nend",
"title": ""
},
{
"docid": "a8a245ccce4eb0888a6190e8f7b69edf",
"score": "0.7923945",
"text": "def diamond(n)\n stars = 1\n blanks = (n - 1) / 2\n loop do\n puts \"#{' ' * blanks}#{'*' * stars}\"\n break if stars == n\n stars += 2\n blanks -= 1\n end\n loop do\n break if stars == 1\n stars -= 2\n blanks += 1\n puts \"#{' ' * blanks}#{'*' * stars}\"\n end\nend",
"title": ""
},
{
"docid": "897ab21cdfab56bbf3e712e33efef1f4",
"score": "0.7916544",
"text": "def diamond(n)\n half = (n / 2.0).ceil\n spaces_per_row = 1\n\n 1.upto(n) do |iteration_num|\n if iteration_num == 1 || iteration_num == n\n puts '*'.center(n)\n else\n puts ('*' + (\"\\s\" * spaces_per_row) + '*').center(n)\n iteration_num < half ? spaces_per_row += 2 : spaces_per_row -= 2\n end\n end\nend",
"title": ""
},
{
"docid": "c14234dd7f3af40ef42f5ef4ffa36488",
"score": "0.7916514",
"text": "def diamond(grid_size)\n max_distance = (grid_size - 1) / 2\n max_distance.downto(0) { |distance| print_row(grid_size, distance) }\n 1.upto(max_distance) { |distance| print_row(grid_size, distance) }\nend",
"title": ""
},
{
"docid": "6b1e6ec3b44c64d507609f3d3f4d6d77",
"score": "0.7915833",
"text": "def diamond(integer)\n spaces = integer / 2\n asterisks = 1\n\n (integer/2).times do\n puts (\" \" * spaces) + (\"*\" * asterisks)\n spaces -= 1\n asterisks += 2\n end\n\n (integer/2 + 1).times do \n puts (\" \" * spaces) + (\"*\" * asterisks)\n spaces += 1\n asterisks -= 2\n end\nend",
"title": ""
},
{
"docid": "86feacea68d851d86d961210d9386eb2",
"score": "0.78969955",
"text": "def diamond(n)\n ((1..n).step(2).to_a + (1..n).step(2).to_a.reverse[1..-1]).each do |x|\n puts ('*' + ' ' * (x-1) + '*').center(n)\n end\nend",
"title": ""
},
{
"docid": "9fe2cc3342d0d8e44e91cd5bbad6f3cb",
"score": "0.78909385",
"text": "def diamond(num)\n mid = num / 2\n counter = mid\n (1..num).step(2) do |n|\n puts \"#{' ' * counter}#{('*' * n)}\"\n counter -= 1 if counter > 0\n end\n (2..num).step(2) do |n|\n counter += 1\n puts \"#{' ' * counter}#{'*' * (num - n)}\"\n end\nend",
"title": ""
},
{
"docid": "bb032ec25c10ef406feb05174ba146c6",
"score": "0.7887104",
"text": "def diamond(n)\n 1.upto(n-1) { |i| puts (\"*\" * i).center(n) if i.odd? }\n n.downto(1) { |i| puts (\"*\" * i).center(n) if i.odd? }\nend",
"title": ""
},
{
"docid": "64c4e84ec86b07c4477c973e30696621",
"score": "0.78739524",
"text": "def diamond(n)\n\n 0.upto(n/2) do |index|\n stars = n - (2 * (n/2-index))\n spaces = (n - stars)/2\n puts ' '*spaces + '*'*stars # middle line\n end\n\n (n/2-1).downto(0) do |index|\n stars = n - (2 * (n/2-index))\n spaces = (n - stars)/2\n puts ' '*spaces + '*'*stars\n end\nend",
"title": ""
},
{
"docid": "30427cc81e17bf3b3c49661084196b36",
"score": "0.78703",
"text": "def diamond(num)\n 1.upto(num) do |i|\n puts \"#{'*' * i}\".center(num, ' ') if i.odd?\n end\n num.downto(1) do |i|\n puts \"#{'*' * i}\".center(num, ' ') if i.odd? && i < num\n end\nend",
"title": ""
},
{
"docid": "0745c23c6bf51ce36d3eece83eda5d38",
"score": "0.78694355",
"text": "def diamond(n)\n half_size = n / 2\n 1.upto(half_size) do |i|\n puts ' ' * (half_size - i + 1) + '*' * (2 * i - 1)\n end\n puts '*' * n\n half_size.downto(1) do |i|\n puts ' ' * (half_size - i + 1) + '*' * (2 * i - 1)\n end\nend",
"title": ""
},
{
"docid": "4fbb311ac4660fd9b3e3fe5684fc9572",
"score": "0.7866756",
"text": "def diamond(num)\n sign_arr = (1..num).step(2).to_a + (1..num-1).step(2).to_a.reverse\n spaces = (num-1)/2\n spaces_arr = (0..spaces).to_a.reverse + (1..spaces).to_a\n \n 0.upto(num-1) do |i|\n puts \"#{\" \" * spaces_arr[i]}#{\"*\" * sign_arr[i]}\"\n end \nend",
"title": ""
},
{
"docid": "706e1b38747b6c906be7adf45fdbc192",
"score": "0.7851505",
"text": "def diamond(number)\n target_width = number\n midpoint = number - 2\n splat_counter = 1\n 1.upto(target_width) do |num|\n puts ('*' * num).center(target_width, ' ') if num.odd?\n end\n midpoint.downto(1) do |num|\n puts ('*' * num).center(target_width, ' ') if num.odd?\n end\n\n # until splat_counter > target_width\n # ('*' * splat_counter).center(target_width, ' ')\n # splat_counter += 2\n # end\n # splat_counter -= 2\n # until splat_counter == 1\n # splat_counter -= 2\n # ('*' * splat_counter).center(target_width, ' ')\n # end\nend",
"title": ""
},
{
"docid": "9075f3d99bd70c51fa377d10c05a36ac",
"score": "0.7845782",
"text": "def diamond(size)\n stars = 1\n 1.upto(size) do |x|\n spaces = (size - stars) / 2\n if stars > 2\n inner_spaces = stars - 2\n puts \"#{' ' * spaces}*#{' ' * inner_spaces}*#{' ' * spaces}\"\n else\n puts \"#{' ' * spaces}#{'*' * stars}#{' ' * spaces}\"\n end\n x / size.to_f >= 0.5 ? stars -= 2 : stars += 2\n end\nend",
"title": ""
},
{
"docid": "f1ce101c754f66d00a570308727a3e98",
"score": "0.7828941",
"text": "def diamond(int)\n stars = 1\n \n while stars < int\n spaces = (int - stars) / 2\n spaces.times {|y| print ' '}\n stars.times { |x| print '*' }\n spaces.times {|y| print ' '}\n print \"\\n\"\n \n stars += 2\n end\n \n while stars > 0\n spaces = (int - stars) / 2\n spaces.times {|y| print ' '}\n stars.times { |x| print '*' }\n spaces.times {|y| print ' '}\n print \"\\n\"\n \n stars -= 2\n end\n \nend",
"title": ""
},
{
"docid": "36e285c6743954a2edbea6e94884af23",
"score": "0.7828233",
"text": "def diamond2(n) # where n is an odd integer\n halfway = n / 2 + 1\n diamonds = {}\n # Using math to build number of diamonds and spaces for half the lines\n 1.upto(halfway) do |num|\n diamonds[num] = 2*num - 1\n end\n # Displaying the top half of the diamond, including the center line\n 1.upto(halfway) do |num|\n puts \"#{(\"*\" * diamonds[num]).center(n)}\"\n end\n # Displaying the bottom half of the diamond, excluding the center line\n (halfway - 1).downto(1) do |num|\n puts \"#{(\"*\" * diamonds[num]).center(n)}\"\n end\nend",
"title": ""
},
{
"docid": "6fc15d5e30ad5cb0c909be0dc79ecf05",
"score": "0.78254336",
"text": "def diamond(num)\n return puts \"*\" if num == 1\n \n counter = (num / 2)\n middle_space = 1\n \n puts \" \" * counter + \"*\"\n counter -= 1\n \n (num / 2).times do \n puts \" \" * counter + \"*\" + \" \" * middle_space + \"*\"\n middle_space += 2\n\n\n counter -= 1\n end\n \n counter = 1\n middle_space -= 4\n \n ((num / 2) -1).times do \n puts \" \" * counter + \"*\" + \" \" * middle_space + \"*\"\n middle_space -= 2\n counter += 1\n end\n puts \" \" * counter + \"*\"\nend",
"title": ""
},
{
"docid": "99f6a4119986b099a71203a3330a9f3d",
"score": "0.78254306",
"text": "def diamond(num)\n return nil if num.even? || num <= 0\n\n diamond = []\n max_stars = (num / 2) + 1\n\n (1..max_stars - 1).each do |i|\n space = ' ' * (max_stars - i)\n stars = '*' * ((i * 2) - 1)\n diamond << \"#{space}#{stars}\\n\"\n end\n\n diamond.join + \"#{'*' * num}\\n\" + diamond.reverse.join\nend",
"title": ""
},
{
"docid": "486f910dbefb75a1fa011ffeb142893f",
"score": "0.78208643",
"text": "def diamond(n)\n stars = 1\n spaces = (n-stars)/2\n loop do\n puts \" \"*spaces + \"*\"*stars + \" \"*spaces\n stars += 2\n spaces = (n-stars)/2\n break if stars > n\n end\nend",
"title": ""
},
{
"docid": "850b72d8d9efee825646e3181cdf7778",
"score": "0.7818725",
"text": "def diamond(n)\n half_length = n/2\n diamonds_counter = 1\n spaces_counter = half_length\n \n loop do # grow diamond\n puts(\"#{' ' * spaces_counter}#{'*' * diamonds_counter}\")\n break if spaces_counter == 0\n diamonds_counter += 2\n spaces_counter -= 1\n \n end\n \n loop do # shrink diamond\n break if diamonds_counter <= 1\n diamonds_counter -= 2\n spaces_counter += 1\n puts(\"#{' ' * spaces_counter}#{'*' * diamonds_counter}\")\n end\n \nend",
"title": ""
},
{
"docid": "63118a7c62da75070049acef61570829",
"score": "0.78174424",
"text": "def diamond(num)\n stars = 1\n spaces = (num - stars) / 2\n until stars > num\n puts \" \" * spaces + \"*\" * stars + \" \" * spaces\n stars += 2\n spaces = (num - stars) / 2\n end\n stars = num - 2\n until stars < 1\n spaces = (num - stars) / 2\n puts \" \" * spaces + \"*\" * stars + \" \" * spaces\n stars -= 2\n end\nend",
"title": ""
},
{
"docid": "14ee5104fd04ef20bbfd510bcc556c78",
"score": "0.78034675",
"text": "def diamond(number)\n odd_numbers = []\n array_numbers = (1..number).to_a << (1..(number - 1)).to_a.reverse\n array_numbers.flatten.each {|num| odd_numbers << num if num.odd?}\n odd_numbers.each do |num|\n diamonds = \"*\" * num if num.odd?\n puts diamonds.to_s.center(number)\n end\nend",
"title": ""
},
{
"docid": "afcfffa530467b936d44c63b65740233",
"score": "0.7802636",
"text": "def diamond(num)\n stars = 1\n spaces = (num - 1)/2\n loop do\n break if spaces < 0\n puts \" \"*spaces + \"*\"*stars + \" \"*spaces\n stars += 2\n spaces -= 1\n end\n \n stars = num - 2\n spaces = 1\n loop do \n break if stars < 0\n puts \" \"*spaces + \"*\"*stars + \" \"*spaces\n stars -= 2\n spaces += 1\n end\nend",
"title": ""
},
{
"docid": "6360444f798d5c9399425226025d94fd",
"score": "0.77968824",
"text": "def diamond(n)\n puts ''\n (1..n - 1).step(2) { |i| puts ('*' * i).center(n) }\n (-n..0).step(2) { |i| puts ('*' * -i).center(n) }\nend",
"title": ""
},
{
"docid": "fbd05eeb4cdc18d34f04c616d3774790",
"score": "0.7789449",
"text": "def diamond(int)\r\n blank = int / 2\r\n stars = int - (blank * 2)\r\n int.times do\r\n blank.times do\r\n print \" \"\r\n end\r\n stars.times do\r\n print \"*\"\r\n end\r\n blank.times do\r\n print \" \"\r\n end\r\n print \"\\n\"\r\n blank -= 1\r\n stars += 2\r\n break if blank == 0\r\n end\r\n int.times do\r\n blank.times do\r\n print \" \"\r\n end\r\n stars.times do\r\n print \"*\"\r\n end\r\n blank.times do\r\n print \" \"\r\n end\r\n print \"\\n\"\r\n blank += 1\r\n stars -= 2\r\n break if blank > int / 2\r\n end\r\nend",
"title": ""
},
{
"docid": "972cbb3f616b2b0839caaecc7e8d96fd",
"score": "0.77814597",
"text": "def diamond(num)\n (1..num).step(2) do |stars|\n spaces = (num - stars) / 2\n puts ' ' * spaces + '*' * stars + ' ' * spaces\n end\n 1.upto(num / 2) do |spaces|\n stars = num - 2 * spaces\n puts ' ' * spaces + '*' * stars + ' ' * spaces\n end\nend",
"title": ""
},
{
"docid": "aa06fe708d4e875480d0218dbdf79ec7",
"score": "0.7755059",
"text": "def diamond(num)\n puts ''\n \n 0.upto(num/2) do |i|\n if i == 0\n puts '*'.center(num)\n next\n end\n spaces = (i*2 - 1)\n puts ('*' + ' '*spaces + '*').center(num)\n end\n\n (num/2 - 1).downto(0) do |i|\n if i == 0 && num > 1\n puts '*'.center(num)\n break\n end\n spaces = (i*2 - 1)\n puts ('*' + ' '*spaces + '*').center(num)\n end\n\nend",
"title": ""
},
{
"docid": "1f3f7d71c58cdbfdf24495f09fde9a3f",
"score": "0.77460515",
"text": "def diamond(n)\n arr = (1..n).to_a\n arr1 = arr.select {|i| i.odd?} + arr.reverse.select {|i| i.odd?}\n arr1.delete_at(arr.size / 2)\n arr1.each{|i, idx| puts ('*' * i).center(n)}\nend",
"title": ""
},
{
"docid": "baa43a71bc21e338ea2e8233ae027ea5",
"score": "0.7744308",
"text": "def diamond(grid_size, sym = '*', outline_only = false)\n result = []\n 1.step(grid_size, 2) { |i| result << sym * i }\n (grid_size - 2).step(1, -2) { |i| result << sym * i }\n\n if outline_only\n result.map! do |element|\n next element if element.size == 1\n sym + ' ' * (element.size - 2) + sym\n end\n end\n\n puts result.map! { |element| element.center(grid_size) }\nend",
"title": ""
},
{
"docid": "9d1775d74035f431be0468437be54d56",
"score": "0.77353156",
"text": "def diamond(n)\n n.times { |i| puts (\"*\" * ([i + 1, n - i].min * 2 - 1)).center(n) }\nend",
"title": ""
},
{
"docid": "2699ba3c57264565d3cbc903340e59cb",
"score": "0.77126193",
"text": "def diamond(num)\n star = '*'\n \n 1.upto(num) do |n|\n next if n.even?\n puts (star * n).center(num)\n end\n \n (num - 1).downto(1) do |n|\n next if n.even?\n puts (star * n).center(num)\n end\nend",
"title": ""
},
{
"docid": "621904ff2ec5c2afdd8bd0f0eec7c62e",
"score": "0.7711226",
"text": "def diamond(number)\n\n counter = 1\n spaces = number\n loop do\n puts (' ' * (spaces / 2)) + ('*' * counter) + (' ' * (spaces / 2))\n counter += 2\n spaces -= 2\n break if counter > number\n end\n\n spaces = -spaces + 1\n counter = counter - 2\n loop do\n counter -= 2\n puts (' ' * (spaces / 2)) + ('*' * counter) + (' ' * (spaces / 2))\n spaces += 2\n break if counter == 1\n end\nend",
"title": ""
},
{
"docid": "6b6b6c6cd3b99f68382ac2a2e40b6cf1",
"score": "0.7701492",
"text": "def diamond(n)\n odd_numbers = retrieve_odd_numbers(n)\n diamond_array = odd_numbers + odd_numbers.reverse[1..-1]\n diamond_array.each do |num|\n row_string = ('*' * num).center(n)\n puts row_string\n end\nend",
"title": ""
},
{
"docid": "e6f0c655ee385218b61d569bce027f4c",
"score": "0.7699268",
"text": "def diamond(n)\n diamond_rows = []\n after_center = false\n stars = 1\n n.times do\n spaces = \" \" * ((n - stars)/2)\n diamond_rows << spaces + ('*' * stars) + spaces\n if after_center\n stars -= 2\n else\n stars += 2\n after_center = !after_center if stars == n\n end\n end\n diamond_rows.each do |row|\n puts row\n end\nend",
"title": ""
},
{
"docid": "f02a40588515bff7b3179dc1be2ab706",
"score": "0.7693141",
"text": "def diamond(n, hollow = true)\r\n output = diamond_lines_first_half(n, hollow)\r\n ((n/2)-1).downto(0) do |i|\r\n output << output[i]\r\n end\r\n puts output\r\nend",
"title": ""
},
{
"docid": "dd3f95ee02f7efee37c1bcdc2b47587e",
"score": "0.7678346",
"text": "def diamond(n)\n middle = '*' * n\n stars = n\n bottom = []\n loop do\n stars -= 2\n break if stars < 1\n bottom << ('*' * stars).center(n)\n end\n diamond = bottom.reverse + [middle] + bottom\n diamond.each { |line| puts line }\nend",
"title": ""
},
{
"docid": "cfff2703939669d61d0255614fcf3c3c",
"score": "0.76752234",
"text": "def diamond(rows)\n 1.step(rows, 2) {|star_num| printout_diamond_row(star_num, rows)}\n (rows-2).step(1, -2) {|star_num| printout_diamond_row(star_num, rows)}\nend",
"title": ""
},
{
"docid": "6014c707da84c68d8c3549942a40a7a9",
"score": "0.76593065",
"text": "def print_diamond(size)\n diamond = ''\n num_stars = 1\n \n 1.upto(size) do |num_stars|\n diamond += generate_line(size, num_stars) if num_stars.odd?\n end\n \n (size - 2).downto(1) do |num_stars|\n diamond += generate_line(size, num_stars) if num_stars.odd?\n end\n \n puts diamond\nend",
"title": ""
},
{
"docid": "fd6ae15c6d79e43b5fcc3fd48e4028f7",
"score": "0.76418906",
"text": "def diamond(num)\n stars = 1\n spaces = (num - 1) / 2\n\n loop do\n puts \" \"*spaces + \"*\"*stars + \" \"*spaces\n break if stars == num\n stars += 2\n spaces -= 1\n end\n\n loop do\n break if stars == 1\n spaces += 1\n stars -= 2\n puts \" \"*spaces + \"*\"*stars + \" \"*spaces\n end\nend",
"title": ""
},
{
"docid": "5c31e8c06372eca3fb2ae5a725df4192",
"score": "0.7639506",
"text": "def diamond(n)\n return \"*\" if n == 1\n # iterate thru a range, first half part\n pre_space = (n-1)/2\n (1..n).step(2) do |star|\n current_line = ' ' * pre_space + '*' * star\n pre_space -= 1\n puts current_line\n end\n\n # second half part\n pre_space = 1\n (n-2).step(1, -2) do |star|\n current_line = ' ' * pre_space + '*' * star\n pre_space += 1\n puts current_line\n end\nend",
"title": ""
},
{
"docid": "f5f412352ff9d05d594726210f465bde",
"score": "0.75921494",
"text": "def diamond(lines)\n\tamtLines = lines\n\tspaces = amtLines - 1\n\tstars = 1\n\twhile amtLines > 0 do\n\t for i in 1..amtLines do\n\t print \" \" * spaces\n\t print \"*\" * stars\n\t puts \" \" * spaces\n\t amtLines -= 1\n\t spaces -= 1\n\t stars += 2\n\t end\n\tend\n\n\tamtLines = lines\n\tspaces = 1\n\tstars = (amtLines * 2)-3\n\twhile amtLines > 0 do\n\t for i in 1...amtLines do\n\t print \" \" * spaces\n\t print \"*\" * stars\n\t puts \" \" * spaces\n\t amtLines -= 1\n\t spaces += 1\n\t stars -= 2\n\t end\n\t break\n\tend\nend",
"title": ""
},
{
"docid": "51910c210c39582caacea144310655d1",
"score": "0.7569156",
"text": "def diamond(n)\n counter = 1\n loop do\n puts ('*' * counter).center(n)\n break if counter == n\n counter += 2\n end\n loop do\n break if counter == 1\n counter -= 2\n puts ('*' * counter).center(n)\n end\nend",
"title": ""
},
{
"docid": "5e456eddcd16f6868a6b239d1aa9212e",
"score": "0.7543793",
"text": "def diamond(n)\n counter = 1\n \n loop do\n puts (\"*\" * counter).center(n)\n break if counter == n\n counter += 2\n end\n \n loop do\n counter -= 2\n puts (\"*\" * counter).center(n)\n break if counter == 1\n end\n \nend",
"title": ""
},
{
"docid": "15b531ac2ccff418487939d6c1d58184",
"score": "0.7536834",
"text": "def diamond(n)\n counter = 1\n maximum_distance = (n - 1) / 2\n bottom_diamond = false\n\n loop do\n bottom_diamond = true if counter >= n\n stars = '*' * counter\n\n puts stars.center(n)\n\n if bottom_diamond == false\n counter += 2\n else\n counter -= 2\n end\n\n break if counter < 1\n end\nend",
"title": ""
},
{
"docid": "d8bbc7291459f59793599a0be4466546",
"score": "0.7518517",
"text": "def print_diamond(half_diamond, grid_size)\n half_diamond += half_diamond[0..-2].reverse\n\n half_diamond.each { |stars| puts stars.center(grid_size) }\nend",
"title": ""
},
{
"docid": "83de691278b6dd40352839e436f61bcc",
"score": "0.7498875",
"text": "def diamond(num)\n num_of_loops = num / 2\n number_of_stars = 1\n\n num_of_loops.downto(1) do |number_of_spaces|\n puts \" \" * number_of_spaces + \"*\" * number_of_stars\n number_of_stars += 2\n end\n\n puts \"*\" * number_of_stars\n\n 1.upto(num_of_loops) do |number_of_spaces|\n number_of_stars -= 2\n puts \" \" * number_of_spaces + \"*\" * number_of_stars\n end\nend",
"title": ""
},
{
"docid": "058e5cf09a8cc9169bb550608ed16223",
"score": "0.7488277",
"text": "def diamond(int)\n x = 1\n while x <= int \n puts (\"*\" * (x)).center(int)\n x += 2\n end\n x -= 2\n while x > 1\n x -= 2\n puts (\"*\" * (x)).center(int)\n end\nend",
"title": ""
},
{
"docid": "e2e5939dbcde9f9fa60196e7fb506d28",
"score": "0.7487145",
"text": "def diamond(n)\n counter = 1\n\n until counter == n\n spaces = \" \" * ((n - counter)/2)\n # puts \"#{spaces} #{\"*\" * counter} #{spaces}\"\n stars = \"*\" * counter\n puts stars.center(n)\n counter += 2\n end\n\n until counter < 1\n spaces = \" \" * ((n - counter)/2)\n # puts \"#{spaces} #{\"*\" * counter} #{spaces}\"\n stars = \"*\" * counter\n puts stars.center(n)\n counter -= 2\n end\n\nend",
"title": ""
},
{
"docid": "e41912fe36aef30baa08aeccc88fd49a",
"score": "0.74805206",
"text": "def diamond(number)\n \"*\".center(number)\n counter = 1\n while counter <= number\n puts (\"*\" * counter).center(number)\n counter += 2\n end\n loop do \n counter -= 2\n break if counter < 1\n puts (\"*\" * counter).center(number)\n end\nend",
"title": ""
},
{
"docid": "299a82318282728854f25269f943b6b1",
"score": "0.7430024",
"text": "def print_x(size)\n mid = (size + 1)/2\n mid.downto(1) do |i|\n for j in 1..size\n print i.to_s + \"*\"\n print j.to_s + \"|\"\n end\n print \"\\n\"\n end\n# Bottom of the diamond\n for i in 2..mid \n for j in 1..size\n print i.to_s + \"*\"\n print j.to_s + \"|\"\n end\n print \"\\n\"\n end\nend",
"title": ""
},
{
"docid": "5ba9b874516518488e18762834d85886",
"score": "0.7429927",
"text": "def diamond(n)\n result = '*'\n count = 2\n\n loop do\n puts result.center(n)\n result += ('*' * count)\n break if result.size == (n + 2)\n end\n\n (n / 2.0).floor.downto(1) do |num|\n result = ('*' * (n - count))\n puts result.center(n)\n count += 2\n end\n\nend",
"title": ""
},
{
"docid": "93eebfb6df13b477e2c8e6fa382703ce",
"score": "0.7425843",
"text": "def print_diamond(size)\n stars = size * 2\n count_of_spaces = 0\n for i in 0...stars\n count_of_stars = (stars - count_of_spaces) / 2\n if (i <= size - 1)\n print \"*\" * count_of_stars\n print \" \" * count_of_spaces\n print \"*\" * count_of_stars\n else\n print \"*\" * count_of_stars\n print \" \" * count_of_spaces\n print \"*\" * count_of_stars\n end\n if i <= size - 1\n count_of_spaces += 2\n count_of_spaces -= 2 if count_of_spaces == stars\n else\n count_of_spaces -= 2\n end\n puts\n end\nend",
"title": ""
},
{
"docid": "a89de86cf178e432bb04d13bec5b0abd",
"score": "0.73934215",
"text": "def diamond(number)\nputs \"\"\n1.upto(number) do |line_num|\n stars = \"\"\n if line_num.odd?\n stars = \"*\" * line_num\n puts stars.center(number) \n end\nend\n\n(number-2).downto(1) do |line_num|\n stars = \"\"\n if line_num.odd?\n stars = \"*\" * line_num\n puts stars.center(number)\n end\n end\nend",
"title": ""
},
{
"docid": "caa0c4a475f9d62d0b860d93f40a80f6",
"score": "0.73786706",
"text": "def diamond(size)\n inner_width = 1\n inner_contents = \"\"\n current_half = \"upper\"\n\n size.times do\n inner_contents = (\"*\" * inner_width)\n p inner_contents.center(size, ' ')\n\n current_half = \"lower\" if inner_width == size\n break if current_half == \"lower\" && inner_width == 1\n\n case current_half\n when \"upper\" then inner_width += 2\n when \"lower\" then inner_width -= 2\n end\n end\nend",
"title": ""
},
{
"docid": "50b02e82e5541a43f94ca0e41579ad3d",
"score": "0.73531514",
"text": "def diamond(height)\n spaces = height / 2\n i = 0\n stars = 1\n middle = false\n\n loop do\n if stars == height\n middle = true\n end\n\n print ' ' * spaces\n puts '*' * stars\n\n if middle\n spaces += 1\n stars -= 2\n else\n spaces -= 1\n stars += 2\n end\n i += 1\n break if i >= height\n end\nend",
"title": ""
},
{
"docid": "a5e0e7aea2b4bfcfe8e321e10537fe7d",
"score": "0.73226386",
"text": "def print_diamond(size)\n # ???\nend",
"title": ""
},
{
"docid": "76911de6e6c73d8212df8927fb21bc68",
"score": "0.7285461",
"text": "def diamond(max_dimension)\n center_point = (max_dimension-1) / 2\n stars = Array.new(max_dimension, \" \")\n stars[center_point] = \"*\"\n\n puts\n\n i = 0\n loop do\n stars.each { |star| print star }\n puts\n\n break if i == center_point\n\n # for modification:\n stars[center_point - i] = \" \"\n stars[center_point + i] = \" \"\n\n i += 1\n\n stars[center_point - i] = \"*\"\n stars[center_point + i] = \"*\"\n\n end\n\n loop do\n \n break if i == 0\n \n stars[center_point - i] = \" \"\n stars[center_point + i] = \" \"\n \n i -= 1\n\n # Modified version\n stars[center_point - i] = \"*\"\n stars[center_point + i] = \"*\"\n\n stars.each { |star| print star }\n puts\n\n end\nend",
"title": ""
},
{
"docid": "568edc4266fdb60ef664217cec976538",
"score": "0.72384083",
"text": "def diamond(num)\n stars = (1...num).step(2).to_a + (num..1).step(-2).to_a\n\n stars.map! do |num_of_stars|\n ('*' * num_of_stars).center(num).rstrip\n end\n \n puts stars\nend",
"title": ""
},
{
"docid": "81f43186bcb7e12f8a6e92fdbc154e63",
"score": "0.7214417",
"text": "def diamond(total_lines)\n stars = 1\n\n 1.upto(total_lines) do |line_width|\n if stars == 1\n puts '*'.center(total_lines)\n else\n space = ' ' * (stars - 2)\n puts ('*' + space + '*').center(total_lines)\n end\n line_width > (total_lines / 2) ? stars -= 2 : stars += 2\n end\nend",
"title": ""
},
{
"docid": "dd178b07ff0936af72f184816cbba373",
"score": "0.7206445",
"text": "def print_diamond(size, num)\n num_of_spaces = (size - num)/2\n puts \" \" * num_of_spaces + \"*\" * num + \" \" * num_of_spaces\nend",
"title": ""
},
{
"docid": "a0ed28abe3224a901a8ddf63eb8bdc15",
"score": "0.695418",
"text": "def diamond_outline(size)\n diamond = []\n # upper part\n 1.upto(size - 1) do |index|\n diamond << '*' if index == 1\n diamond << '*' + ' ' * index + '*' if index.odd?\n end\n # lower part\n diamond[0..-2].reverse.each { |line| diamond << line }\n # display array centering lines\n diamond.each { |line| puts line.center(size) }\nend",
"title": ""
},
{
"docid": "f9180167696bba523399707765afa0b6",
"score": "0.67258",
"text": "def diamonds(num)\n if num == 1\n puts ' ' + '*' + ' '\n return\n end\n \n white_space = (num / 2)\n stars = 1\n\n loop do\n puts (' ' * white_space) + ('*' * stars) + (' ' * white_space)\n\n white_space -= 1\n stars += 2\n break if stars > num\n end\n\n white_space = 0\n stars = num\n\n loop do\n white_space += 1\n stars -= 2\n\n puts (' ' * white_space) + ('*' * stars) + (' ' * white_space)\n\n break if stars == 1\n end\nend",
"title": ""
},
{
"docid": "f8b4b94478358559ba619166308536e2",
"score": "0.66010475",
"text": "def star(n)\n counter = 0\n outer_space = 0\n inner_space = n/2\n loop do # top half\n puts ' '*outer_space + '*' + ' '*inner_space + '*' + ' '*inner_space + '*' + ' '*outer_space\n counter +=1\n outer_space +=1\n inner_space -=1\n break if counter == n/2 +1\n end \n \n puts ' '+\"*\"*n\n \n counter = 0\n outer_space = n/2\n inner_space = 0\n loop do # bottom half\n puts ' '*outer_space + '*' + ' '*inner_space + '*' + ' '*inner_space + '*' + ' '*outer_space\n counter +=1\n outer_space -=1\n inner_space +=1\n break if counter == n/2 +1\n end\nend",
"title": ""
},
{
"docid": "6e06369ad672d502a50bc9b1c0e49c1c",
"score": "0.6599732",
"text": "def processDiamond(array, topIndexX, topIndexY, arraylength, level, range, h)\n\n # Adjust\n arraylength -= 1\n length = arraylength/(2 ** level)\n #offset = (level == 0) ? 1 : 0\n\n #Get coordinates of the diamond\n rightIndexX = topIndexX + length/2\n rightIndexY = (topIndexY == length) ? length/2 : topIndexY + length/2 \n\n leftIndexX = topIndexX + length/2\n leftIndexY = (topIndexY == 0) ? arraylength - length/2 : topIndexY - length/2\n\n bottomIndexX = (topIndexX + length/2 == arraylength) ? length/2 : topIndexX + length\n bottomIndexY = topIndexY\n\n middleX = topIndexX + length/2\n middleY = topIndexY\n\n # Get values\n topValue = array[topIndexX][topIndexY]\n rightValue = array[rightIndexX][rightIndexY]\n bottomValue = array[bottomIndexX][bottomIndexY]\n leftValue = array[leftIndexX][leftIndexY]\n\n # Get average\n average = (topValue + rightValue + bottomValue + leftValue)/4\n\n # Set new value\n array[middleX][middleY] = average + calculateOffset(level, range, h)\n\n # Wraps\n if(middleX == arraylength)\n array[0][middleY] = array[middleX][middleY]\n end\n if(middleY == 0)\n array[middleX][arraylength] = array[middleX][middleY]\n end\n \n end",
"title": ""
},
{
"docid": "b51cc8945aa0141221e0d39690022af4",
"score": "0.6587662",
"text": "def diamond j, n, parent, flag\n return true if flag[j]\n flag[j] = true\n parent[j].each do |e|\n return true if diamond(e, n, parent, flag)\n end\n return false\nend",
"title": ""
},
{
"docid": "7ceaf60e19d4f392420da14ffb1afe55",
"score": "0.65747267",
"text": "def display_diamonds(num, n)\n space = ' ' * ((num - n) / 2)\n diamonds = '*' * n\n space + diamonds + space\nend",
"title": ""
},
{
"docid": "6ba1e512c0443bb85f1df90348367f85",
"score": "0.6571688",
"text": "def diagonal(n)\n sup_e_infe(n)\n n.times do |i|\n n.times do |j|\n if i == 0 || (i + j) == n - 1 || i == n - 1\n print \"*\"\n else\n print \" \"\n end\n \n end\n print \"\\n\"\n end\n sup_e_infe(n)\nend",
"title": ""
},
{
"docid": "e78c2aa12df95164d2e0de4faf828ecf",
"score": "0.6398221",
"text": "def star(odd_int)\n number_of_lines = (odd_int - 7) / 2 + 2\n num_range = (1..number_of_lines).to_a\n num_range.reverse_each do |num|\n puts \"#{\"*\"}#{\" \" * num}#{\"*\"}#{\" \" * num}#{\"*\"}\".center(odd_int)\n end\n puts \"#{\"*\" * 3}\".center(odd_int)\n puts \"#{\"*\" * odd_int}\"\n puts \"#{\"*\" * 3}\".center(odd_int)\n num_range.each do |num|\n puts \"#{\"*\"}#{\" \" * num}#{\"*\"}#{\" \" * num}#{\"*\"}\".center(odd_int)\n end\nend",
"title": ""
},
{
"docid": "b54e2884254d79f7722c4ebc8a95ff82",
"score": "0.63970405",
"text": "def wtf_pyramid\n puts \"Entre un nombre?\"\n n = gets.chomp.to_i\n full_pyramid(n / 2 + 1)\n\n (n/2).times do |i|\n i = i+1\n print \" \" * (i)\n puts \"#\" * (n-2*i)\n end\nend",
"title": ""
},
{
"docid": "688629e40e160f9821af9bb714df87dc",
"score": "0.633305",
"text": "def star(n)\n (n / 2).downto(1) do |i|\n star = '*'\n space = ' ' * (i - 1)\n puts((star + space + star + space + star).center(n))\n end\n puts '*' * n\n 1.upto(n / 2) do |i|\n star = '*'\n space = ' ' * (i - 1)\n puts((star + space + star + space + star).center(n))\n end\nend",
"title": ""
},
{
"docid": "6283b2a07bd682ceae32477e3a14a69e",
"score": "0.63314945",
"text": "def star(n)\n return if n < 7 || n.even?\n num_of_rows = n / 2\n \n num_of_rows.downto(1) do |row_number|\n puts( (\"*\" + \" \" * (row_number - 1) + \"*\" + \" \" * (row_number - 1) + \"*\").center(n) )\n end\n \n puts \"*\" * n\n\n 1.upto(num_of_rows) do |row_number|\n puts((\"*\" + \" \" *( row_number - 1) + \"*\" + \" \" * (row_number - 1) + \"*\").center(n))\n end\n end",
"title": ""
},
{
"docid": "289989c7a7fb9902e49b7b0d9a8431b0",
"score": "0.63126755",
"text": "def diamonds(size)\n lines = [] # creates an array to put each line into\n (1..size).step(2) do |stars| # will jump from 1 , 3, 5 etc so these are the stars\n lines << (' ' * ((size - stars) / 2)) + ('*' * stars) #similar to how my method works, work out whitespace then concat the stars on top\n end\n\n lines += lines[0, size/2].reverse #this will add on elements, the first paramter is the starting point and the second paramter is the size/length\n\nend",
"title": ""
},
{
"docid": "1a80ed4137fd249d969bb4045c03ad29",
"score": "0.63042647",
"text": "def print_stars(height)\n return \"Invalid Level, Level should be greater than 0\" if height < 1\n\n i = 1\n while i <= height\n stars = i + (i - 1) # can use (2i-1) AP formula\n space = height - i\n width = space + stars\n printed_space = 0\n while 1 <= width\n if printed_space != space\n print \" \"\n printed_space = printed_space + 1\n else\n print \"*\"\n end\n width = width - 1;\n end\n puts \"\\n\"\n i = i + 1\n end\nend",
"title": ""
},
{
"docid": "be4ca05dce0a9ee6752af83b51bc2908",
"score": "0.63001525",
"text": "def spiral_nums(dimention)\r\n\treturn -1 if(dimention % 2 == 0)\r\n\r\n\treturner = [1]\r\n\t(2..(dimention-1)).step(2).each{ |num|\r\n\t\t4.times{ returner << returner.last + num }\r\n\t}\r\n\r\n\treturn returner.inject(0){ |sum, i| sum + i }\r\nend",
"title": ""
},
{
"docid": "dc30cf96ec9c52aa5ad2c1dd60957e3e",
"score": "0.6273728",
"text": "def star(int)\n midpoint = int/2\n int.times do |idx|\n if idx == midpoint\n puts '*' * int\n elsif idx < midpoint\n puts ' ' * idx + '*' + ' ' * (midpoint - 1 - idx).abs + '*' + ' ' * (midpoint - 1 - idx).abs + '*'\n else\n puts ' ' * (int - idx - 1) + '*' + ' ' * (idx - midpoint - 1) + '*' + ' ' * (idx - midpoint - 1) + '*'\n end\n end\nend",
"title": ""
},
{
"docid": "eb939ee25655ae6b7f5467eb38c8c39f",
"score": "0.6268739",
"text": "def star(n)\ncounter = n\nspaces = (n - 3) / 2 + 1\npadding = 0\nmidline = n / 2 + 1\n\n loop do\n break if counter <= 0\n if counter == midline\n puts '*' * n\n elsif counter > midline\n spaces -= 1\n puts (' ' * padding) + '*' + (' ' * spaces) + '*' + (' ' * spaces) + '*' \n padding += 1\n else \n padding -= 1\n puts (' ' * padding) + '*' + (' ' * spaces) + '*' + (' ' * spaces) + '*' \n spaces += 1\n end\n counter -= 1\n end\n\nend",
"title": ""
},
{
"docid": "988be64a31531c3d00aa143da5c73630",
"score": "0.62664694",
"text": "def print_horizontal_pyramid(height)\n (1..height).each do |i|\n space_amount = height -i\n print \" \" * space_amount\n start_amount = 2 * i - 1\n print \"*\" * start_amount\n print \" \" * space_amount\n print \"\\n\"\n end\nend",
"title": ""
},
{
"docid": "1d136543ea4aaf60e8258d64e4ce67a5",
"score": "0.6264705",
"text": "def cycle_index_of_dihedral_permutation_group(num_sides, x)\n\t#x is the number of colors\n\t#Keys of perm_map are in the form of [num_cycles_in_perm, size_cycle_in_perm]\n\t#If the items in a key don't multiply to num_sides, it's necessary later on to factor in the fact that there are num_sides - product remaining 1-cycles\n\tperm_map = Hash.new(0)\n\t#Add the identity permutation\n\tperm_map[[num_sides, 1]] = 1\n\n\t#Add rotations\n\tidx = 1\n\twhile idx <= num_sides / 2\n\t\tif num_sides % idx == 0\n\t\t\tif num_sides / idx == 2\n\t\t\t\tperm_map[[idx, num_sides / idx]] += 1\n\t\t\telse\n\t\t\t\tperm_map[[idx, num_sides / idx]] += 2\n\t\t\tend\n\t\telse\n\t\t\tperm_map[[1, num_sides]] += 2\n\t\tend\n\t\tidx += 1\n\tend\n\n\t#Add reflections\n\tif num_sides.odd?\n\t\tperm_map[[num_sides / 2, 2]] += num_sides\n\telse\n\t\tperm_map[[num_sides / 2 - 1, 2]] += num_sides / 2\n\t\tperm_map[[num_sides / 2, 2]] += num_sides / 2\n\tend\n\n\tanswer = 0\n\tperm_map.each do |k, v|\n\t\tif k[0] * k[1] == num_sides\n\t\t\tanswer += v * (x ** k[0])\n\t\telse\n\t\t\tnum_singles = num_sides - k[0] * k[1]\n\t\t\tanswer += v * (x ** num_singles) * (x ** k[0])\n\t\tend\n\tend\n\n\tanswer / (num_sides * 2)\nend",
"title": ""
},
{
"docid": "412d8a769daecfabc5f30899c6390711",
"score": "0.621945",
"text": "def hole4(i)\n\n # put your implementation in here, but please leave the comments above and at the 'end'\n\n end",
"title": ""
},
{
"docid": "bcc38e73fbcd1a55d98747c835cea66f",
"score": "0.62165266",
"text": "def wtf_pyramid(n)\n for i in 0..(n-1)\n for j in 0..((n*2)-2)\n b=(n-1)/2\n if ((b-i <=j) && (j<=i+b) && (i<=b) || (i-b<=j) && (j<=3*b-i) && (i>b))\n print \"#\"\n else\n print \" \"\n end\n end\n puts \"\"\n end\nend",
"title": ""
},
{
"docid": "d551feb5de63757fe1a6aa55de3b5867",
"score": "0.6212156",
"text": "def star(num)\n outside_spaces = 0\n rows = num / 2\n inside_spaces = rows - 1\n \n rows.times do\n puts \" \"*outside_spaces + \"*\" + \" \"*inside_spaces + \"*\" + \n \" \"*inside_spaces + \"*\" + \" \"*outside_spaces\n\n outside_spaces += 1\n inside_spaces -= 1\n end\n\n puts \"*\"*num\n\n rows.times do\n outside_spaces -= 1\n inside_spaces += 1\n\n puts \" \"*outside_spaces + \"*\" + \" \"*inside_spaces + \"*\" + \n \" \"*inside_spaces + \"*\" + \" \"*outside_spaces\n end\nend",
"title": ""
},
{
"docid": "50646e353898c43426cafe87a93cdf7c",
"score": "0.618538",
"text": "def star(num)\n space = ' '\n (num/2).downto(1) do |x|\n if x == num/2\n puts '*' + space * (x-1) + '*' + space * (x-1) + '*' \n else\n puts space * (num/2-x) + '*' + space * (x-1) + '*' + space * (x-1) + '*'\n end\n end\n puts '*' * num\n\n 1.upto(num/2) do |x|\n if x == num/2\n puts '*' + space * (x-1) + '*' + space * (x-1) + '*' \n else\n puts space * (num/2-x) + '*' + space * (x-1) + '*' + space * (x-1) + '*'\n end\n end\nend",
"title": ""
},
{
"docid": "4f38acdaa147ad34427f5328b82e757b",
"score": "0.61692923",
"text": "def halfpyramid n\n i = 1\n until i > n\n n.downto(i + 1) { print ' '} \n i.times { print '#' }\n print \"\\n\"\n i += 1\n end\n print \"\\n\"\nend",
"title": ""
},
{
"docid": "98a89b682afbcb94bcfd50aa852ac8ab",
"score": "0.6156604",
"text": "def letra_x(n)\n n.times do |i|\n n.times do |j|\n if j == n - (i + 1)\n print \"*\"\n elsif j == i\n print \"*\"\n else\n print \" \"\n end\n end\n print \"\\n\"\n end\nend",
"title": ""
},
{
"docid": "dd97a67aca36056ee544ec1e9bfb2cde",
"score": "0.6150946",
"text": "def pyramid n\n i = 0\n j = n - 1\n\n while i < n\n j.times { print ' '}\n (i*2 + 1).times { print '#'}\n print \"\\n\"\n i += 1\n j -= 1\n end\nend",
"title": ""
},
{
"docid": "1afb7fa05a058f260c4dd247ccfc737a",
"score": "0.61423934",
"text": "def full_numberic_pyramid\n height = gets.to_i\n width = (2 * height) - 1\n for i in 1..height\n digit = i\n for j in 1..width\n start = (width / 2) - (i - 1)\n start = (width / 2) - (i - 1)\n if j > start && j <= width - start\n print \"#{digit}\"\n digit = width / 2 < j ? digit - 1 : digit + 1\n else\n print \"0\"\n end\n print \" \"\n end\n puts unless i == j\n end\nend",
"title": ""
},
{
"docid": "c79b342f6b7df557e535249e020f17c5",
"score": "0.6142228",
"text": "def number_spiral(max_side)\n number = 1\n sum = 1\n side = 3\n \n while side <= max_side\n 4.times do\n number += side - 1\n sum += number\n end\n side += 2\n end\n sum\nend",
"title": ""
},
{
"docid": "076523402ea9785f2b6fff598d723f3b",
"score": "0.6141446",
"text": "def halfPyramid(lines)\n for i in 1..lines do\n for j in 1..i do\n print \"*\"\n end\n puts \"\"\n end\nend",
"title": ""
},
{
"docid": "267bb0995dce47a09dfebb6eda815d33",
"score": "0.6138383",
"text": "def graphical_representation arr, n\n 0.upto n-1 do |x|\n 0.upto n-1 do |y|\n if arr[x][y] == 1\n print \"#\"\n else\n print \".\"\n end\n end\n p \"\"\n end\nend",
"title": ""
},
{
"docid": "2e001e2e83bae95cc71faa9605ef9236",
"score": "0.6111076",
"text": "def print_horizontal_pyramid(height)\n height.times {|n|\n print ' ' * (height - n)\n puts '*' * (2 * n + 1)\n }\nend",
"title": ""
},
{
"docid": "852ad16b01023952e3a909a1407cda1b",
"score": "0.61096776",
"text": "def spiral(input)\n grid = input.split(\" \").map { |x| x.to_i }\n len = grid.length\n rows = Math.sqrt(len)\n num_diags = ((rows*2) - 1).to_i\n n = 0\n diags = []\n i = 1\n j = rows - 2\n odd = true\n diags << grid[n]\n until i >= rows\n if odd\n odd = false\n n += rows - i\n i += 2\n else\n odd = true\n n += rows - j\n j -= 2\n end\n diags << grid[n]\n end\n n += rows - j\n diags << grid[n]\n until i <= 1\n if odd\n odd = false\n i -= 2\n n += rows - i\n else\n n += rows - j\n odd = true\n j += 2\n end\n diags << grid[n]\n end\n print grid\n puts \"\"\n print diags\n puts \"\"\n diags.inject(:+)\nend",
"title": ""
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.