text stringlengths 10 2.61M |
|---|
class SurveyResponse < ActiveRecord::Base
belongs_to :survey
belongs_to :response
belongs_to :option
belongs_to :question
belongs_to :user
validates :survey_id, :response_id, null: false
end
|
# frozen_string_literal: true
class AddDefaultToTestsTimer < ActiveRecord::Migration[6.0]
def up
change_column_default :tests, :timer, from: nil, to: 0
end
def down
change_column_default :tests, :timer, from: 0, to: nil
end
end
|
class Bundle < ActiveRecord::Base
belongs_to :charity
has_many :bundlings
has_many :offers, :through => :bundlings
has_many :merchants, :through => :offers
money :donation_value, :cents => :donation_value_cents
alias price donation_value
acts_as_sellable
STATUSES = %w(inactive active)
mount_upload... |
class Enfoque < ApplicationRecord
has_one :carrera
has_many :enfoque_materium
has_many :materium, through :enfoque_materium
validates :nombre,presence: true
validates :nombre, uniqueness: true
end
|
class LinkedAccount < ActiveRecord::Base
attr_accessible :provider, :secret, :token, :uid, :user_id,:name
belongs_to :user
PROVIDERS = {
:twitter => 1,
:facebook => 2,
:mixi => 3,
:soundcloud => 4,
:google => 5
}
after_create do
build_associated_user_account
end
def provider_n... |
Rails.application.routes.draw do
resources :videos, only: [:create, :index ]
get '/application-options', to: "application#index"
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
|
require_relative './order'
class Cart
attr_reader :orders
def initialize
@orders = []
end
# Adds an order to the cart
def add(product_code, quantity)
order = Order.new(product_code, quantity)
order = order.process
@orders.push(order)
end
end |
class DocomoAPI
def initialize
api = Rails.application.secrets[:docomo_api_key]
@uri = URI('https://api.apigw.smt.docomo.ne.jp/puxImageRecognition/v1/faceDetection')
@uri.query = 'APIKEY=' + api
end
#渡された画像URLに顔が写っているかどうかを判定
def face_judgement(picture_url)
response = RestClient.post(
@uri.... |
require 'generators/trailblazer/base'
module Rails
module Generators
class ConceptGenerator < ::Trailblazer::Generators::Cell
source_root File.expand_path('../../templates/concept', __FILE__)
def create_cell_file
template 'cell.rb', "#{base_path}/cell.rb"
end
hook_for(:template_... |
class RemoveDescriptionFromDogs < ActiveRecord::Migration
def up
remove_column :dogs, :description
end
def down
end
end
|
class CreateConversationMemberships < ActiveRecord::Migration[5.2]
def change
create_table :conversation_memberships do |t|
t.integer :user_id
t.integer :conversation_id
t.string :conversation_role
end
end
end
|
class FontIosevkaSs09 < Formula
version "18.0.0"
sha256 "d9622ffbbf952ab2fbba2c9051d876a4369057b9e22017ade35f4752be982213"
url "https://github.com/be5invis/Iosevka/releases/download/v#{version}/ttc-iosevka-ss09-#{version}.zip"
desc "Iosevka SS09"
desc "Sans-serif, slab-serif, monospace and quasi‑proportional ... |
json.array!(@users) do |user|
json.extract! user, :id
json.extract! user, :weibo_uid
end
|
class String
def to_boolean
self.downcase == 'true'
end
def to_number
if self.include? '.'
self.to_f
else
self.to_i
end
end
end
module RBFS
class Serializer
def self.serialize_files(files)
files.length.to_s + ':' + Serializer.help_serailize(files)
end
def self... |
require 'test_helper'
class Tools::ExtractSequencesControllerTest < ActionController::TestCase
context "test create generate fasta" do
setup do
u = users(:users_001)
UserSession.create(u)
@delayed_job_count = Job.count
end
context "Empty Post for JSON" do
setup do
post :... |
require 'yaml'
require 'ffi'
module Yogler
module LibLoader
TESTING = true
def self.debug(arg)
puts arg if TESTING
end
def self.libs
@libs || {}
end
def self.create_lib(lib_name)
opts = libs[lib_name.to_s]
opts["function_list"] = File.open("data/lib... |
# frozen_string_literal: true
require 'jiji/test/test_configuration'
require 'jiji/test/data_builder'
describe Jiji::Utils::TimeSource do
it '日時を設定/取得できる' do
time = Jiji::Utils::TimeSource.new
expect(time.now).not_to be nil
time.set(Time.new(2015, 1, 1))
expect(time.now).to eq Time.new(2015, 1, 1)... |
class AddEventsToClubs < ActiveRecord::Migration[5.2]
def change
change_column :events, :rsvp, :text
change_column :events, :location, :text
end
end
|
# frozen_string_literal: true
require 'sequel'
require 'casbin-ruby'
module CasbinRubySqlAdapter
# the interface for Casbin adapters
class Adapter < Casbin::Persist::Adapter
attr_reader :db, :table_name, :filtered
def initialize(db_url:, db_options: {}, table_name: :casbin_rule, filtered: false)
@t... |
# frozen_string_literal: true
module Datacite
class Configuration
include Singleton
##
# @!attribute [rw] domains
# @return [String]
# @!attribute [rw] host
# @return [String]
# @!attribute [rw] login
# @return [String]
# @!attribute [rw] password
# @return [String]
... |
# -*- encoding: utf-8 -*-
require 'simple_format/version'
require 'simple_format/emoji'
require 'simple_format/auto_link'
require 'sanitize' unless defined?(::Sanitize)
module SimpleFormat
class Converter
def initialize(emoji=nil)
@emoji = emoji if emoji.is_a?(SimpleFormat::Emoji)
end
def rich_wit... |
require 'chefspec'
require 'chefspec/berkshelf'
require 'pry'
Dir['./spec/support/**/*.rb'].sort.each {|f| require f}
RSpec.configure do |config|
config.platform = 'ubuntu'
config.version = '12.04'
config.role_path = 'spec/roles'
end
def runner(environment = 'test', attributes = {})
ChefSpec::SoloRunner.new ... |
module Troles::Common
module Marshaller
class Generic
attr_reader :role_subject, :valid_roles
def initialize role_subject
raise "The roles subject is not valid: #{role_subject}" if !role_subject || !role_subject.respond_to?(:has_role?)
@role_subject = role_subject
@valid_roles... |
module NetAppSdk
class Qtree < Filer
def self.create(qtreename, volname)
qtree_create = @@filer.invoke("qtree-create",
"qtree", qtreename,
"volume", volname)
raise qtree_create.results_reason \
if qtree_create.results_stat... |
# == Schema Information
#
# Table name: org_profiles
#
# id :integer not null, primary key
# animal_id :integer
# intake_date :date
# intake_reason :string(255)
# neuter_location_id :integer
# neuter_location_type :string(255)
# inta... |
set :application, "conversations"
default_run_options[:pty] = true
set :ssh_options, {:forward_agent => true}
set :repository, "git@cockatoosoftware.unfuddle.com:cockatoosoftware/#{application}.git"
set :branch, "master"
# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default)... |
require 'test_helper'
module Usermanagement
class FamilyviewsControllerTest < ActionController::TestCase
setup do
@familyview = usermanagement_familyviews(:one)
@routes = Engine.routes
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns... |
class AddColumnPersonidToContact < ActiveRecord::Migration
def self.up
add_column :contacts, :person_id, :integer
end
def self.down
remove_column :contacts, :person_id
end
end
|
# frozen_string_literal: true
ENV['ENABLE_COVERADGE_REPORT'] = 'false'
require 'singleton'
require 'fileutils'
require 'jiji/test/test_configuration'
require 'jiji/test/data_builder'
module Jiji
class Server
include Singleton
def initialize
@running = false
end
def setup(id)
return i... |
class Comment < ActiveRecord::Base
belongs_to :user
belongs_to :board
def require_permission?(user)
self.user.id == user.id
end
end
|
class AddNewsletterRestaurantsToUsers < ActiveRecord::Migration
def change
add_column :users, :newsletter_restaurants, :integer, array: true, null: false, default: []
remove_column :users, :newsletter_themes, :string, array: true
add_column :users, :newsletter_themes, :integer, array: true, null: false, d... |
require 'chefspec'
require 'chefspec/berkshelf'
require 'json'
RSpec.configure do |config|
config.log_level = :fatal
end
def create_cron_d(name)
ChefSpec::Matchers::ResourceMatcher.new(:cron_d, :create, name)
end
def delete_cron_d(name)
ChefSpec::Matchers::ResourceMatcher.new(:cron_d, :delete, name)
end
def s... |
class Timer
def initialize
@time = 0
@hour = 0
@minute = 0
@second = 0
end
def seconds=(time)
@time = time
end
def seconds
return @time
end
def time_string
if @time >= 3600
@hour = @time / 3600
@minute = @time % 3600 / 60
@second = @time - @hour * 3600 - @minute * 60
elsif @time >= 6... |
class AddSiteEnrollmentexemption < ActiveRecord::Migration
def up
if(column_exists? :dsc_enrollments, :exemption_id)
remove_reference :dsc_enrollments, :exemption
remove_foreign_key :dsc_enrollments, :exemptions
end
end
def change
# The Address + Location of the Waste Operation
add_... |
class NameFormatValidator < ActiveModel::EachValidator
def validate_each(object, attribute, value)
# This regex should allow only letters in a name (or nil)
#---------------------------------------------------------------
if value.nil?
return
end
unless value =~ /^[\w\-'\s]+$/
object.... |
class SceneEditHospital
BLUE_BACKGROUND = WindowBase::BLUE_BACKGROUND
attr_accessor :window_message, :all_windows
def initialize(app, wm)
@app = app
@window_id = WindowInfoInput.new(@app, 5, 25, 150, 20, 1, BLUE_BACKGROUND, "医院ID", true, true)
@window_hospital_name = WindowInfoInput.new(@app, 5,... |
# require "./lib/drivers_collection"
# describe DriversCollection do
# subject(:dc) { DriversCollection.new }
# describe "#all" do
# context "two drivers" do
# before do
# dc.add(driver1)
# dc.add(driver2)
# end
# let(:driver1) { Driver.new("Bill Smith", "male", "2000", "5") ... |
class Browser
def initialize (default_browser, profile, ini)
@default_browser = default_browser
@profile = profile
@ini = ini
change_firefox_profile
change_browser
end
private
attr_reader :profile, :ini
def firefox_profiles
@firefox_profiles ||= begin
profiles = File.read(ini)
... |
#gets type of math user wants to perform
puts "\nLet's do some simple Math!"
print "What would you like me to do? "
command = gets.chomp.downcase
possible_commands = ["addition", "add", "+", "plus", "subtraction", "minus", "-", "subtract", "multiply", "times", "*", "x", "multiplication" , "division", "divide", "/"]
#... |
# frozen_string_literal: true
module Permissions
class Permission < ActiveRecord::Base
def self.permissions_for_class(*klasses, right: nil)
class_names = klasses.map { |klass| klass_to_string klass }
conditions = { object_type: class_names, object_id: nil }
permissions_scope = righ... |
class User::SignOutInteraction < InteractionBase
def exec
require_current_user!
current_user.remove_token mobile_device_id
end
def as_json opts = {}
{ message: I18n.t('user.notifications.sign_out') }
end
end
|
Rails.application.routes.draw do
root 'posts#index', as: 'home' #home page
get 'about' => 'pages#about', as: 'about' #about page
resources :posts #all CRUD routes for posts ^^
end
|
require 'securerandom'
require 'action_dispatch'
require 'digest'
module Services
class Base
class << self
def inherited(subclass)
subclass.const_set :Error, Class.new(StandardError)
subclass.send :include, Rails.application.routes.url_helpers if defined?(Rails)
subclass.send :inclu... |
class RemoveDiscountValueFromQuotation < ActiveRecord::Migration[5.1]
def change
remove_column :quotations, :discount_value, :integer
end
end
|
class SitesController < ApplicationController
def show
@site = Site.find(params[:id])
@collection_points = @site.collection_points
@soilmoistures = []
@collection_points.each_with_index do |point, key|
@soilmoistures[key] = Hash.new
@soilmoistures[key]['point... |
class Event < ApplicationRecord
has_many :user_events
has_many :users
end
|
class AddStateToInstalls < ActiveRecord::Migration
def self.up
add_column :installs, :state, :string
add_index :installs, :state
User.all.each do |user|
user.installs.group_by(&:app_id).each do |(app_id, installs)|
state = 'Initial'
installs.each do |install|
if ins... |
# frozen_string_literal: true
class MembershipsController < ApplicationController
before_action :authenticate_token!, except: %i[update_memberships]
before_action :authenticate_as_owner!, only: %i[update destroy]
before_action :authenticate_as_privileged!, only: %i[granted_memberships]
after_action :log_event,... |
Pod::Spec.new do |spec|
spec.name = "AlefSDK"
spec.version = "0.1.0"
spec.summary = "A short description of AlefSDK."
spec.homepage = "https://alefedge.com"
spec.license = "MIT"
spec.author = { "Lam Ngo" => "lam.ngo@alefedge.com" }
spec.source = { :git => 'https://... |
# modify the code so that the loop stops if
# number is equal to, or between, 0 and 10
loop do
number = rand(100)
puts number
break if number.between?(0, 10)
end |
class CreateLikes < ActiveRecord::Migration[5.0]
def change
create_table :likes do |t|
t.integer :user_id
t.integer :article_id, null: true
t.integer :comment_id, null: true
t.integer :rx_id, null: true
t.integer :formulation_id, null: true
t.integer :category_id, null: true
... |
class BowlingGame
def initialize(frames)
@score_string = frames
@total_score=0
@bonus_frames = 0
if frames[frames.length-3] == "X"
@bonus_frames = 2
elsif frames[frames.length-2] == "/"
@bonus_frames = 1
end
twoAgo = ""
oneAgo = ""
framesLeft = frames.le... |
class Definition < ActiveRecord::Base
before_save { word.downcase! }
validates :word, presence: true
validates :meaning, presence: true
end
|
class Definitions
attr_reader(:word_definition)
@@definitions_list = []
define_method(:initialize) do |attributes|
@word_definition = attributes.fetch(:word_definition)
@id = @@definitions_list.length().+(1)
end
define_method(:id) do
@id
end
define_method(:save) do
@@definitions_list.pu... |
class CreateSpotTags < ActiveRecord::Migration
def self.up
create_table :spot_tags, :force => true do |t|
t.string :name,:limit=>20
t.integer :spots_count,:default=>0
end
add_index :spot_tags, :name
sql = ActiveRecord::Base.connection()
sql.begin_db_transaction
File.ope... |
class CheckInsController < ApplicationController
skip_before_action :verify_authenticity_token
before_action :require_user, only: [:create, :update, :destroy]
def create
@newcheckin = CheckIn.new(checkin_params)
@newcheckin.user = current_user
@newcheckin.subscription = current_user.subscriptions.las... |
require 'test_helper'
class TripsIndexTest < ActionDispatch::IntegrationTest
def setup
@trip = trips(:tester)
end
test "index including pagination" do
get trips_path
assert_template 'trips/index'
assert_select 'div.pagination'
Trip.paginate(page: 1).each do |trip|
assert_select 'a[... |
class Email < SnapshotCluster
cluster_of :email_snapshots
has_signature :ad
has_many :account_emails
def cluster_targeting_id
# if it's not a cluster of emaisl we sent, it's garbage
# eg "Welcome to Gmail" email
(self.snapshots.first.exp_e_id || self.snapshots.first.outsider) ? self.id.to_s : "gar... |
class ServiceStationAdministratorServiceStationShip < ActiveRecord::Base
belongs_to :service_station
belongs_to :service_station_administrator
end
|
module Naf
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
errors = Array(instance.error_message).join('; ')
if html_tag =~ /^<label for=/
%(<span class="validation-error">#{html_tag}</span>).html_safe
else
%(#{html_tag}<span class="validation-error"> #{errors}</span... |
# -*- coding: utf-8 -*-
#
# Author:: lnznt
# Copyright:: (C) 2011 lnznt.
# License:: Ruby's
#
require 'gmrw/ssh2/message/def_message'
module GMRW::SSH2::Message
categories = ['diffie-hellman-group1-sha1','diffie-hellman-group14-sha1']
def_message :kexdh_init, [
[ :byte, :type, 30 ],
[ :mpint, :e ... |
# frozen_string_literal: true
module Might
# User provided sorting syntax:
# * `name` - sort by name
# * `-name` - sort by name in reversed order
# * `-name,created_at` - sort by name in reversed order, and then sort by created_at
#
# This middleware parses sorting string and builds Parameter array
... |
require 'fog/openstack/models/volume/volume'
module Fog
module Volume
class OpenStack
class V1
class Volume < Fog::Volume::OpenStack::Volume
identity :id
superclass.attributes.each{|attrib| attribute attrib}
attribute :display_name, :aliases => 'displayName'
... |
class AddGoodreadsLinkImageUrlSmallImageUrlToBook < ActiveRecord::Migration
def change
add_column :books, :goodreads_link, :string
add_column :books, :image_url, :string
add_column :books, :small_image_url, :string
end
end
|
module Paysafe
module Refinements
module SnakeCase
refine Hash do
def to_snake_case(data = self)
case data
when Array
data.map { |value| to_snake_case(value) }
when Hash
data.map { |key, value| [underscore_key(key), to_snake_case(value)] }.to_h
... |
# frozen_string_literal: true
#
# Fluentd Kubernetes Metadata Filter Plugin - Enrich Fluentd events with
# Kubernetes metadata
#
# Copyright 2017 Red Hat, 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 ... |
class Consistent
def consistent?(kat)
first = kat.first
last = kat.last
len = kat.size
(last - first) == (len - 1) ? true : false
end
def make_consistent(start=1)
if (self.is_pstack_consistent?) && (self.positions.first.position == start)
#... |
# nome
# apelido
# user_id / user
# empresa_id / empresa
require "data_source"
class Colaborador < ActiveRecord::Base
belongs_to :user , :autosave => true
belongs_to :empresa
belongs_to :organizacao
has_many :colaboradores_empresas , :class_name => "ColaboradorEmpresa"
has_many :empresas, :through => :cola... |
class Book
def title
@title
end
def title=(string)
string.capitalize!
end
end |
class WineRetionTreeRenameParrentToParentId < ActiveRecord::Migration
def up
rename_column :wine_region_trees, :parent, :parent_id
end
def down
rename_column :wine_region_trees, :parent_id, :parent
end
end |
# frozen_string_literal: true
require 'simplecov'
SimpleCov.start
require 'minitest/autorun'
require 'minitest/pride'
require 'bigdecimal'
require './lib/item'
# Item test class
class ItemTest < Minitest::Test
def setup
@item = Item.new(
id: 1,
name: 'Pencil',
description: 'Y... |
require 'rubygems'
require 'sinatra'
require 'timeout'
require 'pp'
require File.expand_path(File.dirname(__FILE__) + '/string')
require File.expand_path(File.dirname(__FILE__) + '/path_grabber')
KOAN_FILENAMES = PathGrabber.new.koan_filenames
EDGECASE_CODE = IO.read("koans/edgecase.rb").remove_require_lines.s... |
class ItemAmountsController < ApplicationController
def index
@item_amounts = current_user.item_amounts
@categories = @item_amounts.map { |item_amount| item_amount.category }.uniq.sort
@expiring_items = @item_amounts.filter { |item_amount| item_amount.expired? }
@recipes = Recipe.all
@item_amounts... |
class QuotationLine < ApplicationRecord
acts_as_paranoid
belongs_to :quotation
belongs_to :job_request
before_save :calculate_total
before_update :calculate_total
monetize :price_per_unit_cents, with_model_currency: :currency, numericality: { greater_than_or_equal_to: 0 }
monetize :total_cents, with_model... |
class CreateBettingDetails < ActiveRecord::Migration[5.2]
def change
create_table :betting_details do |t|
t.integer :betting_ticket_id
t.integer :bet_type
t.boolean :multi
t.boolean :box
t.boolean :nagashi
t.boolean :formation
t.string :first_horse, array: true
t.st... |
class AddSubscriberIdToSavedEmail < ActiveRecord::Migration
def change
add_column :saved_emails, :subscriber_id, :integer
end
end
|
# frozen_string_literal: true
require "rails_helper"
RSpec.describe Aspace::Indexer do
describe ".index_new" do
before do
stub_aspace_login
stub_aspace_repositories
stub_aspace_resource_ids(repository_id: "13", resource_ids: ["1", "2", "3"])
stub_aspace_resource_ids(repository_id: "13", m... |
=begin
Question 5
Depending on a method to modify its arguments can be tricky:
def tricky_method(a_string_param, an_array_param)
a_string_param += "rutabaga"
an_array_param << "rutabaga"
end
my_string = "pumpkins"
my_array = ["pumpkins"]
tricky_method(my_string, my_array)
puts "My string looks li... |
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
module Gradebook
module Components
module Models
class Attendance < Base
properties :type,:parent_name,:parent_type,:name,:t... |
require_relative('../db/sql_runner')
class ShooOrder
attr_reader :full_name, :address, :quantity, :size
def initialize(params)
@id = params['id'].to_i
@full_name = params['full_name']
@address = params['address']
@quantity = params['quantity'].to_i
@size = params['size'].to_i
end
def save()
sql = "INSER... |
class CreateWholesalePrices < ActiveRecord::Migration
def self.up
create_table :wholesale_prices do |t|
t.integer :minimum_quantity
t.float :discount_percentage
t.text :terms
t.boolean :enabled
t.timestamps
end
end
def self.down
drop_table :wholesale_prices
end
end
|
require_relative '../lib/players_rating.rb'
describe PlayersRating do
it 'Raises argument error when arguments are given' do
expect { PlayersRating.new('value') }.to raise_error(ArgumentError)
end
end
|
class AboutController < ApplicationController
def index
url = url_from_path(:url) unless params[:url].blank?
@feed = Feed.find_by(feedlink: url) unless url.blank?
unless @feed.nil?
@is_feedlink = true
respond_to do |format|
format.html { render action: :index }
format.json { re... |
require 'rails_helper'
RSpec.describe Checkout::PaymentStep do
let(:order) { create :order}
let(:user) { create :user }
let(:params) do
ActionController::Parameters.new( order: { credit_card_attributes: attributes_for(:credit_card).to_h } )
end
let(:invalid_params) do
ActionController::Paramet... |
class PagesController < ApplicationController
skip_before_action :authenticate_user!, only: [:home, :map]
def home
@experiences = Experience.all
end
def map
@experiences = Experience.geocoded
@markers = @experiences.map do |experience|
{
lat: experience.latitude,
lng: experi... |
require 'net/http'
require 'uri'
require 'json'
module Services
class Base
def post(path, body = {})
uri = URI.parse("#{base_url}/#{path}")
Rails.logger.info(">>>>> Calling external #{uri} - body `#{body}`")
r = Net::HTTP::Post.new(uri.request_uri, header)
r.body = body
respos = htt... |
class UsersController < ApplicationController
def new
@user = User.new
end
def create
params = user_params
params['completed'] = true
params['verified'] = false
current_user = User.find_by_email(params['email'])
if (current_user.nil?)
current_user = User.new(params)
if curre... |
module BackpackTF
module Price
# This lives inside the `@items` hash of BackpackTF::Price::Response
class Item
# @return [String] the name of item
attr_reader :item_name
# @return [Fixnum] an index number as per TF2's Item Schema
attr_reader :defindex
# @return [Hash<Fixnum, Item... |
require 'rake/clean'
require 'configatron'
require 'dictionary'
Dir.glob(File.join(File.dirname(__FILE__), 'tools/Rake/*.rb')).each do |f|
require f
end
include Rake::DSL
verbose true
task :default => [:clobber, 'compile:all', 'tests:run', 'package:all']
desc 'Runs a quick build just compiling the libs ... |
class AddColumnsToDetections < ActiveRecord::Migration
def change
add_column :detections, :category, :string
add_column :detections, :date_occurred, :string
end
end
|
require 'rails_helper'
RSpec.describe User, type: :model do
describe 'associations' do
it { should have_many(:orders) }
end
describe 'validations' do
it { should validate_presence_of(:name) }
it { should validate_presence_of(:email) }
it { should validate_uniqueness_of(:email).ignoring_case_sens... |
require 'assert'
require 'sanford-protocol/test/fake_socket'
# These tests are intended as a high level test against Sanford's server. They
# use fake and real connections to test how Sanford behaves.
class RequestHandlingTests < Assert::Context
desc "Sanford's handling of requests"
setup do
@env_sanford_prot... |
# frozen_string_literal: true
module Importers
class BranchOwners < Importer
self.path = :branch_owners
def hashify_json
json_data.map.with_index do |row, i|
[
i,
{
branch_id: row['branch_id'],
user_id: row['user_id']
}
]
end
... |
module Generator
class ConstantGenerator
attr_reader :value
def initialize(seed=nil)
seed = Random.new_seed if seed.nil?
@prng = Random.new(seed)
end
def generate(value)
@value = value
# Return a link to the object so that methods can be chained
self
end
... |
xml.instruct!
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
site_url = "#{config[:base_url]}/blog"
xml.title "GoCD"
xml.subtitle "Continuous Delivery"
xml.id URI.join(site_url, blog.options.prefix.to_s)
xml.link "href" => URI.join(site_url, blog.options.prefix.to_s)
xml.link "href" => URI.join(site_u... |
Pod::Spec.new do |s|
s.name = 'iTunesControls'
s.version = '0.1.0'
s.summary = 'A wrapper to control iTunes app.'
s.description = <<-DESC
A wrapper to control iTunes app on macOS 10.14 and older.
DESC
s.homepage = 'https://github.com/Minh-T... |
namespace :import do
desc "Import EMS locations' data to db."
task :ems => :environment do
flocation = File.open('./lib/tasks/emslocation.json')
location = flocation.read
locs = eval(location)
locs.each do |loc|
puts loc['name'] + ' '+ loc['value'] + ' ' + loc['type']
p = Emslocation.c... |
class ApplicationController < ActionController::Base
include AbstractController::Rendering
include ActionController::Rendering
include ActionController::Renderers::All
include ActionController::StrongParameters
include ActionController::ForceSSL
include ActionController::Instrumentation
include Serialize... |
RSpec.describe OSM::Exporter do
before(:all) do
@png = File.read('spec/fixtures/tile.png')
response = Typhoeus::Response.new(code: 200, body: @png)
Typhoeus.stub(/tiles\.example\.com/).and_return(response)
@tile = OpenStruct.new(x: 136485, y: 92249)
end
it "downloads the tiles" do
exporter = ... |
module RelationshipTracer
class StepLimitExceeded < StandardError; end
class UnknownRelator < StandardError; end
def self.included(base)
base.extend(ClassMethods)
end
# Recursively find all series system relationships for an object
# Returns nested arrays of uris
#
# Examples:
# obj.trace('... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.