text
stringlengths
10
2.61M
class Snowboard < ActiveRecord::Base extend Enumerize # Associations - Store #---------------------------------------------------------------------------- belongs_to :store # Image #---------------------------------------------------------------------------- has_attached_file :image, :styles => { :mediu...
module DataAbstraction::Unit class MagneticValue < Generic STANDARD_UNIT = "T" UNITS = [ [ "tesla", "T" ], [ "milli_tesla", "mT" ], [ "micro_tesla", "uT", "microtesla" ], [ "nano_tesla", "nT", "nanotesla" ], [ "gauss", "Gauss" ] ] ...
ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' require 'nokogiri' require 'simplecov' SimpleCov.start class ActiveSupport::TestCase def after_teardown # dropping collections Mongoid.default_client.database.collections.each do |c...
# 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 bin/rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # ...
class Node attr_reader :value, :children attr_writer :parent def initialize(value) @value = value @children = [] @parent = nil end def add_parent(node) node.children << self self.parent = node end def add_child(node) self.children << node ...
module RedStorm class Application TASKS_FILE = "#{RedStorm::REDSTORM_HOME}/lib/tasks/red_storm.rake" def usage puts("usage: redstorm install|examples|jar <project_directory>|local <topology_class_file>") exit(1) end def run(args) if args.size > 0 if ["install", "exampl...
module SCC # Timer handles the logic of ensuring responses are collected the correct # number of times at the correct interval. class Timer # The exception raised when the call count is zero. ZeroCallCountError = Class.new(StandardError) # @params interval [Integer] Number of seconds between invokati...
class Tag < ActiveRecord::Base has_many :term_tags has_many :terms, :through => :term_tags attr_accessible :name scope :ordered, order(:name) end
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "nlg/version" Gem::Specification.new do |s| s.name = "nlg" s.version = Nlg::VERSION s.authors = ["Sricharan Sunder", "Jiren Patel", "Gautam Rege"] s.email = ["sricharan@joshsoftware.com", "jiren@joshsoftware.com...
module Squirrel class InstallGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) class_option :api_key, :type => :string, :desc => "The API key obained from squirrel." def create_ship template "squirrel.rake.erb", File.join(Rails.root, "lib", "tasks", "squirr...
require 'date' require 'erb' require 'enumerator' require 'fileutils' require 'rexml/document' # Ignore non-existent rubygems. begin require 'rubygems' rescue LoadError nil end # Require a gem and provide usefull error message if require wasn't successful. def safe_require module_name, reason, rubyforge_id requ...
# Interior Designer Client Details # # 1. create client hash # 2. create keys USING SYMBLOLS for name, age, number of children, theme, # # PROGRAM REQUIREMENTS # 1. prompt user for all of his data # 2. Convert user data to appropriate type # 3. Print the hash back out when user has answered all the questions # 4. ...
namespace :db do desc "Fill database with sample data" task populate: :environment do admin = User.create!(name: "Example User", email: "example@railstutorial.org", password: "foobar", password_confirmation: "foobar", ...
# --- Day 5: Doesn't He Have Intern-Elves For This? --- # Santa needs help figuring out which strings in his text file are naughty or # nice. # A nice string is one with all of the following properties: # It contains at least three vowels (aeiou only), like aei, xazegov, or # aeiouaeiouaeiou. It contains at least o...
# == Schema Information # # Table name: users # # id :integer not null, primary key # first_name :string(255) not null # last_name :string(255) not null # email :string(255) not null # password_digest ...
# frozen_string_literal: true class AddSubmittedAtToTalkSummaries < ActiveRecord::Migration[5.1] def change add_column :talk_summaries, :submitted_at, :datetime TalkSummary.update_all(submitted_at: Time.current) change_column_null(:talk_summaries, :submitted_at, false) end end
class Ability include CanCan::Ability def initialize(user) user ||= User.new if user.admin? can :manage, :all can :manage, :dashboard elsif user.editor? can :manage, :all can :manage, :dashboard else if user.confirmed? can :create, Comment end ...
require 'rails_helper' describe CommandHandlers::RunJob do include Commands::Execute describe '#call' do let(:uid) { Time.current.strftime("%H%M%S%L#{SecureRandom.random_number(100)}") } context 'when success' do it 'Events::EmailReceived event published (integration)' do cmd = Commands::Ru...
#encoding: utf-8 module ProductDecorator def display_price number_to_currency(price, unit: '¥', precision: 0) end def display_image image_tag(image_url) if image? end def display_description simple_format description end def label_recommend content_tag :span, "オススメ", class: "label lab...
class Post < ApplicationRecord validates :title, presence: true validates :title, inclusion: { in: %w[booking reading wish] } belongs_to :book belongs_to :user scope :booking, -> { where(title: 'booking', active: true) } scope :reading, -> { where(title: 'reading', active: true) } scope :readed, -> { wh...
class Step < ApplicationRecord belongs_to :cycle, inverse_of: :steps, optional: true end
class CreateShoppingCartItem < ActiveRecord::Migration[5.2] def change create_table :shopping_cart_items do |t| t.references :product t.references :shopping_cart t.integer :quantity #In gms t.decimal :amount, precision: 12, scale: 2 t.decimal :tax_amount, precision: 12, scale: 2 ...
# Copyright (c) 2015 Lamont Granquist # Copyright (c) 2015-2018, Chef Software Inc. # # 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 r...
# frozen_string_literal: true # Shareable validation for checking business rules for Grid Reference on a Location # This can be used in Context dependent situations module WasteExemptionsShared class GridReferenceValidator < SimpleDelegator include ActiveModel::Validations delegate :site_info, :grid_refer...
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..") $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..\libs') require "test/unit" require "browser_operator" class BrowserOpraterTest < Test::Unit::TestCase def setup @website = '192.168.80.206' @browser = BrowserOperator.instance en...
#!/usr/bin/env ruby require 'net/http' require 'uri' # Cross-platform way of finding an executable in the $PATH. # # which('ruby') #=> /usr/bin/ruby def which(cmd) exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| exts.each { |ext| exe = Fi...
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= # ▼ Shop Clouts # Author: Kread-EX # Version 1.02 # Release date: 07/01/2012 #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:= #---------------------------------------------------------------------------...
require 'rails_helper' describe 'Submitting a complaint', type: :request do include ActiveJob::TestHelper before do Timecop.freeze(Time.parse('2019-09-11 15:34:46 +0000')) allow(SecureRandom).to receive(:uuid).and_return('e2161d54-92f8-4e10-b3a1-94630c65df3c') end let(:expected_optics_payload) do ...
class ChangeColumnsInEvents < ActiveRecord::Migration def change change_column :events, :songs_to_learn, :text change_column :events, :songs_to_review, :text end end
class Private::ConversationsController < ApplicationController before_action :redirect_if_not_signed_in def index @conversations = Private::Conversation.where(sender: current_user).or(Private::Conversation.where(recipient: current_user)) end def show @conversation = Private::Conversation.includes(:sen...
class AddColumnToUser < ActiveRecord::Migration[5.2] def change add_column :users, :age, :integer add_column :users, :work, :integer add_column :users, :profile_image_id, :string add_column :users, :is_deleted, :boolean, default: false end end
# frozen_string_literal: true RSpec.describe ActiveEncryption::Encryptor do subject(:encryptor) do described_class.new(setting) end let(:data) { 'Lorem ipsum.' } let(:setting) do instance_double( 'ActiveEncryptio::EncryptionSetting::Record', key: ['fc27192c31cb0602bd41c62d676d7ddf'].pack('...
namespace :clockwork do desc "Stop clockwork" task :stop do on roles(:app) do execute "if [ -d #{current_path} ] && [ -f #{pid_file} ]; then cd #{current_path} && kill -INT `cat #{pid_file}` ; fi" end end desc "Start clockwork" task :start do on roles(:app) do execute "daemon --inherit --n...
class EmojisController < ApplicationController before_action :authenticate_user!, :except => [:show] def index redirect_to root_path end def create emoji_params[:image_file].each do |emoji_file| filename = emoji_file.original_filename.gsub(/\.gif/, '') tag_list = split_into_array(emoji_params[:tag_list]...
$:.push File.expand_path("../lib", __FILE__) require "entity_store_sequel/version" Gem::Specification.new do |s| s.name = "entity_store_sequel" s.version = EntityStoreSequel::VERSION.dup s.platform = Gem::Platform::RUBY s.summary = "Sequel body for Entity Store" s.email = "stephen@cro...
class AdminsController < ApplicationController def new @admin = Admin.new end def create @admin = Admin.new(admin_credentials) if @admin.authenticated? flash[:success] = 'logged in as admin' sign_in(@admin, @admin.stay_signed_in != '0') redirect_to categories_path else fl...
class User < ApplicationRecord has_many :reviews has_many :locations, through: :reviews has_many :event_users has_many :events, through: :event_users has_secure_password validates :username, uniqueness: true def self.search(search) where("name LIKE ? OR username LIKE ?", "%#{search}%", "%#{search}%")...
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Sessions' do def login(shop) OmniAuth.config.test_mode = true OmniAuth.config.add_mock(:shopify, provider: 'shopify', uid: shop.shopify_domain, credentia...
class AddPasswordResetToken < ActiveRecord::Migration def change add_column :users, :password_reset_token, :string add_index :users, :password_reset_token add_column :users, :password_reset_token_date, :datetime end end
require 'page-object' require 'watir' class DynamicLoading include PageObject page_url('http://the-internet.herokuapp.com/dynamic_loading') link(:link_hidden, href: '/dynamic_loading/1') link(:link_dynamic, href: '/dynamic_loading/2') button(:button_start, text: 'Start') h4(:hello_world, text: 'Hello...
# # Point Mutations # A mutation is simply a mistake that occurs during the creation or copying of a nucleic acid, in particular DNA. Because nucleic acids are vital to cellular functions, mutations tend to cause a ripple effect throughout the cell. Although mutations are technically mistakes, a very rare mutation may ...
class CreateStopStats < ActiveRecord::Migration def change create_table :stop_stats do |t| t.string :action t.decimal :monthly_avg, {:precision => 6, :scale => 1} t.date :month_begin t.integer :stop_id end add_index :stop_stats, :stop_id add_index :stop_stats, :monthly_avg e...
Pod::Spec.new do |s| s.name = 'MWPhotoBrowser-Fork' s.version = '0.0.2' s.platform = :ios s.license = 'MIT' s.summary = 'A simple iOS photo browser.' s.homepage = 'https://github.com/mwaterfall/MWPhotoBrowser' s.author = { 'Michael Waterfall' => 'mw@d3i.com' } s.source = { :git => 'https:...
class RenameForms < ActiveRecord::Migration[6.0] def change rename_column :forms, :meil, :mail end end
# require File.expand_path(File.join(File.dirname(__FILE__), '..' ,'spec_helper',)) require 'cocaine' describe 'tests to test the gem' do it 'fails logically' do expect(1).to eq(2) end it 'b' do end it 'c' do end it 'pends' do pending raise end it 'raises a simple error' do raise ...
module AdvertisementManagement class Engine < ::Rails::Engine isolate_namespace AdvertisementManagement # 階層化したlocalesの読み込み config.paths['config/locales'].glob = "**/*.{rb,yml}" config.generators do |g| g.test_framework :rspec, :view_specs => false end config.assets.precompile += [con...
require 'spec_helper' describe AngellistApi::Client::Reviews do let(:client) { AngellistApi::Client.new } describe "#get_reviews" do it "gets 1/reviews" do options = { :some => "options" } client.should_receive(:get).with("1/reviews", options).and_return("success") client.get_reviews(options...
# If we want to load our ohai_plugins via the ohai::default recipe # we do it this way, however we must include this recipe if we want these plugins to load node.set['ohai']['plugins'][cookbook_name] = 'ohai_plugins' include_recipe 'ohai' # although I thought about actually installing them into the gem dir # # I supp...
require 'rails_helper' RSpec.describe Contract, type: :model do it 'has a valid factory' do expect(create :contract).to be_valid end it { should belong_to :client } it { should have_many :contract_responsibles } it { should have_many :contract_responsible_financials } it { should have_many :contract_payments ...
require_relative '../../config/environment.rb' $prompt = TTY::Prompt.new def cli_subjects(choices) # Implement later if needed # pick = $prompt.select("", choices, filter: true, per_page: 10) # if pick == "Start over" # cli_legislators_or_bills_or_mostest # end # subj_choices = { # ...
class Volunteers def initialize(year:) @year = year end def relation_select volunteer_ids = GroupMembership.select(:person_id).shool_year(@year) pta_member_ids = PtaMembership.select(:person_id).school_year(@year) Person .active .default .where(id: volunteer_ids) .where....
module Social class Feedback < ApplicationRecord belongs_to :author, class_name: "User" end end
class OrderController < ApplicationController skip_before_action :verify_authenticity_token, :only => [:create] def index @orders = Order.all end def create @order = Order.new(:name => order_params['name'], :adress => order_params['adress']); @order.p...
class SoundFilesController < ApplicationController before_filter :authenticate_user! def toggle_publish sound_file = SoundFile.find(params[:id]) if sound_file.publish == true sound_file.publish = false else sound_file.publish = true end sound_file.save end def update_...
#!/usr/bin/env ruby def gamma_ln_approx(a) # approximation for a > 6 t = a + 5.5 (a + 0.5) * Math.log(t) - t end def gamma_ln_series(a) coefficients = [ 76.18009172947146, -86.50532032941677, 24.01409824083091, -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5 ] ...
# frozen_string_literal: true module Decidim module Opinions # A module with all the hash tags common methods for opinions # and collaborative draft commands. module HashtagsMethods private def title_with_hashtags @title_with_hashtags ||= Decidim::ContentProcessor.parse_with_processo...
require 'spec_helper' provider_class = Puppet::Type.type(:postfix_master).provider(:augeas) describe provider_class do before :each do Puppet::Type.type(:postfix_master).stubs(:defaultprovider).returns described_class FileTest.stubs(:exist?).returns false FileTest.stubs(:exist?).with('/etc/postfix/maste...
module ApplicationHelper # Display page title def page_title prefix = "#{current_page.data.title} | " if current_page.data.title suffix = data.site.title unless data.site.title raise "Site title is missing: add a `title` field in `data/site.yml`" end prefix + suffix end # Display sit...
# coding: us-ascii # Copyright (c) 2015 Kenichi Kamiya class Integer def divisor?(n) return true if zero? && n.zero? return false if n.zero? (self % n).zero? end def divisors case when zero? [0] when self > 0 1.upto(self).select { |n| divisor? n } when self < 0 u...
class Item < ActiveRecord::Base attr_accessible :name, :description validates_presence_of :name, :description has_many :comments end
require 'pathname' module HamlHelper # # acts like haml_tag, capture_haml, or haml_concat, depending on how it is called. # # two or more args --> like haml_tag # one arg and a block --> like haml_tag # zero args and a block --> like capture_haml # one arg and no block ...
describe Notifier, "Signup Email" do include Rails.application.routes.url_helpers before(:each) do @user = create(:user, :email => 'myfake@email.com', :first_name => nil, :last_name => nil) @email = Notifier.signup_notification(@user.id) end it "should be set to be delivered to the emai...
# encoding: utf-8 # frozen_string_literal: true RSpec.describe TTY::Tree::Node do it "provides directory stats" do dir = fixtures_path('dir1') node = TTY::Tree::Node.new(dir, '', '', 0) expect(node.directory?).to eq(true) expect(node.file?).to eq(false) expect(node.symlink?).to eq(false) exp...
require 'rails_helper' feature 'user sends images', active_job: true do let(:message_body) { 'You have an appointment tomorrow at 10am' } let(:rr) { create :reporting_relationship } let(:user) { rr.user } let(:client) { rr.client } before do login_as(user, scope: :user) end scenario 'user sends im...
module ActiveTools module Misc module ScriptFlow class Map attr_reader :content delegate :any?, :empty?, :to => :content def initialize @content = ::ActiveSupport::OrderedHash.new { |h,k| h[k] = ::ActiveSupport::SafeBuffer.new } end # Called by _layout_fo...
class EmailNotifier def initialize(email_config) @config = email_config end def send_message(commit_number, commit_info) require 'net/smtp' message = compose_message(commit_number, commit_info) send message end private def compose_message(commit_number, commit_info) message_header...
class AddRatingsOnUsers < ActiveRecord::Migration[5.0] def change add_column :users, :rating, :integer User.update_all(rating: 0) end end
require 'spec_helper' describe SimpleMoney::Money do let(:currency) { SimpleMoney::Currency.new(:name => 'Spec Currency', :iso_code => 'XYZ', :symbol => '$', :decimal_places => 2) } let(:money) { SimpleMoney::Money.new(currency, 123) } subject { SimpleMoney::Money } describe "simple" do before do ...
class Font3270 < Formula version "2.0.4,ece94f6" sha256 "d5755c4774eb5ab81b8284d53021930ec55b191ab977f14d27b25c6f33358963" url "https://github.com/rbanffy/3270font/releases/download/v#{version.to_s.sub(/,.*/, "")}/3270_fonts_#{version.to_s.sub(/.*,/, "")}.zip" desc "IBM 3270" homepage "https://github.com/rban...
# frozen_string_literal: true lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'growi/image_converter/version' Gem::Specification.new do |spec| spec.name = 'growi-image_converter' spec.version = Growi::ImageConverter::VERSION spec.authors ...
# frozen_string_literal: true require 'rails_helper' describe Common::HashHelpers do describe '#deep_compact' do it 'should deep compact a hash' do hash = { a: '', b: nil, c: { d: nil } } expect(described_class.deep_compact(hash)).to eq( a: ''...
class UsersController < ApplicationController before_action :user_setting, only: [:show] def show end private def user_setting @user = User.find(params[:id]) end end
# Add it up! # Complete each step below according to the challenge directions and # include it in this file. Also make sure everything that isn't code # is commented in the file. # I worked on this challenge [by myself, with: Mila Arinich ]. # 0. total Pseudocode # make sure all pseudocode is commented out! # Input...
module Regularization class RequerimentsController < ApplicationController layout 'layouts/portal/application' before_action :set_address before_action :validate_cpf_session, only: [:show, :bank_slip] def index end def new @requeriment = Requeriment.new end def create @r...
# Includes relationships to tags and taggins as well as a scope used for filtering. module Tagable extend ActiveSupport::Concern included do has_many :taggings, as: :taggable has_many :tags, through: :taggings scope :tags, (lambda do |tag_ids| tag_ids.reject!(&:empty?) joins(:tags).where(t...
class OrdersController < ApplicationController before_action :authenticate_user! before_action :SetItem, only: [:index, :create] before_action :move_to_index, only: [:index] def index if @item.user_id == current_user.id return redirect_to root_path end @order = OrderAddress.new end def cr...
# frozen_string_literal: true class CreateUsers < ActiveRecord::Migration[6.0] def self.up create_table :users do |t| ## Devise::DatabaseAuthenticatable t.string :email, null: false, default: "" t.string :encrypted_password, null: false, default: "" ## Devise::Rememberable ...
class RemoveTitleFromSeeds < ActiveRecord::Migration def change remove_column :seeds, :title, :string end end
require 'spec_helper' describe User do before(:each) do @valid_attributes = { :name => "User", :email => "user@test.com", :password => "12341234", :password_confirmation => "12341234" } end after(:each) do User.destroy_all end it "should be valid with valid_attributes" do ...
class Prestation < ApplicationRecord belongs_to :user belongs_to :category validates_uniqueness_of :category_id, :scope => :user_id, :message => "Vous avez déjà créé une proposition pour cette catégorie. RDV dans la section Profile du menu déroulant en haut à droite si vous souhaitez la modifier" has_many :gr...
require 'socket' class MessQ def initialize(host='0.0.0.0', port=8888) @host = host @port = port @q = [] end def messQ_server begin webserver = TCPServer.new(@host, @port) puts "messQ has been started at #{@host}:#{@port}" while (session = webserver.accept) request = se...
require 'spec_helper' describe 'puppler install command' do describe "with only Puppetfile in workdir" do before :all do puppler 'install' end it "runs without errors" do expect(@output).to be end it "creates modules directory" do expect(File).to exist('modules') end ...
require 'rails_helper' RSpec.describe Group, type: :model do user = User.create(email: 'user@domain.com', password: 'password', password_confirmation: 'password') it 'must have name' do expect { Group.create!(user: user) }.to raise_error expect { Group.create!(name: 'English words', user: user) }.to_not ...
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "debian-70rc1-x64" config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210.box" # Create a forwarded port mapping which allows access to a specific port # within the machine from a po...
class Victim < ApplicationRecord validates :rut, format: { with: /([0-3]{0,1}+).([000-999]{3}+).([000-999]{3}+)-([0-9])/, message: 'invalid' }, uniqueness: true end
require 'rails_helper' RSpec.describe 'Admin creates a new judge', type: :feature do let(:admin) { create(:user, :admin) } before do login_as(admin) end scenario 'creating a new judge' do judge_count = Judge.count visit new_admin_judge_path fill_in 'First Name', with: FFaker::Name.first_name...
class GroupsController < ApplicationController before_action :set_group, only: [:show, :edit, :update, :destroy, :search_teams, :update_teams] before_action :set_tournament, only: [:index, :new, :create] before_action :set_team, only: [:update_teams] # GET /groups # GET /groups.json def index @groups =...
Gem::Specification.new do |s| s.name = "turbogenerator" s.version = "0.4.0" s.date = "2015-03-12" s.summary = "turbo is a curl wrapper for make test based on HTTP more easier" s.description = "turbo is a curl wrapper for make test based on HTTP more easier" s.authors = ...
require 'test_helper' class BikesControllerTest < ActionDispatch::IntegrationTest setup do @bike = bikes(:one) end test "should get index" do get bikes_url assert_response :success end test "should get new" do get new_bike_url assert_response :success end test "should create bike" ...
require 'rim/command_helper' require 'rim/upload_module_helper' module RIM class UploadHelper < CommandHelper def initialize(workspace_root, review, logger, module_infos = nil) @module_helpers = [] @review = review super(workspace_root, logger, module_infos) end # upload all module changes into co...
require 'test_helper' require 'nokogiri' module NomadicCrawler class CurriculumParserTest < ActiveSupport::TestCase def setup course_info = {year: 2018, semester: 6, course_code: "002551", course_division: 1} cyberlecture_info = {year: 2018, semester: 6, course_code: "002060", cours...
# frozen_string_literal: true require_relative './item' require_relative './repository_helper' require 'time' require 'bigdecimal' # Item repository class class ItemRepository include RepositoryHelper def update(id, params) return nil unless @repository.key?(id) sig_fig = params[:unit_price].to_s.size - ...
class AddStatusToAttendances < ActiveRecord::Migration[5.1] def change add_column :attendances, :status, :string, default: false end end
class MovieCategory < ActiveRecord::Base belongs_to :movie belongs_to :category end
module Factory module Factory def get_factory(classname:) factory = nil begin factory = Class.forName.new rescue => ClassNotFoundException puts "クラス#{classname}が見つかりません。" rescue => exception e.backtrace end end def create_link(caption:, url:) ...
# This class mostly exists to be instrumented by New Relic. Make sure any new methods set up an `add_transaction_tracer`. # https://docs.newrelic.com/docs/agents/ruby-agent/background-jobs/monitoring-ruby-background-processes-daemons#custom_background_jobs class ClockTasks def self.send_daily_ncr_budget_report Re...
# How could we go about changing the to_s output on this method to look like this: I am a tabby cat? (this is assuming that "tabby" is the type we passed in during initialization). class Cat attr_reader :type def initialize(type) @type = type end def to_s "I am a #{type}." end end lucy = Cat.new('...
class CreateSchools < ActiveRecord::Migration def change create_table :schools do |t| t.string :name, null: false t.integer :town_id, null: false t.string :address, null: false t.string :contact_name, null: false t.string :email, null: false t.string :encrypted_password, null: ...
class Text < ActiveFedora::Base include CurationConcern::CaseWork include ActionView::Helpers::AssetTagHelper self.human_readable_short_description = "Any Text work, preferably with TEI xml attached." self.accept_datastream_attachments ["TEI", "TEIP5", "MODS", "METS", "QDC"] def tei? datastreams['TEIP5'...
class FontRaviPrakash < Formula head "https://github.com/google/fonts/raw/main/ofl/raviprakash/RaviPrakash-Regular.ttf", verified: "github.com/google/fonts/" desc "Ravi Prakash" homepage "https://fonts.google.com/specimen/Ravi+Prakash" def install (share/"fonts").install "RaviPrakash-Regular.ttf" end te...