text
stringlengths
10
2.61M
class Vino < ActiveRecord::Base belongs_to :bodega belongs_to :denominacion belongs_to :envejecimiento has_many :uso_uvas_vinos has_many :tipo_uvas, through: :uso_uvas_vinos has_many :comentarios, as: :comentable has_many :ratings def average_rating ratings.size > 0 ? ratings.sum(:valoracion) /...
require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' platform :ios, '13.0' prepare_react_native_project! flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enab...
class Question < ActiveRecord::Migration def up create_table :questions do |t| t.text :description t.string :title t.integer :response_id t.string :hit_id t.string :video_url t.string :status, :default => "open" end end def down drop_table :questions end end
describe 'Parsing d’un brin' do before(:all) do @collecte = Collecte.new(folder_test_1) @film = @collecte.film # Il faut charger le module de parsing Collecte.load_module 'parsing' end describe 'Film::Brin#parse' do before(:each) do end let(:brin) { @brin ||= Film::Brin.new(@film) } ...
class User < ActiveRecord::Base # == Constants SEX = %w(male female) SHIRT_SIZE = %w(xs s m l xl) end
class Turret attr_reader :x, :y, :angle def initialize(image, x, y) @x, @y = x, y @angle = @target_angle = rand(360) @fov = 30 @range = 256 @speed = 2 @image = image end def within?(x, y) if distance(@x, @y, x, y) < 20 then return true else return false end ...
describe Tugboat::Dockerfile do context 'when Dockerfile exists' do let(:subject) { Tugboat::Dockerfile.new(test_dockerfile) } context 'when finds label (double quoted)' do before { create_dockerfile( %Q[LABEL tug.repository="repository.com/test" tug.name="test.2.2.2"] ) } it 'has repository' d...
class ApplicationController < ActionController::Base protect_from_forgery :with => :exception #prepend: true before_action :configure_permitted_parameters, if: :devise_controller? protected def configure_permitted_parameters devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name,...
class Transaction @@id = 1 @@transactions = [] attr_reader :id, :customer, :product def initialize(customer, product, is_return = false) if !is_return && !product.in_stock? raise OutOfStockError, "'#{product.title}' is out of stock" end if !is_return && customer.ca...
class FileReader def initialize(titles_file) @titles_file = titles_file end def read_file IO.read(@titles_file).split().map(&:chomp) end end FileReader.new("movies.txt").read_file
class UsersController < ApplicationController def index @users = User.sorted end def show @user = User.find(params[:id]) end def new @user = User.new end def create # Instantiate a new object using form parameters @user = User.new(user_params) # Save the object if @user.sav...
class Delivery < ApplicationRecord belongs_to :request belongs_to :user enum status: { accepted: 0, pickedup: 1, ontheway: 2, delivered: 3 } validates :request_id, uniqueness: true validates :user_id, presence: true end
class CreateWeixinReportNewsData < ActiveRecord::Migration[5.1] def change create_table :weixin_report_news_data do |t| t.date :ref_date t.string :ref_hour t.date :stat_date t.string :msgid t.string :title t.integer :int_page_read_user t.integer :int_page_read_count ...
class ApplicationController < ActionController::Base protect_from_forgery before_filter :set_cache_buster has_widgets do |root| root << widget(:notification) end def set_cache_buster response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate" response.headers["Pragma"...
source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.0.0', '>= 5.0.0.1' # Use mysql2 as the database for Active Record gem 'mysql2' # Use Unicorn as the app server platforms :ruby do # keep this version of unicorn, because 5.5.0 seems not to be stable, upda...
class AlgorithmsController < ApplicationController before_action :logged_in_user, only: [:new, :create] def index @algorithms = Algorithm.all end def new @algorithm = Algorithm.new end def create @algorithm = current_user.algorithms.build(algorithm_params) if @...
# 1 %、%Q # ダブルクオートで囲う場合と同等。 # シングルクオートやダブルクオートのエスケープが不要になる。 # 後述の%q()と違い、変数・定数の展開もできる。 str = %(Programming language "Ruby") puts str # => Programming language "Ruby" ruby = "Ruby" str2 = %(Programming language "#{ruby}") puts str2 # => Programming language "Ruby" # 2 %q # シングルクオートで囲う場合と同等。 # シングルクオートなので、変数や定数の展開...
class Admin::ImagesController < Admin::ApplicationController load_and_authorize_resource :area load_and_authorize_resource :through => :area helper_method :permission before_filter :find_parent_model def new if !@area.area_category.decide_purview(Image) redirect_to admin_area_url(@area) end...
class Study ### # # Study: main object class for portal; stores information regarding study objects and references to FireCloud workspaces, # access controls to viewing study objects, and also used as main parsing class for uploaded study files. # ### include Mongoid::Document include Mongoid::Timesta...
module CloudFilesBackup #:nodoc # Defines an available backup within the configured container. class AvailableBackup attr_accessor :date, :filename # Initialize a new available backup definition. def initialize(*args) args.first.each do |key, value| send(:"#{key}=", value) end ...
# ******************************************* # This is a demo file to show usage. # # @package TheCityAdmin::Admin # @authors Robbie Lieb <robbie@onthecity.org>, Wes Hays <wes@onthecity.org> # ******************************************* require 'ruby-debug' require File.dirname(__FILE__) + '/../lib/the_city_admin.rb...
module ApplicationHelper def alert_class(flash_type) case flash_type when 'success' then 'alert-success' # Green when 'error' then 'alert-danger' # Red when 'alert' then 'alert-warning' # Yellow when 'notice' then 'alert-info' # Blue else flash_type.to_s end end def page_title(title, ...
class Pokemon < ActiveRecord::Base validates :name, presence: true, uniqueness: true validates :element, presence: true validates :level, presence: true end
require 'nokogiri' require 'ostruct' class RateHash attr_writer :rates def initialize(rates = {}) if rates.instance_of?(String) load(rates) else @rates = rates end end def load(data_file) @rates = {} doc = Nokogiri::XML(File.new(data_file)) doc.xpath('//rate').each d...
class PresentationsController < ApplicationController def show @presentation = Presentation.find(params[:id]) @event_date = @presentation.time_slot.event_date @event = @event_date.event end def edit @presentation = Presentation.find(params[:id]) @event_date = @presentation.time_slot.event_dat...
require 'test_helper' class MoneybookersNotificationTest < Test::Unit::TestCase include ActiveMerchant::Billing::Integrations def setup @moneybookers = Moneybookers::Notification.new(http_raw_data) end def test_accessors assert @moneybookers.complete? assert_equal "2", @moneybookers.status as...
ActiveAdmin.register Category do index do selectable_column column :id column :name column :updated_at # column 'Products' do |category| # link_to category.products.count, admin_products_path(category_id: category.id) # end actions end permit_params do permitted = [:na...
AboutType = GraphQL::ObjectType.define do name 'About' description 'Information about the application' interfaces [NodeIdentification.interface] global_id_field :id field :name, types.String, 'Application name' field :version, types.String, 'Application version' field :upload_max_size, types.String, 'Maxi...
class AddEndTimeToActivity < ActiveRecord::Migration[5.0] def change add_column :activities, :first_phase_end, :datetime add_column :activities, :second_phase_end, :datetime end end
class StocksController < ApplicationController before_action :require_user def index @stocks = Stock.all end def new @stock = Stock.new @accounts = Account.all end def edit @stock = Stock.find(params[:id]) @accounts = Account.all end def create @stock = Stock.new(stock_params...
require 'goby' RSpec.describe Goby::Battle do let(:dummy_fighter_class) { Class.new(Entity) do include Fighter def initialize(name: "Player", stats: {}, inventory: [], gold: 0, battle_commands: [], outfit: {}) super(name: name, stats: stats, inventory: inventory, gold: gold, outfit: outfit)...
class Article < ActiveRecord::Base has_many :comments, dependent: :destroy has_many :infos, dependent: :destroy validates :title, presence: true, length: {minimum: 3 } end
class Index::User < ApplicationRecord mount_uploader :avatar, UserAvatarUploader # 头像上传 # 用于上传头像时保存图片参数 attr_accessor :x, :y, :width, :height, :rotate store_accessor :info, :collage, :grade, :major # 使用插件建立用户密码验证体系 has_secure_password belongs_to :school, counter_cache: tru...
require "set" class GraphNode attr_accessor :value, :neighbors def initialization(value) @value = value @neighbors = [] end def add_neighbors(node) neighbors << node end def bfs(start_node, target) queue = [start_node] visited_nodes = Set.new ...
class HomeController < ApplicationController skip_before_filter :authenticate_employee! def index return render :logged_out unless employee_signed_in? return redirect_to edit_employee_profile_path unless current_employee.profile @current_wheeler = Wheeler.order('created_at desc').first return redir...
FactoryBot.define do factory :post do content { "TestText" } image { "app/assets/images/test.jpg" } association :user end end
class ChangeColumnSpentOn < ActiveRecord::Migration def self.up change_column :easy_money_other_expenses, :spent_on, :date, { :null => true } change_column :easy_money_other_revenues, :spent_on, :date, { :null => true } end def self.down end end
class AddIdentityUrlToUsers < ActiveRecord::Migration def change add_column :users, :string, :identity_url end end
# frozen-string-literal: true # # The pg_range extension adds support for the PostgreSQL 9.2+ range # types to Sequel. PostgreSQL range types are similar to ruby's # Range class, representating an array of values. However, they # are more flexible than ruby's ranges, allowing exclusive beginnings # and endings (ruby'...
#!/usr/bin/env ruby SENTENCES = [{ sentence: "I decided to _ a _ funny party for my _ _.", options: ["verb", "adjective","adjective","noun"] },{ sentence: "I was _ down the street one afternoon when _ came up to me and _ in my face.", options: ["verb", "noun", "verb"] }] puts "----------------" puts "...
class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :user t.string :pass t.string :full_name t.integer :user_level t.string :user_group t.string :phone_login t.string :phone_pass t.timestamps end end end
# experimenting with a users controller as per demo vid # Here i was trying to create a csv/xlx download # class UsersController < ApplicationController # def index # @users = user.request(:name) # respond_to do |format| # format.html # format.csv {send_data text: @usersto_csv} # format.xls {send_data te...
# frozen_string_literal: true # Players class Player attr_reader :token def initialize(token = 'X') @token = token end def take_turn puts "\nPlayer #{@token}, what is your move?" @move = gets.to_i until @move >= 1 && @move <= 9 puts 'Pick a space between 1-9!' @move = gets.to_i ...
module SNMP4EM # This implements EM::Deferrable, so you can hang a callback() or errback() to retrieve the results. class SnmpGetNextRequest < SnmpRequest attr_accessor :snmp_id # For an SNMP-GETNEXT request, @pending_oids will be a ruby array of SNMP::ObjectNames that need to be fetched. As # respon...
require "vanity-routes/version" require "vanity-routes/setup" require "vanity-routes/errors" require "vanity-routes/overrides" module Vanity module Routes class Engine < Rails::Engine initializer 'my_engine.vanity_routes', after: :add_routing_paths do |app| raise Vanity::NoConfigurationError if Van...
class CallbacksController < ApplicationController def twitter # STEP 1: search for a user with the given provider / uid twitter_data = request.env['omniauth.auth'] user = User.find_from_oauth(twitter_data) # STEP 2: Create the user if the user is not found user ||= User.create_from_oauth(twitter_...
class RewardsController < ApplicationController def index @rewards = Reward.all end def new @reward = Reward.new end def create @reward = Reward.new(reward_params) if @reward.save flash[:notice] = "Success! Your reward was created." format.html { redirect_to project_url(@project)...
feature 'User sign up' do scenario 'I can sign up as a new user' do expect { sign_up }.to change(User, :count).by(1) expect(page).to have_content('Welcome, username') expect(User.first.username).to eq('username') end scenario 'with a password that does not match' do expect { sign_up(password_con...
require_relative 'everything' require 'sqlite3' require 'singleton' class Users attr_accessor :fname, :lname def self.all data = QuestionDBConnection.instance.execute("SELECT * FROM users") data.map { |datum| Users.new(datum) } end def self.find_by_id(id) user = QuestionDBConnection.instance.execut...
describe OrderItem do let(:tenant) { create(:tenant) } let(:order) { create(:order, :tenant_id => tenant.id) } let(:order_item) { create(:order_item, :order_id => order.id, :portfolio_item_id => 123, :tenant_id => tenant.id) } context "updating order item progress messages" do it "syncs the time between or...
module Protest # The +:summary+ report will output a brief summary with the total number # of tests, assertions, passed tests, pending tests, failed tests and # errors. class Reports::Summary < Report include Utils::Summaries include Utils::ColorfulOutput attr_reader :stream #:nodoc: # Set the...
class ApplicationPresenter def helpers @helpers ||= ActionController::Base.helpers end end
#!/usr/bin/env ruby # Read list of all hosts from InfluxDB and checks if dashboard exists for host, # if a dashboard is missing a new one is created based on a template. # # Author: Florian Schwab <florian.schwab@sic.software> require 'optparse' require 'net/http' require 'net/https' require 'json' require 'influxdb' ...
class Post < ActiveRecord::Base attr_accessible :details, :image has_attached_file :image, styles: { large: "1000x1000", medium: "300x300", small: "40x40" } has_many :likes, as: :likable_object has_many :liking_users, through: :likes, source: :user has_many :comments has_many :commenting_us...
class PropertyAgricultureGreenbelt < ActiveRecord::Migration def up add_column :property_agricultures, :greenbelt, :string add_column :property_agricultures, :greenbelt_potential, :string end def down remove_column :property_agricultures, :greenbelt remove_co...
require 'test_helper' class NewsFeedTest < ActiveSupport::TestCase test "it gets active joined groups" do feed = NewsFeed.new(users(:vikhyat)) groups = feed.active_joined_groups.map(&:slug) assert_includes groups, 'gumi-appreciation-group' assert_includes groups, 'jerks' end end
# encoding: UTF-8 require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper')) # TODO: mocks class GoogleDirectionsTest < Test::Unit::TestCase def test_happy_case orig = "121 Gordonsville Highway, 37030" dest = "499 Gordonsville Highway, 38563" google = GoogleDirections.new(orig, des...
class Captain < ActiveRecord::Base has_many :boats def self.catamaran_operators #binding.pry includes(boats: :classifications).where(classifications: {name: "Catamaran"}) #Event.includes(users: :profile) #If you want to include an association (we'll call it C) of an already #included association (we'll cal...
# Write a method, least_common_multiple, that takes in two numbers and returns the smallest number that is a mutiple # of both of the given numbers def least_common_multiple(num_1, num_2) n1 = num_1 n2 = num_2 while n1 != n2 if n1 > n2 n2 += num_2 else n1 += num_1 ...
Dir.glob('./{models,helpers,controllers,services,values}/*.rb').each do |file| require file end require 'sinatra/activerecord/rake' require 'config_env/rake_tasks' require 'rake/testtask' task default: [:local_and_running] desc 'Run specs' Rake::TestTask.new(:specs) do |t| t.pattern = 'specs/*_spec.rb' end desc...
class CreateStudents < ActiveRecord::Migration[5.1] def change create_table :students do |t| t.integer :github_id t.string :login t.string :url t.string :avatar_url t.string :name t.string :blog t.string :location t.string :bio t.string :email t.string :learn t.timestamps e...
# frozen_string_literal: true module CronJob class Worker include Sidekiq::Worker def perform(task) Rails.logger.debug("Executing cron task #{task}") instance_exec(task, &ThreeScale::Jobs::JOB_PROC) end def rake(task) system('rake', task) end def runner(command) sys...
require 'rails_helper' describe Project do let(:project) { build_stubbed :project } it "is valid" do expect(project).to be_valid end end
require 'sql_executor' require 'silence' module Results class FictionalRanker include Silence include SqlExecutor # Results::Ranker.rank!(results, {year: 2015, stage: 'regional', division: 'men'}) def rank!(*args) silence do rank_loudly!(*args) end end def self.rank!(...
#=============================================================================== # ** Dimensional_Sphere_Settings #------------------------------------------------------------------------------- # Impostazioni della sfera dimensionale #=============================================================================== modu...
class CreateQuestions < ActiveRecord::Migration def change create_table :questions do |t| t.text :prompt t.string :image t.string :supplement t.string :title t.string :difficulty t.string :topic t.string :correct_response t.string :incorrect_one t.string :inco...
class Main < Controller map '/' helper :paginate trait :paginate => { :limit => 100, :var => "page" } def index @pager = paginate(Post.all(:order => [:posted_at.desc])) end def say redirect_referer unless request.post? post = Post.create({ :posted_at => Time.now, :message => requ...
# frozen_string_literal: true module SwitchPoint class QueryCache def initialize(app, names = nil) @app = app @names = names end def call(env) names.reverse.inject(lambda { @app.call(env) }) do |func, name| lambda { ProxyRepository.checkout(name).cache(&func) } end.call ...
class ActivitiesController < ApplicationController before_action :ensure_current_user def create @user = current_user @activity = current_user.activities.create(activity_params) end def destroy @user = current_user @activity = current_user.activities.find(params[:id]).destroy render :cr...
class AddMarkdown < ActiveRecord::Migration def change add_column :jobs, :description_markdown, :text add_column :companies, :description_markdown, :text end end
require "codeunion/command" module CodeUnion module Command # A base class for built-in commands class Base def initialize(options) @options = options end private attr_reader :options end end end
class CarsController < ApplicationController before_filter :require_user, :only => [:new, :edit, :update, :delete] def update_model_dropdown @models = Model.find(:all, :conditions => [" make_id = ?", params[:id]] ).sort_by{ |k| k['name'] } respond_to do |format| format.json { render :json => ...
class Visitor::Special < Visitor::Base def self.human_name_in_swedish 'Special' end def type_name 'visitor_special' end end
Then /^the field (\w+) of the document '(\w+)' is not nil$/ do |field, name| doc = instance_variable_get("@#{name}") doc.send(field).should_not be_nil end When /^'(\w+)' references '(\w+)' as '(\w+)'$/ do |parent, child, field| parent_doc = instance_variable_get("@#{parent}") child_doc = instance_variable_get(...
class AddClonedToApartments < ActiveRecord::Migration def change add_column :apartments, :cloned, :boolean, default: true end end
RSpec.describe Yabeda::GraphQL do it "has a version number" do expect(Yabeda::GraphQL::VERSION).not_to be nil end subject do YabedaSchema.execute( query: query, context: {}, variables: {}, ) end describe "queries" do let(:query) do <<~GRAPHQL query { ...
class PosController < ApplicationController before_action :set_po, only: [:show, :edit, :update, :destroy] before_action :authenticate_user! # GET /pos # GET /pos.json def index Person.find(current_user.person_ids).each do |teste| if teste.po @po = Po.find(teste.po.id) end end ...
class User < ActiveRecord::Base attr_accessible :email, :first_name, :last_name, :provider, :role, :uid validates_presence_of :email, :first_name validates_uniqueness_of :email ROLES = %w[admin publisher author tech guest] SUPERROLES = %w[super_admin admin publisher author tech guest] #def role?(base_role...
class Questions::SearchsController < ApplicationController before_action :set_q,only:[:index] def index @results = @q.result end private def set_q @q = Question.ransack(params[:q]) end end
class ManageIQ::Providers::Amazon::NetworkManager::SecurityGroup < ::SecurityGroup def self.display_name(number = 1) n_('Security Group (Amazon)', 'Security Groups (Amazon)', number) end end
puts fetch(:stage_url) set :application, 'capistrano-resque-test-app' set :repo_url, 'git@github.com:dmarkow/capistrano-resque-test-app' set :rbenv_type, :system set :rbenv_custom_path, "/opt/rbenv" set :rbenv_ruby, "2.1.2" set :deploy_to, '/data/www/capistrano-resque-test-app' set :format, :pretty set :log_level, :inf...
# --- Day 20: Infinite Elves and Infinite Houses --- # # To keep the Elves busy, Santa has them deliver some presents by hand, # door-to-door. He sends them down a street with infinite houses numbered # sequentially: 1, 2, 3, 4, 5, and so on. # # Each Elf is assigned a number, too, and delivers presents to houses based...
# encoding: utf-8 require 'spec_helper' describe SippyCup::Media do before :each do @from_ip = '192.168.5.1' @from_port = '13579' @to_ip = '192.168.10.2' @to_port = '24680' @media = SippyCup::Media.new @from_ip, @from_port, @to_ip, @to_port end it 'should start with an empty sequence...
# encoding: UTF-8 require 'spec_helper' describe "Relationships" do before(:each) do @user = FactoryGirl.create(:user) visit signin_path fill_in "Adresse e-mail", :with => @user.email fill_in "Mot de passe", :with => @user.password click_button end describe "following a user" do b...
class Links::Game::NhlIceTracker < Links::Base def site_name "NHL.com" end def description "Ice Tracker" end def url "http://www.nhl.com/ice/icetracker.htm?id=" \ "#{game.game_number}" end def group 0 end def position 2 end end
# frozen_string_literal: true require "thor" require "logger" require_relative "renaming/version" require_relative "cli" require_relative "constant" module Github class Renaming < Thor class_option :token, type: :string, aliases: '-t', desc: "User's Github Token at github.com" class_option :repo, type: :str...
class Lesson < ActiveRecord::Base belongs_to :owner, :class_name => "User" has_many :core_lesson_problem_types, :dependent => :destroy has_many :problem_types, :through => :core_lesson_problem_types belongs_to :category belongs_to :subject accepts_nested_attributes_for :problem_types, :reject_if => lam...
require 'active_support/concern' module ExcludedFiles extend ActiveSupport::Concern def excluded_files @excluded_files ||= Settings.classes.concerns.excluded_files.to_set end def excluded_directories @excluded_directories ||= Settings.classes.concerns.excluded_directories.to_set end def excluded...
# Copyright (c) 2016 Cameron Harper # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, dis...
class Rental < ApplicationRecord belongs_to :movie belongs_to :customer validates :movie, :customer, presence: true def self.get_rental(movie_id, customer_id) # returning rental with oldest due date incase customer has multiple rentals for same movie return Rental.where(movie_id: movie_id, customer_id:...
class Campaign < ActiveRecord::Base has_and_belongs_to_many :products validates :name, :descrip, :init_date, :end_date , presence: true validates :name, uniqueness: true def safe_to_delete if campaigns_products.any? return false else return true end end # valid if a product is in...
class AiPlayer @@dictionary = Set.new def self.load_dictionary File.open("dictionary.txt").each {|str| @@dictionary.add(str.chomp)} end def self.get_move(fragment, num_players) self.load_dictionary if @@dictionary.empty? winning_moves = Hash.new(0) losing_moves = Set.ne...
class AddDefaultPriceAndCurrencyToOrders < ActiveRecord::Migration def change change_column_default :products, :usd_price, 0 change_column_default :products, :cad_price, 0 change_column_default :products, :price, 0 add_column :orders, :currency, :string add_column :order_units, :currency, :string ...
class AddTempIndexToStepAction < ActiveRecord::Migration def change add_column :step_actions, :temp_index, :integer end end
class Section < ActiveRecord::Base has_many :roles_sections,:dependent => :destroy has_many :roles, :through=> :roles_sections end
# Create an array to store 3 boolean values entered in by the user. Print out YES if all the values are true and NO if at least one value is false. Hint: Prompt the user to enter true or false, and accept those values using gets. Since gets will give us back a string (instead of the boolean values we want) use if state...
Reloader::Application.routes.draw do resources :users get 'browser' => 'browser#index' end
require 'set' class RandomizedSet def initialize() @hash = {} @array = [] end def insert(val) return false if @hash.has_key?(val) @array.push(val) @hash[val] = @array.length - 1 return true end def remove(val) return false unless @hash.has_key?(val) index = @hash.delete(val)...
class FARule < Struct.new(:state, :character, :next_state) def applies_to?(state, character) self.state == state && self.character == character end def follow next_state end def inspect "#<FARule #{state.inspect} --#{character}--> #{next_state.inspect}>" end end
# frozen_string_literal: true # Rocket Model class Rocket < ApplicationRecord # Rockets list def self.names_list Dir["#{Rails.root}/rockets/*"].map do |dir| rocket_name = dir.split('/').last dir_size = 0 Dir.glob("#{dir}/**/**").map do |file| dir_size += File.size(file) end ...