text
stringlengths
10
2.61M
FactoryGirl.define do factory :team, class: Wildcat::Team do id { SecureRandom.random_number(1e2.to_i) } name { ["Baltimore Ravens", "Carolina Panthers"].sample } nickname { name.split(' ').last } abbreviation { ["BAL", "CAR"].sample } location { "#{Forgery(:address...
# A cache store implementation which stores everything into memory in the # same process. If you're running multiple Ruby on Rails server processes # (which is the case if you're using mongrel_cluster or Phusion Passenger), # then this means that your Rails server process instances won't be able # to share cache data w...
When("I hover over the main Image") do @PdpNina.zoom_mouse_image end Then("I should see the zoomed image pop up") do @PdpNina.zoom_mouse_image expect(page).to have_content(@PdpNina.getZoomedImg) end When("I Click the blue arrow in the Specifications section") do @PdpNina.clickExpandSpecifications sleep 2 e...
require "./ratio" require "./parser" begin if ARGV[0]==nil raise "Error" end s=ARGV[0] print(Parser.new(s).parse().to_str) rescue => error print("Error") end
# frozen_string_literal: true # A set of transformations that can be applied to a blob to create a variant. This class is exposed via # the ActiveStorage::Blob#variant method and should rarely be used directly. # # In case you do need to use this directly, it's instantiated using a hash of transformations where # the ...
class Admin::ContactsController < Admin::AdminController # GET /article_categories # GET /article_categories.json def index @contacts = Contact.paginate(:page => params[:page]).order('id') end # GET /article_categories/1 # GET /article_categories/1.json def show @contact = Contact.find(params[:id...
module OrderConcern extend ActiveSupport::Concern include ApplicationConcern include StateNameConcern attr_reader :order_id, :store, :products, :address, :client, :address, :marketplace, :order_params, :auth_token, :seller_id Address = Struct.new(:name, :line_1, :line_2, :line_3, :city, :state_or_province_...
# frozen_string_literal: true require 'spec_helper' RSpec.describe Brcobranca::Retorno::RetornoCnab400 do before do @arquivo = File.join(File.dirname(__FILE__), '..', '..', 'arquivos', 'CNAB400.RET') end it 'Ignora primeira linha que é header' do pagamentos = described_class.load_lines(@arquivo) pa...
class CreateFieldValues < ActiveRecord::Migration def change create_table :field_values do |t| t.string :value t.string :field_api_name, null: false t.integer :structure_id, null: false t.timestamps end add_foreign_key :field_values, :structures, on_delete: :cascade add_inde...
class StarsController < ApplicationController expose(:webinar) { Webinar.find(webinar_params[:webinar_id]) } expose(:star) def create star.user_id = current_user.id star.webinar_id = webinar.id if star.save redirect_to webinars_path else redirect_to webinars_path, error: I18n.t('contr...
class ChangeWp10DataType < ActiveRecord::Migration def change change_column :revisions, :wp10, :float change_column :revisions, :wp10_previous, :float end end
class HistoricalEvent < ApplicationRecord include Concerns::Images::ValidatesAttachment validates :title, :description, :date, presence: true, uniqueness: true resourcify end
require 'yaml' require 'ostruct' module Warren class << self attr_accessor :config end DEFAULT_CONFIG = { "node_name": "rabbit", "policies": {}, "base_mnesia_dir": '/var/lib/rabbitmq/mnesia', "log_base": '/var/lib/rabbitmq/infos', "log_level": Logger::INFO } def self.reset_config(co...
#payload json.user do json.partial! "./api/users/user", user: @user end json.tickets do @user.tickets.each do |ticket| json.set! ticket.id do #object of event names for which user registered json.extract! ticket, :id, :name, :description, :date, :time, :price, :capacity ...
require 'spec_helper' describe User do describe '.find_or_create_by_omniauth' do subject { User.find_or_create_by_omniauth(auth) } let(:auth) do { 'provider' => 'twitter', 'uid' => 'uid', 'info' => { 'name' => 'name' }, 'credentials' => { 'token' => 'token', ...
require 'integration_test_helper' class SpecialistSectorBrowsingTest < ActionDispatch::IntegrationTest should "render an specialist sector tag page and list its sub-categories" do subcategories = [ { slug: "oil-and-gas/wells", title: "Wells", description: "Wells, wells, wells." }, { slug: "oil-and-g...
class Post < ApplicationRecord belongs_to :user has_one :movie, as: :videoble accepts_nested_attributes_for :movie end
class AddTaraToAccount < ActiveRecord::Migration def change add_column :accounts, :tara, :string end end
# n method first # input - one 3-letter string representing a codon # output - one string representing the amino acid that corresponds to the given # codon OR an InvalidCodonError # rules: # explicit requirements # each of the 17 codons corresponds to an amino acid OR to STOP # if a STOP codon is re...
require 'digest/sha2' class User < ActiveRecord::Base # An user have many rooms has_many :rooms # oAuth has_many :client_applications has_many :tokens, :class_name => "OauthToken", :order => "authorized_at desc", :include => [:client_application] attr_accessor :password, :password_conf...
# frozen_string_literal: true require 'digest/md5' require 'param/secure_auth_header' require 'param/simple_auth_header' module Uploadcare module Param # This object returns headers needed for authentication # This authentication method is more secure, but more tedious class AuthenticationHeader #...
require 'bots/my_bot/contact' require 'bots/my_bot/detector' class Hostiles < Array def initialize(tank) @tank = tank end def <<(contact) contact = update(contact) contact ? super(contact) : self end def closest sort.find { |contact| !contact.lost?(time) } end def find(target) tar...
class CreateTsServiceDemandBreakdownUsagePatterns < ActiveRecord::Migration def change create_table :ts_service_demand_breakdown_usage_patterns do |t| t.integer :user_id t.references :service_demand_breakdown t.integer :year t.integer :month t.integer :date t.float :quantity ...
AutoStripAttributes::Config.setup do set_filter(upcase_first: false) do |value| !value.blank? && value.respond_to?(:upcase_first) ? value.upcase_first : value end end
class AddPhoneToUsers < ActiveRecord::Migration def change add_column :users, :phone_number, :string add_column :users, :time, :datetime end end
module RPG #============================================================================== # ** RPG::EquippableItem #--------------------------------------------------------------------------- # Inserisce gli attributi appropiati agli oggetti equipaggiabili #===================================================...
class Item < ActiveRecord::Base before_save :create_slug belongs_to :category has_many :descriptions has_many :images has_many :reviews has_many :likes validates :Name, presence: true validates :Description, presence: true accepts_nested_attributes_for :images, :allow_destroy => true accepts_nes...
# vim: ts=2 sts=2 et sw=2 ft=ruby fileencoding=utf-8 require "spec_helper" describe DMM::Response::Item do before :all do stub_get.to_return(xml_response("com.xml")) @item = DMM::new.item_list.result.items.first end describe 'methods which returns integer' do subject { @item } DMM::Response::Ite...
class CreateChartSavedConditions < ActiveRecord::Migration def self.up create_table :chart_saved_conditions do |t| t.string :name, :null => false t.integer :project_id, :null => true t.string :conditions, :null => false t.string :chart, :null => false end add_index :chart_saved_con...
require 'rails_helper' RSpec.describe PeopleController do describe 'index' do before do request.session[:admin] = true get :index end it do expect(response.status).to eq(200) end it do create :person, name: 'karol' expect(response.body).to match('<li>karol</li>') ...
class Gift < ApplicationRecord belongs_to :user validates :name, :date, :occasion, presence: true end
=begin #Location API #Geolocation, Geocoding and Maps OpenAPI spec version: 2.0.0 Generated by: https://openapi-generator.tech OpenAPI Generator version: 3.3.4 =end require 'date' module unwiredClient class RadioSchema GSM = '\"gsm\"'.freeze UTMS = '\"utms\"'.freeze CDMA = '\"cdma\"'.freeze ...
class User < ApplicationRecord has_secure_password has_many :posts, dependent: :destroy has_many :post_requests, dependent: :destroy has_many :transactions, dependent: :destroy has_many :banner_ads, dependent: :destroy has_many :brands, dependent: :destroy has_many :markers, dependent: :destroy has_many :logs, ...
# Represents a vertex in 3D space class Vertex attr_reader :x, :y, :z def initialize(*v) @x, @y, @z = v end def ==(vertex) x == vertex.x && y == vertex.y && z == vertex.z end end
class UsersController < ApplicationController layout "dashboard" before_action :load_user, only: [:show, :edit, :update] before_action :admin_only, except: [:edit, :update] # GET # Lista todos os usuários def index @users = User.all.page(params[:page]).per_page(10) end # Carrega o usuário e sal...
require_relative 'sample_data_macros' module AwardWalletMacros Response = Struct.new(:body) def self.included(base) base.extend ClassMethods base.include SampleDataMacros end def stub_award_wallet_api(json) response = Response.new(json) allow(Integrations::AwardWallet::APIClient).to receive(:...
class RemoveItemIdFromDeliveries < ActiveRecord::Migration def up remove_column :deliveries, :item_id end def down add_column :deliveries, :item_id, :integer end end
class CreateRanks < ActiveRecord::Migration def change create_table :ranks do |t| t.integer :rank t.references :mst_date, index: true, foreign_key: true t.references :mst_genre, index: true, foreign_key: true t.references :mst_music, index: true, foreign_key: true t.timestamps null:...
module Spree module Context module Taxon extend ActiveSupport::Concern include Spree::Context::Base included do class_attribute :request_fullpath cattr_accessor :context_routes #(:either, :list,:detail,:cart,:account,:checkout, :thanks,:signup,:login) sel...
class ChangeMemberStatusinAccountDetail < ActiveRecord::Migration[5.1] def change remove_column :account_details, :member_status, :string add_column :account_details, :member_status, :integer end end
require "bcrypt" module Castronaut module Adapters module Devise class User < ActiveRecord::Base cattr_accessor :encryptor, :stretches, :pepper def self.authenticate(username, password) if user = find_by_email(username) if user.valid_password?(p...
class Civilization attr_accessor :name, :unit_settings def initialize(name, unit_settings) @name = name @unit_settings = unit_settings end end
class Detail < ApplicationRecord belongs_to :plan validates :destination, presence: true, length: { maximum: 255 } validates :amount, :numericality => :only_integer validate :start_end_check VALID_PHONE_REGEX = /\A\d{10}$|^\d{11}\z|^\d{0}\z/ validates :phone, format: { with: VALID_PHONE_REGEX } VALID...
json.array!(@homeworks) do |homework| json.extract! homework, :id, :student_id, :class_name, :description, :status json.url homework_url(homework, format: :json) end
# # Gemfile # # Keeping a Gemfile up to date and especially updated Gems with security issues # is an important maintenance task. # # 1) Which Gems are out of date? # 2) Update a Gem # 3) Gemfile.lock # 4) Versioning # 5) Importance of a Gem to the Application # 6) Resetting Gems back to the original version # 7) Break...
#!/usr/bin/env ruby require File.expand_path(File.dirname(__FILE__) + '/capfile.rb') require 'json' require 'optparse' options = {:path => ".", :output => "capfile.json"} OptionParser.new do |opts| opts.banner = "Usage: strano.rb [options]" opts.on('-p path', '--path=path', 'Application path') { |path| option...
# frozen_string_literal: true ## # Follow the link to see how controllers are managed in Ruby on Rails: # {Action View Controller}[https://guides.rubyonrails.org/action_controller_overview.html]. class ApplicationController < ActionController::Base end
LanshanServer::Admin.controllers :cats do get :index do @title = "Cats" @cats = Cat.all.paginate(:page => params[:page]).order("created_at DESC") render 'cats/index' end get :new do @title = pat(:new_title, :model => 'cat') @cat = Cat.new render 'cats/new' end post :create do @ca...
class CreateQuestions < ActiveRecord::Migration # No need to specify an 'id' column. # ActiveRecord auto create an integer field called 'id' with autoincrement def change create_table :questions do |t| t.string :title t.text :body t.timestamps null: false end end end
class RenamePrivateToIsPrivateInFeedUser < ActiveRecord::Migration def up rename_column :feed_users, :private, :is_private change_column :feed_users, :is_private, :boolean, default: true, null: false end def down rename_column :feed_users, :is_private, :private change_column :feed_users, :private...
module InvoicePDF # Generators should be contained within the <tt>InvoicePDF::Generators</tt> module. module Generators # The default InvoicePDF generator. class Standard include InvoicePDF::Helpers # Constructor here for future use... maybe. def initialize( options = {} ); end #...
class Admin::ProductsController < Admin::BaseController # before_action :set_record, :only => [:show, :edit, :update, :destroy] def index @products_grid = initialize_grid(Admin::Product.all, per_page: 15) end def new @product = Admin::Product.new end def create @product = Admin::Product.cre...
module SportsDataApi module Nfl class Player def initialize(xml) if xml.is_a? Nokogiri::XML::Element player_ivar = self.instance_variable_set("@#{xml.name}", {}) self.class.class_eval { attr_reader :"#{xml.name}" } xml.attributes.each do | attr_name, attr_value| ...
# frozen_string_literal: true require "English" require "faraday" module HubStep module Faraday # Faraday middleware for wrapping a request in a span. # # tracer = HubStep::Tracer.new # Faraday.new do |b| # b.request(:hubstep, tracer) # b.adapter(:typhoeus) # end class Middleware...
require 'spec_helper' describe TitlesController do describe 'routing' do it 'routes to #index' do expect(get: '/titles').to route_to('titles#index') expect(get: '/titles/all').to route_to('titles#index', initial: 'all') expect(get: '/titles/a').to route_to('titles#index', initial: 'a') end ...
class ReviewsController < ApplicationController before_action :find_book before_action :find_review, only: [:edit, :update, :destroy, :show] before_action :authenticate_user!, only: [:new, :edit] def index @reviews = @book.reviews respond_to do |format| format.json {render json: @reviews} ...
#!/usr/bin/ruby -w def prompt(*args) input_arg=false until input_arg do print(*args) value=String(gets) rescue false input_arg=value rescue false if value =~ /[A-D]/ # prompt again if the argument isn't A, B, C, or D input_arg=true else input_arg=false end end return value e...
require 'spec_helper' # I can't get this to work T_T feature 'User registers' do background do visit root_path click_link 'Sign up' end scenario 'successfully' do fill_in 'Email', with: 'joe@example.com' fill_in 'Password', with: 'password' fill_in 'Password confirmation', with: 'password' ...
# frozen_string_literal: true module X25519 # Known-good inputs and outputs for X25519 functions module TestVectors # Test vector for variable-base scalar multiplication VariableBaseVector = Struct.new(:scalar, :input_coord, :output_coord) # X25519 variable-base test vectors from RFC 7748 VARIABLE...
require 'rails_helper' RSpec.describe ProductType, :type => :model do let(:product_type) {FactoryGirl.create(:product_type)} context "Factory settings for product_type" do it "should validate the product_type factories" do expect(FactoryGirl.create(:product_type).valid?).to be true end end describe...
class EmailAuthentications::PasswordsController < Devise::PasswordsController def edit users_email_authentication = resource_class.with_reset_password_token(params["reset_password_token"]) return render "expired_reset_token" unless users_email_authentication&.reset_password_period_valid? super end end
# The fake Resque class. This needs to be loaded after the real Resque # for the assertions in +ResqueUnit::Assertions+ to work. module Resque # Resets all the queues to the empty state. This should be called in # your test's +setup+ method until I can figure out a way for it to # automatically be called. def ...
class Work < ActiveRecord::Base belongs_to :composer has_and_belongs_to_many :editions, :order => "year ASC" has_and_belongs_to_many :instruments PERIODS = { [1650..1750, %w{ EN DE FR IT ES NL }] => "Baroque", [1751..1810, %w{ EN IT DE NL }] => "Classical", [1751..1830, %w{ FR }] => "Classical", ...
class Api::V1::EvaluationsController < ApplicationController before_action :authorized, only: [:create, :update] def create evaluation = Evaluation.new(eval_params) if evaluation.save render json: evaluation else render json: {errors: evaluation.errors.full_messages} end end def u...
FactoryBot.define do factory :order_address do postal_code { '123-4567' } prefecture_id { 1 } city { '町田市' } addresses { '8-9' } building { 'tesuto' } phone_number { '09099999999' } token { 'tok_4f612c8e1089f52009d0980d151c' } end...
require 'spec_helper' describe Study do let(:nicknames) {%w(nickname1 nickname2)} let(:study_name) {"study_1"} it "should create new study with nicknames" do study = Study.new(official_name: study_name, nicknames: nicknames) study.study_nicknames.length.should == nicknames.length study.official_nam...
require 'rails_helper' RSpec.describe User, type: :model do it { should have_many(:questions) } it { should have_many(:exam_results).class_name('ExamResult') } # it { should have_many(:categories).through(:categorizations) } it 'should filter by role' do student = create(:student) teacher = create(:t...
class PullRequestsController < ApplicationController def index team = Team.find_by(slack_team_id: params[:team_id]) channel = Channel.find_by(slack_channel_id: params[:channel_id]) if team.nil? || channel.nil? render text: "Something went wrong, PRBot can't find your team or channel" else ...
# 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 ...
class LocationsController < ApplicationController load_and_authorize_resource :except => [:locations_for_topic] # GET /locations # GET /locations.json def index @locations = Location.all @markers = Location.all.to_gmaps4rails respond_to do |format| format.html # index.html.erb format...
# frozen_string_literal: true require 'test_helper' class DateRangeTest < ActiveSupport::TestCase def setup @start = Date.new(2021, 5, 10) @stop = Date.new(2021, 5, 12) @daterange = DateRange.new(@start, @stop) end test 'includes_date? returns true for start date' do assert @daterange.includes_...
class BooksController < ApplicationController before_action :param_id, only: [:edit,:show, :update, :destroy] def index @books = Book.all.order(title: :asc) end def show end def new @book = Book.new end def create @book = Book.new param_permit if @book.save redirect_to books...
Then(/^I should see the Edit page for the post$/) do expect(current_path).to eq edit_post_path(@post.id) end When(/^I fill the '(.+)' field with '(.+)'$/) do |field, text| fill_in field, with: text end When(/^I click the '(.+)' button$/) do |button| click_button button end Then(/^I should see the content '(.+)...
class Employee < ActiveRecord::Base belongs_to :office belongs_to :reportee, :class_name => "Employee" has_many :customers, :foreign_key => "sales_rep_employee_id" end
=begin In the previous exercise, we developed a procedural method for computing the value of the nth Fibonacci numbers. This method was really fast, computing the 20899 digit 100,001st Fibonacci sequence almost instantly. In this exercise, you are going to compute a method that returns the last digit of the nth Fi...
require_relative 'participant' class Auditor attr_reader :name, :id def initialize(p_name, p_id) @name = p_name @id = p_id end # Push model # Will probably stick to Push model as it sends only required information to observer. # In the context this code, there is only 1 auditor who's auditing all ...
class Client < ActiveRecord::Base has_many :transactions enum status: [:delay, :at_day, :service_suspend, :banned] end
require 'open-uri' require 'date' require "tmpdir" require "digest" module ManticoreHelper def self.fetch_version_and_url(formula_name, base_url, pattern) highest_version, highest_version_url = self.find_version_and_url(formula_name, base_url, pattern) filepath, sha256 = download_file(formula_name, highest_v...
YELLOW='' RESET='' ignore %r!^out/!, %r!^testdata/gen/.*/HAVE!, %r!^tmp/! def run(cmdline) puts "#{YELLOW}+#{cmdline}#{RESET}" system cmdline end def run_tests(file, flags='') parent = File.dirname file sources = Dir["#{parent}/*.go"].reject{|p| p.end_with? '_test.go' }.uniq.join ' ' sources = "co...
class RenameGigDatesColumnName < ActiveRecord::Migration[5.0] def change rename_column :gigs, :start, :start_date rename_column :gigs, :end, :end_date end end
require 'uri' require 'net/https' module Castronaut module Models class ServiceTicket < ActiveRecord::Base include Castronaut::Models::Consumeable include Castronaut::Models::Dispenser MissingMessage = "Ticket or service parameter was missing in the request." belongs_to :ticket_grantin...
class ConcreteHolidays::ChristmasObserved include ConcreteHolidays::Calculations def self.date(year) # December 25th to_weekday_if_weekend(Date.new(year,12,25)) end end
require 'minitest/autorun' require 'minitest/capistrano' require 'capistrano/fanfare' require 'capistrano/fanfare/assets' # # Rake mixes in FileUtils methods into Capistrano::Configuration::Namespace as # private methods which will cause a method/task namespace collision when the # `deploy:assets:symlink' task is crea...
module Spree # file uploaded for template class TemplateFile < ActiveRecord::Base belongs_to :template_theme, :foreign_key=>"theme_id" #validates_uniqueness_of :file_name has_attached_file :attachment self.attachment_definitions[:attachment][:url] = "/shops/:rails_env/1/:class/:id/:basename_:s...
def require_if task, name require name if ARGV[0] =~ %r{^#{task}} end require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'spec/rake/spectask' require 'spec/rake/verify_rcov' require_if :metrics, 'metric_fu' task :default => :spec # run with rake spec Spec::Rake::SpecTask.new(:spec) do |t| t...
class ChangeResourceTitleType < ActiveRecord::Migration def change change_column :resources, :title, :text end end
class Api::TweetSentimentsController < Api::ApiController before_filter :admin_access def index render json: TweetSentiment.all end def create key = Tracker.where(:keyword => params[:keyword]).first list = TweetSentiment.new(:tracker_id => key.id, :date => params[:date], :sentiment => params[:sen...
require 'spec_helper' describe Order, :model => :order do let!(:status) { Fabricate(:status) } let(:order) { Fabricate(:order) } let(:cancelled) { StoreEngine::Status::CANCELLED } let(:shipped) { StoreEngine::Status::SHIPPED } let(:returned) { StoreEngine::Status::RETURNED } let(:paid) { StoreEngine::Statu...
# -*- ruby -*- # This runs both the blog app and the object log viewer as separate # Sinatra apps in the same process require 'sinatra' require 'blog_app' require '../object_inspector/objectlog_app' disable :run set :environment, :development options = { :Port => 4444, :host => 'localhost' } map "/" do run BlogA...
# typed: false # frozen_string_literal: true # This file was generated by GoReleaser. DO NOT EDIT. class Dojoctl < Formula desc "" homepage "" version "0.0.14" bottle :unneeded if OS.mac? && Hardware::CPU.intel? url "https://github.com/zengineDev/dojo/releases/download/v0.0.14/dojoctl_0.0.14_Darwin_x86_...
name 'dashing' maintainer 'Benbria' maintainer_email 'jwalton@benbria.ca' license 'MIT License' description 'Installs/Configures dashing - http://shopify.github.io/dashing/' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.1.0'
class DbToolsExtension < Spree::Extension version "1.0" description "An extension to add a few useful database related rake tasks." url "http://github.com/eliotsykes/spree-db-tools" def self.require_gems(config) config.gem "sevenwire-forgery", :lib => "forgery", :source => "http://gems.github.com" end ...
require 'sinatra' get '/' do # hello @varaible_for_view = 'Hi! I am a variable. the @ at the beginning will make it accessible in the erb/view file.' @people = ["Jonathan", "Joel", "Jarrett"] erb :index, layout: :main end get '/form' do # code! @states = [] #create an array called states #create a hash k...
class RequestStatusesController < ApplicationController before_action :set_request_status, only: [:show, :update, :destroy] def index @request_statuses = RequestStatus.all render json: @request_statuses end def show render json: @request_status end def create @request_status = RequestSta...
def convert_seconds_to_years_and_months(age_in_seconds) @years_old = age_in_seconds / (60 * 60 * 24 * 365) @remaining_months = (age_in_seconds % (60 * 60 * 24 * 365) ) / ( 60 * 60 * 24 * 30 ) end def prints_age_in_years_and_months(age_in_seconds) puts "Being #{age_in_seconds} seconds old is equivalent to being #...
require 'rails_helper' RSpec.describe Project do let(:project){Project.new} let(:task){Task.new} it 'idenitifies a newly created project as done' do expect(project).to be_done end it 'detects that a project with a new task is not done' do project.tasks << task expect(project).to_not be_done ...
class Profile::ResourcesController < Profile::ProfileController before_filter :set_resource, only: [:edit, :update] before_filter :set_current_user, only: [:create, :update] def index @resources = current_user.resources.recent end def new @resource = Resource.new authorize! :new, @resource ...
module Recliner module AttributeMethods module Defaults extend ActiveSupport::Concern included do alias_method_chain :initialize, :defaults end def initialize_with_defaults(attributes={}, &block)#:nodoc: default_attributes.each do |property, default| ...
require "redis" class RedisSet attr_reader :name VERSION = "0.0.6" class InvalidNameException < StandardError; end; class InvalidRedisConfigException < StandardError; end; def initialize(name, redis_or_options = {}, more_options = {}) name = name.to_s if name.kind_of? Symbol raise InvalidNameException.new...
class User < ApplicationRecord has_secure_password validates_presence_of :name, :email, :password_digest validates_uniqueness_of :email validates_format_of :email, with: /\A[^@]+@([^@\.]+\.)+[^@\.]+\z/ def is_admin? id == 1 end class << self def admin first end end end