text
stringlengths
10
2.61M
# encoding: utf-8 module Notificationer def send_system_message(recipients, msg_body, subject, sanitize_text=true, attachment=nil) convo = Conversation.new({:subject => subject}) system_message = SystemMessage.new({:sender => self, :conversation => convo, ...
class Player attr_accessor :name, :score, :hand, :wins def initialize(name) @name = name @score = score @hand = hand @wins = 0 end def hand @hand = [] end def score @score = 0 end def wins_game @wins += 1 end end
class FrequencyCalibrator # Takes an input and returns the sum of all the values contained in the input. # # @param input [File, Array, String] File or string values must be newline separated and interpolated. # @return [Integer] the sum of all parsed input values. def self.analyze(input) frequencies = []...
class AddContainersNeededNameDescriptionToJobs < ActiveRecord::Migration[5.1] def change add_column :jobs, :description, :text add_column :jobs, :name, :string add_column :jobs, :containers_needed, :integer end end
class CreatePropertyLocations < ActiveRecord::Migration def change create_table :property_locations do |t| t.string :area t.integer :city t.integer :state t.integer :country t.timestamps end end end
module Rmega class Progress include Options def initialize(total, options = {}) @total = total @caption = options[:caption] @bytes = 0 @real_bytes = 0 @mutex = Mutex.new @start_time = Time.now if show? and options[:filename] puts options[:filename] end...
#!/usr/bin/ruby $:.push('.') require 'fileutils' require 'net/http' require 'linegui' require 'line_logger' require 'line_message' def main() Management.new().run() end class Management PATH_STICKER = "./sticker" LINE_STICKER_BASE_URL = "http://dl.stickershop.line.naver.jp/products" MAX_DOWNLOADS = 10 attr_rea...
require_relative '../../automated_init' context "CLI" do context "Runner" do runner = CLI::Run.new runner.() test "Test run is started" do assert(runner.test_run.started?) end test "Test run is finished" do assert(runner.test_run.finished?) end end end
class QuizQuestionSerializer < ActiveModel::Serializer attributes :id, :question belongs_to :course has_many :quiz_answers end
class AddAuthorNameToAuthors < ActiveRecord::Migration def change add_column :authors, :author_name, :text end end
require 'spec_helper' require 'fat_core/enumerable' describe Enumerable do it 'enumerates groups of size k' do letters = ('a'..'z').to_a letters.groups_of(3).each do |k, grp| expect(grp.class).to eq Array if grp.last == 'z' expect(grp.size).to eq(2) expect(grp).to eq(['y', 'z']) ...
class PropertyValue < ActiveRecord::Base belongs_to :agent_property, :foreign_key => 'agent_property_id' attr_accessible :value end
class Message def initialize(connection) @database_connection = connection end def create(message,name) insert_sql = <<-SQL INSERT INTO messages (message, name) VALUES ('#{message}','#{name}') SQL @database_connection.sql(insert_sql) end def all @database_connection.sql("select ...
require 'uri' module FileMover module Uri extend self def to_file_mover uri send (uri.scheme || 'file').intern, uri end def FileMover arg to_file_mover uri end private def ftp uri Ftp.new uri end def sftp uri SFtp.new uri end def file uri ...
require 'spec_helper' describe "Comments" do describe "View comments" do before(:all) do u = FactoryGirl.create(:user) p = FactoryGirl.create(:post, body: "lorem\n"*10, author_id: u.id) 10.times do FactoryGirl.create(:comment, author_id: u.id, topic_id: p.id) end end con...
require 'delegate' require 'date' class User def birth_date puts "user #birth_date" Date.new(1979,03,22) end end class UserDecorator < SimpleDelegator def birth_date puts "decorator #birth_date" # we can call super from any method in this object and it will be routed to # the corresponding m...
class AudioSource < GameObject attr_reader :sound, :channel attr_accessor :volume, :speed, :pan attr_accessor :follow def setup @channel = nil @sound = Gosu::Sample.new(@options[:sound]) @volume= 1.0 @speed = 1.0 @pan = 0.0 @follow = nil end def draw Gosu.draw_rect(@x - @siz...
require 'spec_helper' describe VenueType do before do @venue_type = FactoryGirl.create(:venue_type) end subject { @venue_type } it { should respond_to(:name) } it { should respond_to(:venues) } end
# This migration comes from solidus_subscriptions (originally 20170111224458) class ChangeSubscriptionActionableDateToDatetime < ActiveRecord::Migration def change change_column :solidus_subscriptions_subscriptions, :actionable_date, :datetime end end
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 module TwitterCldr module DataReaders class DataReader attr_reader :locale def initialize(locale) @locale = TwitterCldr.convert_locale(locale) end def pattern_at_path(path) tra...
class OrderWorker include Sidekiq::Worker CONFIRM_WITHDRAWAL_PATTERN = /^https:\/\/www.cryptsy.com(\/users\/confirmwithdrawal\/.*)/ def perform(order_id) order = Order.find(order_id) account = order.account if validate(order, account) begin amount = CryptoTeller.price_service.from_usd...
# frozen-string-literal: true require File.join(File.dirname(__FILE__), 'helper') require 'fileutils' class TestID3v2Write < Test::Unit::TestCase SAMPLE_FILE = 'test/data/sample.mp3' OUTPUT_FILE = 'test/data/output.mp3' PICTURE_FILE = 'test/data/globe_east_540.jpg' def reloaded(&block) TagLib::MPEG::Fil...
``` Tasks for the class: 1) sort enumerable 2) sort_by &block 3) autosort (analyze data, pick correct sort) 4) optimize_sort (optional symbols, otherwise use default sorts) ``` require "benchmark" require "sortinghat/version" require "sortinghat/heapsorter" module SortingHat class Sorter include HeapSorter ...
class CreateSubjects < ActiveRecord::Migration def change create_table :subjects do |t| t.string :name t.text :description t.integer :subject_type t.integer :parent_id, null: true t.boolean :fixed, :default => false t.integer :sort_order t.timestamps null: false end ...
class BasicController < ApplicationController def model_class params[:controller].singularize.classify.constantize end def model_s params[:controller].singularize end def model_table model_class.tableize rescue nil end def show_path(obj) table_name = obj.class.name.tableize.pluralize ...
require 'rails_helper' RSpec.describe "create an idea endpoint", type: :request do it "creates an idea with valid parameters" do params = { idea: { title: "New Idea", body: "the body of the idea" } } post "/api/v1/ideas", params body = JSON.parse(response.body, symbolize_...
require 'spec_helper' module Rmega describe Storage do describe '#stats' do let(:session) { Session.new } let(:subject) { Storage.new(session) } let(:nodes) do [{'s' => 10, 't' => 0}, {'t' => 1}, {'s' => 5, 't' => 0}].map do |data| Nodes::Factory.build(session, data) ...
class AddBudgetIdToSpendings < ActiveRecord::Migration[5.0] def change add_reference :spendings, :budget, foreign_key: true end end
require 'echoe' Echoe.new("ccsv") do |p| p.author = "Evan Weaver" p.project = "fauna" p.summary = "A pure-C CSV parser." p.url = "http://blog.evanweaver.com/files/doc/fauna/ccsv/" p.docs_host = "blog.evanweaver.com:~/www/bax/public/files/doc/" end
require 'rails_helper' RSpec.describe 'New Bulk Discount' do before :each do @merchant = create(:merchant) visit merchant_bulk_discounts_path(@merchant) end it 'has link to add new bulk discount' do expect(page).to have_link('New Discount') click_link 'New Discount' expect(current_path).to eq...
class CollectiblesController < ApplicationController skip_before_action :authenticate_user!, only: [:index, :show] def index @category_array = Collectible.pluck(:category).uniq @collectibles = Collectible.all if params[:query].present? @collectibles = @collectibles.search_by_brand_and_model(param...
class RoutinesController < ApplicationController before_action :find_routine, only: [:show, :edit, :update, :destroy, :upvote] before_action :authenticate_user!, except: [:index, :show] def index @routines = Routine.all.order("created_at DESC") end def create @routine = Routine.new(routin...
require_relative "../../app/models/facebook_post" describe FacebookPost do let(:singles_formatter) { stub(:formatter, :as_text => "(12.32) 14.32 (DNF)") } let(:record) { stub(:record) } let(:subject) { FacebookPost.new(record, singles_formatter) } describe "#body" do context "single record" do befor...
desc "Say hello to everyone at Derailed" task :hello, [:times] => :go do |t, args| defaults = {times: '3'} args = defaults.merge(args) args[:times].to_i.times do puts "Hello!" end end desc "Go to the derailed meeting" task :go => [:find_laptop, :get_in_car] do puts "Going to derailed!" end desc "get in ...
module ToadSpawn class Base def initialize(path) raise "Directory does not exist" unless File.exist?(path) raise "Not a directory" unless File.directory?(path) raise "Not writable" unless File.writable?(path) @path = path flush end def key_file_path(key) File.join(...
module PageObjects module Support module Schools module Devices class EnableOrdersPage < PageObjects::BasePage set_url '/support/devices/schools{/urn}/enable-orders' element :no, '#support-enable-orders-form-order-state-cannot-order-field' element :no_school_reopened, ...
# 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 MoviesController < ApplicationController before_action :set_movie, only: [:show, :edit, :update, :destroy] before_action :authenticate_user! def index @movies = Movie.all end def current_user_movies @movies = current_user.movies end def current_user_reviews @...
require File.dirname(__FILE__) + '/spec_helper' describe "should eventually { block }" do it "should pass if block returns true immediately" do lambda { true }.should eventually { |expected| expected.should == true } end it "should pass if block returns true after a delay" do eventually = EventualMock....
class AddFieldsToMealTypesForSlotActivation < ActiveRecord::Migration def change add_column :meal_types, :first_slot_active, :boolean, :default => true add_column :meal_types, :second_slot_active, :boolean, :default => true add_column :meal_types, :third_slot_active, :boolean, :default => true end end
class AddViewsToPhotos < ActiveRecord::Migration def change add_column :photos, :views, 'int unsigned', :null => false, :default => 0, :after => :rating end end
class MailMessage < ActiveRecord::Base Info = Struct.new(:hostname, :rtl) attr_accessor :recipient_type, :recipient_ids, :attachment_error serialize :additional_info belongs_to :sender, :class_name => 'User' has_many :mail_attachments, :dependent => :destroy has_one :mail_recipient_list, :dependent => :d...
class RemoveNotNullFromChallenges < ActiveRecord::Migration[5.0] def change change_column :challenges, :challengee_time, :integer, null: true change_column :challenges, :points, :integer, null: true change_column :challenges, :winner_id, :integer, null: true end end
module CDI module V1 class NotificationConfigPresenter < BasePresenter def initialize(current_user) @current_user = current_user end def to_json json = [] NotificationConfig::TYPES.each do |type| notification_config = @current_user.notification_config(type) ...
class Restaurant < ApplicationRecord has_many :reviews, dependent: :destroy # A restaurant must have at least : a name, an address and a category CATEGORY = ["chinese", "italian", "japanese", "french", "belgian"] validates :name, :category, :address, presence:true validates_inclusion_of :category, in: CATEGO...
class Phoneme < ActiveRecord::Base def is_vowel phoneme_type == "vowel" end def possible_stresses is_vowel ? [0,1,2] : [3] end def stressed_name stress name + (is_vowel ? stress.to_s : "") end def autocomplete_format possible_stresses.map { |i| { :label => stressed_name(i), :...
# # Be sure to run `pod lib lint FALEventHub.podspec' to ensure this is a # valid spec before submitting. # # Any lines starting with a # are optional, but their use is encouraged # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html # Pod::Spec.new do |s| s.name = 'FALEven...
class FontMeowScript < Formula head "https://github.com/google/fonts/raw/main/ofl/meowscript/MeowScript-Regular.ttf", verified: "github.com/google/fonts/" desc "Meow Script" desc "Monoline font with a number of alternate forms in six stylistic sets" homepage "https://fonts.google.com/specimen/Meow+Script" def...
# More documentation about how to customize your build # can be found here: # https://docs.fastlane.tools fastlane_version "2.68.0" # This value helps us track success metrics for Fastfiles # we automatically generate. Feel free to remove this line # once you get things running smoothly! generated_fastfile_id "33b5942...
class Api::V2::AuthenticationController < Api::V2::BaseController before_action :jwt_authenticate_request!, :only => [:auth_test] def auth_test @dataJson = { :message => "[Test] Token 인증 되었습니다! :D", :user => { :appPlayerId => @currentAppUser.id, :appPlayer => @currentAppUser.app_player, :lastTokenG...
class ClassesStudent < ApplicationRecord belongs_to :university_class belongs_to :student, class_name: 'User', foreign_key: 'student_id', validate: true end
require 'rails_helper' RSpec.describe DestroyAdmin do include ModelHelper let(:admin_to_destroy) { create(:admin).as_json.symbolize_keys } after do Admin.destroy_all end it 'Destroy Admin interactor exists' do expect(class_exists?(DestroyAdmin)).to eq(true) end it 'successful destroy' do r...
class AddCountryCityPostcodeToRooms < ActiveRecord::Migration[6.1] def change add_column :rooms, :country, :string add_column :rooms, :city, :string add_column :rooms, :postcode, :string end end
module Smtp class ContentType def initialize(value, boundary: nil, name: nil) @value = value @boundary = boundary @name = name end HTML = 'text/html'.freeze MULTIPART_MIXED = 'multipart/mixed'.freeze def as_header @header ||= HeaderWithParams.new(Header::CONTENT_TYPE, ...
# ================================================================================ # Part: STORE # Desc: # Multiple Table Inheritance for StoreItem, Member, Invoice, Workspace # ================================================================================ class StorePurchase include Mongoid::Document include Mon...
class Item attr_accessor :name, :reserved_price, :status def initialize(params={}) @name = params[:name] @reserved_price = params[:reserved_price] @status = 'available' end end
json.array!(@cloths) do |cloth| json.extract! cloth, :id, :name, :beacon_identification_key, :user_id, :url json.url cloth_url(cloth, format: :json) end
class Contact < Sequel::Model many_to_one :user def validate super validates_presence %i[user_id phone_number] unless Phony.plausible?(phone_number, cc: '1') errors.add(:phone_number, 'is invalid') end end def before_validation super self.phone_number = Phony.normalize(phone_numb...
FactoryGirl.define do factory :product do title Faker::Name.title description Faker::Lorem.paragraph price Faker::Number.between(10, 1000) trait :ruby_book do title "Ruby Book" price 100 end trait :php_book do title "PHP Book" price 1000 end end end
describe "Journals routing" do it 'routes to index' do { get: '/journals' }.should route_to controller: 'journals', action: 'index' end it 'routes to show' do { get: '/journals/1/'}.should route_to controller: 'journals', action: 'show', id: '1' end it 'routes to new' do { get: '/journals/new' }.s...
require 'ipaddress_2' module IPAddress IPv4.class_eval do alias_method :obj_include?, :include? def include?(oth) oth = self.class.new(oth) unless oth.is_a? self.class self.obj_include?(oth) end def as_json(_data = "") to_string end def paginate_hosts(page: 1, limit: 256,...
module DataAbstraction::SensorData class Generic CLASS_DEBUG = true include DataAbstraction::Unit def initialize(values, meta_values = {}, unit = nil) @sensor_class_name = meta_values['sensor_class_name'] if ( meta_values['sensor_class_name'] ) @sensor_name = meta_values['sensor_name'] if (...
require 'constrained/version' module Constrained # This defines version constraints as implemented by Puppet SemVer class VConstraint OPERATOR_METHODS = { :eq => '=', :lt => '<', :gt => '>', :le => '<=', :ge => '>=', :approx => '~>', } OPERATOR_NAMES = OPERATOR_ME...
class User < ApplicationRecord attr_reader :password validates :first_name, :last_name, :email, :birthday, :password_digest, :session_token, presence: true validates :email, uniqueness: true validates :gender, inclusion: {in: ['female', 'male', 'custom']}, presence: true validates :password, length: { minimu...
Pod::Spec.new do |s| s.name = "CoolHUD" s.version = "0.0.1" s.summary = "Cool Loading Animation" s.description = "Cool Loading Animation written by swift " s.license = "MIT" s.author = { "Legendry" => "czqasn_6@163.com" } s.homepage = "https://github.com/czqasngit/CoolLo...
module Hermes module Plugin ## # Checks if a given website is responding or not using a HEAD request. # class Down include Cinch::Plugin set :help => 'down [HOST] - Checks if a website is down or not.', :plugin_name => 'down' match(/down\s+(\S+)/) ## # Array of...
text_fields = { "InteractivePage" => [ :text, :name, :sidebar, :sidebar_title ], "ImageInteractive" => [ :caption, :credit ], "LightweightActivity" => [ :name, :description, :notes ], "MwInteractive" => [ :name, :url, :image_url ], "Sequence" => [ :d...
ActiveRecord::Schema.define do create_table(:subjects, force: true) create_table :delayed_images, force: true do |t| t.references :subject, polymorphic: true t.string :img_file_name t.string :img_content_type t.integer :img_file_size t.integer :position, null: false, default: 0 t.boolean :p...
require 'rails_helper' RSpec.describe Chef, type: :model do describe "validations" do it {should validate_presence_of :name} end describe "relationships" do it {should have_many :dishes} end describe "chef_ingredients" do it 'brings a list of ingredient names use by that chef' do @chef = C...
class AddAnswerToLightning < ActiveRecord::Migration def change add_column :lightnings, :answer, :string, default: "" end end
module TeachersPet module Actions class OpenIssue < Base def read_info @repository = self.options[:repository] @organization = self.options[:organization] @issue = { title: self.options[:title], options: { labels: self.options[:labels] } ...
# Encapsulates methods that need some business logic module DistributionHelper def pickup_day_params return {} unless params.key?(:filters) params.require(:filters).slice(:during) end def pickup_date now = pickup_day_params[:during]&.to_date || Time.zone.today.to_date end_date = now.end_of_day ...
require "spec_helper" RSpec.describe Array do context "#all_empty?" do it "returns true if all elements of the Array are empty" do expect(["", "", ""].all_empty?).to be true end it "returns false if some of the Array elements are not empty" do expect(["", 1, "", Object.new, :a].all_empty?)...
class ManageIQ::Providers::IbmTerraform::Inventory::Collector::ConfigurationManager < ManageIQ::Providers::IbmTerraform::Inventory::Collector def templates @templates ||= begin template_uri = URI.parse(manager.url) template_uri.path = "/cam/api/v1/templates" filter = '{"where": {"type": {"neq":...
class ParkingSpaceController < ApplicationController include ParkingSpaceHelper def index block_id = params['id'] @parking_group = ParkingGroup.where(:id => block_id).first if block_id @parking_spaces = block_id ? @parking_group.parking_spaces : ParkingSpace.all get_parking_status(:block_id => bloc...
########################################################################## # TkTree widget class # # see <http://wiki.tcl.tk/10615> # # Note: optional argument '-font' of the Tcl library is changed to # 'itemfont' on this Ruby library, because of avoiding font # operation trouble in 'initialize' ...
class Listing < ApplicationRecord has_many :images has_many :bookings, dependent: :destroy geocoded_by :address after_validation :geocode, if: :address_changed? end
require 'pp' require 'set' class Node attr_accessor :pos, :dist, :prev def initialize pos, dist, prev @pos = pos @dist = dist @prev = prev end def path_to path = [] node = self while !node.nil? path.unshift node node = node.prev end path.map { |n| n.pos} end end ...
module GoogleApps # Base class for feed entries. class Entry # Find all entries of this type. def self.all xml, more = GoogleApps.connection.get_feed_all(get_all_url) feed = Feed.new(self).add_xml(xml) while more xml, more = GoogleApps.connection.get_feed_all(more.attribute...
require 'bundler' Bundler.require class Subscribe < Goliath::API def response(env) @redis = EM::Hiredis.connect pubsub = @redis.pubsub channel = "events" pubsub.subscribe channel env.logger.info "Starting" env.logger.info "Subscribing to #{channel}" pubsub.on(:message) { |channel, mess...
module ActionController class Reloader class BodyWrapper def initialize(body) @body = body end def close @body.close if @body.respond_to?(:close) ensure Dispatcher.cleanup_application end def method_missing(*args, &block) @body.send(*args, &blo...
class PreferencesController < ApplicationController def initialize # Make sure to initialise the ApplicationController if it is not already initialised super # Made in England, so default to Pound Sterling currency type @default_fiat = 'GBP' # Auto-create a preference model if it doesn't exist ...
require 'rails_helper' describe SchedulerService::BuildConfiguration do let!(:build_folder) { Pathname.new('path_to_build_folder') } let(:configuration) { described_class.new build_folder } context 'with configuration file' do let!(:fake_configuration_file) do YAML.load_file(Rails.root.join('spec', ...
# This class facilitates oauth2 authentication. successful oauth callbacks redirect to #create, # where the jwt token is created with the information of the associated user in our db (which is created if necessary). class SessionsController < ApplicationController before_action :ensure_user_authorized, except: [:cr...
# frozen_string_literal: true module RubyNext module Language module Rewriters class ArgsForward < Base SYNTAX_PROBE = "obj = Object.new; def obj.foo(...) super(...); end" MIN_SUPPORTED_VERSION = Gem::Version.new("2.7.0") REST = :__rest__ BLOCK = :__block__ def on_...
# # This class hides the fact that when connecting to KubeVirt we need to use different API servers: # one for the standard Kubernetes API and another one for the KubeVirt API. # class ManageIQ::Providers::Kubevirt::InfraManager::Connection # # Creates a new connection with the given options. Note that the actual c...
class Character attr_accessor :name, :gender, :age, :eye_color, :hair_color, :film @@all = [] def initialize(hash) hash.each do |key, value| self.send("#{key}=", value) if self.respond_to?("#{key}=") end @@all << self end def self.all @@all end end
module Imgur class Base def self.api_get(url) refresh_token if token_expired? headers = { "Authorization" => "Bearer #{ENV["IMGUR_TOKEN"]}" } Unirest.get(url, headers: headers) rescue raise ImgurError end def self.api_post(url, params) refresh_token if token_expired? ...
class AddAmountToPaypalPayment < ActiveRecord::Migration[5.0] def change add_column :paypal_payments, :amount, :integer end end
class PostsController < ApplicationController before_filter :authenticate_user! def index @posts = current_user.posts.order("published_at DESC").page(params[:page]).per_page(10) end def new @post = Post.new end def create if params[:commit] == "Cancel" redirect_to posts_path else ...
class Dictionary def initialize(file_path) @dictionary = self.load_dictionary(file_path) end def load_dictionary(file_path) dict_arr = IO.readlines(file_path) dict_arr.map(&:chomp) end def include?(word) dict_set = @dictionary.to_set dict_set.include?(word) end def words_start_with?...
ROOT = File.expand_path(File.dirname(__FILE__)) require "#{ROOT}/dynamical" require "#{ROOT}/astar" module Driving class HybridAgent < DynamicalAgent include AStarMixin # Mode in which the agent stops and replans REPLAN_MODE = :replan def handle_msg msg case msg[:type] when :initial...
require 'rails_helper' RSpec.describe User, type: :model do let(:user) { create(:user) } describe '.age' do it 'return user age' do expect(user.age).to eq(Date.current.year - user.date_of_birth.year) end end describe '.full_name' do it 'return user full name' do expect(user.full_name)...
require 'deck' describe Deck do let(:deck) { Deck.new } describe "#shuffle" do it "returns full deck" do expect(deck.size).to eq(52) end it "refills the deck" do 5.times { deck.draw } expect(deck.shuffle.size).to eq(52) end end describe "#draw" do it "returns a card" do...
class AddNpsToProjects < ActiveRecord::Migration[5.2] def change add_column :projects, :nps, :integer add_column :projects, :nps2, :integer end end
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :omniauthable, omniauth_providers: [:twitter, ...
class CustomerAddress < ActiveRecord::Base include UserConcerns attr_accessible :customer_id, :address_type_id, :city, :line_one, :line_two, :name, :state, :suite, :zip, :created_by, :updated_by belongs_to :customer, :class_name => "Customer", :foreign_key => "customer_id" belongs_to :type, :class_name => "Addr...
class MyCar attr_accessor :color #allows us to change and view the color of MyCar attr_reader :year # allows to only view the year but not make changes def initialize(year, color, model) @year = year @color = color @model = model @current_speed = 0 end def speed_up(number) @current_spee...
class AddNtToPredictions < ActiveRecord::Migration def change add_column :predictions, :nt, :integer end end
require 'open-uri' # Had to remove the rss parse library module RSSParse def self.feed_date(feed) ['date', 'updated', 'updated_at', 'dc_date', 'pubDate', 'lastBuildDate'].each do |date_name| return feed.send(date_name) if feed.respond_to? date_name end return false end def self.item_date(it...