text
stringlengths
10
2.61M
class VideoProcessing extend WithDatabaseConnection @queue = :video def self.perform app_session_id start = Time.now puts "AppSession[#{app_session_id}] is processing..." app_session = AppSession.find app_session_id touch = app_session.touch_track.download screen = app_session.screen_track....
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable # Setup accessible (or protected) attri...
module Treasury module Fields module Delayed protected # Internal: Отмена отложенных задач по приращению # # Returns Integer количество отмененных задач def cancel_delayed_increments Resque.remove_delayed_selection(Treasury::DelayedIncrementJob) do |args| args[0]['...
# frozen_string_literal: true # Create new card deck require_relative 'card' class Deck attr_reader :deck, :suits, :ranks def initialize @deck = [] @suits = suits @ranks = ranks create_deck end def create_deck card_generator = [(2..10).to_a, Card::PICTURES].flatten! # puts "card_gen...
class Solution < ActiveRecord::Base belongs_to :health belongs_to :student end
class CreateUserMessages < ActiveRecord::Migration def change create_table :user_messages, options: 'ENGINE=InnoDB, CHARSET=utf8' do |t| # 用户系统消息收件箱 t.references :user # 关联用户 t.integer :m_type # 消息类型(群发消息或点对点消息) t.integer :rel_id, :default => '0' # 关联的message...
MESSAGE_URL = %r{^/discussions?/(?<discussion_id>[\w\d]{24})/messages?$} MESSAGE_ID_URL = %r{^/discussions?/(?<discussion_id>[\w\d]{24})/messages?/(?<id>[\w\d]{24})$} before "#{MESSAGE_URL}*" do @entity_name = Message.name end [MESSAGE_URL, MESSAGE_ID_URL].each do |url| before url do @id = params[:id] @di...
class Video < ApplicationRecord # belongs_to :user has_many :reactions validates :youtube_id, uniqueness: true end
class Room attr_accessor(:song_library, :guests_present, :entry_fee, :nightly_take) attr_reader(:number, :guest_capacity) def initialize(number) @number = number @song_library = [] @guests_present = [] @entry_fee = 15 @guest_capacity = 2 @nightly_take = 0 end def add_song(song) ...
class Comment < ActiveRecord::Base belongs_to :post validates_presence_of :name, :email, :comment validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, :on => :create def website=(url) prefix = "" prefix = "http://" unless url.index("http://") super prefix + url en...
class OrderItem < ActiveRecord::Base belongs_to :order belongs_to :product validates :product_id, :order_id, presence: true validates :quantity, numericality: { greater_than_or_equal_to: 0 } def subtotal quantity * self.product.price end end
class Playlist < ActiveRecord::Base belongs_to :user has_many :playlistings has_many :songs, through: :playlistings end
require "rails_helper" RSpec.describe ConnectCallToVoicemail do describe "#call" do it "connects the participants of a call to voicemail" do call = build_stubbed(:incoming_call, :with_participant) adapter = spy(update_call: true) result = described_class.new( incoming_call: call, ...
require 'spec_helper' resource "Chorus Views" do let(:dataset) { datasets(:table) } let(:owner) { users(:owner) } let(:workspace) { workspaces(:public) } let(:dataset_id) { dataset.id } before do log_in owner end post "/chorus_views" do before do any_instance_of(GpdbSchema) do |schema| ...
# == Schema Information # # Table name: file_sents # # id :bigint not null, primary key # structure_id :bigint # user_id :bigint # content :text # created_at :datetime not null # updated_at :datetime not null # class FileSent < ApplicationRecord belongs_to :str...
class UserMailer < ApplicationMailer def client_welcome_email(user, password='') @user = user @password = password @url = url @domain = domain_name @locale = locale I18n.with_locale(@locale) do mail( to: @user.email, subject: I18n.translate('application_mailer.welcome...
require 'spec_helper' require 'project_razor/slice' describe ProjectRazor::Slice do # before :each do # @test = TestClass.new # @test.extend(ProjectRazor::SliceUtil::Common) # # TODO: Review external dependencies here: # @test.extend(ProjectRazor::Utility) # end context "code formerly known as S...
require File.expand_path(File.dirname(__FILE__) + "/my_sears_test_base") describe "MySearsAdminReviewModerationTest" do include MySearsTestBase before(:all) do setup_super_user end before(:each) do setup_pages @valid_product_info = create_new_product end #it "should verify remo...
require "application_system_test_case" class BeatsTest < ApplicationSystemTestCase setup do @beat = beats(:one) end test "visiting the index" do visit beats_url assert_selector "h1", text: "Beats" end test "creating a Beat" do visit beats_url click_on "New Beat" fill_in "Price", wi...
# encoding: UTF-8 RC = <<-EOT EOT class Film class << self def divisions_file @divisions_file ||= File.join(folder, 'divisions.txt') end # Ouvrir le fichier contenant les divisions du film et # les calcule si nécessaire (si le fichier n'existe pas.) def open_file_divisions forcer = false if forcer ...
class ActivitiesController < ApplicationController prepend_before_filter :authenticate!, only: [:new, :edit, :create, :update, :destroy] # GET /activities def index @activities = Activity.all.order(day: :desc).includes(activity_comments: :game) @activity_policy = Activity::Policy.new(current_user, nil) ...
class CustomersController < ApplicationController before_action :set_customer, only: [:show, :edit, :update, :destroy] before_action :set_company, only: [:index, :show, :new, :create, :edit, :update, :destroy] def index @customers = policy_scope(Customer).where(company_id: @company).sort end def sho...
class Patient < ApplicationRecord belongs_to :person delegate :name, :cpf, :rg, :home_phone, :cell_phone, :birth_date, :sex, :to => :person accepts_nested_attributes_for :person end
module IControl::GlobalLB ## # The Globals interface enables you to set and get global variables. class Globals < IControl::Base set_id_name "value" ## # Gets the state to indicate whether local DNS servers that belong to AOL (America # Online) are recognized. # @rspec_example # @return ...
#!/usr/bin/env ruby require 'TestSetup' require 'test/unit' #require 'rubygems' require 'ibruby' include IBRuby class RowTest < Test::Unit::TestCase CURDIR = "#{Dir.getwd}" DB_FILE = "#{CURDIR}#{File::SEPARATOR}row_unit_test.ib" def setup puts "#{self.class.name} started." if TEST_L...
# frozen_string_literal: true RSpec.describe Kiosk, type: :model do let(:test_layout) { KioskLayout.create!(name: 'touch') } it 'is valid with valid attributes' do expect(Kiosk.new(name: 'test', kiosk_layout_id: test_layout.id)).to be_valid end it 'is not valid without a title' do kiosk = Kiosk.new(na...
class FixNonNullBody < ActiveRecord::Migration def self.up execute "ALTER TABLE `work_logs` CHANGE `body` `body` TEXT DEFAULT NULL" end def self.down execute "ALTER TABLE `work_logs` CHANGE `body` `body` TEXT NOT NULL" end end
# frozen_string_literal: true require 'httparty' require 'openssl' require 'nokogiri' require 'open-uri' require 'pry' class Scraper class << self BASE_URL = 'http://localhost:3000/' def crawl(search_term) payload = query('admin/verify') document = Nokogiri::HTML(payload) qr_code = query(...
require_relative 'guess' class GuessBuilder def build(input, sequence_length) code = input.downcase.chars guess = Guess.new(code, sequence_length) if guess.valid? guess else false end end end if __FILE__ == $0 gb = GuessBuilder.new.build("rrrr") end
class RestaurantDish < ApplicationRecord belongs_to :dishe belongs_to :restaurant end
FactoryBot.define do factory :payment do token { '123' } postal_code { '100-0000' } prefecture_id { '2' } city { '長野市' } addresses { '吉田' } phone_number { '00000000000' } association :user association :item end end
# frozen_string_literal: true ENV["RAILS_ENV"] ||= "test" require "combustion" require "timecop" require "pry-byebug" require "simplecov" require "rake" if ENV["CODE_COVERAGE"] == "true" SimpleCov.command_name Rails.gem_version.to_s SimpleCov.start do add_filter "spec" end end # make sure injected module...
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Lesson API', type: :request do include_context 'super_admin_request' let(:lesson) { json['lesson'] } let(:lessons) { json['lessons'] } let(:group) { json['lesson']['group'] } let(:subject) { json['lesson']['subject'] } describe 'GET /l...
module Pelita module Util module Db def fetch_db_config(file) db_config = File.read(file) db_config = ERB.new(db_config).result db_config = YAML.safe_load(db_config) db_config end module_function :fetch_db_config public :fetch_db_config def generate_...
require 'gfa/record/has_from_to' class GFA::Record::Link < GFA::Record CODE = :L REQ_FIELDS = %i[from from_orient to to_orient overlap] OPT_FIELDS = { MQ: :i, # Mapping quality NM: :i, # Number of mismatches/gaps EC: :i, # Read count FC: :i, # Fragment count KC: :i, # k-mer count ID: :Z ...
class LecturesController < ApplicationController before_filter :authenticate_user! before_filter :check_admin_status before_action :set_lecture, only: [:show, :edit, :update, :destroy] def index @lectures = Lecture.all end def show end def new @lecture = Lecture.new @host_user_id ...
class SpreeCmcicController < ApplicationController respond_to :html def show @order = Spree::Order.find(params[:order_id]) @gateway = @order.available_payment_methods.find{|x| x.id == params[:gateway_id].to_i } if @order.blank? || @gateway.blank? flash[:error] = I18n.t('invalid_arguments') ...
FactoryGirl.define do factory :state do code { Faker::Address.state_abbr } name { Faker::Address.state } country nil end end
#encoding: utf-8 class Boat < ActiveRecord::Base serialize :options, ActiveRecord::Coders::Hstore attr_accessible :boat_category_id, :model, :options, :price, :url_title, :images_attributes, :motor, :title belongs_to :boat_category acts_as_list scope: :boat_category has_many :images, :as => :imageable has_ma...
class ActiveChat < ActiveRecord::Base belongs_to :user belongs_to :admin validates :user_id, uniqueness: {scope: :admin_id}, presence: true validates :admin_id, uniqueness: {scope: :user_id}, presence: true default_scope {includes(:user, :admin)} delegate :name, to: :user, prefix: true delegate :name, to: :ad...
When(/I wait (.*) seconds?/) do |seconds| sleep(seconds.to_i) end
CryptDemo::Application.routes.draw do root "demo#index" resources :demo end
require "spec_helper" describe "Login" do it "renders baby" do visit "/login" page.should have_content "Login" end describe "requesting a login link" do context "with invalid email" do it "display invalid email message" do login("test") expect(page).to have_content "That doesn'...
require "chef/knife" class Chef class Knife module GlesysBase def self.included(includer) includer.class_eval do deps do require 'fog' require 'readline' require 'chef/json_compat' end option :glesys_api_key, :short =>...
class Book < ApplicationRecord validates_presence_of :title validates_presence_of :pages validates_presence_of :year has_many :book_authors has_many :authors, through: :book_authors has_many :reviews def average_rating reviews.average(:rating).to_f end def self.sorted_by_reviews(direction) s...
require 'spec_helper' # require './db/seeds.rb' describe 'employees controller' do it 'should return all employees' do employees = Employee.all names = [] employees.each{|e| names << e.first_name} get '/employees' expect(last_response.status).to eq 200 expect(employees.count).to eq 8 names.each do |na...
require "erubis" require "commuter/file_model" require "rack/request" module Commuter class Controller # To pass this to the app controllers folder so we can use filemodl instead of Commuter::Model::FileModel include Commuter::Model def initialize(env) @env = env end def env @env end def reque...
class Teacher < ActiveRecord::Base has_many :grade_levels has_many :students, through: :grade_levels def tenure years_of_experience > 5 end def relations GradeLevel.all.select do |record| if(record.teacher_id == self.id) record end en...
module AppBuilder def self.included(base) base.extend(ClassMethods) end [:builder, :stdout, :stderr, :build!].each do |meth| define_method(meth) do |*args| self.class.send(meth, *args) end end def app_exec(cmd) container = builder.image.run("/exec #{cmd}") container.wait contai...
# frozen_string_literal: true # == Schema Information # # Table name: books # # id :bigint(8) not null, primary key # base_price :integer # image_content_type :string # image_file_name :string # image_file_size :integer # image_updated_at :datetime # release_date :da...
class Deal < ApplicationRecord belongs_to :brewery belongs_to :client end
# -*- encoding : utf-8 -*- require 'spec_helper' describe Category do let(:category) { FactoryGirl.create(:category) } let(:issued_category) { FactoryGirl.create(:issued_category) } subject { category } it { should have_many(:articles) } it { should have_many(:navigators).dependent(:destroy) } it { shou...
require 'spec_helper' describe 'sensu::repo', :type => :class do it { should create_class('sensu::repo') } ['Debian', 'Ubuntu' ].each do |os| describe "operatingsystem: #{os}" do let(:facts) { { :operatingsystem => os } } context 'no params' do it { should contain_class('sensu::repo::apt'...
# == Schema Information # # Table name: users # # id :integer not null, primary key # name :string(255) # email :string(255) # created_at :datetime not null # updated_at :datetime not null # password_digest :string(255) # remember_token :strin...
# frozen_string_literal: true class CourseCategoriesController < ApplicationController before_action :set_course_category, only: %i[show edit update destroy] def index @course_categories = CourseCategory.all end def show; end def new @course_category = CourseCategory.new end def edit; end ...
class DeckCard < ApplicationRecord belongs_to :deck belongs_to :card validates_inclusion_of :quantity, in: 1..3 end
module Fog module Compute class Google class Snapshot < Fog::Model identity :name attribute :creation_timestamp, :aliases => "creationTimestamp" attribute :description attribute :disk_size_gb, :aliases => "diskSizeGb" attribute :id attribute :kind att...
class Contact < ActionMailer::Base def from_site(contact, receive_a_copy = false) common_settings(contact.subject || "Contato via Dev in Sampa", contact.email) recipients "contato@devinsampa.com.br" cc contact.email if receive_a_copy body :contact => contact end def attende...
module ServiceOffering class Icons attr_reader :icon_id attr_reader :icon def initialize(id) @icon_id = id.to_s end def process TopologicalInventory.call do |api_instance| @icon = api_instance.show_service_offering_icon(@icon_id) end self rescue StandardError...
class CreateProducts < ActiveRecord::Migration[5.2] def change create_table :products do |t| t.string :name, null: false, index: true t.string :detail, null: false, index: true t.integer :size_id, null: false t.integer :price, null: false t.integer :status_id, default: 0 t.int...
class RemoveLengthFromPrograms < ActiveRecord::Migration def change remove_column :programs, :length, :time end end
# == Schema Information # Schema version: 20110309094442 # # Table name: tags # # id :integer not null, primary key # name :string(255) # document_id :integer # created_at :datetime # updated_at :datetime # class Tag < ActiveRecord::Base attr_accessible :name, :document_id belongs...
FactoryBot.define do factory :offer do advertiser_name {'Advertiser Name'} url {'http://some.url.com'} description {'A little description'} starts_at {Date.today} ends_at {Date.today + 3.days} premium {true} end end
module Warren class Client TYPES = [:disk, :ram] attr_reader :hostname, :node_name, :type, :cluster attr_reader :address # name@hostname attr_reader :adapter def initialize(adapter: , hostname: adapter.hostname, node_name: Warren.config.node_name, type: Node::TYPES.first) @node_name = nod...
module SerializerHelper # Serializing object def serialize(object, context=nil) klass = convert_to_resource_class(object) JSONAPI::ResourceSerializer.new(klass).serialize_to_hash(klass.new(object, context)) end private def convert_to_resource_class (object) Object.const_get("Api::V1::#{object....
module Synapse module RetryPolicy include Synapse::StatsD def with_retry(options = {}, &callback) max_attempts = options['max_attempts'] || 1 max_delay = options['max_delay'] || 3600 base_interval = options['base_interval'] || 0 max_interval = options['max_interval'] || 0 retria...
require("spec_helper") describe("Specialty") do describe(".all") do it("starts off with no specialties") do expect(Specialty.all()).to(eq([])) end end describe("#name") do it("tells you the specialty's name") do specialty = Specialty.new({:name => "Orthopedics", :id => nil}) expect...
class AddDefaultToPauseCountInAccountDetail < ActiveRecord::Migration[5.1] def change remove_column :account_details, :pause_permit_count, :integer add_column :account_details, :pause_permit_count, :integer, default: 0 end end
class AlterMovementAddSchoolId < ActiveRecord::Migration def change add_column :movements, :school_id, :integer add_index :movements, :school_id end end
# Generates help pages to be loaded into application’s built-in Help window. # Generates pages from docs collection, but sets an extra frontmatter variable # ``in_app_help: true`` for each page. # # Note: “docs” below can be used to refer to documentation pages # as well as to Jekyll’s concept of “document”. module Je...
module VagrantPlugins module Beaker module Command class TestRunnerConfig < Vagrant.plugin( 2, :config ) def initialize @tests = UNSET_VALUE @helper = UNSET_VALUE end def tests=( one_or_more_tests ) @tests = Array( one_or_more_tests ) end ...
class CreateNearbyEvents < ActiveRecord::Migration[5.1] def change create_table :nearby_events do |t| t.integer :user_id, null: false t.decimal :lat, null: false, precision: 10, scale: 6 t.decimal :lng, null: false, precision: 10, scale: 6 t.date :date, null: false t.time :start_time...
class BlogsController < ApplicationController before_action :set_blog, only: [:show, :comment] def index @blogs = Blog.order(id: :desc).page(params[:page]).per(params[:per_page]) end def new @blog = Blog.new end def show @comments = @blog.comments.page(params[:page]).per(params[:per_page]) e...
class Comment < ActiveRecord::Base belongs_to :photo has_many :likes end
Airbrake.configure do |config| config.environment = Rails.env config.ignore_environments = %w(development test) config.project_id = 1 config.project_key = ENV.fetch('ERRBIT_PROJECT_KEY', '_') config.host = ENV.fetch('ERRBIT_URL', '') end
require 'socket' require 'openssl' require_relative 'events' class SocketClient def initialize e @e = e @debug = true @sockets = [] end def Create name, host, port, ssl sock = TCPSocket.open(host, port) sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true) if ssl ssl_c...
class UnknownMessagesController < ApplicationController load_and_authorize_resource def index @messages = UnknownMessage.all respond_to do |format| format.html # show.html.erb format.json { render json: @messages } end end def destroy @message = UnknownMessage.find(params[:id]...
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.version = "0.6.6" s.name = 'pyrite' s.summary = 'Easy peasy browser testing' s.description = 'A small, simple testing framework for use with selenium' s.authors = ["Adam Rogers","Dean Strelau"] s.email = 'adam@mintdigital.com' s.homepage = 'http:...
class Hour < ActiveRecord::Base belongs_to :user belongs_to :project belongs_to :hourtype validates :user_id, numericality: true validates :project_id, numericality: true validates :hourtype_id, numericality: true validates :date, presence: true validates :duration_human, presence: true validates :du...
require "spec_helper" describe Lob::Resources::Area do before :each do @sample_area_params = { description: "Test Area", front: "https://s3-us-west-2.amazonaws.com/lob-assets/areafront.pdf", back: "https://s3-us-west-2.amazonaws.com/lob-assets/areaback.pdf", routes: ["94158-C001", "94107-...
class Divingsite < ApplicationRecord belongs_to :country has_many :reviews, dependent: :destroy has_many :reviews acts_as_votable has_attached_file :divesiteimage, default_url: "/images/:style/missing.png" validates_attachment_content_type :divesiteimage, content_type: /\Aimage\/.*\z/ def self.search(se...
module Slack module Aria class Akari < Undine class << self def name '水無灯里' end def icon 'https://raw.githubusercontent.com/takesato/slack-aria/master/image/akari120x120.jpg' end end Company.client.on :message do |data| if data['type'...
require 'rails_helper' RSpec.describe Ship do describe "initialize ship" do let(:position) { ["A", 5] } let(:ship) { Ship.new(position.first, position.last) } it "has size" do expect(ship.size).not_to be nil end it "has position" do expect(ship.col).to eq position.last end en...
require 'compiler_helper' module Alf class Compiler describe Default, "unwrap" do subject{ compiler.call(expr) } let(:expr){ unwrap(an_operand(leaf), :a) } it_should_behave_like "a traceable compiled" it 'has a Unwrap cog' do expect(subject).to be_ki...
require 'spec_helper' describe Admin::UsersController do it 'should deny acces to regular users' do sign_in Factory(:user) get :index response.should be_redirect end context "as an admin user" do before(:each) do @admin_user = Factory(:admin) sign_in @admin_user end ...
# Copyright 2014 Cognitect. All Rights Reserved. # # 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 applicable law or a...
require 'vanagon/component/source/git' describe "Vanagon::Component::Source::File" do let (:file_base) { 'file://spec/fixtures/files/fake_file_ext' } let (:tar_filename) { 'file://spec/fixtures/files/fake_dir.tar.gz' } let (:plaintext_filename) { 'file://spec/fixtures/files/fake_file.txt' } let (:workdir) { Di...
require 'kilomeasure' describe 'showerheads' do include_examples 'measure', 'showerheads' let!(:before_inputs) do { afue: 0.7, gpm: 2.5, dhw_cold_water_temperature: 80, dhw_hot_water_temperature: 130 } end let!(:after_inputs) do { gpm: 1.5, dhw_cold_water_tempe...
# gem install httparty require 'httparty' require 'uri' require 'csv' APPBOY_URL = 'https://api.appboy.com/users/track' FILE_NAME = 'user_ids_to_export.csv' VALID_ATTRIBUTE_PREFIX = 'looker_export.' class AttributeExporter def initialize puts "1 for Elevate, 2 for Balance" if gets.chomp == "1" @is_el...
require 'vizier/visitors/base' raise "This file currently not suitable for use" #Should either become a subclass of VisitState or get absorbed where it's used module Vizier module Visitors class ArgumentAddresser < Command #TODO: this looks like parent's command_open... def initialize(node, modules)...
require "rails_helper" RSpec.describe "Incoming Call API", :as_twilio, type: :request do describe "POST #create" do context "with valid params" do it "creates an incoming call" do user = create(:user_with_number) contact = create(:contact, user: user, phone_number: "+18285555000") s...
class Comment < ActiveRecord::Base searchkick callbacks: :async belongs_to :user belongs_to :post default_scope { order('comments.updated_at DESC') } end
require 'rails_helper' RSpec.describe Admin::UsersController, type: :controller do let(:valid_attributes) { attributes_for(:student) } let(:invalid_attributes) {attributes_for(:invalid_user)} describe 'Admin pages requires login' do it "GET #index" do get :index expect(response).to redirect_to l...
require "integration_test_helper" class MainstreamBrowsingTest < ActionDispatch::IntegrationTest include RummagerHelpers test "that we can handle all examples" do # Shuffle the examples to ensure tests don't become order dependent schemas = GovukSchemas::Example.find_all("mainstream_browse_page").shuffle ...
class RegController < ApplicationController def index end def show @reg = Reg.find(params[:id]) end def new @reg = Reg.new end def create @reg = Reg.new(reg_params) if @reg.save redirect_to @reg else render 'new' end end private def reg_params params.require(:rg).perm...
json.array!(@ads) do |ad| json.extract! ad, :id, :title, :body, :price, :created_at, :updated_at json.user ad.user json.categories ad.category end
class Practice < ActiveRecord::Base has_many :signups has_many :players end
Gem::Specification.new do |s| s.name = 'zweb_spider' s.version = '0.0.0' s.date = '2015-04-01' s.summary = "spider" s.description = "a sample web spider just for fun" s.authors = ["A kun"] s.email = 'zhukun6150909@gmail.com' s.files = ["lib/zweb_spider.rb"] s.home...
class Member < ApplicationRecord devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable, :encryptable, :omniauthable, :omniauth_providers => [:shibboleth], :encryptor => :restful_authentication_sha1, :authentication_keys => [:login] has_many :event_roles has_many :comments ha...
# frozen_string_literal: true class Bank attr_accessor :money def initialize(money = 0) @money = money.to_i end def add_money(m) self.money += m end def take_money(m) self.money -= m if (money - m) >= 0 end end