text
stringlengths
10
2.61M
# encoding: UTF-8 # # Cookbook Name:: chef-dev-workstation # Recipe:: windows-setup # # general node - we're avoiding using package/windows_package resource to allow this recipe to run via chef-apply so there are no outside dependencies. # Download Sublime remote_file "#{Chef::Config[:file_cache_path]}/Sublime_Text_2....
# == Schema Information # # Table name: scholarship_submissions # # id :integer not null, primary key # first_name :string(255) default(""), not null # last_name :string(255) default(""), not null # high_school :string(255) ...
# frozen_string_literal: true require 'tty-command' RSpec.describe Sam::Unicorn::Identifier do subject(:identifier) { described_class.new } let(:config) { Pathname.new(__FILE__).join('../../../../fixtures/server_settings.rb') } after(:each) do TTY::Command.new(printer: :null) .run!('bundle ...
require 'rake' include Rake::DSL module K8S def rewrite_config_by_setting(path, setting, output, verbose = false) { :NUM_MINIONS => (setting["node_num"] or 4), :ZONE => (setting["zone"] or "asia-east1-b"), :MASTER_SIZE => (setting["master_instance_type"] or "g1-small"), :MINION_SIZE => (setting["minion...
require 'spec_helper' require 'helpers/unit_spec_helper' describe Puppet::Type.type(:clc_group) do let(:create_params) { { :name => 'name', :parent_group_id => 'parent-group', } } [:name, :parent_group_id, :parent_group, :datacenter].each do |field| it_behaves_like "it has a n...
module Spine module Mappings # Maps objects to hash. # # == Types # * any - Value as is. # * integer - Integer, default value is 0. # * string - String, default value is ''. # * decimal - Floating point number, default value is 0.0. # * date - Date in ISO 8601 format (YYYY-MM-DD). ...
class Wallet attr_accessor :contents, :value, :cents def initialize @contents = [] @value = { :penny => 1, :nickel => 5, :dime => 10, :quarter => 25, :dollar => 100 } @cents = 0 end def << (coin) @contents << coin @cents += @value[coin] end def take(coin, *coins) if @contents.incl...
# Board Model class Board < ApplicationRecord validates :title, presence: true, length: { in: 5..30 } # model association has_many :lists, dependent: :destroy has_many :cards, dependent: :destroy end
require 'digest/sha1' class User < ActiveRecord::Base attr_accessible :username, :fname, :lname validates_presence_of :username, :fname, :lname validates_uniqueness_of :username validates_length_of :username, :in => 2..8 validates_length_of :fname, :minimum=>2 validates_length_of :lname, :minimum=>2 attr_ac...
require 'natto' module MecabNatto AMOUNT_SAVE_WORDS = 500 def analysis_text(text) natto = Natto::MeCab.new word_hash = {} natto.parse(text) do |n| word_hash[n.surface] ? word_hash[n.surface] += 1 : word_hash[n.surface] = 1 if should_extract?(n.feature, n.surface) end words = word_h...
require 'spec_helper' describe ProjectHistoryPosition do let(:project_history) { FactoryGirl.create(:project_history) } let(:position) { FactoryGirl.create(:position) } before do @project_history_position = ProjectHistoryPosition.new(project_history: project_history, ...
require_relative 'ship.component' # # class Ship # # class Collector < Component attr_reader :warmup, :power, :efficiency ## # # def initialize( ship, warmup = 20, power = 20, efficiency = 5 ) super ship @warmup = warmup @power = power @efficiency = efficiency end ## # #...
# config valid for current version and patch releases of Capistrano lock "~> 3.10.1" set :application, "demo" set :repo_url, "git@github.com:narender2031/demo.git" set :deploy_user, "deploy" set :user, 'deploy' set :deploy_to, "/home/#{fetch :deploy_user}/#{fetch :application}" # set :rbenv_type, 'deploy' # set :r...
class SampleDelayedJobsController < ApplicationController def create redirect_to sample_delayed_jobs_path end def index @sample_delayed_jobs = SampleDelayedJob.all end end
# frozen_string_literal: true require 'rails_helper' RSpec.describe Api::BirthdayEmailTemplatesController do render_views let(:user) { create(:user) } let(:admin) { create(:user, :admin) } describe 'GET #index' do it 'authenticates user' do get :index, format: :json expect(response.code).to e...
Multiply All Pairs Write a method that takes two Array arguments in which each Array contains a list of numbers, and returns a new Array that contains the product of every pair of numbers that can be formed between the elements of the two Arrays. The results should be sorted by increasing value. You may assume that ...
# frozen_string_literal: true # Application controller base class ApplicationController < ActionController::Base protect_from_forgery with: :exception if %w[production staging development].include? Rails.env def append_info_to_payload(payload) super(payload) Honeycomb.add_field(request.env, self.c...
class Subitem < ApplicationRecord belongs_to :subitem_category has_many :subitem_item_categories accepts_nested_attributes_for :subitem_item_categories, reject_if: :all_blank, allow_destroy: true has_attached_file :image, styles: { high: "1260x900#", medium: "560x400#", thumb: "200x200#" }, default_url: "...
require 'spec_helper' describe "Static pages" do describe "Home page" do it "should have the content 'Sample App'" do visit '/static_pages/home' expect(page).to have_content('Home') end it "should have the right title" do visit '/static_pages/home' expect(page).to have_title(...
class HomeController < ApplicationController def index @homepage = true @favorites = current_user ? current_user.favorites : Favorite.where(nil) @posts = Post.order('created_at DESC').limit(10) @venues = Venue.all end end
class RestaurantsController < ApplicationController skip_before_action :authenticate_user!, only: [:index, :search] before_action :set_restaurant, only: [:show, :edit, :update, :destroy, :collect, :uncollect] # GET /restaurants # GET /restaurants.json def index gon.is_login = false gon.latitude = 0....
class Api::V3::MedicalHistoriesController < Api::V3::SyncController def sync_from_user __sync_from_user__(medical_histories_params) end def sync_to_user __sync_to_user__("medical_histories") end def metadata {user_id: current_user.id} end private def merge_if_valid(medical_history_params...
class CreateSubstructureTypes < ActiveRecord::Migration def change create_table :substructure_types, id: :uuid do |t| t.uuid :parent_structure_type_id, index: true t.uuid :audit_strc_type_id, index: true t.integer :display_order t.timestamps end end end
module BECoding class RoversManager def initialize(rovers = []) @rovers = rovers end def send_commands(rover_number, commands) commands.each_char do |command| @rovers[rover_number].execute_command(Command::Lookup.init_by_uppercase(command)) end end end end
# frozen_string_literal: true require "openssl" require "base64" module Obfuscate class << self def cipher OpenSSL::Cipher.new('AES-256-CBC') end def cipher_key if defined?(Rails) Rails.application.secrets.secret_key_base elsif ENV["SECRET_KEY_BASE"] ENV["SECRET_KEY_BAS...
# Initial Deployment: cap (production|staging) deploy:initial require 'bundler/capistrano' require 'capistrano/ext/multistage' require 'capistrano/deploy/tagger' def get_binding binding # So that everything can be used in templates generated for the servers end def from_template(file) require 'erb' template =...
class DeleteSenderAndTimeTo < ActiveRecord::Migration def change remove_column :reservations, :to end end
# 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...
require 'abstract_controller' require 'active_support/core_ext/string/inflections' require 'active_support/callbacks' require 'active_support/version' module Telegram module Bot # Base class to create update processors. With callbacks, session and helpers. # # Public methods ending with `!` handle messag...
require 'ipaddr' begin print "Enter the IP address: " ip = IPAddr.new $stdin.gets.chomp print "Enter the Subnet mask: " subnet_mask = IPAddr.new $stdin.gets.chomp rescue Exception => e puts "An error occurred: #{e}\n\n" end subnet = ip.mask(subnet_mask.to_s) puts "Subnet address is: #{subnet}\n\n"
require 'objects/f5_object' module F5_Object class IPSecPolicy < F5_Object @path = 'net/ipsec/ipsec-policy/' # @param [Hash] opts Options hash # @option opts [String] name # @option opts [String] float_ip Source endpoint IP # @option opts [String] remote_ip Destination endpoint Ip def initia...
require 'spec_helper' describe "catalog/_facets" do before do @mock_config = Blacklight::Configuration.new view.stub(:blacklight_config => @mock_config) end it "should not have a header if no facets are displayed" do view.stub(:render_facet_partials => '') render expect(rendered).to_not have_...
class BookingsController < ApplicationController skip_before_action :authenticate_user!, only: [:show] before_action :set_booking, only:[:show] # before_action :set_goy, only: [:create, :new] def create @booking = Booking.new(booking_params) @booking.status = "pending" @booking.jew = current_...
# == Schema Information # # Table name: exams # # id :integer not null, primary key # name :string(255) # course_id :integer # created_at :datetime # updated_at :datetime # lesson_category_id :integer # duration :integer # max_points ...
# frozen_string_literal: true # supported_version: Rails::VERSION::STRING '~> 7.0.0.alpha2' # https://github.com/rails/rails/issues/28503 module ActionView class Digestor class << self # https://github.com/rails/rails/blob/v7.0.0.alpha2/actionview/lib/action_view/digestor.rb#L43-L68 # rubocop:disabl...
class AddNotNullConstraintsToEnrollments < ActiveRecord::Migration def down end def up change_column :enrollments, :user_id, :integer, :null => false change_column :enrollments, :course_id, :integer, :null => false change_column :enrollments, :token, :string, :null => false end end
module Api module V2 class LocationSerializer < ActiveModel::Serializer attributes :id, :name, :address, :city, :state, :phone, :url, :rating, :rating_total, :zip, :tax, :bio, :logo, :twitter_url, :facebook_url, :google_url, :instagram_username, :favourited, :is_checked_in, :favourit...
class RegisterToFileWorker < ApplicationWorker::Base def perform(rebel_data) save_on_file(rebel_data) end private def save_on_file(rebel_data) File.open("rebels.txt", "a") do |f| f.puts(rebel_data) end end end
require_relative "../problem/2d_array" describe "Problem 2d_array" do let(:arr) do input.split("\n").map do |row| row.split(' ').map(&:to_i) end end context 'case 1' do let(:input) do <<~EOF 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 2 4 4 0 0 0 0 2 0 0 0 0 1 2 4 0 EOF end it...
# Author : Merdan Durdyýew # Github : https://github.com/eminarium # Medium (Personal blog) : https://medium.com/@merdan.durdiyev # Medium (Publication) : https://medium.com/kodeser # Date : 24.09.2020 # Beýany: "Ses hasaplamak" programmasy, görkezilen faýlda girizilen atlary sanap, # haýsy ada näçe ses berlendigini h...
class CreatePhones < ActiveRecord::Migration def change create_table :phones do |t| t.references :phoneable, polymorphic: true t.integer :phone_type_id, null: false t.string :number, null: false, limit: 32 t.timestamps end add_index :phones, [:pho...
include_recipe 'heads' build_user = 'heads' build_home = '/home/' + build_user build_dir = build_home + '/php-src' prefix = '/usr/local/php-head' build_sh = build_home + '/build/php.sh' bash 'git clone php' do action :run user build_user cwd build_home code "git clone https://github.com/php/php-src.git" not...
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } # Declare your gem's dependencies in new_google_recaptcha.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec ...
# == Schema Information # # Table name: categories # # id :integer not null, primary key # name :string(255) # created_at :datetime not null # updated_at :datetime not null # code :string(255) # icon :string(255) # position :integer # desc :text(65535) ...
module Rack class MogileFS class Endpoint # Provides a default client if one is not passed in a a param. It is # recommended to use the default client if you can module Client def initialize(*) super @options[:client] ||= lambda { default_client } end ...
class UserPolicy < ApplicationPolicy # # User Policies # def index? user.kind.moderator? end def new? true end def create? true end def block? true end # # User Session Policies # def session_new? true end def session_create? true end def session_destr...
FactoryGirl.define do factory :game do title "Test Game" sport "Testing" location "Virtual" time "1" min "1" max "10" sign_ups "3" details "Stuff" password "Password" end end
class Profesor < ActiveRecord::Base has_many :materia_profesors has_many :cursos, :through => :materia_profesors has_many :cursos end
=begin check if the object has the method, or the object is a specific type =end def send_as_package(obj) if obj.respond_to? :package packaged = obj.package elsif $stderr.puts "Not sure how to package a #{obj.class}" package = Package.new obj end send(package) end def multiple_precisely a, b i...
module UserHashidable extend ActiveSupport::Concern included do skip_before_action :authenticate_user! # we're going to change the definition of current_user # rename current_user to devise_user alias_method :devise_user, :current_user protected def current_user hashid_user || devi...
require "rails_helper" RSpec.describe FacilityYearlyFollowUpsAndRegistrationsQuery do describe "#call" do it "aggregates yearly reports from monthly data for HTN and DM" do Timecop.freeze("31 May 2023 1PM UTC") do user = create(:user) facility = create(:facility) patient_1 = create...
require 'test_helper' class PropertiesControllerTest < ActionDispatch::IntegrationTest setup do @property = properties(:one) end test "should get index" do get properties_url assert_response :success end test "should get new" do get new_property_url assert_response :success end tes...
require "rails_helper" RSpec.describe ActionRequiredsController, type: :routing do describe "routing" do it "routes to #index" do expect(get: "/action_requireds").to route_to("action_requireds#index") end it "routes to #new" do expect(get: "/action_requireds/new").to route_to("action_require...
class AtendeesController < ApplicationController def create Atendee.create atendee_params redirect_to "/events" end def destroy @atendee = Atendee.find(params[:id]) @atendee.destroy if current_user === @atendee.user redirect_to "/events" end private def atendee_params params....
class Journal < ApplicationRecord has_many :action_steps, dependent: :destroy belongs_to :user scope :old, -> { where("created_on < ?", 7.days.ago) } scope :recent, -> { where("created_on > ?", 7.days.ago) } scope :by_created, -> { order('created_on DESC') } def self.purge(user) user.journals.old.de...
class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable has_many :jobs has_many :requests, dependent: :destro...
# TODO: Convince somebody on #ruby-core that this should be defined by default. class String def >> obj obj.send self end end module Church::Kernel # Our reference to the Kernel constant KERNEL = ('ancestors' >> ('class' >> []))[-2] # Reads and returns a single line from standard input. GETS = -> { 'g...
module FreeKindleCN class AsinList # 销售飙升榜 def movers_and_shakers(total_pages = 1) asins = handle_page("movers-and-shakers", total_pages) update_list('movers-and-shakers', asins) asins end # 新品排行榜 def new_releases(total_pages = 1) asins = handle_page("new-releases", tota...
class Formatter attr_reader :datastore def initialize @datastore = [] end def format_values(currency, call_time = @call_time, response = @response) @datastore << { 'last': (response[currency.upcase]['last'] * 100).floor, 'datetime': call_time } end end
class BeaconsController < ApplicationController before_action :authenticate_user!, excepts: [:index, :show] before_action :set_beacon, except: [:index, :create] before_action :authorize_beacon, except: [:index, :create] before_action :set_form_resources, only: [:new, :edit] # GET /beacons # GET /beacons.js...
class DepSSHKey < ActiveRecord::Base acts_as_paranoid validates_presence_of :name validates_uniqueness_of :name self.table_name = 'sshkeys' has_many :credentials, foreign_key: 'sshkey_id', dependent: :destroy has_many :depusers, through: :credentials def serializable_hash(_options = {}) { id: id, ...
class Map < ApplicationRecord include MarkdownRenderCaching belongs_to :game has_many :match_rounds, class_name: 'League::Match::Round', dependent: :restrict_with_error validates :name, presence: true, uniqueness: true, length: { in: 1..64 } validates :description, presence: true, allow_blank: true caches...
# This migration comes from platforms_core (originally 20200308091113) class CreatePlatformsUsers < ActiveRecord::Migration[6.0] def change create_table :platforms_users do |t| t.string :platform_id t.string :name t.string :thumbnail_url t.boolean :admin t.string :web_url t.str...
require 'spec_helper' describe SimpleHdGraph::ResourceNode do include ExampleLoader let(:parser) { SimpleHdGraph::Parser.new } # @return [Hash] def testing_context YAML.load(<<EOD, symbolize_names: true) id: context EOD end # @return [Hash] def testing_resource YAML.load(<<EOD, symbolize_names...
ActiveRecord::Schema.define(version: 20151004165642) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" create_table "authem_sessions", force: :cascade do |t| t.string "role", null: false t.integer "subject_id", ...
class UpdateSocialNetworkIdFromIntegerToString < ActiveRecord::Migration def up change_column :users, :twitter_id, :string change_column :users, :github_id, :string end def down change_column :users, :twitter_id, :integer change_column :users, :github_id, :integer end end
class Rent < ActiveRecord::Base belongs_to :member has_many :items, :class_name => 'RentItem' def delay_in_days @delay_in_days ||= distancia(end_date, Time.now) end def self.open items = RentItem.open rents = [] items.each {|item| rents << item.rent unless rents.include? item.rent } rent...
class Item < ActiveRecord::Base validates :name, :size, :user_id, presence: true belongs_to :user, inverse_of: :items has_and_belongs_to_many :occasions has_and_belongs_to_many :seasons def occasions_for_display for_display(occasions) end def seasons_for_display for_display(seasons) end pr...
class UsersController < ApplicationController before_action :set_user, only: [:show, :edit, :update, :destroy] before_action :admin_user, except: [:index, :show] before_action :set_patients, only: [:index, :show] def index if current_user.user_type.name == "Patient" @users = User.where.not(id: current...
class Snippet < ActiveRecord::Base belongs_to :address belongs_to :user belongs_to :language validates :content, presence: true validates :user, presence: true, if: lambda { address.authenticate? } validates :language, presence: true end
# This migration comes from refinery_frequently_asked_questions (originally 1) class CreateFrequentlyAskedQuestionsFrequentlyAskedQuestions < ActiveRecord::Migration def up create_table :refinery_frequently_asked_questions do |t| t.string :question t.string :category t.string :sub_category ...
class EventItemsController < ApplicationController before_action :set_event_item, only: [:show, :edit, :update, :destroy] before_action :get_event # GET /event_items # GET /event_items.json def index @event_items = EventItem.where(:event_id => @event.id).order(sort_params).page(params[:page]) end # ...
require 'rails_helper' describe Event do describe 'ActiveModel validations' do it 'has a valid factory' do expect(FactoryGirl.create(:event, capacity: 100)).to be_valid end it 'is invalid without a name' do expect(FactoryGirl.build(:event, name: nil)).to_not be_valid end it 'is inva...
require 'formula' class ModFastcgi < Formula url 'http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz' homepage 'http://www.fastcgi.com/' sha1 '69c56548bf97040a61903b32679fe3e3b7d3c2d4' def install target_arch = MacOS.prefer_64_bit? ? "x86_64" : "i386" system "cp Makefile.AP2 Makefile" ENV.append...
class ApplicationController < ActionController::Base rescue_from Faraday::ResourceNotFound, with: :not_found rescue_from Faraday::ClientError, with: :client_error before_action :set_current_auth private def set_current_auth Current.http_basic_auth = ActionController::HttpAuthentication::Basic.user_name...
module JudgementsHelper def work_points_sum(point_details, memberships) points(point_details, memberships, method(:sum_work_details)).sum end def responsibility_points_sum(point_details, memberships) points(point_details, memberships, method(:sum_responsibility_details)).sum end def all_points_sum(p...
class Brewery < ActiveRecord::Base include AverageRating validates :name, presence: true validates :year, numericality: { greater_than_or_equal_to: 1024, less_than_or_equal_to: ->(_){Time.now.year} } scope :active, -> { where active:true } scope :retired, -> { where active:[nil,false] } has_many :beers...
class AddDistance < ActiveRecord::Migration[5.2] def change add_column :users_vets, :distance, :string end end
require 'rails_helper' describe NasaDay do subject { NasaDay.new(attributes) } context 'attributes' do it 'has a date' do expect(subject.date).to eq('January 4, 2018') end end context 'instance methods' do describe '#near_earth_objects' do it 'returns all potentially hazardious astero...
class ChangeNationalBoardMemberForUsers < ActiveRecord::Migration def up change_column :users, :national_board_member, :string rename_column :users, :national_board_member, :about_us_type end def down rename_column :users, :about_us_type, :national_board_member change_column :users, :national_board_membe...
# frozen_string_literal: true require 'rakuten_web_service/resource' module RakutenWebService module Ichiba class Item < Resource class << self def ranking(options={}) RakutenWebService::Ichiba::RankingItem.search(options) end def genre_class RakutenWebService:...
class AddInvitationUrlToMeetingPeople < ActiveRecord::Migration def change add_column :meeting_people, :invitation_url, :string end end
#encoding: UTF-8 require 'net/http' require 'iconv' module Lei module Investment module Bond class Parser MARKET_HU = '1' MARKET_SHEN = '2' BOND_QUOTE_LINK = 'http://bond.money.hexun.com/quote/default.aspx?market=' BOND_DETAIL_BASE = 'http://bond.jrj.com.cn...
require 'simp/cli/config/items/data/puppetdb_master_config_puppetdb_server' require_relative '../spec_helper' describe Simp::Cli::Config::Item::PuppetDBMasterConfigPuppetDBServer do before :each do @ci = Simp::Cli::Config::Item::PuppetDBMasterConfigPuppetDBServer.new @ci.silent = true end describe "#val...
require 'oystercard' describe Oystercard do let(:entry_station) {double :entry_station} let(:exit_station) {double :exit_station} # it { is_expected.to respond_to :top_up } it "has a balance of zero" do expect(subject.balance).to eq(0) end it 'increases the balance' do expect { subject.top_up(...
json.message "Resource validation failed." # Renders model validation errors as # # "errors": [ # { # "resource": "resource_class_name", # "resource_id": 1, # "parameter": "attribute_name", # "code": "required", # "message": "is required." # } # ] if @error &...
module GraphQLIncludable class Includes attr_reader :included_children def initialize(parent_attribute) @parent_attribute = parent_attribute @included_children = {} end def add_child(key) return @included_children[key] if @included_children.key?(key) manager = Includes.new(ke...
require 'rails_helper' describe "Fibonnacci API", type: :request do let!(:test_user) { create(:user) } context 'When user is logged in' do it 'GET#show returns success status' do get api_v1_fibonaccis_path(n: 15), headers: login_headers expect(response).to have_http_status(:success) expect(...
require 'rails_helper' require 'sidekiq/testing' Sidekiq::Testing.fake! RSpec.describe ReadingsController, :type => :controller do let(:thermostat_id) {'1'} let(:household_token) {'1cyed7l2dd'} def validate_parse_response response expect(response).to have_http_status(200) JSON.parse(response.body) e...
require 'applicative_functor/identity' module ApplicativeFunctor def fmap(proc) if @value.is_a? Proc self.class.new(->(value) { # compose them @value.call(proc.call(value)) }) else self.class.new(proc.call(@value)) end end def apply(applicative_functor) applicat...
class PassangerBooking < ApplicationRecord belongs_to :booking belongs_to :passanger end
class AddOwnerToHelpfuls < ActiveRecord::Migration def self.up rename_column :helpfuls, :review_id, :owner_id add_column :helpfuls, :owner_type, :string, :null => false, :default => 'Review' end def self.down rename_column :helpfuls, :owner_id, :review_id remove_column :helpfuls, :owner_t...
class CreateMembers < ActiveRecord::Migration[5.1] def change create_table :members do |t| t.string :position t.date :start_time t.date :end_time t.references :company, foreign_key: true t.references :user, foreign_key: true t.index [:company_id, :user_id], unique: true ...
require 'card' class Deck attr_accessor :cards # initialize by creating and shuffling deck def initialize self.cards = [] (0..51).each { |i| cards << Card.new(i) } self.cards.shuffle! end def draw self.cards.pop end def has_cards? !self.cards.empty? end end
# --- Day 19: Medicine for Rudolph --- # # Rudolph the Red-Nosed Reindeer is sick! His nose isn't shining very brightly, # and he needs medicine. # # Red-Nosed Reindeer biology isn't similar to regular reindeer biology; Rudolph # is going to need custom-made medicine. Unfortunately, Red-Nosed Reindeer # chemistry isn't...
# -*- encoding: utf-8 -*- require File.expand_path(File.join('..', 'lib', 'ahoy', 'views', 'version'), __FILE__) Gem::Specification.new do |gem| gem.name = 'ahoy-views' gem.version = Ahoy::Views::VERSION gem.platform = Gem::Platform::RUBY gem.summary ...
# Include this module in WeaselDiesel # to add response verification methods. # module JSONResponseVerification # Verifies the parsed body of a JSON response against the service's response description. # # @return [Array<TrueClass, FalseClass, Array<String>>] True/false and an array of errors. def verify(parse...
class Design < ApplicationRecord mount_uploader :Imagen, ImageUploader # Tells rails to use this uploader for this model. validates :Nombres, presence: true # Make sure the owner's name is present. validates :Imagen, presence: true belongs_to :proyecto before_save :default_values def default_values self...
module Squall # OnApp Whitelist class Whitelist < Base # Return a list of all whitelists # # ==== Params # # * +user_id*+ - ID of the user to display whitelists for def list(user_id) response = request(:get, "/users/#{user_id}/user_white_lists.json") response.collect { |user| us...
class Oystercard attr_reader :balance, :in_journey, :entry_station, :exit_station, :stations DEFAULT_BALANCE = 0 MINIMUM_BALANCE = 1 MAXIMUM_BALANCE = 90 MINIMUM_FARE = 1 # JOURNEY_STATE = "Inactive" def initialize(balance = DEFAULT_BALANCE) @balance = balance @entry_station = nil @exit_stati...