text stringlengths 10 2.61M |
|---|
require_relative 'message_constants'
module GroupBuzz
class SenderNameProcessor
include GroupBuzz::MessageConstants
def extract_sender_name(sender_name)
sender_name.delete('"').gsub(GROUPBUZZ_SENDER_VIA_SUFFIX, '')
end
end
end |
class DropPhotosTable < ActiveRecord::Migration
def up
drop_table :photos
end
def down
create_table :photos do |t|
t.datetime :photographed_at
t.float :latitude
t.float :longtitude
end
end
end
|
class AddSocialLinksToQuestionaires < ActiveRecord::Migration[5.2]
def change
add_column :questionaires, :whats_app, :string
add_column :questionaires, :linkedin, :string
add_column :questionaires, :twitter, :string
end
end
|
require 'rails_helper'
describe "the add a comment process" do
it "should add a comment" do
choice_one = Choice.create({ option: "Would you rather", option_a: "this", option_b: "that" })
visit choice_path(choice_one)
fill_in "Text", with: "This is a comment"
click_on 'Comment'
expect(page).to ha... |
require 'spec_helper'
describe Mist do
it "should generate the repo automatically" do
Mist.repository
File.should be_directory(Mist.repository_location.join('.git'))
end
describe "with an existing repo" do
before do
Git.init(Mist.repository_location.to_s)
end
it "should not gene... |
# encoding: UTF-8
require File.dirname(__FILE__) + '/acceptance_helper'
feature "Time logging", %q{
In order to trace spent time
As a user
I want to see time spent on a project and tasks
} do
scenario "Seeing time spent on my own tasks" do
fake_pivotal_api
sign_in_as "user@amberbit.com"
visit task... |
require "spec_helper"
describe "See talks", :type => :request do
let!(:user) { create(:user, :paul) }
let!(:talk) { create(:talk, :users => [ user ], :owner => user.id) }
context "with two talks" do
before do
login_as(user)
visit root_path
click_link "Palestras"
end
it "redirects ... |
class Favor
attr_accessor :person
attr_accessor :amount
def initialize(person, amount)
@person = person
@amount = amount
end
end
class Person
attr_accessor :name
attr_accessor :favor
def initialize(name)
@name = name
@favor = {}
end
def add_favor(other, direction, amount)
facto... |
require 'nokogiri'
class TkXML
def parse(source)
listener = Nokogiri_Listener.new(self)
parser = Nokogiri::XML::SAX::Parser.new(listener)
parser.parse(source)
end
#
class Nokogiri_Listener < Nokogiri::XML::SAX::Document
#
attr :tk
#
def initialize(tk)
super()
@tk =... |
Rails.application.routes.draw do
get '/', to: 'welcome#show'
get 'welcome/', to: 'welcome#show'
get 'welcome/:id/', to: 'welcome#show'
get 'contact/', to: 'contact#show'
get 'team/', to: 'team#show'
get 'message/show'
# For details on the DSL available within this file, see http://guides.rubyonrails.or... |
module Jekyll
class TagPageList < Liquid::Tag
def initialize(tag_name, text, tokens)
super
end
def render(context)
tags = context.registers[:site].tags
html = ""
sorted = tags.sort_by { |t,posts| posts.count }
sorted.reverse.each do |t, posts|
html << "<li><span cl... |
begin
require "aws-sdk-s3"
rescue LoadError => e
e.message << " (You may need to install the aws-sdk-s3 gem)"
raise e
end
module Paperclip
module Storage
# Need to create boolean field synced_to_s3
module Delayeds3
class << self
def included(base)
base.extend(ClassMethods)
... |
class AddPremiumOnPa < ActiveRecord::Migration
def change
add_column :pas, :premium, :float
end
end
|
# frozen_string_literal: true
class ApplicationController < ActionController::Base
# TODO: Remove once https://github.com/inertiajs/inertia-rails/pull/72 is merged and fixed
# Should be "if" instead of "unless"
after_action do
# Axios by default looks for an XSRF-TOKEN cookie to use for POST requests
coo... |
#!/usr/bin/env ruby
#
require 'bio'
def printUsage(str)
puts str
puts "Usage: fasta_extract_region -c <contig> [-a]|[-s <start_positions> -l <lengths>] <input.fasta>"
end
line_size = 70
tmp = ARGV.shift
if tmp!="-c"
printUsage("Missing -c")
exit
end
contig = ARGV.shift
all = false
tmp = ARGV.shift
if tmp=="-a"
... |
# -*- encoding : utf-8 -*-
class AddEncryptedUidToLinks < ActiveRecord::Migration
def change
add_column :links, :encrypted_uid, :string
end
end
|
require 'spec_helper'
describe "completed_challenges/edit.html.erb" do
before(:each) do
@completed_challenge = assign(:completed_challenge, stub_model(CompletedChallenge,
:user_id => 1,
:challenge_id => 1,
:user_specific_gameplan_id => 1
))
end
it "renders the edit completed_challenge ... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/centos-7.1"
config.ssh.insert_key = false
config.vm.define 'web' do |web|
web... |
# frozen_string_literal: true
module Vedeu
# Converts the array of elements provided into a comma separated
# sentence with the penultimate and ultimate elements separated with
# the word 'and'.
#
# @api public
#
class Sentence
# @param (see #initialize)
# @return (see #construct)
def self.... |
module V1
module Services
class Update < Base
helpers V1::Params::Services
desc I18n.t('api.v1.services.update.desc') do
failure(
[
{ code: 400, message: I18n.t('api.code_400') },
{ code: 422, message: I18n.t('api.code_422') }
]
)
su... |
module YoutubeEmbed
module ModelAdditions
def youtube_embed(attribute, options)
before_validation do
send("#{attribute}=", YoutubeEmbed.youtube_embed(send(attribute), options))
end
end
end
end |
# Read about factories at https://github.com/thoughtbot/factory_girl
require 'faker'
FactoryGirl.define do
factory :moderator, class: User do
sequence(:username) { |n| "user#{n}" }
sequence(:email) { |n| "user#{n}@user#{n}.com"}
password "password"
end
factory :sub do
name Faker::Lorem.word
... |
namespace :update do
desc "Create CcTld classes from Wikipedia's list of ccTLDs."
task :tlds do
dirname = File.dirname(__FILE__)
gen = File.join(dirname, %w{tld.rb})
cc_lib = File.expand_path(File.join(dirname, %w{.. lib tld cc_tld.rb}))
generic_lib = Fil... |
class User < ApplicationRecord
has_many :image_feeds
def self.get_feeds(access_token)
client = InstagramApis.get_recent_media(access_token)
user = save_username(client)
if user
ImageFeed.save_user_feeds(client.user_recent_media, user)
end
return user
end
def self.save_username(cli... |
class RemoveUnique2 < ActiveRecord::Migration[5.2]
def change
remove_column :channels, :title
add_column :channels, :title, :string
add_index :channels, :title
end
end
|
# frozen_string_literal: true
# Rules for validations, associatoin for patients table
class Patient < ApplicationRecord
enum patient_type: %i[out_patient in_patient emergency]
enum status: %i[not_admit admit refered discharged checkout]
#validate :status_cannot_be_dischared_on_creating
before_create :dump_ad... |
module SimpleJsonapi::Node
# Represents a +links+ object (a collection of links).
#
# @!attribute [r] object
# @return [Object]
# @!attribute [r] link_definitions
# @return [Hash{Symbol => Definition::Link}]
class ObjectLinks < Base
attr_reader :object, :link_definitions
# @param object [Obje... |
require_relative '../models/post'
# -- Posts
# Show create post form
get '/posts/new' do
# Redirect to login if not authenticated
if !logged_in?
redirect to '/session/new'
end
erb :post_new
end
# Create new post
post '/posts' do
# Redirect to login if not authenticated
if !logged_in?
redirect to ... |
class Sheets::Renderers::CSVRenderer < Sheets::Renderers::Base
renders :csv
def to_csv
@data.collect {|row| row.join(',') }.join("\n")
end
end |
# == Schema Information
# Schema version: 20081119013232
#
# Table name: games
#
# id :integer(4) not null, primary key
# current_player :integer(4)
# created_at :datetime
# updated_at :datetime
# world_id :integer(4)
# is_allocation_round :integer(4) d... |
require_relative('../db/sql_runner')
class Album
#getters
attr_reader :name, :quantity, :artist_id, :id
#initialize
def initialize(options)
@id = options["id"].to_i if options["id"]
@name = options["name"]
@quantity = options["quantity"].to_i
@artist_id = options["artist_id"].to_i
end
#save m... |
require 'test_helper'
class ContactTest < ActiveSupport::TestCase
def setup
@contact = Contact.new(name: "画像のアップロードができない",
email: "user1@example.com",
message: "画像がアップロードできません。どうしたらよいでしょうか?")
end
test 'should be valid' do
assert @contact.valid?
en... |
class CreateChores < ActiveRecord::Migration
def change
create_table :chores do |t|
t.belongs_to :lists
t.string :name
t.boolean :isDone, :default => false
t.integer :list_id
t.timestamps
end
end
end
|
class Xlineitem < ActiveRecord::Base
belongs_to :xferslip
default_scope -> { order('itemnumber ASC') }
validates :xferslip_id, presence: true
validates :listid, presence: true
validates :itemnumber, presence: true
validates :desc1, presence: true
validates :quantity, numericality: { greater_than: 0 }
end
|
class UsersController < ApplicationController
def show
@user = User.find(params[:id])
@messages = @user.messages.order('created_at DESC')
end
end
|
class Users::SessionsController < Devise::SessionsController
# before_action :configure_sign_in_params, only: [:create]
before_action :set_sign_in_page_metadata, only: :new
before_action :set_devise_banner_title
#caches_page :new
# GET /resource/sign_in
# def new
# super
# end
# POST /resource/sig... |
class Users::SessionsController < Devise::SessionsController
# before_action :configure_sign_in_params, only: [:create]
# GET /resource/sign_in
# def new
# super
# end
# POST /resource/sign_in
def create
unless current_user.blank?
if !(current_user.admin? or current_user.contributor?)
@session = S... |
require 'resolv'
module EM::Xmpp
module Resolver
extend self
def resolve(domain)
resolve_all(domain).first
end
def resolve_all(domain)
srv = []
Resolv::DNS.open do |dns|
record = "_xmpp-client._tcp.#{domain}"
srv = dns.getresources(record, Resolv::DNS::Resource::IN... |
require 'ftp_photo_uploader'
require 'test/unit'
class FtpPhotoUploaderTest < Test::Unit::TestCase
def setup
@photo_sorter = PhotoSorter.new
@photo_sorter.photo_data = {"petrababa"=>[{"files"=>["23?2", "56?4", 89, 90], "with"=>"dsc543"}], "newyork"=>[{"files"=>["02?3", "03", "07", "13?2"], "with"=>"dsc024"}... |
class AddReferenceUserToPieceHistoric < ActiveRecord::Migration
def change
add_reference :piece_historic_situations, :user, index: true, foreign_key: true
end
end
|
require_relative 'Jungle_beats.rb'
puts "Welcome to Jungle Beats!"
continue = true
while continue == true
puts "Let's make a beat! Enter some sounds:"
initial = gets.chomp
jb = JungleBeat.new(initial)
continue2 = true
skip_msg = false
until continue2 == false
if skip_msg == false
puts "Your beat s... |
class ApplicationController < ActionController::Base
rescue_from ActiveRecord::RecordNotFound, with: :record_not_found
protect_from_forgery with: :exception
before_action :authorize
before_action :set_i18n_locale_from_params
before_action :set_hit_counter
before_action :logout_user_on_inactivity
around_ac... |
class EditarPage < SitePrism::Page
element :viewTask, "a[href='index.php?module=Tasks&action=index&return_module=Tasks&return_action=DetailView']"
elements :botao_edit, "a[class='edit-link']"
element :contactName, "input[id='contact_name']"
elements :saveButton, '#SAVE'
element :validarTitulo, ".module-title-text... |
require "spec_helper"
describe StoriesController do
describe "routing" do
it "routes to #index" do
get("/").should route_to("stories#index")
end
it "routes to #new" do
get("/submit").should route_to("stories#new")
end
it "routes to #show" do
get("/1").should route_to("stories... |
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
class HolydayCalendar
@@year = 0
@@month = 0
@@day = 0
def initialize(year=nil, month=nil, day=nil)
@@year=year
@@month=month
@@day=day
end
def self.isNationalHolyday(year=@@year, month=@@month, day=@@day)
# ref. http://homepage1.nifty.com/~tetsu/rub... |
# Preview all emails at http://localhost:3000/rails/mailers/doctor_mailer
class DoctorMailerPreview < ActionMailer::Preview
def update_password
DoctorMailer.with(doctor: Doctor.last).update_password
end
end
|
# frozen_string_literal: true
class Document
class GuestShareSerializer < ActiveModel::Serializer
attributes :share_id, :document_title, :document_owner_username, :document_id
def share_id
object.id.to_s
end
def document_id
document.id.to_s
end
def document_title
document... |
class Api::ApiKeysController < ApiController
respond_to :json
skip_before_filter :restrict_access, :only => [:create]
def create
authenticated_user = User.find_by_email(login_params[:email]).authenticate(login_params[:password])
respond_to do |format|
format.json {
if authenticated_user
... |
class Knight < Piece
def valid_move?(x, y)
super(x,y) &&
[(x - x_position).abs, (y - y_position).abs].sort == [1,2]
end
end
|
require 'faraday'
require 'faraday_middleware'
module Graphlient
module Adapters
module HTTP
class FaradayAdapter < Adapter
def execute(document:, operation_name:, variables:, context:)
response = connection.post do |req|
req.headers.merge!(context[:headers] || {})
... |
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
def location
if Rails.env.test? || Rails.env.development?
Geocoder.search("72.229.28.185").first.data["city"]
... |
# frozen_string_literal: true
module Robots
module DorRepo
module Release
class UpdateMarc < LyberCore::Robot
def initialize
super('releaseWF', 'update-marc')
end
# `perform` is the main entry point for the robot. This is where
# all of the robot's work is done.
... |
require 'yaml'
require_relative 'board'
class Minesweeper
LAYOUT = {
small: { grid_size: 9, num_bombs: 10 }
}
def initialize(size)
layout = LAYOUT[size]
@board = Board.new(layout[:grid_size], layout[:num_bombs])
end
def run
until @board.win? || @board.lost?
system('clear')
puts ... |
module Hydra::Works
class MoveGenericFileToGenericWork
##
# Move a generic file from one generic work to another
#
# @param [Hydra::Works::GenericWork] :old_parent_work where the generic file currently lives
# @param [Hydra::Works::GenericWork] :new_parent_work where the generic file is being mov... |
require 'net/http'
require 'json'
class RpcHelper
attr_accessor :rpc_user, :rpc_password, :host, :port
def initialize(rpc_user, rpc_password, host, port)
self.rpc_user = rpc_user
self.rpc_password = rpc_password
self.host = host
self.port = port
end
def rpc(method, *params)
http = Net::HT... |
class RegistrationsController < ApplicationController
# Get sign-up
def new
end
# Post sign-up
def sign_up
@user = User.new
@user.email = params[:user][:email]
@user.password = params[:user][:password]
@user.password_confirmation = params[:user][:password_confirmation]
@user.user_id = '1... |
# frozen_string_literal: true
require 'bank_deposits/calculate_annual_deposit_sum'
# Expected results are calculated with CalculateStuff.com:
# https://www.calculatestuff.com/financial/compound-interest-calculator
RSpec.describe BankDeposits::CalculateAnnualDepositSum, '#call' do
subject { calculate_annual_deposit... |
#!/usr/bin/env ruby
# == Synopsis
# The wddx command can be used to save pretty print wddx XML files.
#
# == Usage
# You can pipe wddx xml into the wddx command:
# xmllint test.xml | wddx
# You can read files:
# wddx < wddx.xml
# OR
# wddx wddx.xml
#
# == Author
# Stefan Saasen
#
# == Copyright
# Copyrigh... |
TOTAL_ROWS_COUNT = 128
TOTAL_COLS_COUNT = 8
ROW_SYMBOLS_COUNT = 7
SEAT_SYMBOLS_COUNT = 3
def binary_search(str, l_sym, r_sym, min, max)
return str.first == r_sym ? max : min if str.count == 1
if str.first == l_sym
binary_search(str.drop(1), l_sym, r_sym, min, max - (max - min + 1) / 2)
elsif str.first == r_s... |
require 'rails_helper'
require 'helper_methods'
describe Vote do
before :all do
populate_users(10)
init_variables
end
before :each do
@discussion = Discussion.start(@user0, @text)
@comment = Comment.new(user: @user1, parent_id: @main_thread_reply[:parent_id], content: @main_thread_reply[:content... |
#! /usr/bin/env ruby
#
# sheepdog_expect checks for a last connection using regex, e.g.
#
# sheepdog_expect --filter penguin2 --elapse 24h
#
rootpath = File.dirname(File.dirname(__FILE__))
$: << File.join(rootpath,'lib')
require 'json'
require 'optparse'
require 'ostruct'
require 'sheepdog'
require 'time'
require '... |
require 'rails_helper'
RSpec.describe FacilitiesManagement::ServiceHours, type: :model do
let(:service_hours) { described_class.new }
let(:source) do
{ 'monday': { service_choice: :not_required },
'tuesday': { service_choice: :all_day },
'wednesday': { service_choice: :hourly, start_hour: '10', sta... |
module RecommendedLinks
class RecommendedLink < Struct.new(:title, :description, :url, :match_phrases, :format, :search_index)
def to_index
{
"title" => title,
"description" => description,
"format" => format,
"link" => url,
"... |
require 'rails_helper'
RSpec.describe Event, type: :model do
let(:user) { User.new(username: 'admin') }
subject(:event) { Event.new(start: Date.today, finish: Date.today + 1.day, timezone: 'CET', creator: user) }
let!(:events) { create_list(:event, 10)}
describe 'validations' do
it 'is valid with valid atr... |
class TicTacToe
Player = Struct.new(:name, :symbol)
def spots
@spots = [1,2,3,4,5,6,7,8,9]
end
def board
@board = [" ", " ", " ", " ", " ", " ", " ", " " , " "]
end
def initial_board
puts " "
puts "Please type a number to select a position on the board: "
puts " "
puts "... |
# frozen_string_literal: true
class RemoveStatusField < ActiveRecord::Migration[5.2]
def change
remove_column :tickets, :status
end
end
|
require "addressable/uri"
require "oj"
module Zulu
class SubscriptionRequest
LIST = "subscription_requests".freeze
MODES = %w(subscribe unsubscribe).freeze
def self.push(request)
Zulu.redis.lpush(LIST, request.to_json)
end
def self.pop(timeout=nil)
_, params = Zulu.redis.br... |
class User < ActiveRecord::Base
has_many :photos
has_many :tags, autosave: true, dependent: :destroy
has_many :photos, through: :tags
has_secure_password
validates :email, :presence => true, :uniqueness => true,
length: { maximum: 50 }
validates_format_of :email, with: /^.+@.+\..+$/, on: :create... |
class Theme < ActiveRecord::Base
has_and_belongs_to_many :events
validates :name, :presence => true, :uniqueness => true
end
|
class AddSubHeaderToArticle < ActiveRecord::Migration
def change
add_column :articles, :subheader, :string
end
end
|
class PostsController < ApplicationController
def index
# @posts = Post.all
@posts = Post.all
# @sorted_posts = @posts('created_at DESC')
end
def new
@post = Post.new
end
def create
@post = Post.new(post_params)
if @post.save
render 'index'
else
render "new"
end
end
def show
@post = Po... |
class CompetitionMap < ActiveRecord::Base
belongs_to :competition
belongs_to :map
end
|
module Roark
module CLI
class Create
include Shared
def initialize
@options = { :account_ids => [],
:parameters => {},
:region => 'us-east-1',
:tags => {} }
@logger = Roark.logger
end
def create... |
# vi: ft=ruby
Pry.config.exception_handler = proc do |output, exception, _pry_|
choices = ['full', 'summary', 'none']
choice = choices.find { |c| c == (ENV['PRY_EXCEPTION'] || '').downcase } || 'summary'
if choice == 'summary'
output.puts "#{exception}"
remove = [
/pry/,
/spring/,
/a... |
FactoryBot.define do
factory :raid do
gym { nil }
boss { "MyString" }
level { 1 }
time { Time.current }
remaining_time { 44 }
end
end
|
require 'rails_helper'
describe CompletedFileReviewJob do
describe '.perform' do
it 'completes FileReview with violations' do
file_review = create_file_review
stub_build_report_run
stub_pull_request
stub_payload
CompletedFileReviewJob.perform(attributes)
file_review.reload
... |
class AwsImage < ActiveRecord::Base
self.table_name = 'IMAGE_AWS'
self.primary_key=:IMAGE_NO
belongs_to :image , foreign_key: 'IMAGE_NO'
end
|
require_relative './create_campaign_state'
require_relative '../main_menu_state'
require_relative './base_campaign_state'
class CampaignDetailState < State
def header_text
"CAMPAIGN DETAILS"
end
def start_up(input_value, user_id)
puts "Campaign selected: #{input_value.dungeon.name}"
... |
class SpreeShipstation::ExportOrderJob < ApplicationJob
queue_as :shipstation
def perform(order)
Spree::ShipstationManager.new(:export_order, order: order)
end
end
|
# frozen_string_literal: true
require 'bolt_spec/plans/action_stubs'
require 'bolt_spec/plans/publish_stub'
require 'bolt/error'
require 'bolt/result_set'
require 'bolt/result'
require 'pathname'
require 'set'
module BoltSpec
module Plans
MOCKED_ACTIONS = %i[command script task upload].freeze
class Unexpec... |
class UpdateMangerIdRecordAsUserId < ActiveRecord::Migration
def self.up
#employee manager_id update
all_employees= ActiveRecord::Base.connection.execute("select * from employees").all_hashes
all_employees.each do |e|
if e["reporting_manager_id"].present?
sql="UPDATE employees AS x INNER JO... |
require 'rest-client'
require 'json'
require 'singleton'
require 'yaml'
gem 'CloudFlareDNS', '= 0.1'
require 'CloudFlareDNS'
### MAIN ROUTINE STARTS HERE ######
options={}
#options[:config_file] = 'cloudflare-config.yaml'
options[:tkn] = "80ddf8458f30a996b7a6fdf3fa2c85d1ca03a"
options[:email] = "it.service.subscriber@... |
require 'octokit'
require 'highline/import'
class EdaCodeDownloader < Struct.new(:organization, :branch_name_includes, :clone_location)
def clone_repos
FileUtils::mkdir_p(clone_location) unless File.directory? clone_location
repos.each do |repo|
puts repo.name
branch_to_clone = repo.rels[:branc... |
Fabricator(:update) do
text { sequence(:text) { |i| "This is update #{i}" } }
twitter false
author
feed { |update| Fabricate(:feed, :author => update.author) }
end
|
# An ad driven campaign.
#
# Unique from other campaigns in that their cost is derived from associated
# DatedCost records.
#
class AdvertisingCampaign < Campaign
accepts_nested_attributes_for :dated_costs
##
# The sum cost of this campaign
#
def cost
Money.new(dated_costs.sum(:cost))
end
end
|
require "#{File.expand_path(File.dirname(__FILE__))}/../spec_helper"
describe 'Email Sending' do
before do
@user = FactoryGirl.create(:user)
@mandatory = CWC::XMLGeneratorV2.new.mandatory_doc
@mandatory_xml = @mandatory.to_xml
end
it "should send the email once i create it " do
CWC::OFFICE_TO_EM... |
FactoryBot.define do
factory :event do
start Date.today
finish 10.days.from_now
timezone 'CET'
user_id 1
name { Faker::Lorem.word }
description { Faker::Lorem.word }
location 'Office1'
association :creator, factory: :user, username: "admin"
end
end
|
require File.dirname(__FILE__) + '/../spec_helper'
describe InstitucionPeriodisticasController do
describe "handling GET /institucion_periodisticas" do
before(:each) do
@institucion_periodistica = mock_model(InstitucionPeriodistica)
InstitucionPeriodistica.stub!(:find).and_return([@institucion_perio... |
class ExpenseCategory < ActiveRecord::Base
attr_accessible :category_name, :user_id
has_many :expense_items
def total
total = 0
self.expense_items.each do |i|
total += i.amount
end
total
end
end
|
# frozen_string_literal: true
module Dry
module Logic
module Appliable
def id
options[:id]
end
def result
options[:result]
end
def applied?
!result.nil?
end
def success?
result.equal?(true)
end
def failure?
!success... |
# frozen_string_literal: true
module Copyist
class Jira
IssueTicket = Struct.new(:title, :description, :labels, :parent)
attr_accessor(:title_identifire, :skip_identifires, :label_identifire, :global_labels, :template_file_path,
:basic_auth, :parent_identifire)
def initialize(argv)
... |
require 'rails_helper'
RSpec.describe ProcessStatus, type: :model do
it 'has a valid factory' do
expect(create :process_status).to be_valid
end
end
|
class CreateInvoices < ActiveRecord::Migration
def change
create_table :invoices do |t|
t.date :due_at, null: false
t.float :tax_rate, null: false, default: 0.1
t.float :shipping
t.date :payment_at
t.string :payment_reference
t.timestamp... |
# encoding: UTF-8
require 'minitest_helper'
describe FuzzyPrice do
before do
@fp = FuzzyPrice.new 1
@sample0 = "Total 71.75"
@sample1 = ": % ` ’ ' Total . k` 27.32“"
@sample2 = "TofaI $26.18"
@sample3 = "T0faI 55.IA"
@sample4 = "T0faI 55.15"
@sample5 = "Total 35—O3"
@sample6 = ... |
require_relative 'investor_contract'
class Investor
include InvestorContract
def initialize(name)
@name = name
end
def update(stock)
puts "Notified #{@name} of #{stock.symbol}'s change to #{stock.price}"
end
end
|
class CreateBuyerAddresses < ActiveRecord::Migration[6.0]
def change
create_table :buyer_addresses do |t|
t.timestamps
t.string :postnumber, null:false
t.string :telephonenumber, null:false
t.integer :area_id, null:false
t.string :area_town, null:false
t.string :area_street, n... |
require 'sqlite3'
module CureMuno
module_function
#update
def update_db(db, table, time, total, retweet)
# all processes are in one transaction
db.transaction
begin
# get the current record for the current time
current = db.execute("select total, retweet from #{table} where time = \"#{t... |
#
# Be sure to run `pod spec lint VoceQpadCore.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://githu... |
class Comment < ActiveRecord::Base
default_scope :order => 'created_at ASC'
belongs_to :user
belongs_to :friend
def user_email
user.email if !user.nil?
end
def friends_email
friend.email if !friend.nil?
end
def as_json(options={})
super(
:methods => [:user_email, :friends_email],
... |
# frozen_string_literal: true
class NotesController < ApplicationController
before_action :set_note, only: %i[show edit update destroy]
before_action :set_course
before_action :set_subject
def edit; end
def create
@note = @course.notes.create(note_params)
respond_to do |format|
if @note.save... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.