text stringlengths 10 2.61M |
|---|
class Comment < ActiveRecord::Base
include AnnotationBase
include HasImage
field :text
validates_presence_of :text, if: proc { |comment| comment.file.blank? }
before_save :extract_check_entities, unless: proc { |p| p.is_being_copied }
after_commit :send_slack_notification, on: [:create, :update]
after_c... |
require 'dm-core'
require 'dm-migrations'
class Student
include DataMapper::Resource
property :id, Serial
property :name, String
property :grade, Text
property :score, Integer
property :birthday , Date
end
configure do
enable :sessions
set :username, 'frank'
set :password, 'sinatra'
end
DataMapp... |
module ActivitiesHelper
def explanation_of(activity)
@activity = activity
case which
when :status
render_explanation status_in_words(@activity.activible)
when :comment
render_explanation comment_in_words(@activity.activible)
end
end
def which
if @activity.activible.is_a? Status then... |
class RsGitFsmonitor < Formula
desc "Git fsmonitor hook written in Rust"
homepage "https://github.com/jgavris/rs-git-fsmonitor"
url "https://github.com/jgavris/rs-git-fsmonitor/releases/download/v0.1.3/rs-git-fsmonitor"
sha256 "a221bbd9d44a23190d913b6f7e97d00dfac5f83452fa419122bad73b147af473"
depends_on "wa... |
require_relative('../db/sql_runner.rb')
class Customer
attr_reader :id
attr_accessor :name, :funds
def initialize(options)
@id = options['id'].to_i if options['id']
@name = options['name']
@funds = options['funds'].to_f
end
def save()
sql = "INSERT INTO customers(name, funds) VALUES ($1, $... |
module GroupDocs
module Storage
class Package < Api::Entity
include Api::Helpers::Path
# @attr [String] name Package name
attr_accessor :name
# @attr [Array<GroupDocs::Storage::File, GroupDocs::Storage::Folder>] objects Storage entities to be packed
attr_accessor :objects
#
... |
class Comment < ActiveRecord::Base
belongs_to :support_request
belongs_to :user
validates :content, presence: true
scope :newest, -> { order(created_at: :desc) }
scope :oldest, -> { order(created_at: :asc) }
end
|
class SpeakerImagesController < ApplicationController
before_action :authenticate_admin!
before_action :set_speaker_image
# DELETE /speaker_images/1
# DELETE /speaker_images/1.json
def destroy
@speaker_image.destroy
respond_to do |format|
format.html { redirect_to speakers_url, notice: 'Speaker image was s... |
FactoryBot.define do
factory :user do
name {Faker::Japanese::Name.name}
name_reading {'ヤマダハナコ'}
email {Faker::Internet.free_email}
password {"a1"+ Faker::Internet.password(min_length: 6)}
password_confirmation {password}
address ... |
# Analyze the Errors
# I worked on this challenge [by myself, with: ].
# I spent [#] hours on this challenge.
# --- error -------------------------------------------------------
#"Screw you guys " + "I'm going home." = cartmans_phrase
# This error was analyzed in the README file.
# --- error -----------------------... |
require 'db/connect'
module ImageGetter
class Page < Sequel::Model
STATUS = %w|inprogress completed|.freeze
many_to_one :job
many_to_one :parent, :class => self
one_to_many :children, :key => :parent_id, :class => self
def root?
!parent
end
# Convenience for PG Array instead of in... |
class MovesController < ApplicationController
def create
GamesService.make_move(_move_params)
# redirect_to :controller => 'games', :action => 'show', :id => _move_params[:game_id]
end
private
def _move_params
params[:move][:player_id] = params[:move][:player_id].to_i
params.require(:move).p... |
# frozen_string_literal: true
# Copyright (C) 2016-2020 MongoDB 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... |
shared_examples_for "replaces" do |argument, result|
it "replaces #{argument} with #{result}" do
subject.replace(argument).should eq(result)
end
end
|
class User < ApplicationRecord
has_and_belongs_to_many :rewards
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_one :income
h... |
class Comment < ActiveRecord::Base
belongs_to :creator, foreign_key: 'player_id', class_name: 'Player'
belongs_to :game
validates :body, presence: true
end |
# encoding: utf-8
control "V-53961" do
title "Access to default accounts used to support replication must be restricted to authorized DBAs."
desc "Replication database accounts are used for database connections between databases. Replication requires the configuration of these accounts using the same username and pa... |
class BusinessManagementsController < ApplicationController
before_action :authenticate_user!
before_action :check_voucher_admin_and_superadmin
before_action :set_business_management, only: [:show, :edit, :update, :destroy]
# GET /business_managements
# GET /business_managements.json
layout 'adminpanel_tabl... |
# 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 rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
belongs_to :purchase_order
rails_admin do
navigation_l... |
=begin
input: string
output: boolean
data: array, string
algorithm:
use the word match
=end
BLOCK = [['B','O'], ['X', 'K'], ['D','Q'], ['C','P'], ['N','A'],
['G','T'], ['R','E'],['F','S'], ['J','W'], ['H','U'],
['V','I'], ['L', 'Y'], ['Z', 'M']]
def block_word?(word)
!BLOCK.any? do |a, b|
wor... |
require_relative './test_helper'
require 'mars_rovers/file_parser'
FIXTURE_EXAMPLE_PATH = 'tests/fixtures/input.txt'
class TestFileParser < Minitest::Test
def test_unxistent_input_file_raises_error
assert_raises(MarsRovers::Error) do
MarsRovers::FileParser.parse!('abc.txt')
end
end
def test_loa... |
# Feature: 'About' page
# As a visitor
# I want to visit an 'about' page
# So I can learn more about the website
|
# encoding: UTF-8
module FeedAbstract
VERSION = "0.0.15"
end
|
namespace :status_expired do
desc "statusをexpiredへ変更"
def current_of_the_day
year = Time.zone.now.year
month = Time.zone.now.month
day = Time.zone.now.day
time = Time.zone.local(year, month, day)
end
def models_hash
["Goal", "Subgoal"].map{|model| model.constantize}
end
... |
# caesar_cipher.rb
require 'pry'
user_input = gets.chomp
shift_five = gets.chomp.to_i
def caesar_cipher(user_input, shift_five)
alphabet_hash = {
"a" => 0, "b" => 1, "c" => 2, "d" => 3, "e" => 4,
"f" => 5, "g" => 6, "h" => 7, "i" => 8, "j" => 9,
"k" => 10, "l" => 11, "m" => 12, "n... |
class AudioMp3 < ActiveRecord::Base
belongs_to :audio_content
attr_accessible :audio_mp3_content_type, :audio_mp3_file_size, :audio_mp3_updated_at, :audio_mp3_file_name, :audio_content_id, :audio_title, :audio_mp3
has_attached_file :audio_mp3, :url => "/system/:class/:id/:filename", :path => ":rails_root/public/s... |
require 'spec_helper'
describe SPV::Options do
subject(:options) { described_class.new }
describe '.new' do
it 'holds the passed options' do
waiter = 'some'
options = described_class.new(
waiter: waiter
)
expect(options.waiter).to eq(waiter)
end
end
describe '#add_sh... |
class ImportCatalogService
def initialize(store, max)
@store = store
@to = 9
@from = 0
@max = max
@products = []
end
def execute
import!
end
private
def import!
return false if @store.catalog_source_api.blank?
(@max / @to).to_i.times {
response = HTTPar... |
require 'mysql2'
require 'debugger'
class Dog
attr_accessor :color, :name, :id
@@db = Mysql2::Client.new(:host => "localhost", :username => "root", :database => "dogs")
def initialize name, color
@name = name
@color = color
end
def insert
db.query("INSERT INTO dogs (name, color) VALUES ('#{sel... |
namespace :toots do
require ENV['PWD'] + '/app/controllers/concerns/mecab_natto'
require ENV['PWD'] + '/app/controllers/concerns/request_mastodon'
include RequestMastodon
include MecabNatto
desc 'Fetch toots'
task fetch: :environment do
old_date = Time.current.ago(3.days).strftime('%Y-%m-%d %T')
t... |
class BlogPostsController < ApplicationController
before_action :authenticate_user!, except: :index
def index
load_blog_posts
end
def new
build_blog_post
end
def edit
load_blog_post
end
def create
build_blog_post
save_blog_post or render 'new'
end
def update
load_blog_post... |
LOYALTY_TIERS_DATA = [
{ name: "Standard", points_required: 0 },
{ name: "Gold", points_required: 1000 },
{ name: "Platinum", points_required: 5000 }
]
namespace :setup do
desc 'Create Loyalty Tiers'
task create_loyalty_tiers: :environment do
LOYALTY_TIERS_DATA.each do |data|
LoyaltyTier.create!(na... |
#! /bin/env/ ruby
require 'getoptlong'
infile = nil
is_no_geneconv = FALSE
is_modify_seq_title = FALSE
###############################################################
opts = GetoptLong.new(
[ '--infile', '--in', GetoptLong::REQUIRED_ARGUMENT ],
[ '--no_geneconv', GetoptLong::NO_ARGUMENT ],
[ '--modify_seq_titl... |
module Fog
module Compute
class Google
class Mock
def set_forwarding_rule_target(_rule_name, _region, _target_opts)
# :no-coverage:
Fog::Mock.not_implemented
# :no-coverage:
end
end
class Real
def set_forwarding_rule_target(rule_name, region... |
require "simple-spreadsheet/version"
require 'roo'
require 'roo-xls'
module SimpleSpreadsheet
require 'simple-spreadsheet/modules/roo_module'
class Workbook
def self.read(file, ext = nil)
file = file.to_s
ext ||= File.extname(file).downcase
case ext
when '.xls'
ExcelReader.n... |
# ****************************************************************************
#
# Copyright (c) Microsoft Corporation.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of this distribution. If
# you ... |
class CorePacket::CoreField
def size
raise NotImplementedError
end
def to_bytes
raise NotImplementedError
end
def names
raise NotImplementedError
end
def initialize(packet)
@packet = packet
end
end
require 'core_packet/core_length_field'
require 'core_packet/core_bit_field'
r... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def meow
render text: "meow"
end
end
|
Appetite::Application.routes.draw do
resources :joints do
end
# let's set up the homepage
root 'joints#index'
end
|
class CreateSaleItems < ActiveRecord::Migration
def change
create_table :sale_items do |t|
t.integer :sale_id, null: false, index: true
t.integer :item_id, null: false, index: true
t.timestamps null: false
end
add_index :sale_items, [:sale_id, :item_id]
end
end
|
class CurrentWeatherSerializer
include FastJsonapi::ObjectSerializer
cache_options enabled: true, cache_length: 1.hours
attributes :id, :summary,
:temperature, :visibility,
:uvIndex, :humidity
attribute :feels_like do |forecast|
forecast.feels_like.round
end
attribute :visib... |
require 'net/http'
require 'net/https'
require 'uri'
module EasyUtils
class HttpUtils
def self.url_invalid?(domain_url, path = nil)
begin
get_request(domain_url, path)
rescue SocketError => ex
msg = ex.message
msg.force_encoding('UTF-8') if msg.respond_to?(:force_encoding)
... |
require 'test_helper'
require 'sortable'
class SortableTest < Minitest::Test
def setup
@sortable = Sortable.new([3, 2, 4, 5, 6, 1])
end
def teardown
# Do nothing
end
def test_sorting
skip("To be implemented")
# @sortable.sort()
# @sortable.sort(:worst_case => "lgn")
# @sortable.bub... |
class UpdatesController < ApplicationController
before_action :set_update, only: [:edit, :update, :destroy]
before_action :set_deal, only: [:new, :create, :edit, :update, :destroy]
def new
@update = Update.new
authorize @deal, :owner?
end
def edit
authorize @deal, :owner?
end
def create
... |
require 'prawn'
module ProjectPdf
PDF_OPTIONS = {
# Escolhe o Page size como uma folha A4
page_size: 'A4',
# Define o formato do layout como portrait (poderia ser landscape)
page_layout: :portrait,
# Define a margem do documento
margin: [40, 75]
}.freeze
def self.project(name, descriptio... |
class BooksController < ApplicationController
before_action :set_book, only: [:show, :edit, :update, :destroy,:destroy_comment]
# GET /books
# GET /books.json
def index
@books = Book.all
end
# GET /books/1
# GET /books/1.json
def show
end
# GET /books/new
def new
@book = Book.new
end
... |
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
validates :pseudo, presence: true, uniqueness: true
... |
# frozen_string_literal: true
# rubocop:todo all
require 'spec_helper'
describe Mongo::Server::RoundTripTimeAverager do
let(:averager) { Mongo::Server::RoundTripTimeAverager.new }
describe '#update_average_round_trip_time' do
context 'no existing average rtt' do
it 'updates average rtt' do
aver... |
class MetadatoEspecie < ActiveRecord::Base
self.table_name = :metadato_especies
belongs_to :especie
belongs_to :metadato
def fotos_bi(usuario_id)
# Por algun caso extraño por si se borro a mano la foto
return unless metadato
return if ConabioPhoto.find_by_native_photo_id(metadato.id.to_s)
tax... |
class Journey
PENALTY_FARE = 6
MINIMUM_FARE = 2
attr_reader :info
def initialize
@info = { start: nil, finish: nil, fare: nil }
end
def incomplete?
return true if @info[:start].nil? || @info[:finish].nil?
false
end
def terminate_incomplete_journey
if incomplete?
fare
retu... |
require 'rubygems'
gem "nokogiri", "~> 1.5.6"
gem "osc", "~> 0.1.4"
gem "listen", "~> 0.7.2"
require 'listen'
require 'nokogiri'
require 'osc'
include OSC
# global scope - OSC destination address/port
$serverHost
$serverPort
# global scope hash so when units/buildings complete we can indicate that to listeners by ... |
class AddIndexToMentorIdInUsers < ActiveRecord::Migration
def change
change_table :users do |t|
t.index(:mentor_id)
end
end
end
|
class FindpostsController < ApplicationController
before_filter :authenticate_user!, except: :findyou
before_filter :correct_user, only: :destroy
def create
@findpost = current_user.findposts.build(params[:findpost])
if @findpost.save
flash[:success] = "Findpost created!"
redirect_to findyo... |
# $Id$
# Table containing users' backup sites
class BackupSite < ActiveRecord::Base
# Some site name constants for use in queries, views
Facebook = 'facebook'
Twitter = 'twitter'
Gmail = 'gmail'
Blog = 'blog'
Picasa = 'picasa'
Linkedin = 'linkedin'
TypeMap = {
Gmail => 'email',... |
class Ticket < ApplicationRecord
belongs_to :user
belongs_to :showtime
end
|
##
# Beacon 是管理 iBeacon 设备的封装类。
class Wechat::ShakeAround::Beacon
extend Wechat::Core::Common
extend Wechat::ShakeAround::Common
##
# 查询设备列表
# http://mp.weixin.qq.com/wiki/15/b9e012f917e3484b7ed02771156411f3.html#.E6.9F.A5.E8.AF.A2.E8.AE.BE.E5.A4.87.E5.88.97.E8.A1.A8
#
# Return hash format if success:
... |
module RubyXL
class OOXMLObject
# Throughout this class, setting class variables through explicit method calls rather
# than by directly addressing the name of the variable because of context issues:
# addressing variable by name creates it in the context of defining class,
# while calling the ... |
require 'rails_helper'
RSpec.describe AnswersController, type: :controller do
describe 'POST #create' do
let(:question) {create(:question)}
context 'with valid attributes' do
it 'save the new answer in the database' do
expect {post :create, params: { answer: attributes_for(:answer), question_id... |
class AddColumnsToLaunches < ActiveRecord::Migration[5.1]
def change
add_column :launches, :launch_success, :boolean
add_column :launches, :reuse_core, :boolean
add_column :launches, :reuse_side_core1, :boolean
add_column :launches, :reuse_side_core2, :boolean
add_column :launches, :reuse_fairings... |
class Topic < ActiveRecord::Base
belongs_to :section
belongs_to :sample_business_plan
validates_presence_of :section, :on => [:not_import, :update], :message => 'Choose a Section'
validates_presence_of :number, :message => 'Input a number'
validates_format_of :number, :with => /\A[+-]?\d.+\Z/, :message => 'O... |
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe MetaconceptosController do
describe 'GET/show action' do
before :each do
@method = :get
@action = :show
Metaconcepto.stub!(:new).and_return(@metaconcepto = mock_model(Metaconcepto, :id => 1))
Metaconcepto... |
require 'spec_helper'
describe ExceptionHub::Interceptor do
before do
@interceptor = ExceptionHub::Interceptor.new(Exception.new("Production error!"), {})
ExceptionHub.validators = []
ExceptionHub.handlers = [ExceptionHub::Notifier]
end
after { ExceptionHub.handlers = [ExceptionHub::Notifier, Except... |
class ChangeContactsToProposals < ActiveRecord::Migration
def change
rename_table :contacts, :proposals
end
end
|
require 'rack/less/options'
require 'rack/less/request'
require 'rack/less/response'
module Rack::Less
class Base
include Rack::Less::Options
def initialize(app, options={})
@app = app
initialize_options options
yield self if block_given?
validate_options
end
# The Rack call... |
require 'net/http'
require 'json'
require 'awesome_print'
class Project < ActiveRecord::Base
# Validations
validates :project_name, presence: true
validate :has_users?
def has_users?
errors.add(:users, "A project must have at least one user.") if self.users.blank?
end
# Associations
has_and_b... |
class CleanupSchemaOnExperiences < ActiveRecord::Migration
def change
change_column :experiences, :votes_cache, :integer, null: false, default: 0
change_column :experiences, :location_id, :integer, null: false
change_column :experiences, :name, :string, null: false
remove_column :experiences, :starts,... |
# Write a Deaf Grandma program. Whatever you say to grandma (whatever you type in),
# she should respond with HUH?! SPEAK UP, SONNY!, unless you shout it (type in all capitals).
# If you shout, she can hear you (or at least she thinks so) and yells back, NO, NOT SINCE 1938!
# To make your program really believable... |
require 'test_helper'
class PurchaseTransactionTest < ActiveSupport::TestCase
def test_import_from_piped_file
lines = ["120|1|foo@bar.com||2009-10-10|||", "121|3"]
keys = [:transaction_id, :product_id, :purchasers_email, :status, :purchased_at, :shipped_at, :purchasers_first_name, :user_guid]
row... |
class Item < ApplicationRecord
belongs_to :user
has_one_attached :image
has_one :order
with_options presence: true do
validates :name
validates :description
validates :state_id, numericality: { other_than: 1 }
validates :shipping_fee_id, numericality: { other_than: 1 }
validates :area_id, nu... |
require 'yaml'
class Game
def initialize
puts "Welcome to minesweeper!"
end
def run
board = Board.new
until board.over == :lose || board.over == :win
board.show
print "Type 'd' to dig, 'f' to flag, 's' to save, 'l' to load: "
action = gets.chomp
if action == "d" || action =... |
class Buyer < ApplicationRecord
belongs_to :profile
has_many :shoes
has_and_belongs_to_many :sellers
end
|
module Adminpanel
module AnalyticsHelper
def days_to_substract
if params[:insight] == 'day'
1
elsif params[:insight] == 'week'
7
elsif params[:insight] == 'days_28'
28
else
0
end
end
def insight
return 'day' if !params[:insight].present... |
class CreateGenericFiles < ActiveRecord::Migration
def self.up
create_table :generic_files do |t|
t.string :name
t.string :file
t.string :file_type
t.string :category
t.integer :owner_id
t.string :owner_type
t.timestamps
end
end
def self.down
drop_table :gene... |
module Suits
SPADES = "spades"
CLUBS = "clubs"
DIAMONDS = "diamonds"
HEARTS = "hearts"
NO_SUIT = "no_suit"
STANDARD_SUITS = [
SPADES,
CLUBS,
DIAMONDS,
HEARTS
]
ALL_SUITS = [
SPADES,
CLUBS,
DIAMONDS,
HEARTS,
NO_SUIT
]
end
|
# frozen_string_literal: true
module CMagick
VERSION = '0.2.2'
end
|
class LinkedListNode
attr_accessor :value, :next_node
def initialize(value, next_node=nil)
@value = value
@next_node = next_node
end
end
def reverse_list(list)
previous_node = nil
while list
current_node = list
next_node = current_node.next_node
current_node.next_node = p... |
$:.unshift File.dirname(__FILE__)
require 'syslog/logger'
module StitcherService
class Pretty < Logger::Formatter
def call(severity, time, program_name, message)
"#{time.utc.iso8601} stitcher-#{ENV['SERVICE_ENV']} #{severity}: #{message}\n"
end
end
def self.configure
yield self
end
def s... |
class Listing < ApplicationRecord
belongs_to :profile
has_many :bookings, dependent: :destroy
belongs_to :questionnaire
geocoded_by :location
after_validation :geocode, if: :location_changed?
validates :description, presence:true
validates :name, presence:true
validates :type_place, presence:true
va... |
class Artist < ApplicationRecord
has_many :works, dependent: :destroy
validates :name, uniqueness: :true, presence: :true
belongs_to :user
end
|
# frozen_string_literal: true
# rubocop:todo all
module Mongo
module ServerSelection
module Read
# Represents a Server Selection specification test.
#
# @since 2.0.0
class Spec
# Mapping of read preference modes.
#
# @since 2.0.0
READ_PREFERENCES = {
... |
module Api
module V1
class BaseController < ::ApplicationController
skip_before_action :verify_authenticity_token
def render_error(error_message, status_code = 422)
render json: { error: error_message }, status: status_code
end
end
end
end
|
module MauticApi::Auth
# OAuth Client modified from https://code.google.com/p/simple-php-oauth/
class AuthInterface
# Check if current authorization is still valid
#
# @return bool
def is_authorized
raise 'not implemented'
end
# Make a request to... |
require_relative 'row'
class Board
attr_accessor :board
def initialize
@board= Array.new(9, Row.new.row)
end
end |
class AddVenueToEvents < ActiveRecord::Migration[5.2]
def change
add_column :events, :venue, :string
add_column :events, :city, :string
add_column :events, :state, :string
add_column :events, :country, :string
add_column :events, :latitude, :float
add_column :events, :longitude, :float
end
e... |
class CreateLpayments < ActiveRecord::Migration
def change
create_table :l_payments do |t|
## Database authenticatable
t.string :national_id, :null => false
t.string :transaction_type, :null => false
t.string :local_creation_time, :null => false
t.integer :am... |
require 'time'
class MessagesController < ApplicationController
include Swagger::Docs::ImpotentMethods
before_action :set_message, only: [:update, :destroy]
# GET /messages
def index
messages_public = Message.where(private: false).merge(Message.where.not(posted: nil))
# TODO should be done by default... |
class Client
attr_accessor :name, :balance, :portfolios
def initialize(options={})
@name = options[:name]
@balance = options[:balance]
@portfolios = options[:portfolios] || {}
end
end
|
class UsersController < ApplicationController
def show
@user = User.find(params[:id])
@nickname = current_user.nickname
@courses = @user.courses.page(params[:page]).per(6).order('created_at DESC')
end
end
|
class TextDocument < Document
include Mongoid::Document
field :co, as: :content, type: String, default: ""
has_many :images, class_name: 'Ckeditor::Picture'
has_many :attachments, class_name: 'Ckeditor::AttachmentFile'
accepts_nested_attributes_for :images
accepts_nested_attributes_for :attachments
end
|
require 'csv'
def filter(*args)
# parse options for input, output, or both
in_options, out_options = Hash.new, {row_sep: $INPUT_RECORD_SEPARATOR}
if args.last.is_a? Hash
args.pop.each do |key, value|
case key.to_s
when /\Ain(?:put)?_(.+)\Z/
in_options[$1.to_sym] = value
when /... |
class Harfbuzz < Formula
homepage "http://www.freedesktop.org/wiki/Software/HarfBuzz"
url "http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-0.9.38.tar.bz2"
sha256 "6736f383b4edfcaaeb6f3292302ca382d617d8c79948bb2dd2e8f86cdccfd514"
bottle do
cellar :any
sha1 "edcff2779c5a7917a434777838dde51c... |
require_relative '../bank'
describe Bank do
let(:bank) { Bank.new 'GA Bank' }
describe '.new' do
it "should return a new bank" do
expect(bank).to_not eq nil
end
it "should have a name" do
expect(bank.name).to eq 'GA Bank'
end
it "should have no accounts" do
expect(bank.acc... |
class CreateAudits < ActiveRecord::Migration
def change
create_table :audits do |t|
t.string :audit_title
t.string :audit_scope
t.string :audit_purpose
t.string :audit_summary
t.string :audit_type
t.string :audit_criteria
t.string :audit_compliance
t.date :audit_sta... |
class UpdateUploads < ActiveRecord::Migration
def self.up
add_column :uploads, :is_public, :boolean, :default => 1
end
def self.down
remove_column :uploads, :is_public
end
end
|
require 'helper'
require 'media/option'
module Media
class TestOption < MiniTest::Unit::TestCase
def subject
Option
end
def test_option
assert_equal ['-foo', 'bar'], subject.new(key: 'foo', value: 'bar').to_a
end
def test_true_flag
assert_equal ['-foo'], subject.n... |
class AddTitleAndPermalinkToProblemType < ActiveRecord::Migration
def self.up
add_column :problem_types, :title, :string
add_column :problem_types, :permalink, :string
end
def self.down
remove_column :problem_types, :permalink
remove_column :problem_types, :title
end
end
|
class AddIndexesToAddressTicketsWidgetPlacements < ActiveRecord::Migration
def change
add_index "addresses", [:addressable_id, :addressable_type], :name => "by_addressable_id_and_type"
add_index "phones", [:phonable_id, :phonable_type], :name => "by_phonable_id_and_type"
add_index "tickets", [:order_id], ... |
module OpenAPIRest
###
# Rest Response Renderer
#
class RestRenderer
attr_reader :controller
attr_reader :response
def initialize(args)
@controller = args[:controller]
@response = args[:response]
end
def render
unless response.is_a?(OpenAPIRest::QueryResponse)
con... |
=begin
class Array
# RenderRjs::TestBasic#test_rendering_a_partial_in_an_RJS_template_should_pick_the_JS_template_over_the_HTML_one
# relies on stable sorting (ie. if #<=> returns 0, then the relative order of the
# elements in the original array is maintained) somewhere. However, Ruby does not guarantee a stable... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.