text
stringlengths
10
2.61M
require 'spec_helper' describe "challenge_completions/index.html.erb" do before(:each) do assign(:challenge_completions, [ stub_model(ChallengeCompletion, :challenge => "", :user => "", :user_specific_gameplan => "", :writeup => "Writeup" ), stub_model(ChallengeC...
class SeriesController < ApplicationController before_filter :authenticate_user!, :except => [:index, :show] respond_to :html, :json def index @series = Series.all end def show @series = Series.find(params[:id]) end def new authorize! :manage, Series end def find authorize! :manag...
require 'serverspec' set :backend, :exec describe 'bcs_ruby::default' do describe 'ruby development environment installed' do dependencies = %w[autoconf bison build-essential libssl-dev libyaml-dev zlib1...
# encoding: utf-8 # # Cookbook Name:: postgres-hardening # Attributes:: default # # Copyright 2014, Christoph Hartmann # Copyright 2014, Deutsche Telekom AG # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of t...
class CreatePods < ActiveRecord::Migration def change create_table :pods do |t| t.integer :category t.integer :total_points, null: true t.timestamp :close_date, default: 1.weeks.from_now t.timestamps end end end
class CreateTracks < ActiveRecord::Migration[6.0] def change create_table :tracks do |t| t.string :title t.string :ISRC t.integer :artist_id t.integer :license_id t.integer :songwriter_id t.timestamps end end end
module ProductOwners class ProductsController < ProductOwnersController def edit @product = Product.find(params[:id]) end def update @product.attributes = product_params if @product.draft_update flash[:success] = I18n.t("product_owners.products.update.success") redirect...
class Settings::AppearanceController < ApplicationController def index render inertia: "Settings/Appearance/Index", props: { settings: { primary_color: @active_company.settings&.[]("primary_color") } } end def update if @active_company.update(settings_params) redirect_to set...
FactoryBot.define do factory :appeal do case_no { "20200042" } factory :norris_appeal do case_type { "Appeal" } case_subtype { "Reconsideration" } status { "Closed" } case_no { "20192106" } appeal_no { "xyzzy" } requester { "Norris, Chuck" } custodian { "Executive Of...
module Typhoeus module EasyFu module Proxy def proxy=(proxy) set_option(:proxy, proxy[:server]) set_option(:proxytype, Typhoeus::Easy::PROXY_TYPES[proxy[:type]]) if proxy[:type] end def proxy_auth=(authinfo) set_option(:proxyuserpwd, proxy_credentials(authinfo)) ...
class CreateInterviews < ActiveRecord::Migration def change create_table :interviews do |t| t.belongs_to :company, index: true t.belongs_to :student, index: true t.belongs_to :application t.integer :time_slot t.date :day t.text :description t.text :note t.timestamps...
# Orange tree. Make an OrangeTree class that has a height method that returns # its height and a one_year_passes method that, when called, ages the tree one # year. Each year the tree grows taller (however much you think an orange # tree should grow in a year), and after some number of years (again, your # call) the tr...
Vagrant.configure(2) do |config| # Box設定 config.vm.box = "bento/centos-6.7" # IP設定 config.vm.network "private_network", ip: "192.168.33.10" # 共有フォルダ config.vm.synced_folder ".", "/vagrant", owner: "vagrant", group: "vagrant", :mount_options => ['dmode=755', 'fmode=644'] # chef install config.vm.provi...
require_relative 'actor' require_relative 'coin' # The player class Player < Actor def initialize(map, data = { x: 0, y: 0, hit_points: 20, hunger: 100, inventory: [Coin.new(0).save_data] }) super @symbol = '@' @damage_range = 1..6 @map.player = self @hunger = data[...
class AnimalInfor < ActiveRecord::Base validates :animal_id, uniqueness: true end
node(:status) { 'success' } node(:notifications) do child @ns, :object_root => false do attributes :user_id, :status, :notification_type, :commenter_id, :notifiable_id, :notifiable_type node(:created_at) { |n| n.created_at.utc.strftime("%Y-%m-%d %H:%M:%S") } child(:notifier) do attributes :username...
require "uk_postcode" class PostcodeValidator < ActiveModel::EachValidator def initialize(postcode_service: UKPostcode, **args) self.postcode_service = postcode_service super args end def validate_each(record, attribute, value) if value.blank? record.errors.add(attribute, :blank) else ...
FactoryBot.define do factory :director do sequence :name do |n| "Director no.#{n}" end country {'usa'} active {true} trait :inactive do active {false} end trait :aussie do country {'australia'} end end end
FactoryBot.define do factory :client_account_summary, class: IGMarkets::ClientAccountSummary do account_info { build :account_balance } account_type 'CFD' accounts { [build(:client_account_summary_account_details)] } authentication_status 'AUTHENTICATED' client_id 'CLIENT' currency_iso_code 'U...
#!/usr/bin/env ruby require 'nokogiri' require 'yaml' if ARGV.size < 2 puts "Takes two args, input file and output file" exit end f = File.open(ARGV[0]).read doc = Nokogiri::XML(f) n = doc.xpath('//node') nodes = {} n.each{|x| nodes[x.attributes['id'].value] = [x.attributes['lat'].value.to_f, x.attributes['lon...
# == Schema Information # # Table name: line_fragments # # id :bigint(8) not null, primary key # working_article_id :bigint(8) # paragraph_id :bigint(8) # order :integer # column :integer # line_type :string # x :float # y ...
require File.expand_path(File.dirname(__FILE__)) + '/adapter/nokogiri' class Premailer # Manages the adapter classes. Currently supports: # # * nokogiri # * hpricot module Adapter autoload :Hpricot, 'premailer/adapter/hpricot' autoload :Nokogiri, 'premailer/adapter/nokogiri' # adapter to requir...
require 'rails_helper' RSpec.describe Support, type: :model do before do @support = FactoryBot.build(:support) end describe '資金援助機能' do context '資金援助ができる時' do it "priceとtokenがあれば保存ができること" do expect(@support).to be_valid end end context '資金援助ができない時' do it "userが紐づいていな...
namespace :images_table do task upgrade: :environment do connection = ActiveRecord::Base.connection connection.transaction do unless connection.column_exists?(:images, :processing) puts 'Adding processing column...' connection.add_column(:images, :processing, :boolean) end ...
class MetaDataFieldGroup < ActiveRecord::Base belongs_to :meta_data_group belongs_to :meta_data_field end
class Drvgtyp < ActiveRecord::Base self.table_name = "drvgtyp" self.primary_key = "drvgtypid" has_many :drvgxs end
# frozen_string_literal: true # Author: Usman Ahmad require 'csv' require 'colorize' require 'date' require 'logger' # Calendar module for a simple calendar alongwith the facility to add/remove/ # delete and view events module Cal DATE_FMT = '%Y-%m-%d' MONTH_FMT = '%Y-%m' # An Event class to hold name, detail...
require 'rails_helper' RSpec.describe "Desires", type: :system do let(:users) { create_list(:user, 6) } let(:item_a) { create(:item, name: "プロを目指す人のためのRuby入門 言語仕様からテスト駆動開発・デバッグ技法まで (Software Design plusシリーズ) [ 伊藤淳一(プログラミング) ]") } let(:item_b) { create(:item, name: "現場で使える Ruby on Rails 5速習実践ガイド [ 大場寧子 ]") } ...
include_recipe "rails" case node[:web_app][:system][:database] when "mysql" include_recipe "mysql::server" include_recipe "mysql::client" end include_recipe "nginx" remote_file "#{Chef::Config[:file_cache_path]}/#{node['web_app']['system']['name']}-#{node['web_app']['system']['version']}.tar.gz" do sour...
# frozen_string_literal: true require "rails_helper" describe Serializer do class ConcreteSerializer < Serializer class << self def dump_as_json(value) value end def load_as_json(value) value end end end describe ConcreteSerializer do it_behaves_like "Serial...
class SaveTray prepend SimpleCommand attr_reader :shelf, :args def initialize(shelf, args = {}) @shelf = shelf @args = args end def call save_record end private def save_record record = @shelf.trays.find(@args.id) record.shelf = @shelf record.code = @args.code row = @she...
module CDI module V1 module ServiceConcerns module DiscussionParams extend ActiveSupport::Concern WHITELIST_ATTRIBUTES = [:title, :content, :video_link, :cover_id, :category_ids, :best_comment_id] included do def create_discussion_params @create_discussion_p...
class CreateAccounts < ActiveRecord::Migration def change create_table :accounts do |t| t.integer :invoice_no t.integer :room_no t.integer :price t.integer :extension t.integer :deposit t.text :miscellaneous t.text :remark t.date :date t.timestamps null: fals...
require 'rails_helper' describe SalesController do # Also see requests/sales_spec.rb describe 'Create' do context 'with a password' do before(:each) do @params = multiple_sales.merge(password: '1234') end it 'can create' do post :create, @params expect(response).to...
FactoryBot.define do factory :item do brand item_name model color size price { 89 } eur_price { 105 } ean { '123123123' } art { '12312312' } image { } end factory :brand do name { 'Furla' } end factory :item_name do name { 'Сумка' } end factory :name do ...
class UsersController < ApplicationController before_filter :authenticate_user! def dashboard @user = current_user @restaurants = current_user.restaurants end end
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(2) do |config| config.vm.box = "ubuntu/xenial64" # Put name for your VM here # config.vm.provider "virtualbox" do |v| # v.name = "" # end config.vm.provision "file", source: "requirements.txt", destination: "requirements.txt" # NOTE: this k...
class ConstituentMembershipRecord < ApplicationRecord # Relationships # ----------------------------- belongs_to :constituent,:foreign_key => :lookup_id, :primary_key => :lookup_id belongs_to :membership_record, :foreign_key => :membership_id, :primary_key => :membership_id # Scopes # --------------------...
ready.msg = Приложение готово к работе error.email = Необходимо заполнить электронную почту error.required = Поле должно быть заполнено invalid.credentials = Неверные данные access.denied = Доступ запрещен! could.not.authenticate = Не удалось утентифицироваться! Попробуйте еще раз! home.title = Домой sign.up.title = Р...
# frozen_string_literal: true require 'uri' require 'fileutils' require 'open-uri' require 'net/http' module FeCoreExt::CoreExt end module URI def download(file) warn 'URI#downloadの引数にはPathnameを使いましょう!' if file.is_a?(String) binary = OpenURI.open_uri(self).read file = file + self.basename if file.to_s[...
class Office < ActiveRecord::Base belongs_to :company belongs_to :user has_and_belongs_to_many :promotions end
class RenameColumnHashToPractices < ActiveRecord::Migration[5.0] def change rename_column :practices, :hash, :access_hash end end
class PagesController < ApplicationController respond_to :png, only: %i(show) def index @filter = params[:filter] @with_text = bool :with_text, false @size = int :size, 10 @page = int :page, 1 from = (@page-1) * @size if @filter.nil? @results = nil else es = Rails.configuration.es.index(:nsa) ...
# frozen_string_literal: true module Capwatch class List attr_accessor :config def initialize(config:) @config = config Console::Formatter.currency = config.currency end def watch response = Providers::CoinMarketCap.new(config: config).fetched_json body = format(response) ...
class CLI def hello puts 'Welcome to Astro CLI' API.get_astros self.menu end def menu puts 'Please choose an option' puts '1. all astronauts' puts '2. all spacecraft' puts '3. current location of the ISS' input = gets.strip self.direc...
module CollectionsHelper # Get highlighted collections from JSON file for front-page display. def highlighted_collections if Rails.env.staging? load_collections else @highlighted_collections ||= load_collections end end def load_collections JSON.parse(File.read('config/collections....
require 'rest-client' require 'json' class GetOruloBuildingDetailsService def initialize(buildingId) @buildingId = buildingId end def call begin base_url = "https://www.orulo.com.br/api/v2/buildings/#{@buildingId}" response = RestClient.get(base_url, headers={Authorization: ENV["ORULO_API_KE...
require 'rails_helper' RSpec.describe SupplyTeachers::Journey::NeutralVendorManagedService, type: :model do subject(:results) do described_class.new end it 'describes its inputs' do expect(results.inputs).to eq( looking_for: 'Managed service provider', managed_service_provider: 'Neutral vend...
require 'spec_helper' ##exposing the connection ivars module Eway class Connection def root_url;@root_url;end def url;@url;end end end ### describe Eway::Connection do describe "#initialize" do it "should have sandbox root url when sandbox selected" do Eway::Settings.configure do |conf| conf.envir...
class AdvancePaymentFeesController < ApplicationController filter_access_to :all before_filter :check_permission before_filter :first_rule, :only => [:category_by_students, :fee_head_by_student, :list_online_fee_head_form, :category_wise_transaction_by_student, :wallet_particular_report_by_collection, :w...
# # this script goes through the assets folder and cleans up # files so that we can stay within our disk quota # FIND = '/usr/bin/find' DIR = '/data/kafki/assets' FILES = "/data/tmp/_files.txt" # grab assets and uploaded files, sort by access time `find #{DIR} -type f | grep -e '\.jpg' -e '[0-9]\.' | xargs stat --for...
@@games = [] @@game = nil class Game define_method(:initialize) do @user_guess = '' @message = '' @guesses = 0 @wrong_guesses = 0 @game_state= :in_process @word = set_word @hidden = hide_word @wrong_letters = [] end define_singleton_method(:all) do @@games end define_sing...
require 'spec_helper' describe 'et_upload::default' do let(:chef_run) { ChefSpec::Runner.new.converge(described_recipe) } users = data_bag('users') before do setup_environment end users['upload'].each do |uname, u| next if uname == 'id' u['home'] = "/home/#{uname}" u['gid'] = 'uploadonly...
Sequel.migration do change do create_table :profiles do primary_key :id foreign_key :user_id, :users String :full_name Date :birthday String :gender Text :about String :avatar_basename Integer :avatar_file_size index :user_id end end end
class PartController < ApplicationController before_filter :set_part, only: [:new, :show, :edit, :update, :destroy] load_and_authorize_resource def index render_404 end def create @part = Part.new(part_params) if @part.save redirect_to parts_path else render :new end end ...
# This handles reporting methods, only taking the data that's already in the # database and presenting it for various functions. class SummaryController < ApplicationController require 'yaml' def index # Set options for viewing. @opt = {} @opt['show_only_flagged'] = 1 if params['show_only_flagged'] ...
class FollowsController < ApplicationController def create @follow = Follow.create(follow_params) use = User.find(params[:followed_id]) redirect_to user_path(use) end private def follow_params params.permit(:follower_id, :followed_id) end end
class Mms::App < ActiveRecord::Base self.table_name = "mms_apps" has_many :user_apps, :foreign_key => "mms_app_id", :dependent => :destroy has_many :users, :through => :user_apps validates_presence_of :logo, :on => :save, :message => "logo不能为空" validates_presence_of :url, :on => :save, :message => "URL不能为空...
# # package.rb # TransporterPackager # # Created by Mat Clutter on 10/31/11. # Copyright 2011 darumatou. All rights reserved. # require 'rubygems' require "net/http" require "fileutils" require "builder" require "digest/md5" class Package attr_accessor :response def initialize(eisbn,filelist,folder,errlog)...
require 'rspec' class Task attr_reader :content, :id, :created_at attr_accessor :complete, :updated_at @@current_id = 0 def initialize(content) @content = content @id = @@current_id @@current_id += 1 @complete = false @created_at = Time.now @updated_at = nil end def complete? @complete ? true : f...
class ApplicationController < ActionController::Base protect_from_forgery def not_found_404 ActionController::RoutingError.new('Not Found') end end
class MailController < ApplicationController def support_email SupportMailer.support_email(params[:message_attrs]).deliver_now render json: "Success!", status: 200 end end
class CreateUsers < ActiveRecord::Migration[5.1] def change create_table :users do |t| t.string :calendar_id t.string :oauth_access_token t.string :oauth_refresh_token t.string :sync_token t.string :name t.timestamps end end end
# frozen_string_literal: true require 'rails_helper' RSpec.configure do |config| config.swagger_root = Rails.root.join('swagger').to_s config.swagger_docs = { 'v1/swagger.yaml' => { openapi: '3.0.1', info: { title: 'API V1', version: 'v1', }, paths: {}, servers: ...
# issue with numbers support, will return letter rather than number # can't handle multi-line input text as well as consecutive letters in CAPS consistently require 'pry' require_relative 'message_reader' require_relative 'characters' class NightReader include MessageReader attr_reader :char_count def initiali...
class User < ApplicationRecord has_many :items has_many :user_equips has_many :equips, through: :user_equips validates :username, presence: true end
class AddUsdRateToCurrencies < ActiveRecord::Migration[5.0] def change add_column :currencies, :usd_rate, :float Currency.find_each do |currency| currency_rate = Money.default_bank.get_rate(currency.uid, "USD") currency.update(usd_rate: currency_rate) end end end
class CreateMedicineBillRecords < ActiveRecord::Migration[5.0] def change create_table :medicine_bill_records do |t| t.references :station, foreign_key: true t.integer :bill_id t.string :name t.string :company t.string :noid t.string :signid t.date :expire t.integer...
class CreateUserPreferences < ActiveRecord::Migration def change create_table :user_preferences do |t| t.belongs_to :user, index: true t.timestamps null: true t.string :preference_type, null: false t.string :title, null: false t.string :author, null: false t.string :link, null:...
guard 'livereload' do watch(%r{^static/css/.+\.(scss|css|js|ejs|html)}) watch(%r{^static/js/.+\.(js)}) watch(%r{^templates/.+\.(html)}) end
require 'rails_helper' RSpec.describe DiscourseChat::Rule do let(:tag1){Fabricate(:tag)} let(:tag2){Fabricate(:tag)} describe '.alloc_id' do it 'should return sequential numbers' do expect( DiscourseChat::Rule.alloc_id ).to eq(1) expect( DiscourseChat::Rule.alloc_id ).to eq(2) expect( D...
require 'test_helper' class CreativesControllerTest < ActionController::TestCase setup do @creative = creatives(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:creatives) end test "should get new" do get :new assert_response :success ...
require "rails_helper" require "rspec_api_documentation" resource "Users" do get "/users" do it "Listing users" do User.create(first_name: "a", last_name: "b") do_request expect(status).to eq(200) end end post "/users" do parameter :first_name, "Will contain the first name of user...
class SeasonSerializer < ActiveModel::Serializer attributes :id, :sequence has_one :tv_show, embedded: true def sequence object.sequence.to_s.rjust(2, '0') end end
require_relative '../config/environment.rb' prompt = TTY::Prompt.new def change_party_pokemon prompt = TTY::Prompt.new print TTY::Box.frame "Change Party Pokemon", align: :center choice = prompt.select("What would you like to do?", ["Remove pokemon from party", "Add pokemon to party", "Change pokemon name"...
class AddCoordinatesToChevals < ActiveRecord::Migration[5.0] def change add_column :chevals, :latitude, :float add_column :chevals, :longitude, :float end end
# encoding: utf-8 require 'spec_helper' describe 'bin/ktl cluster' do include_context 'integration setup' let :partitions do path = Kafka::Utils::ZkUtils.reassign_partitions_path fetch_json(path, 'partitions') end let :final_state do state = partitions.dup overflow.each do |o| o['part...
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 require 'singleton' module TwitterCldr module Timezones class Timezone include Singleton ALL_FORMATS = ( GenericLocation::FORMATS + GmtLocation::FORMATS + Iso8601Location::FORMATS +...
class DashboardController < ApplicationController before_filter :require_user def show @activities = current_user.activities.order('created_at desc') end end
certificate_domain = attribute("certificate_domain") certificate_pem = attribute("certificate_pem") describe x509_certificate(content: certificate_pem) do its('issuer.CN') { should eq "Fake LE Intermediate X1" } its('subject.CN') { should eq certificate_domain } its('key_length') { should be 2048 } its('validi...
module CloudstackSpec::Resource class VirtualMachine include Base # do nothing attr_reader :name, :template_name, :zonename def initialize(name='rspec-test1', zonename=nil, template_name='') @name = name @template_name = template_name @connection = CloudstackSpec::Helper::Api.new....
class UserSubject < ApplicationRecord include ActivityLog belongs_to :user belongs_to :user_course belongs_to :subject has_many :user_tasks, dependent: :destroy has_many :tasks, through: :subject enum status: {pending: 0, started: 1, finished: 2} tracked only: :update, owner: Proc.new{|controller| con...
module Aws class Broker module Publishing # only :create, :update, :destroy def publish_event(*events) events.each do |event| event = event.to_sym unless [:create, :update, :destroy].include?(event) raise "Invalid publish event #{event}" end ...
RSpec.describe Tools::Resistors do describe 'Gets the numeric output values from input colors' do it 'gets the value for brown and green' do resistor_a = Tools::Resistors.new(['brown', 'green']) expect(resistor_a.base).to eq 15 end it 'ignores additional values' do resistor_a = Tools::...
#!/usr/bin/env ruby require 'bundler/setup' require 'faker' require 'json' require 'jsonpath' require 'securerandom' def anonymize Faker::Config.locale = 'en-GB' json = File.read(get_output_file_path('data.json')) hash = JsonPath .for(json) .gsub('..supplier_name') { Faker::Company.name } .gsub...
require 'spec_helper' RSpec.describe "Drugs API" do include Helpers::DrugHelpers before :each do setup_drug_data end describe "typeahead search" do it "should provide results based on substring" do get "/api/v1/drugs.json?q=ia" expect(json["results"].length).to eq 2 end it "...
# frozen_string_literal: true class Task < ApplicationRecord validates :task_name, presence: true, uniqueness: true, length: { minimum: 3 } validates :task_name, format: { with: /\A[\w\d._@\ ]*\z/, message: 'Please do not use special characters.' } validates :task_description, format: { with: /\A[\w\d._@\ ]*\z/,...
# # Cookbook Name:: bcs_ruby # Recipe:: default # # ruby dependencies dependencies = %w(autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev ...
module Models class Tag include DataMapper::Resource property :id, Serial property :name, String end end
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
class Comment < ApplicationRecord belongs_to :article validate :article_should_be_published after_create :email_article_author def article_should_be_published errors.add(:article_id, 'is not published yet') if article && !article.published? end def email_article_author puts "...
class WebsitesController < ApplicationController before_action :load_website, only: %i[show destroy destroy_all_versions] authorize_resource def new @website = Website.new end def create @website = Website.new(website_params) @website.user = current_user if @website.save redirect_to ...
# Aruba module Aruba # Platforms module Platforms # Abstract environment variables class UnixEnvironmentVariables # We need to use this, because `nil` is a valid value as default UNDEFINED = Object.new.freeze private attr_reader :env public def initialize(env = ENV.to...
class FilmMakersStepsController < ApplicationController include Wicked::Wizard steps :basic def show @filmmaker = Movie.find(session[:id]) render_wizard end def update @filmmaker = Movie.find(session[:id]) @filmmaker.attributes = movie_params render_wizard @filmmaker end private d...
class ProductsController < ApplicationController before_action :set_product, only: [:show, :edit, :update, :destroy] access all: [:show], user: {except: [:destroy, :new, :create, :update, :edit]}, admin: :all def index if params[:query].present? @products = Product.search(params[:query]).page(params[:p...
require_relative 'routee_service' class RouteeTwoStepVerificationService < RouteeService def self.getInstance @instance ||= RouteeTwoStepVerificationService.new(nil, 'https://connect.routee.net/2step') end def init2StepVerification(token, verificationData) response = RestClient.post(baseUrl, verificati...
# frozen_string_literal: true # == Schema Information # # Table name: settings # # id :bigint(8) not null, primary key # mc_only :boolean default(FALSE) # created_at :datetime not null # updated_at :datetime not null # class Setting < ApplicationRecord before_create :o...
require "hand.rb" class Player attr_accessor :hand, :pot def self.deal_player_in(deck) Player.new(deck.draw(3)) end def initialize(hand) @hand = hand @pot = 0 end def fold @hand.each do |card| end end def count @hand.count end end
class AddBrideGroomAnnouncedAsToReceptions < ActiveRecord::Migration def change add_column :receptions, :bride_groom_announced_as, :string end end
require_relative "tree.rb" # 1. Create a binary search tree from an array of random numbers (`Array.new(15) { rand(1..100) }`) bst = Tree.new(Array.new(15) { rand(1..100) }) bst # 2. Confirm that the tree is balanced by calling `#balanced?` p bst.balanced? # 3. Print out all elements in level, pre, post, and in...