text
stringlengths
10
2.61M
lass AddSeasonToShows < ActiveRecord::Migration[5.2] def change create_column :seasons do |s| s.string :season end end end
class Appointment < ActiveRecord::Base include ActionView::Helpers::DateHelper belongs_to :user belongs_to :customer validates_presence_of :apt_start, :message => '^Appointment Start Time Can Not Be Blank!' validates_presence_of :apt_end, :message => '^Your Appointment Currently Does Not Have An End Time' ...
# # Author:: Tim Smith(<tsmith84@gmail.com>) # Cookbook Name:: sssd_ldap # Recipe:: default # # Copyright 2013-2014, Limelight Networks, Inc. # # 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 the License at #...
def rotate_array(arr) new_arr = arr[1..-1].each_with_object([]) do |element, new_arr| new_arr << element end new_arr << arr[0] end # p rotate_array([7, 3, 5, 2, 9, 1]) == [3, 5, 2, 9, 1, 7] # p rotate_array(['a', 'b', 'c']) == ['b', 'c', 'a'] # p rotate_array(['a']) == ['a'] x = [1, 2, ...
require 'time' require 'date' require_relative 'sales_engine' class SalesAnalyst attr_reader :items, :merchants, :invoices, :invoice_items, :transactions, :customers def initialize(items, merchants, invoices, transactions, invoice_items, custom...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'bisu/version' Gem::Specification.new do |spec| spec.name = 'bisu' spec.version = Bisu::VERSION spec.authors = ['Hannes Fostie'] spec.email = ['hannes.fostie@g...
module IGN module Resource class Game < Base has_attribute :name, :handle, :id, :rating, :release_date, :thumb, :description, :publisher, :platforms end end end
require 'rails_helper' RSpec.describe ApiUser do context 'with invalid attribute' do before do @api_user = ApiUser.new end it 'should not be valid' do @api_user.valid? @api_user.errors.full_messages.should match_array([ "Password Password is missing", "Password is too s...
ActsAsTalented::Engine.routes.draw do mount JasmineRails::Engine => '/specs' if defined?(JasmineRails) devise_for :employers, class_name: "ActsAsTalented::Employer", module: :devise # root "dashboard#index" namespace :api, defaults: {format: 'json'} do namespace :v1 do resources :employers end en...
class AddColumnsToEventMasters < ActiveRecord::Migration def change add_column :event_masters, :admin_contact_no, :string add_column :event_masters, :admin_contact_email, :string add_column :event_masters, :map_location, :string add_column :event_masters, :is_terms_and_condition, :boolean ad...
class Resources::QuestionsController < ResourcesController def answers question = Qa::Question.find_by_param! params[:id] sort = params[:sort] || "most_helpful" per_page = params[:per_page].try(:to_i) || default_number_of_answers page = params[:page].try(:to_i) || 1 offset = (page - 1) * p...
# See GitHubV3API documentation in lib/github_v3_api.rb class GitHubV3API # Represents a single GitHub Issue and provides access to its data attributes. class Issue < Entity attr_reader :url, :html_url, :number, :state, :title, :body, :user, :labels, :assignee, :milestone, :comments, :pull_reque...
class Activity class Import class ImplementingOrganisationBuilder FIELDS = { "implementing_organisation_names" => "Implementing organisation names" }.freeze attr_accessor :activity, :org_names def initialize(activity, row) @activity = activity @org_names = split_o...
#Defining a method that increases each letter of the string by one. #def encrypt(word) # #Initialized the counter outside the loop. # i = 0 # #Iterating through each index until it matches the given word length. # until i == word.length # #Printing the incremented letter following each index. # next_word = w...
require "spec_helper" describe AuthenticJwt::Validator do subject(:validator) { AuthenticJwt::Validator.new } let(:valid_jwt) { "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzUxMiJ9.eyJzdWIiOiIxOTA3Iiwicm9sZXMiOlsiQURNSU4iXSwibmFtZSI6IlN0ZXZlIEhvZWtzZW1hIiwiZW1haWwiOiJteXRvdXJzQGtvdGlyaS5jb20iLCJwYXJ0bmVycyI6W3siYXVkIjoibXl0b3Vy...
# Carry on here in Walkthrough: We can now flesh out the route, saving the submitted data to the database: # Controller class require 'sinatra/base' require 'sinatra/flash' require './models/bookmark' class BookmarkManager < Sinatra::Base register Sinatra::Flash enable :sessions get '/' do redirect '/bookm...
class FileHandler attr_accessor :object, :stream def initialize(object, stream) @object = object @stream = stream end def save begin fs = Mongoid.default_client.database.fs file = Mongo::Grid::File.new(stream.tempfile.read, filename: stream.original_filename, content_type: stream....
# Switch to SluggableJake gem # module Sluggable # extend ActiveSupport::Concern # included do # after_validation :generate_slug! # class_attribute :slug_column # end # def to_param # self.slug # end # def generate_slug! # alt_title = self.send(self.class.slug_column.to_sym).strip.gsu...
# frozen_string_literal: true require_relative 'base' class Landing < Base set_url '' element :item_input, '#item_text' element :save_button, '#button_submit' element :item_list, '#todo_list_id', :visible => false element :clear_button, '#clear_button' element :list_items, '.list-group-item' end
class BaseDecorator < Draper::Decorator delegate_all def decorated_class object.class end def decorated_class_human decorated_class.to_s.underscore.humanize end def decorated_class_plural_underscore decorated_class.to_s.pluralize.underscore end end
namespace :user do desc "Create a User" task :login, [:email, :password, :password_confirmation] => :environment do |task, args| puts "Gerando o usuário padrão..." User.create!( email: args[:email], password: args[:password], password_confirmation: args[:password_confirmation] ) ...
class AddColumnToEndUsers < ActiveRecord::Migration[5.2] def change add_column :end_users, :family_name, :string, default: "", null: false add_column :end_users, :first_name, :string, default: "", null: false add_column :end_users, :family_name_kana, :string, default: "", null: false add_column :end_u...
class Store < ApplicationRecord belongs_to :user validates_presence_of :name validates :api_key, presence: true, length: { is: 32 } validate :valid_url? private def valid_url? uri = URI.parse(url) uri.is_a?(URI::HTTP) && !uri.host.nil? rescue URI::InvalidURIError errors.add(:url, 'Invalid ...
=begin This plugin allows Thorog to update the database remotely, scping the file into place and running a shiny plugin to run it, then deleting the update file so I can't screw everything over. =end Command.new do name "Update" desc "Allows admins to update the newsboard" help <<-eof This command allows Thor...
class CreateAddresses < ActiveRecord::Migration[5.2] def change create_table :addresses do |t| t.integer :post_address t.string :prefecture t.string :city t.integer :house_number t.string :building_name t.integer :tel t.timestamps end end end
class VersionManager < ActiveRecord::Base attr_accessible :kind, :version validates :kind, presence: true, format: {with: /\A\w.+\Z/, message: 'only words are allowed'} validates :version, presence: true, format: {with: /\A\w.+\Z/, message: 'only words are allowed'}...
# -*- encoding : utf-8 -*- class Staffobjectjournal < ActiveRecord::Base belongs_to :staff belongs_to :workobject attr_accessible :edate, :sdate, :staff_id, :workobject_id, :status validates :edate, presence: true validates :sdate, presence: true validates :staff_id, presence: true validates :workobject_...
require "minitest/autorun" require "functions_framework/testing" class AppTest < MiniTest::Test include FunctionsFramework::Testing def test_should_return_ok load_temporary "app.rb" do request = make_post_request "http://localhost", '{"name": "Ruby"}', ...
module UiMockHelper S3_DATA_BUCKET = 'ctrp-bddtest-mock-data' DEFAULT_LOCAL_ROOT = "#{Rails.root}/public/data_bucket" UI_MOCK_FOLDER = 'ui_mock' def self.get_search(type, action) puts "****Rails.env.development? #{Rails.env.development?}" puts action.inspect file_name = action=='cols' ? "search_#{t...
require File.expand_path(File.dirname(__FILE__) + "/../../test_helper") class Admin::ArticlesControllerTest < ActionController::TestCase def setup super @request.env['HTTPS'] = 'on' # Admin::BaseController req's SSL @user = Factory :superuser @ai = Factory :article_instance @session_hash ...
class AppliancesController < ApplicationController def index render json: Appliance.all end private def appliance_params params.require(:appliance).permit(:name, :load, :duration, :image) end end
require './lib/game.rb' require './lib/gameboard.rb' Dir["./lib/pieces/*.rb"].each {|file| require file } require 'stringio' describe Game do let(:game) { Game.new } before(:each) do @board = Gameboard.new @gameboard = @board.board @dummyboard = Gameboard.new end it "creates a...
Rails.application.routes.draw do root "pages#index" namespace :api do resources :cards, only: [:index, :update] resources :columns, only: [:index] end end
class PollsController < ApplicationController before_action :set_poll, only: [:show, :edit, :update, :destroy] def index @polls = Poll.all respond_with(@polls) end def show respond_with(@poll) end def new @poll = Poll.new respond_with(@poll) end def edit end def create @...
require 'csv' class BoardStateWithResultOpponent PATH_TO_RAW_DATA = "/training_data/board_state_with_result.csv" def self.parse_raw_data_file inputs = [] outputs = [] CSV.foreach(File.join(Rails.root,PATH_TO_RAW_DATA)) do |row| inputs << (0...18).collect{|i| row[i].to_f} outputs << [row[1...
Rails.application.routes.draw do root 'users#new' resources :users end
class Preference < ApplicationRecord has_many :partner_to_preference has_many :partners, through: :partner_to_preference end
class CreateFinishingPosition < ActiveRecord::Migration[5.2] def change create_table :finishing_positions do |t| t.integer :final_position t.integer :race_id t.integer :driver_id t.integer :game_id end end end
class PushNotificationSubscription < ActiveRecord::Base # The push_notification_subscription table tracks the # resources that a given user has expressed a desire # to receive push notifications from. For example, # if a user gives a good rating on a menu item, he # might be subscribed to that item. # NOT...
class OrderMailer < ApplicationMailer default from: 'notifications@example.com' def order_email attachments['film.png'] = File.read(Rails.root.join('tmp', 'film.png')) mail(to: 'pupu1416@yahoo.com.tw', subject: 'Test') end end
class Friendship < ActiveRecord::Base attr_accessible :friend_id, :user_id, :email, :username belongs_to :friend, class_name: "User", :foreign_key => 'friend_id' belongs_to :user validate :email_or_username def email_or_username Rails.logger.ingo('gimme some info') if false unless (User.find_by_use...
#!/usr/bin/ruby require 'set' x_fails = Set.new ['O','.'] o_fails = Set.new ['X','.'] File.open(ARGV[0]) do |file| num_cases = file.readline.to_i (1..num_cases).each do |case_num| x = Hash.new { |h,k| h[k] = Set.new } o = Hash.new { |h,k| h[k] = Set.new } unplayed_spots = 0 table = (0...4).map {...
#!/bin/ruby require 'optparse' require 'securerandom' opts = ARGV.getopts('N') if opts['N'] file_size = 0 encoded_string = "" open 'source.txt' do |f| file_size = f.stat.size encoded_string = "\t.byte " f.each_byte do |b| encoded_string << "0x#{b.to_s(16)}," end encoded_string.chomp...
class CreateWeathers < ActiveRecord::Migration[5.2] #define a change method in which to do the migration def change create_table :weathers do |t| t.string :description t.string :precipitation t.integer :temperature t.integer :search_id t.timestamps end end end
class EquipmentsController < ApplicationController def new @equipment = Equipment.new end def create @equipment = Equipment.new(equipment_params) @equipment.user = current_user @cruise = Cruise.find(params[:cruise_id]) @equipment.cruise = @cruise if @equipment.save redirect_to equi...
class BizPhoto < ApplicationRecord validates :user_id, :business_id, presence: true has_one_attached :picture validate :ensure_photo def ensure_photo unless self.picture.attached? errors[:picture] << "must be attached" end end belongs_to :user, foreign_key...
dbnodes = search(:node, "*:*") dbnodes.each do |n| template "/tmp/#{n["hostname"]}" do source "hosts.erb" mode "0644" owner node["current_user"] group node["current_user"] #variables :hostname => n["hostname"], :ip=>n["ipaddress"] variables({ :hostname => n["hostname"], :ip => ...
class UserProfile < ActiveRecord::Base has_many :comments has_many :notifications end
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "autouncle_branding_rails/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "autouncle_branding_rails" s.version = AutouncleBrandingRails::VERSION s.authors = ["Cris...
class Post < ApplicationRecord belongs_to :user has_many :post_tags, dependent: :destroy has_many :comments, dependent: :destroy validates :title, presence: true, length: {maximum: Settings.post.maximum_of_title} validates :content, presence: true, length: {maximum: Settings.post.maximum_of_content} valida...
class SlackService class << self CHANNELS = { github: "#github_noti", error: Rails.env.production? ? "#production_error" : "#development", log: Rails.env.production? ? "#production_log" : "#development", } def send_message(title, msg, channel = :log) title = "🤔 " + title if...
module Cache class StructHelper < Struct class << self def build_struct(hash) struct = new(*hash.keys.map(&:to_sym)) struct.new(*hash.values) end end end end
class ApplicationController < ActionController::Base protect_from_forgery before_filter :print_params private def print_params puts params.inspect end end
require 'rails_helper' RSpec.describe WorksController, type: :controller do before(:each) do @user = create :user sign_in @user end describe 'GET /index' do before(:each) do get :index end it 'returns http success' do expect(response).to have_http_status(:success) end i...
class EquipmentController < ApplicationController def create @equipment = current_user.equipment.new(equipment_params) redirect_to owner_profile_path, notice: 'Equipment was successfully added.' if @equipment.save end def destroy @equipment = Equipment.find(params[:id]) @equipment.destroy re...
#!/usr/bin/ruby -w # This program reads in a CSV file of widgets and re-formats it to a new file require 'csv' widgets = CSV.read('widgets.csv') # file to read out = File.new('widgets.out', 'w+') # file to write to widgets.each do |row| # the last two columns need to be swapped for proper formatting row[row.size-...
require 'rails_helper' RSpec.describe "products/edit", type: :view do let(:valid_attributes) { { name: 'Sneakers', price: 49.99, quantity: 4 } } before(:each) do @product = Product.create! valid_attributes end it "renders the edit product form" do render assert_select "form[action=?][method=?]", ...
# frozen_string_literal: true require 'integration_test_helper' require 'kubernetes-deploy/restart_task' class RestartTaskTest < KubernetesDeploy::IntegrationTest def test_restart_by_annotation assert_deploy_success(deploy_fixtures("hello-cloud", subset: ["configmap-data.yml", "web.yml.erb", "redis.yml"])) ...
require 'test_helper' class MonthTest < ActiveSupport::TestCase context 'Month' do setup do @first_of_february_2004 = Time.zone.local(2004,2,1).to_date end should 'initialize by first day' do month = Month.new(@first_of_february_2004) assert_equal Time.zone.local(2004, 2, 1).to_date, ...
# frozen_string_literal: true require 'dry/monads/try' module SC::Billing::Stripe::Subscriptions class CreateOperation < ::SC::Billing::BaseOperation include Dry::Monads::Try::Mixin def call(user, items:, coupon: nil) Try(Stripe::InvalidRequestError, Stripe::CardError) do subscription_data = ...
require File.expand_path('../boot', __FILE__) require 'rails' # Pick the frameworks you want: require 'active_model/railtie' require 'active_job/railtie' require 'active_record/railtie' require 'action_controller/railtie' require 'action_mailer/railtie' require 'action_view/railtie' require 'action_cable/engine' requi...
require_relative "../lib/concerns/findable.rb" class Genre attr_accessor :name attr_reader :songs extend Concerns::Findable @@all =[] def initialize(name) @name = name @songs = [] end def save @@all << self end def self.all @@all end def self.destroy_all @@all.clear end de...
# pls execute me with ruby main.rb in the dir of the files, ruby being installed require "#{Dir.pwd}/module_container" puts 'by just using REQUIRE, class methods can be accessed namespaced i.e:' Modular::class_printer Modular.class_printer begin Modular.instance_printer rescue NoMethodError puts 'instance method...
class AddUnitToRecipeIngredients < ActiveRecord::Migration[6.0] def change add_column :recipe_ingredients, :unit, :string rename_column :recipe_ingredients, :portions, :default_amount end end
class ProfanitiesAddOwnerIndex < ActiveRecord::Migration def self.up add_index :profanities, [:owner_type, :owner_id], :name => "profanities_owner_type_owner_id_index" end def self.down remove_index :profanities, :name => :profanities_owner_type_owner_id_index end end
# Pseudocode # # INPUT: account number (9-digit integer) # OUTPUT: true if account is valid, false otherwise # Example: # account number: 3 4 5 8 8 2 8 6 5 # position names: d9 d8 d7 d6 d5 d4 d3 d2 d1 # # checksum calculation: # (d1+2*d2+3*d3 +..+9*d9) mod 11 = 0 # # 1. split account number into array of sin...
module LemonadeStand class HeatWaveEvent < Event; def modify choice choice.max_sales * 2 end end end
require 'sqlite3' module AIBot::Store class SQLiteDataStore attr_reader :store def initialize(configuration) if configuration[:file] data_store_file = File.expand_path(configuration[:file]) File.new(data_store_file, 'w') unless File.exists?(data_store_file) @store = SQLite3::Da...
require 'matrix' module HullMath def HullMath.standardFormOfLineFunction(a_point, b_point) a = b_point.y - a_point.y b = a_point.x - b_point.x c = a_point.x * b_point.y - a_point.y * b_point.x return Proc.new { |point| if (a*point.x + b*point.y > c) 1 # (x, y) is on t...
# Modelo Medicamento # Tabla medicamentos # Campos id:integer # nombre:string # created_at:datetime # updated_at:datetime class Medicamento < ActiveRecord::Base has_many :medicamentos_favoritos, class_name: 'MedicamentoFavorito', inverse_of: :medicamento, ...
require 'artoo/drivers/driver' module Artoo module Drivers # The Sphero driver behaviors class Sphero < Driver RED = [255, 0, 0] GREEN = [0, 255, 0] YELLOW = [255, 255, 0] BLUE = [0, 0, 255] WHITE = [255, 255, 255] COMMANDS = [:roll, :stop, :detect_co...
require 'pry' DIGITS = { 0 => '0', 1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '6', 7 => '7', 8 => '8', 9 => '9', } def integer_to_string(int) new_array = [] int.digits.reverse.each do |num| new_array << DIGITS[num] end new_array.join end def signed_integer_to_string(number) if number <...
require File.expand_path("shotgun", File.dirname(__FILE__)) Dir[root("lib/**/*.rb")].each { |rb| require rb } Encoding.default_external = Encoding::UTF_8 Encoding.default_internal = Encoding::UTF_8 # Possibly simplest and cleanest way of publishing a global configuration # object. OpenRedis = Hashie::Mash.new(YAML....
class Text < ActiveRecord::Base ALTERATIONS = ['Disemvowel', 'Munge', 'ROT 13'] attr_accessor :alteration attr_accessible :text, :alteration before_create :alter private def alter case alteration when 'Disemvowel' disemvowel when 'Munge' munge when 'ROT 13' rot_13 el...
require 'spec_helper' describe 'right_meow' do describe "Time#meow" do it "matches at the same instant" do meow = Time.meow now = Time.now expect(now.to_i).to eq(meow.to_i) end it "does not match at a different instant" do meow = Time.meow sleep(1) now = Time.now ...
# == Schema Information # # Table name: prescriptions # # id :integer not null, primary key # patient_name :string not null # patient_address :string not null # patient_birth_date :date not null # created_at :datetime not null # upd...
class Ingredient < ActiveRecord::Base has_many :toppings has_many :crepes, through: :toppings mount_uploader :photo, ItemPhotoUploader end
require "rails_helper" require "sidekiq/api" RSpec.describe "Health Check", type: :request do it "returns an ok HTTP status code without requiring authentication" do ClimateControl.modify CURRENT_SHA: "b9c73f88", TIME_OF_BUILD: "2020-01-01T00:00:00Z" do get "/health_check", headers: {"CONTENT_TYPE" => "app...
class Visuals class MapRenderer # One sprite for one (x,y) position. Holds multiple sprites for multiple layers. class TileSprite attr_reader :real_x attr_reader :real_y attr_accessor :mapx attr_accessor :mapy attr_accessor :sprites def initialize(viewport) @sprite...
class Term < ApplicationRecord include Concerns::HasIds MIN = -2**16 MAX = 2**26 belongs_to :technology has_many :term_assessments, dependent: :destroy has_many :assessments, through: :term_assessments has_many :vulnerabilities, through: :assessments validates :term, presence: true, uniqueness: { sc...
module IGN module Resource class Base class << self attr_reader :attributes def has_attribute(*attrs) @attributes = [*attrs] attr_reader(*attrs) end end def initialize(info = {}) info.slice(*attributes).each do |attr, value| instanc...
class JiraBug < ActiveRecord::Base # assignee_name # summary # status # jira_name belongs_to :creator, :class_name => 'User', :foreign_key => 'creator_id' belongs_to :package, :class_name => 'Package', :foreign_key => 'package_id' def creator return User.find(self.creator_id) end end
class AddDescriptionFieldToShopAndRestaurant < ActiveRecord::Migration def change add_column :shops, :description, :text, default: '' add_column :restaurants, :description, :text, default: '' end end
class CreateReviews < ActiveRecord::Migration[5.2] def change create_table :reviews do |t| t.integer :evaluation_id t.integer :user_id t.integer :trip_id t.integer :evaluation_image_id t.string :comment t.string :month t.datetime :timezone_start t.datetime :timezone...
class Ability include CanCan::Ability def initialize(user) user ||= User.new alias_action :create, :read, :update, :destroy, to: :crud p user if user.role == "Campus Director" can :manage, :all elsif user.role == "Instructor/TA" can :crud, Project can :crud, :transmits c...
class Event @@event_count = 0 def initialize(name, date, location) @name = name @date = date @location = location @@event_count += 1 end def self.get_count return @@event_count end def self.remove_count @@event_count -= 1 end def get_name return @name end def get_dat...
class AdTagAddLeafUpperRightToPlacements < ActiveRecord::Migration def self.up change_column :ad_tags, :placement, :enum, AdTag::PLACEMENT_DB_OPTS end def self.down end end
# frozen_string_literal: true require 'deep_merge/core' module Diplomat # Base class for interacting with the Consul RESTful API class RestClient @access_methods = [] @configuration = nil # Initialize the fadaray connection # @param api_connection [Faraday::Connection,nil] supply mock API Connect...
ActiveAdmin.register AuthForum::About do menu label: 'About' controller do def create about = AuthForum::About.new(about_params) if about.save redirect_to admin_auth_forum_about_path(about) else render 'new' end end def update about = AuthForum::About.find_...
class Thesauru < ApplicationRecord has_many :meters, inverse_of: :thesauru has_many :mesubstations, inverse_of: :thesauru validates :name, presence: true validates :cvalue, presence: true end
class InitialsAvatar < Sinatra::Base # Canvas sizes DEFAULT_OUTPUT_SIZE = 100 MIN_CANVAS_SIZE = 100 # Font size as a proportion of the canvas FONT_RATIO = 0.30 # Shift down text 4% from the center, since we're using caps Y_OFFSET = -0.01 # Resize filter and sharpness settings # See http://stackover...
json.array!(@reportefacturas) do |reportefactura| json.extract! reportefactura, :id json.url reportefactura_url(reportefactura, format: :json) end
class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :first_name t.string :last_name t.string :sex, default: 'Not Set' t.string :email, null: false t.string :username, null: false t.string :image t.string :password_digest t.st...
class CreateInvoices < ActiveRecord::Migration def change create_table :invoices do |t| t.string :charge t.references :account t.datetime :charge_date t.time :deleted_at t.timestamps end add_index :invoices, :account_id end end
require 'acceptance_spec_helper' RSpec.describe 'GET /' do include_context 'Api Authentication' When { get root_path } Then { expect(last_response.status).to be 200 } And { expect(last_response.headers).to include('Content-Type' => 'application/hal+json') } And { expect(last_response.body).to be_hal } A...
require 'spec_helper' describe Playlist do let!(:escape) { FactoryGirl.create(:escape) } let!(:metro) { FactoryGirl.create(:metro) } let!(:unique_song) { FactoryGirl.create(:unique_song, :metro_id => metro.id) } let!(:artist) { unique_song.artist } let!(:rdio_track) { FactoryGirl.create(:rdio_track) } let!(:rdio...
class AddSampleGroup < ActiveRecord::Migration def change create_table :sample_groups, id: :uuid do |t| t.uuid :parent_structure_id, null: false, index: true t.uuid :audit_strc_type_id, null: false t.string :name, null: false t.integer :n_structures t.datetime :successful_upload_on ...
SimpleConfig.for :application do group :api do group :coingate do set :url, 'https://api-sandbox.coingate.com' set :auth_token, ENV["COINGATE_AUTH_TOKEN"] end end end
class Color < Dry::Struct attribute :name, Types::String.enum(*Domain::Color::COLORS.keys) def self.build_all_colors Domain::Color::COLORS.keys.map do |name| self.new(name: name) end end def self.build_white_color self.new(name: Domain::Color::WHITE_COLOR_NAME) end def self.valid_name?(...
#============================================================================== # * Game mode configuration #============================================================================== #tag: game_mode module PONY::GameMode #------------------------------------------------------------------------------ GameMode =...