text
stringlengths
10
2.61M
class AddIndicesToSeasonDates < ActiveRecord::Migration[5.1] def change add_index :seasons, [:started_on, :ended_on] end end
class BasicRate # Daily cost in dollars attr_reader :daily # Weekly cost in dollars attr_reader :weekly # Monthly cost in dollars attr_reader :monthly def initialize(daily, weekly, monthly) @daily = daily @weekly = weekly @monthly = monthly end end
# # Cookbook Name:: hanlon # Recipe:: dnsmasq # # Copyright (C) 2014 # # # dhcp_interface = node['hanlon']['dhcp_interface'] no_dhcp_interface = node['hanlon']['no_dhcp_interface'] dhcp_interface_ip = node['network']['interfaces'][dhcp_interface]['addresses'].keys[1] dhcp_end_ip = node['hanlon']['dhcp_end_ip'] node.d...
class Error include ActiveModel::Validations include ActiveModel::Conversion extend ActiveModel::Naming attr_accessor :status, :message validates_presence_of :status validates_presence_of :message def initialize(attributes = {}) attributes.each do |name, value| if name.eql?(:status) self.status = val...
class MyType < ActiveHash::Base self.data = [ { id: 1, name: '--' }, { id: 2, name: 'とても内向的' }, { id: 3, name: '内向的' }, { id: 4, name: '内向的寄り' }, { id: 5, name: '両向的' }, { id: 6, name: '外向的寄り' }, { id: 7, name: '外向的' }, { id: 8, name: 'とても外向的' } ] include ActiveHash::Associations ...
Sequel.migration do up do create_table(:artists) do primary_key :id String :name, :null => false DateTime :created_at, :null => false DateTime :updated_at, :null => false index :id, :unique => true end end down do drop_table(:artists) end end
Vagrant.configure("2") do |config| config.vm.box = "ubuntu/trusty64" config.vm.network :forwarded_port, guest: 9000, host: 9090 config.vm.network :forwarded_port, guest: 8000, host: 8080 config.vm.provision :shell, path: "vagrant.sh" end
# Copyright (c) 2006, 2007 Ruffdogs Software, Inc. # Authors: Adam Lebsack <adam@holonyx.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License. # # This program ...
module FeatureHelpers # Submits the current form (clicking on input or button) def click_on_submit_button find('*[type=submit]').click end # Fills out login form def sign_in(user) fill_in 'user_email', with: user.email fill_in 'user_password', with: user.password click_on_submit_button end...
class EssayAward < ActiveRecord::Base belongs_to :essay belongs_to :award before_validation :set_default_placement validates_presence_of :essay, :award def placement_string if placement.present? placement.ordinalize else nil end end def title if award.present? "#{awar...
class CustomDeliveryStat < ActiveRecord::Base extend ScopeExtension::Stat extend ScopeExtension::Match belongs_to :custom after_create :set_default def set_default self.unsigned ||= 0 if self.has_attribute? :unsigned self.by_self ||= 0 if self.has_attribute? :by_self self.by_station ||= 0 if se...
require 'http' require 'oga' module ImageGetter class Scraper attr_reader :base_url, :document, :html def initialize(base_url,document) @base_url = base_url @document = document @html = Oga.parse_html(@document) end def links @links ||= get_links end def images ...
class PrivilegeGroup < ApplicationRecord has_many :control_privileges end
def substrings(phrase, dictionary) substring_hash = Hash.new substring_hash.default = 0 phrase.downcase.gsub!(/[^a-z\s]/i, '') phrase = phrase.split(' ') phrase.each do |word| dictionary.each do |list| if word.include? list substring_hash[list] += 1 end end end substring_has...
require 'date' require 'httparty' # references: # https://www.cryptocompare.com/api/#-api-data-price- module ApiHelper # currencies and coins we care about CORE_CURRENCIES = [{name: "US Dollar", symbol: "USD"}, {name: "Euro", symbol: "EUR"}, {name: "Japanese Yen", symbol: "JPY"}, {name: "British Pound", symbol: "GB...
class User < ActiveRecord::Base has_secure_password has_many :links validates :name, presence: { message: "is required. " } validates :email, presence: { message: "is required. " }, uniqueness: { message: "is already in use. " } validates :password, presence: { message: "is required. " }, ...
class Team < ApplicationRecord has_many :course_users has_many :products belongs_to :course attr_accessor :studentsAmount, :leader, :leader_id, :logo_file, :access_requested def as_json options=nil options ||= {} options[:methods] = ((options[:methods] || []) + [:studentsAmount,:leader,:leader_id, :...
require 'test_helper' class ShortUrlsControllerTest < ActionController::TestCase def login_user @user = User.create(name: "test_user", email: "test_user@example.com",password: "123456") session[:user_id] = @user.id end test "should autnenticate user" do get :index assert_redirected_to login_path...
# encoding: UTF-8 require 'test_helper' class OrderItemTest < ActiveSupport::TestCase setup do @client = Client.create name: "John", email: "john@gmail.com", password: 'tre543%$#', password_confirmation: 'tre543%$#' @order = @client.orders.create @product = Product.create name: 'Xaxá', price: 0.2 end ...
class Item < ApplicationRecord # refileに必要なメソッド attachment :item_image # アソシエーション belongs_to :user belongs_to :brand belongs_to :category # バリデーション validates :category_id, presence: true validates :price, presence: true end
class Admin::StudentsController < Admin::AdminController before_action :set_student, only: [:show, :edit, :update, :destroy] before_action :load_resources, only: [:new, :create, :edit, :update] # GET /students # GET /students.json def index @students = Student.all respond_with @students end # GE...
class CoreLessonProblemType < ActiveRecord::Base belongs_to :lesson belongs_to :problem_type validates_presence_of :problem_type_id, :lesson_id validates_uniqueness_of :problem_type_id, :scope => :lesson_id end
class ArtyscisController < ApplicationController before_action :set_artysci, only: [:show, :edit, :update, :destroy] before_action :authenticate_user!, except: [:index, :show] before_action :correct_user, only: [:edit, :update, :destroy] # GET /artyscis # GET /artyscis.json def index @artyscis = Artysc...
class Song attr_accessor :artist, :name def initialize(name) @name = name end def artist_name=(name) self.artist = Artist.find_or_create_by_name(name) artist.add_song(self) end def self.new_by_filename(file) song_info = file.chomp(".mp3").split(" - ") song = Song.new(song_info[1]) ...
module Rounders module Matchers class CC < Rounders::Matchers::Matcher attr_reader :pattern def initialize(pattern) @pattern = pattern end def match(message) return if message.cc.nil? matches = message.cc.map do |address| address.match(pattern) e...
class RemoveForeignKeys < ActiveRecord::Migration[5.2] def change remove_foreign_key :order_items, :orders remove_foreign_key :order_items, :weddings end end
require_relative 'spec_helper' #get all the stuff we need for testing. require_relative '../scoring.rb' #include all the code in scoring.rb that we need to test. module Scrabble #Since all the tests in this spec correspond to Scoring, which lives inside Scrabble, can wrap the tests in the module also. describe Sco...
class CreateUserProfiles < ActiveRecord::Migration def self.up create_table :user_profiles do |t| t.belongs_to :user t.integer :religion_id t.integer :sexual_orientation_id t.integer :country_id t.integer :gender_id t.integer :age_id t.integer :political_view_id t.s...
# What will the following code print? Why? Don't run it until you've attempted to answer. def count_sheep 5.times do |sheep| puts sheep end end puts count_sheep # count_sheep prints the numbers 0 to 4 within the times method, and then returns 5, the initial integer times was called upon. puts count_sheep wil...
class RingGroupCallQuery < Types::BaseResolver description "Get the specified ring group call" argument :id, ID, required: true type Outputs::RingGroupCallType, null: false policy RingGroupPolicy, :view? def resolve RingGroupCall.find(input.id).tap { |call| authorize call.ring_group } end end
namespace :php do desc '配置 Laravel 環境。' task :setup do on roles(:app) do within release_path do execute :chmod, "u+x artisan" execute :chmod, "-R 777 storage/logs" execute :chmod, "-R 777 storage/framework" execute :chmod, "-R 777 bootstrap/cache" end end end ...
class ApplicationController < ActionController::Base INVALID_LOGIN_MESSAGE = 'Invalid email or password.' # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. # Could use with: null_session here and then wouldn't need to skip before filter in HealthpostControll...
class App < ActiveRecord::Base has_many :comments, dependent: :destroy, inverse_of: :app belongs_to :user, inverse_of: :apps validates :title, presence: true validates :description, presence: true validates :user_id, presence: true validates :app_photo, presence: true mount_uploader :app_ph...
# Defines our Vagrant environment # # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| # create management node config.vm.define :management do |management_config| management_config.vm.box = "ubuntu/trusty64" management_config.vm.hostname = "management" management_config.vm.ne...
FactoryGirl.define do factory :invite do email 'someone@there.org' token { InviteToken.new('secret').hashed } group_id 1 group_name 'users' role Role.group_admin trait :pending trait :accepted do accepted_at { Time.current } accepted_by 'socrates' end trait :revoked ...
# frozen_string_literal: true require 'spec_helper' describe 'evergreen service' do it 'chooses the correct items amongst LBCC materials' do lbcc_available = EvergreenHoldings::Item.new({ status: 'Available', l...
class ChoreReward < ActiveRecord::Base belongs_to :chore belongs_to :reward end
# frozen_string_literal: true require_relative '../validators/rating' # StringFilter is used for many-to-many # relation between Category and StringParameter class StringFilter < ApplicationRecord belongs_to :category belongs_to :string_parameter end
class TasksController < ApplicationController before_action :logged_in_user, only: [:new, :create, :index, :update, :show, :edit, :update, :destroy] before_action :correct_user, only: [:new, :create, :index, :update, :show, :edit, :update, :destroy] def new @task = Task.new end def create @task = T...
class AgentSessionsController < ApplicationController before_action :set_agent_session, only: [:show, :edit, :update, :destroy] # GET /agent_sessions # GET /agent_sessions.json def index if current_user.admin? @agent_sessions = AgentSession.all else @agent_sessions = AgentSession.joins('INN...
require 'rails_helper' describe 'A visitor' do context 'visits stations index' do it 'sees all stations with name, dock count, city, installation date' do station_1 = Station.create(name: 'City hall', dock_count: 20, city: 'San Jose', installation_date: Time.now, created_at: 2018-02-21, updated_at: 2018-03...
#!/usr/bin/env ruby # # Shortcut for git commit -am && push # # Automatically prefixed commit message with ticket number # puts `git status` commit_message = ARGV.join(" ").strip full_git_branch_path = `git symbolic-ref HEAD`.chomp git_branch_name = full_git_branch_path.split('/').last commit_prefix = git_branch_na...
# frozen_string_literal: true require 'spec_helper' describe Apartment do describe '#config' do let(:excluded_models) { ['Company'] } let(:seed_data_file_path) { Rails.root.join('db/seeds/import.rb') } def tenant_names_from_array(names) names.each_with_object({}) do |tenant, hash| hash[te...
module Constantizable include ActiveSupport::Concern def get_constantized(type) self.class.get_constantized(type) end module ClassMethods def get_constantized(type) elements = constants.map {|sym| sym.to_s.underscore } elements.include?(type) ? get_constant(type) : raise_invalid_type e...
""" Hand Score Write a method hand_score that takes in a string representing a hand of cards and returns it's total score. You can assume the letters in the string are only A, K, Q, J. A is worth 4 points, K is 3 points, Q is 2 points, and J is 1 point. The letters of the input string not necessarily uppercase....
require_relative('../db/sql_runner') require_relative('../models/ticket') class Customer attr_accessor :name, :funds attr_reader :id def initialize(options) @id = options['id'].to_i if options['id'] @name = options['name'] @funds = options['funds'] end # CRUD # create def save() # sq...
json.array!(@posts) do |post| json.label post.title json.id post.id end
require 'spec_helper' describe Metasploit::Model::Visitation::Visitor do context 'validations' do it { should validate_presence_of :block } it { should validate_presence_of :module_name } it { should validate_presence_of :parent } end context '#initialize' do subject(:instance) do describe...
#!/bin/env ruby # encoding: utf-8 $nataniev.require("action","tweet") class VesselDictionarism include Vessel def initialize id = 0 super @name = "Dictionarism" @docs = "A twitter bot that makes -isms out of words. A fork of an old [Nataniev automaton](https://wiki.xxiivv.com/#dict...
class Tag < ActiveRecord::Base has_many :taggings, dependent: :destroy has_many :events, through: :taggings end
require './lib/world' describe World do before do @world = World.new end it 'set cell alive should set the cell to live' do @world.set_alive(1,1) expect(@world.is_alive?(1,1)).to be true end it 'set cell alive, other cells should be dead' do @world.set_alive(1,1) expect(@world.is_alive?...
require 'rspec' require 'task' require 'list' describe Task do it 'is initialized with a description' do test_task = Task.new('scrub the zebra') test_task.should be_an_instance_of Task end it 'lets you read the description out' do test_task = Task.new('scrub the zebra') test_task.description.shou...
Snackstack::Application.routes.draw do resources :items devise_for :users root to: "home#index" end
require 'rails_helper' RSpec.describe BooksController, type: :controller do let(:test_book){ Book.create title: "Test Book", author: "Author Name", isbn: 1234, pub_date: 2008, genre: "fi...
class Spree::Calculator::PrinceEdwardTax < Spree::Calculator def self.description "Prince Edward Tax" end def self.register super end def compute(order) calculate_taxation(order.item_total) end private def calculate_taxation(total) gst = total * 0.05 pst = (total + gst) * 0.1 #P...
# frozen_string_literal: true require 'integration_test' class SurveyRequestsControllerTest < IntegrationTest setup do @survey_request = survey_requests(:sent) login(:uwe) end test 'should get index' do get survey_requests_path assert_response :success end test 'should get new' do get ...
class Payment < ActiveRecord::Base validates_uniqueness_of :number belongs_to :customer_company, :class_name => 'CustomerCompany' belongs_to :bank belongs_to :salesman, :class_name => 'Account' belongs_to :account belongs_to :order before_create do self.number = 'ZF-' + Time.now.strftime("%Y%m%d") ...
# Exceptions and Stack Traces =begin For the purposes of this section an exception can be viewed as synonymous with an error. During the course of program execution, many things can go wrong for a variety of reasons, and when something does go wrong, usually we say "an exception is raised". This is a common technical...
require File.dirname(__FILE__) + '/../../../spec_helper' require 'stringio' require 'zlib' describe 'Zlib::GzipFile#finish' do before(:each) do @io = StringIO.new @gzip_writer = Zlib::GzipWriter.new @io end after :each do @gzip_writer.close unless @gzip_writer.closed? end it 'closes the GzipFile' d...
require 'rails_helper' describe Machine, type: :model do describe 'relationships' do it { is_expected.to belong_to(:owner) } it { is_expected.to have_many(:snacks) } end describe 'validations' do it { is_expected.to validate_presence_of(:location) } end describe 'methods' do before(:all) do...
class Players attr_accessor :name, :score def initialize(name) @name = name @score = 3 end def decrement_score @score -= 1 end def player_live? @score > 0 end end
class AddCnPropertyExplanationField < ActiveRecord::Migration RAILS_ENV="chinese" def self.up config = ActiveRecord::Base.configurations["chinese"] ActiveRecord::Base.establish_connection(config) add_column :cn_properties, :explanation, :string end def self.down config = ActiveRecord::Base.confi...
Pod::Spec.new do |s| # Root specification s.name = "box-ios-browse-sdk" s.version = "1.0.4" s.summary = "iOS Browse SDK." s.homepage = "https://github.com/box/box-ios-browse-sdk" s.license = { :type => "Apache License, Version 2.0", :file => "LIC...
class MigrateSourceDatabasesToReferences < ActiveRecord::Migration[6.1] # This IRREVERSIBLE migration transforms data from the deprecated # source_databases table into references associated with the respective # records. # # It also creates paper_trail 'create' versions for records previously # imported ...
# == Schema Information # # Table name: path_subscriptions # # id :integer not null, primary key # path_id :integer # user_id :integer # # Indexes # # index_path_subscriptions_on_path_id (path_id) # index_path_subscriptions_on_user_id (user_id) # FactoryGirl.define do factory :path_subscription ...
# frozen_string_literal: true # # Copyright (c) 2019-present, Blue Marble Payroll, LLC # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # require 'spec_helper' describe Proforma::HtmlRenderer::Writer do let(:intro_name) { 'example.txt.erb...
require 'spec_helper' describe Nature::Service do include FakeFS::SpecHelpers before(:each) do # Bug in FakeFS, we dont need to worry about it here File.stub(:chmod) end describe ".new" do it "sets up the class propery" do path = Pathname.new('/etc/sv/test-service') cwd ...
require 'thor' require 'fileutils' class Testing < Thor @@path = File.dirname(__FILE__) @@templates_path = @@path + '/templates' @@framework_templates_path = @@path + '/frameworks_templates' desc 'new <project_name>', 'Create new empty project' method_option :with_rspec, default: false, ...
# frozen_string_literal: true require 'pry' class Plant attr_reader :type def initialize(type) @type = type end def self.grow 'ai am class' end def grow if trees.include?(type) 'a tree' elsif grass.include?(type) 'a grass' elsif seaweed.include?(type) 'a seaweed' ...
API::Engine.routes.draw do # API routes # Set APIVersion.new(version: X, default: true) for dafault API version scope module: :v1, constraints: APIVersion.new(version: 1, current: true), defaults: { format: 'json' } do with_options only: :index do |list_index_only| list_index_only.resources :domains ...
module Autoprotocol module Util # Convert a Unit or volume string into its equivalent in microliters. # # === Parameters # # * vol : Unit, str # A volume string or Unit with the unit "nanoliter" or "milliliter" def self.convert_to_ul(vol) v = Unit.fromstring(vol) if v.u...
require 'dry/transaction' require 'yaml' module Indoctrinatr module Tools module ErrorChecker class TemplatePackErrorChecker include Dry::Transaction # class wide constants # needs to match indoctrinatr's TemplateField model VALID_PRESENTATIONS = %w[text textarea checkbox r...
class ItemsController < ApplicationController before_action :signed_in_administrator, only: [:new, :index, :edit, :update, :destory] def new @item = Item.new end def index @items = Item.where(lang: I18n.locale) end def create @item = Item.new(item_params) @item.save redirec...
require 'spec_helper' require 'rails_helper' RSpec.describe EstimationSessionsController, :type => :controller do describe 'estimationSession in general' do before do @project = FactoryGirl.create(:project) @serie = FactoryGirl.create(:serie) end it 'creating estimation' do es...
# http://www.mudynamics.com # http://labs.mudynamics.com # http://www.pcapr.net require 'mu/pcap/reader' require 'stringio' require 'zlib' module Mu class Pcap class Reader # Reader for HTTP family of protocols (HTTP/SIP/RTSP). # Handles message boundaries and decompressing/dechunking payloads. class HttpFamily < Re...
class CreateInvoices < ActiveRecord::Migration[5.2] def change create_table :invoices do |t| t.float :price t.string :buyer_tax_number t.string :buyer_name t.string :buyer_address t.references :job t.timestamps end end end
#!/usr/bin/env ruby require 'gli' begin # XXX: Remove this begin/rescue before distributing your app require 'markedblog' rescue LoadError STDERR.puts "In development, you need to use `bundle exec bin/markedblog` to run your app" exit 64 end include GLI::App program_desc 'Create a static blog from MultiMarkdown f...
# main class to store event data incl. basic details and ticket purchase info # also stores related students, posts, ads, announcements # an event is associated with one club, and can only be created by an Admin. class Event < ActiveRecord::Base belongs_to :club, class_name: "Club" has_many :ticket_reservations, f...
require 'boxzooka/base_request' require 'boxzooka/landed_quote_request_item' module Boxzooka class LandedQuoteRequest < BaseRequest root node_name: 'LandedQuote' # ISO 4217 scalar :currency # ISO 3166-1 Alpha-2 scalar :destination_country_code # Country-specific. For US: use 2 char state c...
class WoundSerializer < ActiveModel::Serializer belongs_to :people has_many :treatments attributes :name, :description, :img_url, :location, :person_id, :treatments end
#### # # Letter # # Letter is the association between Invoice and InvoiceText # #### # class Letter < ApplicationRecord belongs_to :invoice belongs_to :invoice_text validates :invoice, :invoice_text, presence: true end
class MakersController < ApplicationController def new end def create @maker = Maker.new(maker_params) @maker.save redirect_to @maker end def show @maker = Maker.find(params[:id]) respond_to do |format| format.html format.json{ render :json => @maker.to_json } ...
# coding: utf-8 class CommunityPresenter < BasePresenter include ActionView::Helpers include ApplicationHelper presents :community def title raw link_to(article.title, show_community_article_url(article.community, article)) end def text raw truncate(strip_tags(article.body), length: 140, omission: ...
class PostSearch attr_accessor :keywords, :category, :per_page def initialize(params = {}) @keywords = params[:keywords] ? params[:keywords].gsub(/[^a-zA-Z0-9\s]/, '').split(/\s/) : [] # @per_page = 15 # @page = params[:page] || 1 @category_id = params[:category_id] || nil # @ca...
package "midonet-cluster" do action :install end file "/etc/midonet/midonet.conf" do action :edit # group "root" # user "root" block do |content| nsdb_binds = node[:nsdb_ips].map{|x| "#{x}:2181"}.join(?,) content.sub!(/^\#?zookeeper_hosts = .*$/, "zookeeper_hosts = #{nsdb_binds}") end end execute "Configur...
Ransack::Helpers::FormHelper.module_eval do def link_name(label_text, dir) ERB::Util.h(label_text).html_safe end end
class AddTypeCdToUsers < ActiveRecord::Migration def change add_column :users, :type_cd, :string, limit: 20, null: false, after: :uuid end end
require 'str_to_seconds' class Title < ApplicationRecord belongs_to :category belongs_to :notice, optional: true belongs_to :office, optional: true has_many :records validates :name, presence: true, :uniqueness => { :scope => [:category] } validates :category, presence: true validates :description, pre...
require 'rails_helper' RSpec.describe ActiveRecordMultipleQueryCache::Rails5QueryCache do next if ActiveRecord.gem_version < Gem::Version.new('5.0.0') let(:instance) { described_class.new(active_record_base_class) } let(:active_record_base_class) { ActiveRecord::Base } describe '#run' do subject do ...
require 'alphavantagerb' module AlphavantageClient DEFAULT_WAITING_TIME = 5 DEFAULT_RETRY = 10 def alphavantage_client AlphavantageClient.alphavantage_client end def alphavantage_config AlphavantageClient.alphavantage_config end def self.alphavantage_config return @alphavantage_config if @a...
class AddErrorbundle < ActiveRecord::Migration def self.up create_table "errorbundles" do |t| t.column :offering_id, :integer t.column :comment, :string t.column :name, :string t.column :content_type, :string t.column :data, :binary, :limit => 4.megabyte t.column :created_at, :...
require 'spec_helper' resource "Notes" do let(:user) { users(:owner) } let(:note) { events(:note_on_hdfs_file) } let(:hdfs_file) { HdfsEntry.files.first } let(:attachment) { attachments(:sql) } before do log_in user end post "/notes" do parameter :body, "Text body of the note" parameter :en...
class WeInvite < ActionMailer::Base def our_invite(guest) @guest = guest mail(:to => @guest.email, :subject => "Wedding Invitation", :from => "weddinginviteon28@gmail.com") end end
class GroupEnrollmentsController < WebApplicationController before_action :set_group_enrollment, only: [:destroy] def create group = GroupOffering.find( group_enrollment_params[:group_offering_id] ).group @group_enrollment = GroupEnrollment.new( group_enrollment_params ) if @group_enrollment.save ...
require 'test_helper' class ArticlesCreateTest < ActionDispatch::IntegrationTest def setup @user = users(:stacy) @article = articles(:one) end test "create article after succesfully logged in" do get new_article_path assert_not is_logged_in? get login_path assert_response :success a...
class RequestController < ApplicationController before_action :require_user #This method will return all the requests for the user logged in. def index @requests = Request.where(user_id: session[:user_id]).where(is_completed: 0) end def new @request = Request.new end def show @request = R...
module Api class BaseController < ::ApplicationController respond_to :json before_filter :require_json_format protect_from_forgery except: [:routing_error] private def require_json_format unless request.format == "json" render json: {error: "Only json format is supported"}, status:...
require "curses" include Curses class CursesScreen def initialize game init_screen @game = game end def play grid begin crmode while true do print_step grid sleep 0.5 grid = @game.step grid end ensure close_screen end end def print_step gr...
class Venue attr_reader :name, :capacity, :patrons def initialize(name, capacity) @name = name @capacity = capacity @patrons = [] end def add_patron(name) @patrons << name end def yell_at_patrons yelled = [] @patrons.each do |name| yelled << name.upcase end yelled en...
class AddTimestampsToPortfoliosStocks < ActiveRecord::Migration def self.up # Or `def up` in 3.1 change_table :portfolios_stocks do |t| t.timestamps end end def self.down # Or `def down` in 3.1 remove_column :portfolios_stocks, :created_at remove_column :portfolio...