text stringlengths 10 2.61M |
|---|
class Store < ActiveRecord::Base
has_many :products
has_many :url_parameters
default_scope -> { includes(:url_parameters).order('id ASC') }
validates_uniqueness_of :name
validates_presence_of :domain
end |
require "jsontableschema/constraints/required"
require "jsontableschema/constraints/min_length"
require "jsontableschema/constraints/max_length"
require "jsontableschema/constraints/minimum"
require "jsontableschema/constraints/maximum"
require "jsontableschema/constraints/enum"
require "jsontableschema/constraints/pat... |
require 'test_helper'
class ResearchTopicsControllerTest < ActionController::TestCase
test "User can view accepted research topics" do
login(users(:user_1))
get :index
assert_response :success
assert_equal ResearchTopic.accepted, assigns(:research_topics)
end
test "User can edit own research t... |
class PaymentsController < ApplicationController
before_action :set_payment, only: [:show, :edit, :update, :destroy]
after_action :purchase_create, only: [:create]
# GET /payments
# GET /payments.json
def index
@payments = Payment.all
end
# GET /payments/1
# GET /payments/1.json
def show
end
... |
require 'spec_helper'
describe user('funamushi') do
it { should have_uid 101 }
it { should belong_to_group 'funamushi' }
it { should have_authorized_key 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHLGQsVtZEdZT4KnTPn0hdilci3lbisQccz7gSkK6VD5nDUh7Hy2/mj+YM8yo5sCfnJpPiujj7rB+qv7MNtTosO41UY+KHaMUPq3iyA5mBWzzxnTecdM7qXKX... |
source 'https://rubygems.org'
# For more information on Bundler groups: http://bundler.io/groups.html
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec ... |
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "autocomplete_select/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "autocomplete_select"
s.version = AutocompleteSelect::VERSION
s.authors = ["Chen, Yi-Cyuan"]
... |
class ContractChangesController < ApplicationController
def index
@contract_changes = ContractChange.all
respond_to do |format|
format.html
format.json { render json:@contract_changes}
end
end
end
|
class CreateAttendances < ActiveRecord::Migration
def self.up
rename_table :event_users, :attendances
end
def self.down
rename_table :attendances, :event_users
end
end
|
Pod::Spec.new do |s|
s.name = "TQCellRemove"
s.version = "0.0.1"
s.summary = "A table view cell remove animation with FBPOP."
s.description = <<-DESC
A table view cell remove animation with FBPOP.
DESC
s.homepage = "https://github.com/TinyQ/TQT... |
When(/^I send a (GET|DELETE) request epics to (.*?)$/) do |method, end_point|
require_relative '../../../src/helpers/data_helper'
require_relative '../../../src/data/epics'
http_request = @client.get_request(method, end_point)
@http_response = @client.execute_request(@http_connection, http_request)
@epics = E... |
class Document < ActiveRecord::Base
attr_accessible :file_name, :document
belongs_to :user
belongs_to :group
mount_uploader :document, DocumentsUploader
validates_presence_of :document
before_save :check_extension
def self.upload_doc doc, owner
new_document = Document.new :document => doc, :file... |
require 'spec_helper'
feature 'Organization admin filters entries' do
attr_reader :organization, :accepted_entry, :not_accepted_entry
before do
@organization = create :organization
challenge = create :challenge, organization: organization
member_one = create :member
member_two = create :member
... |
class CreateBatchProcesses < ActiveRecord::Migration
def change
create_table :batch_processes do |t|
t.integer :batch_id
t.integer :process_type_id
t.datetime :started
t.datetime :stopped
t.timestamps
end
end
end
|
class MP3Importer
attr_accessor :path
def initialize(filename)
@path = filename
end
def files
Dir.entries(@path).select {|f| f.include?(".mp3")}
end
def import
self.files.each {|file| Song.new_by_filename(file)}
end
end
|
if ENV['REDIS_HOST']
redis_host = ENV['REDIS_HOST']
redis_port = ENV['REDIS_PORT'] || 6379
Rails.application.config.session_store :redis_store,
servers: ["redis://#{redis_host}:#{redis_port}/"],
expires_in: 90.minutes,
... |
require 'spec_helper'
feature 'Organization admin updates organization profile' do
scenario 'from the dashboard' do
organization = create :organization
sign_in_organization_admin(organization.admin)
click_on 'Perfil'
fill_in 'organization_name', with: 'Updated org name'
click_button 'Actualizar'... |
class Mmap
attr_reader :array, :size, :threads, :answer
MAX_THREADS = 8
def initialize(array)
@array = array
@size = array.size
@threads = []
@answer = Array.new(size)
end
def map(&block)
ranges.each { |range_array| threads << create_thread(range_array, answer, &block) }
threads.eac... |
class Startup
attr_reader :name, :domain
@@all = []
def initialize(name,domain,founder_name)
@founder_name = founder_name
@name = name
@domain = domain
@@all << self
end
def founder
@founder_name
end
def pivot=(domain, name)
@domain = domain
@name = name
end
def self.all... |
require 'yaml'
require 'fileutils'
class Alignment
attr_reader :read_name, :flag, :ref_name, :read_pos, :mapq, :cigar, :mate_ref, :mate_pos, :tlen, :seq, :phred, :tags, :cigar_totals
def initialize(line)
if line.split("\t").length < 12
$stderr.puts "This may not be a SAM record: #{line}"
return ... |
require 'grab_machine'
require 'encryptor'
GrabMachine.setup(user_method: :pmo_current_user)
class Api::Promotions::OneMoneyController < Api::BaseController
class InvalidSeedOwner < RuntimeError; end
include FastUsers
skip_before_action :authenticate_user!, only: [:show, :item, :items, :status, :item_status, ... |
class CustomAuthFailure < Devise::FailureApp
def respond
self.status = 401
self.content_type = "json"
self.response_body = {
status: "error",
msg: {
title: I18n.t(:title, scope: "devise.fail_app"),
body: I18n.t(:body, scope: "devise.fail_app")
}
}.to_json
end
end
|
class AddFacebookFanPageIdToMovies < ActiveRecord::Migration
def self.up
add_column :movies, :facebook_fan_page_id, :string
# would migrate old data if we had some
drop_table :fan_page_redirections
end
def self.down
remove_column :movies, :facebook_fan_page_id
create_table "fan_page_redirecti... |
require 'rails_helper'
RSpec.describe ApplicationController, type: :controller do
describe '#current_order' do
it 'order with session' do
order = create :order
session[:order_id] = order.id
expect(controller.current_order).to eq(order)
end
context 'order without session' do
... |
class User < ActiveRecord::Base
belongs_to :organization
validates :login, presence: true, uniqueness: true, format: { with: /\A[-a-zA-Z0-9._]{3,20}\z/}
validates :email, format: { with: /\A[-\w.]+@([A-z0-9][-A-z0-9]+\.)+[A-z]{2,4}\z/}
validates :name, presence: true, format: { with: /\A[а-яА-я ]*\z/}
valida... |
require 'rails_helper'
RSpec.describe Category, type: :model do
it "has a valid factory" do
expect(create :category).to be_valid
end
describe ".associations" do
it { is_expected.to belong_to :user }
it { is_expected.to have_many :word_categories }
it { is_expected.to have_many :words }
end
... |
class Player
attr_accessor :name, :life_points
def initialize(player_name)
@name = player_name
@life_points = 10
end
def show_state
puts "#{@name} a #{@life_points} points de vie."
if @life_points <= 0
puts "Le joueur #{@name} a été tué !"
end
end
def gets_damage(damage_received... |
class CreateOrders < ActiveRecord::Migration[6.0]
def change
create_table :orders do |t|
t.monetize :total_cost, currency: { present: false }
t.string :delivery_status, null: false, default: "pending"
t.string :checkout_session_id
t.string :state
t.datetime :date_of_dispatch
t.... |
class CreatePosts < ActiveRecord::Migration
def change
create_table :posts do |t|
t.string :title
t.string :content
t.integer :view, default: 0, null: false
t.integer :status
t.timestamps null: false
# foreign key. belongs_to user, category.
t.integer :user_id
t.in... |
# == Schema Information
#
# Table name: base_pokemon_abilities
#
# id :integer not null, primary key
# base_pokemon_id :integer
# ability_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
class BasePokemonAbility < ApplicationRecord
... |
class FixColumnName2 < ActiveRecord::Migration
def change
change_table :members do |t|
t.rename :Hot_Skills, :hot_Skills
end
end
end
|
class AddEvenMoreToUser < ActiveRecord::Migration
def change
add_column :users, :location_search, :string
add_column :users, :geocoded_location, :string
end
end
|
# frozen_string_literal: true
describe Kafka::ProduceOperation do
let(:cluster) { double(:cluster) }
let(:transaction_manager) { double(:transaction_manager) }
let(:compressor) { double(:compressor) }
let(:buffer) { Kafka::MessageBuffer.new }
let(:logger) { LOGGER }
let(:instrumenter) { Kafka::Instrumenter... |
module ApplicationHelper
def admin_types
['AdminUser']
end
def active?(path)
'active' if current_page?(path)
end
def employee?
current_user.type == 'Employee'
end
def admin?
admin_types.include?(current_user.type)
end
def status_label status
status_span_generator status
end
... |
json.array!(@juice_mixes) do |juice_mix|
json.extract! juice_mix, :name, :notes
json.url juice_mix_url(juice_mix, format: :json)
end
|
FactoryGirl.define do
factory :product_thickness do
name "thickness name"
created_at Time.zone.local(2000,1,1, 0,0,0)
updated_at Time.zone.local(2000,1,1, 0,0,0)
end
end |
class ApplicationController < ActionController::Base
include Monban::ControllerHelpers
protect_from_forgery with: :exception
before_action :require_login
before_action :require_account
private
def ensure_venue_owner
@owner = current_user.account
unless Concert.find_by(venue_id: @owner)
redi... |
Vector = Struct.new(:x, :y, :z) do
def inspect
"<x=#{x}, y=#{y}, z=#{z}>"
end
def +(other)
Vector.new(x + other.x, y + other.y, z + other.z)
end
end
class Moon
attr_accessor :position, :velocity
def initialize(initial_position)
@position = initial_position
@velocity = Vector.new(0, 0, 0)
... |
class CMS::EventsController < CMS::ApplicationController
prepend_before_action { @model = Event }
def index
super type: params[:online] == 'true' ? 'OnlineEvent' : 'OfflineEvent'
end
def new
super category: params[:category], type: params[:online] == 'true' ? 'OnlineEvent' : 'OfflineEvent'
end
d... |
class AddDefaultValueToLastReadAtChatroomUser < ActiveRecord::Migration[6.0]
def change
change_column_default :chatroom_users, :last_read_at, Time.now
end
end
|
require_relative '../lib/interface_data_control.rb'
describe InterfaceDataControl do
let(:new_class) { InterfaceDataControl.new }
it 'Raises argument error when less than two arguments are given' do
expect { InterfaceDataControl.new('value') }.to raise_error(ArgumentError)
end
it 'Raises argument error w... |
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..")
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..\libs')
require "test/unit"
require "page_control"
class PageControlTest < Test::Unit::TestCase
def setup
@pageControl = PageControl.new('Router', '192.168.80.206')
end
def ... |
class CreateSetlistings < ActiveRecord::Migration[4.2]
def self.up
create_table :setlistings do |t|
t.timestamps
t.references :records
t.references :songs
t.integer :track_number
end
rename_table :tracklists, :tracklistings
end
def self.down
drop_table :setlistings
ren... |
class CommentsController < ApplicationController
# GET /comments
def index
@comments = Comment.all
render :json => @comments
end
# GET /comments/1
def show
@comment = Comment.find(params[:id])
render :json => @comment
end
# POST /comments
def create
@comment = Comment.new(params[:... |
# frozen_string_literal: true
require_relative 'address_list_item'
class AddressListItem < WatirPump::Component
td_reader :first_name, -> { root.tds[0] }
td_reader :last_name, -> { root.tds[1] }
td_reader :city, -> { root.tds[2] }
td_reader :state, -> { root.tds[3] }
link_clicker :show, -> { root.link(text:... |
class Post < ApplicationRecord
validates :title, :description, presence: :true
end
|
class UserRepo
def self.find_for_jwt_authentication(_sub)
User.with_pk(_sub)
end
end
class RevocationStrategy
def self.jwt_revoked?(payload, user)
false
end
end
Warden::JWTAuth.configure do |config|
config.secret = 'super-secret'
config.expiration_time = 31 * 24 * 60 * 60
config.mappings = {defa... |
require 'httpclient'
require 'nokogiri'
class CmisClient
module WebService
def get(url, query = {})
@log.debug("GET on #{url}")
client = HTTPClient.new
client.set_auth(url, @username, @password)
content = client.get_content(url, query)
Nokogiri::X... |
require 'ico-validator/ico_validation'
require 'logobox/version'
require 'uri'
require 'net/http'
module Logobox
class LogoNotFound < StandardError; end
LOGO_SIZES = [:small, :medium, :big]
def self.generate_logo_url(ico, size = nil)
if size
fail ArgumentError, 'size must be one of :' + LOGO_SIZES.jo... |
class AddIdentityToSites < ActiveRecord::Migration
def change
add_column :sites, :identity, :string
end
end
|
# frozen_string_literal: true
require "zeitwerk"
require "dry/core"
module Dry
module Logic
include Dry::Core::Constants
def self.loader
@loader ||= Zeitwerk::Loader.new.tap do |loader|
root = File.expand_path("..", __dir__)
loader.tag = "dry-logic"
loader.inflector = Zeitwerk... |
require 'omniauth-oauth2'
module OmniAuth
module Strategies
class Telphin < OmniAuth::Strategies::OAuth2
option :name, 'telphin'
args [:client_id, :client_secret]
option :client_options, {
:site => 'https://pbx.telphin.ru',
:token... |
class Return < ActiveRecord::Base
belongs_to :receipt
belongs_to :product
def mark_returned
found_purchase = Purchase.where(receipt_id: self.receipt_id, product_id: self.product_id, returned: false)
found_purchase.first.update(returned: true)
end
end
|
class UserMailer < ApplicationMailer
def new_user_signed_up(user)
@user = user
mail(to: "notifications@citizendebate.org", subject: "#{user.email} has registered for Citizen Debate!")
end
def charity_user_signed_up(charity_email)
@charity_email = charity_email
mail(to: "notifications@citizendeba... |
require 'yaml'
require 'javaclass/dependencies/edge'
require 'javaclass/dependencies/node'
require 'javaclass/dependencies/graph'
module JavaClass
module Dependencies
# Serializes a Graph of Nodes to YAML.
# Author:: Peter Kofler
class YamlSerializer
# Create a seri... |
class User < ApplicationRecord
attr_accessor :remember_token
before_save { email.downcase! }
before_save :downcase_email
has_and_belongs_to_many :categories
has_many :posts, dependent: :destroy
has_many :likes
has_many :liked_posts, :through => :likes, :source => :post
has_many :comments
has... |
require_relative 'base_page'
class CompleteProfilePage < BasePage
def title
"Profiel aanmaken"
end
set_url "#{Global.settings.base_url}/complete-profile"
selector :menu_tab, "//a[contains(., 'Mijn profiel')]"
selector :new_gig_tab, "//a[contains(., 'Nieuwe')]"
selector :my_gigs_tab, "//a[contains(... |
class Task < ActiveRecord::Base
validates :title, length: {maximum: 140}
end
|
class User < ActiveRecord::Base
belongs_to :position
validates :name, presence: true, allow_blank: false, length: { minimum: 5 }
validates :position, presence: true
end
|
# frozen_string_literal: true
module Playlists
# Create playlist service
class CreatePlaylistService < BaseService
attr_reader :playlist_params
def initialize(current_user, playlist_params)
super(current_user)
@playlist_params = playlist_params
end
def call
playlist = current_us... |
require 'autobuild/reporting'
module Autoproj
class << self
attr_accessor :verbose
def silent?
Autobuild.silent?
end
def silent=(value)
Autobuild.silent = value
end
end
@verbose = false
def self.silent(&block)
Autobuild.silent(&blo... |
require 'planet/config'
require 'planet/xmlparser'
require 'fileutils'
require 'time'
require 'planet/publisher'
module Planet
def Planet.splice
config = Planet.config['Planet']
# ensure that the output directory exists
output_dir = config['output_dir'] || '.'
FileUtils.mkdir_p(output_dir)
# p... |
module Alchemy
# Holds everything concerning the building and creating of contents and the related essence object.
#
module Content::Factory
extend ActiveSupport::Concern
module ClassMethods
SKIPPED_ATTRIBUTES_ON_COPY = %w(position created_at updated_at creator_id updater_id id)
# Builds a ... |
class Url < ActiveRecord::Base
# This is Sinatra! Remember to create a migration!
validates :long_url, uniqueness: true, presence: true, format: {
with: /http.?:\/\/.+/,
message: "Invalid URL"
}
def shorten
rnumbers = []
8.times { rnumbers << rand(1..9) }
self.short_url = rnumbers.join.to_i.to_s(36)
en... |
class Follower
attr_reader :name, :age, :motto
@@all = []
def initialize(name, age, motto)
@name = name
@age = age
@motto = motto
@@all << self
end
def self.all
@@all
end
def bloodoaths
Bloodoath.all.select { |oath| oath.follower == self }
#array of oath instances of followe... |
FactoryBot.define do
factory :address, class: Address do
postal_code {"123-4567"}
city {Faker::Address.city}
address {Faker::Address.street_address}
building_name {Faker::Dessert.variety}
trait :prefecture do
prefecture
end
association :prefecture, factory: :prefecture
associati... |
class GameDesktopController < ApplicationController
layout 'game_desktop'
before_action :check_user
before_action :check_game, except: [:join, :ended]
before_action :check_state, only: [:game]
def join
@game = Game.find(params[:game_id])
game_login @game
redirect_to gd_game_path
end
def game
@vide... |
# frozen_string_literal: true
RSpec.describe Importers::Items do
before :all do # rubocop:disable RSpec/BeforeAfterAll
CraftingComponent.destroy_all
ItemCrafting.destroy_all
Item.destroy_all
Organization.destroy_all
described_class.organization = Organization.create!(name: 'Test Organization', s... |
module Slideable
def horizontal_dirs
hori_dir = [
[0, 1],
[1, 0],
[-1, 0],
[0, -1]
]
hori_dir
end
def diagonal_dirs
diag_dir = [
[1, 1],
[1, -1],... |
class BatchCarbonationSetting < ActiveRecord::Base
belongs_to :batch
scope :kind, lambda { |short_name| where(:kind => (KINDS.select {|kind| kind[:short_name] == short_name}).first.try(:[], :kind_id)) }
KINDS = [
{:kind_id=>0, :short_name=>'batch_gallons', :desc=>'kombucha in bright tank', :unit => '... |
Facter.add("idholder") do
setcode do
id = {}
keys = Facter::Core::Execution.exec('defaults read /Library/Preferences/Identity.plist | grep "="')
keys.each_line do |line|
line = line.delete("\n").split('=')
key = line[0].strip
value = line[1].strip.chop.chomp('"').reverse.chomp('"').rever... |
class Model::Section::Column < SitePrism::Section
element :image_promo, "[id$='-img-promo-und-0-target-id']"
elements :title, "[id$='title']"
elements :url, "[id$='url']"
end |
require 'sprockets'
require 'compass/sprite_importer'
module Compass
class SpriteImporter < Sass::Importers::Base
alias :old_find :find
def find(uri, options)
if old = old_find(uri, options)
@_options = options
self.class.files(uri).each do |file|
if pathname = resolve(file... |
class IntentionsController < ApplicationController
PROMPTS = {
ALL: '$key从 $src 变更为 $dest ',
ADD_ITEMS: '添加 $name ,价格: $price ,数量: $amount ',
REMOVE_ITEMS: '移除 $name ,价格: $price ,数量: $amount '
}
PROMPT_MATCHS = {
ALL: '*',
ITEMS: /items\[(\d+)\]\.(\w+)/
}
class IntentionInvalidState < St... |
class Filter #:nodoc:
def initialize
@constraints = []
end
def constraint(&block)
@constraints << block
end
def to_proc
lambda { |e| @constraints.all? { |fn| fn.call(e) } }
end
end
|
class RanksController < ApplicationController
before_filter :authenticate_user!
def index
@ranks = Rank.all
end
def show
@rank = Rank.find(params[:id])
end
def new
@rank = Rank.new
end
def create
@rank = Rank.new(params[:rank])
if @rank.save
flash[:success] ... |
require 'rails_helper'
RSpec.describe "ルートの投稿", type: :system do
before do
@user = FactoryBot.create(:user)
@route = FactoryBot.build(:route)
end
context 'ルートの投稿ができるとき'do
it 'ログインしたユーザーは新規投稿できる' do
# ログインする
sign_in(@user)
# 新規投稿ページへのリンクがあることを確認する
expect(page).to have_content(... |
module AccountingEntries
class Approve
def initialize(args:)
@args = args
@current_date = @args[:current_date] || Date.today
@accounting_entry = @args[:accounting_entry]
end
def run
@accounting_entry.update!(
status: "approved",
date_posted: @curren... |
class ArticlePolicy < ApplicationPolicy
class Scope
def initialize(user, scope)
@user = user
@scope = scope
end
def resolve
if user.admin?
scope.all
elsif user.moderator?
scope.where(status: "draft")
elsif user.member?
scope.where(status: "draft", u... |
class Highrise::Person
def self.search(*args)
(1..10).map { |i| self.new(i) }
end
def initialize(i)
@i = i
end
def to_ldap_entry
entry = {
"objectclass" => ["top", "person", "organizationalPerson", "inetOrgPerson", "mozillaOrgPerson"],
"uid" => [@i.to_s],
"sn" ... |
$: << File.dirname(__FILE__)
require 'spec_helper'
module SqlPostgres
describe "Inserting and then Selecting" do
include_context "AllCharacters"
def self.testCases
[
[
["integer", "int", "int4"],
[-2147483648, +2147483647, nil]
],
[
["smallint"... |
# frozen_string_literal: true
require './lib/board_values.rb'
require './lib/pieces/pieces.rb'
RSpec.describe Pawn do
def all_board_pos
(0..7).to_a.repeated_permutation(2).to_a
end
def moves(row, col, is_on_baseline, is_capturing, is_white)
if is_capturing
directions = [[1, 1], [1, -1]]
else
... |
# If you use will_paginate in your app, you need to configure an initializer for Kaminari to avoid conflicts.
Kaminari.configure do |config|
config.page_method_name = :per_page_kaminari
end
|
class MinilangRuntimeError < RuntimeError; end
class BadTokenError < MinilangRuntimeError; end
class EmptyStackError < MinilangRuntimeError; end
class Minilang
def initialize(commands)
@commands = commands.split
@stack = []
@reg = 0
end
def eval(options = {})
@commands.each do |command|
co... |
class SignupsController < ApplicationController
before_action :require_nationbuilder_slug
skip_before_action :verify_authenticity_token, only: :signup_majority
def create
unless person_params[:email].present?
redirect_back flash: { error: 'Please enter an email address' }, fallback_location: root_path
... |
module CassandraObject
module Types
class TimeType < BaseType
def encode(time)
raise ArgumentError.new("#{time.inspect} is not a Time") unless time.kind_of?(Time)
time.utc.xmlschema(6)
end
def decode(str)
Time.parse(str).utc.in_time_zone if str
rescue
end
... |
# frozen_string_literal: true
# Ingredient model
class Ingredient < ApplicationRecord
has_many :uses, dependent: :destroy
belongs_to :user
validates :name, presence: true, length: { in: 3..20 }, uniqueness: { scope: :user_id }
validates :calories, length: { maximum: 5 }
scope :my_ingredients, -> { where(us... |
class Vigil
class CommandResult
attr_reader :status
attr_reader :output
attr_reader :process_status
def initialize(command, status, output, process_status)
@command = command
@status = status
@output = output
@process_status = process_status
end
def seria... |
class RemoveIndexFromEmployees < ActiveRecord::Migration
def change
remove_column :employees, :index, :string
end
end
|
# Exercicio 05
# Considere os métodos (as funções) escritos nos exercícios anteriores:
# Os métodos que calculam:
# - o diâmetro de um círculo é 2x o seu raio
# - o comprimento de um círculo é seu diâmetro vezes o valor da constante matemática PI (3.1415...)
# - a área de um círculo é seu raio ao quadrado vezes o valor... |
require 'menu'
describe Menu do
subject(:menu) {described_class.new}
it 'should display the dishes and their prices' do
expect(menu.menu_list).to eq Menu::MENU_LIST
end
end
|
module Amorail
# AmoCRM unsorted entity
class Unsorted < Amorail::Entity
amo_names 'unsorted'
amo_field :source, :source_uid, :source_data, :data
validates :source, :source_uid, :source_data, :data,
presence: true
attr_accessor :category
end
end
|
# == Schema Information
#
# Table name: hubs
#
# authentication_token :string(255)
# blanket_id :integer
# created_at :datetime
# current_sign_in_at :datetime
# current_sign_in_ip :string(255)
# id :integer not null, primary key
# last_sign_in_at :datetime
... |
class FixLatColumnInSpots < ActiveRecord::Migration[5.2]
def change
rename_column :spots, :last, :lat
end
end
|
class AddStatusToAssets < ActiveRecord::Migration
def change
add_column :assets, :status, :string, default: 'Available'
end
end
|
class Event::ShowSerializer < EventSerializer
belongs_to :creator
end
|
class AttendanceSetting < ActiveRecord::Base
def self.attendance_lock_setting(key, value)
config = find(:first, :conditions=>{:setting_key=>key,:user_type => 'Student'})
config.nil? ?
AttendanceSetting.create(:setting_key => key, :is_enable => value) :
config.update_attributes(:is_enable => v... |
class PropertiesController < ApplicationController
before_action :set_property, only: [:show, :edit, :update, :destroy]
def index
# @user = current_user
@properties = Property.all
end
def new
@property = Property.new
authorize! :new, @property
end
def create
@property = Property.new(p... |
module Semantic
module Ui
module Sass
VERSION = "2.2.3.0"
SEMANTIC_UI_SHA = '39f5bc44baf9ca2583403f1dcb75097779688b36'
end
end
end
|
class Plane
attr_reader :flying
alias_method :flying?, :flying
def initialize
@flying = false
end
def land_to airport
fail 'Plane is not flying' if flying? == false
airport.park(self)
@flying = false
"#{self} has landed in #{airport}"
end
def take_off_from airport
fail 'Plane is... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.