text
stringlengths
10
2.61M
# == Schema Information # # Table name: collections_services # # id :integer not null, primary key # service_id :integer # collection_id :integer # created_at :datetime not null # updated_at :datetime not null # class CollectionsService < ApplicationRecord belongs_to...
class SpecializationsController < ApplicationController before_action :set_specialization, only: [:show, :edit, :update, :destroy] # GET /specializations # GET /specializations.json def index @specializations = Specialization.all end # GET /specializations/1 # GET /specializations/1.json def show ...
require 'rails_helper' SaveVendor = Inventory::SaveVendor Vendor = Inventory::Vendor RSpec.describe Inventory::SaveVendor, type: :command do context 'when params has no id' do subject { { name: Faker::Lorem.word } } it 'save as new record' do before_count = Inventory::Vendor.c...
#!/usr/bin/ruby # Downloads and parses the US Census Zipcode database # Created On: 12-05-2015 # Created By: Kevin Ashcraft (@kevashcraft) # Last Modified: 04-16-2016 by Kevin require 'open-uri' require 'fileutils' require 'spreadsheet' $mydir = File.expand_path(File.dirname(__FILE__)) require "#{$mydir}/../DBConn...
module Inventory class QueryFacilityStrains prepend SimpleCommand attr_accessor :strains def initialize(facility_ids) raise ArgumentError.new('facility_ids is required') if facility_ids.blank? @facility_ids = facility_ids end def call self.strains = Inventory::FacilityStrain....
class CreateAlerts < ActiveRecord::Migration def change create_table :alerts do |t| t.string :usercd , null: false # ユーザーコード t.string :eventcd , null: false # イベントコード t.string :alertusercd , null: false # ユーザーコード t.integer :alertbranchnum , null: false # ユーザーコード枝番 ...
class TournamentsController < ApplicationController def index @active_tournaments = Tournament.active @expired_tournaments = Tournament.expired end def new @tournament = Tournament.new end def create creator = TournamentCreator.new(tournament_params) if creator.save @tournament = c...
describe "CartDeleteOperation" do let(:cart) { double } let(:pipe) { double } subject(:cart_delete_operation) do require __FILE__.sub("/spec/", "/").sub("_spec.rb", ".rb") CartDeleteOperation.new end def accomplish_prepare_fakes cart.should_receive(:delete).with(12).and_return true end befor...
class String def just_latin? !!self.match(/^[a-zA-Z0-9_&,\."'\-+ ]*$/i) end end
require 'unauthorised_access' class ApplicationController < ActionController::API #In vod platform we want to register all the unauthorised access in the system done from the user. So We have defined two such #observers to watch on such activities. It waits for it to be notified on such actions performed. Those tw...
class CreateProfiles < ActiveRecord::Migration def change create_table :profiles do |t| t.string :primary_language t.string :secondary_language t.string :favorite_movie t.string :worst_movie t.string :favorite_genre t.belongs_to :user, index: true, foreign_key: true t.ti...
require 'rails_helper' describe 'ruby 2.2.0' do context "Enumerable methods" do # slice_before, slice_after and slice_when return Enumerable describe "#slice_before" do it "slices before a matched singular value" do a = ["a", "b", "c"] sliced_array = a.slice_before("b").to_a ...
require 'test/unit' require 'mocha/test_unit' require 'json' require 'processing_queue' class ProcessingQueueTest < Test::Unit::TestCase # ----- test framework ----- class Error < StandardError end class Wrapper def initialize(obj) @obj = obj @before_hooks = {} @after_hooks = {} end...
# -*- coding: utf-8 -*- module Concerns::Susanoo::PageContentsController extend ActiveSupport::Concern included do layout 'editor', only: %i(new edit) before_action :footer_not_required, only: %i(new create edit update) before_action :login_required before_action :set_mobile_edit_mode, only:...
FactoryGirl.define do factory :grocery_item do name "peanut butter" quantity 1 cost_in_cents 129 end end
require 'bugsnag' require 'multi_bug/adapter' module MultiBug module Adapters class Bugsnag < Adapter def notify(exception, options = {}) ::Bugsnag.notify(exception) do |report| report.meta_data = options end end end end end
module ApplicationHelper def human_boolean(boolean) boolean ? "yes" : "no" end def require_login redirect_to root_path unless logged_in? end def logged_in? !!current_user end def current_user @_current_user ||= User.find_by(:id => session[:user_id]) end end
require 'spec_helper' module OpenFec RSpec.configure do |config| config.before(:each) do candidates_all = JSON.parse(File.read("spec/stubs/client/candidates_all.json")) # Client Requests stub_request(:get, "https://api.open.fec.gov/v1/"). with(:headers => {'Accept'=>'*/*', 'Accept-Enc...
require 'json-colorizer' module RailsFluentLogging class JsonFormatter < JsonColorizer SEVERITY_COLORS = { 'DEBUG' => { color: :yellow }, 'INFO' => { color: :cyan }, 'WARN' => { color: :light_magenta }, 'ERROR' => { color: :red }, 'FATAL' => { background: :red, color: :w...
Rails.application.routes.draw do resources :groups devise_for :users resources :memos resources :events resources :contacts get '/c/:id', to: 'home#contact', as: 'contact_edit' # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay ou...
# frozen_string_literal: true class ApplicationController < ActionController::Base protect_from_forgery with: :exception before_action :set_application_raven_context if Rails.env.production? before_action :enable_js_raven if Rails.env.production? private def set_application_raven_context ...
class CreateParents < ActiveRecord::Migration[5.2] def change create_table :parents do |t| t.string :salutation t.string :name t.integer :contact_no t.references :client t.timestamps end end end
require_relative 'base' module Sections class Time < Base TIME_SECTION = 0x02 TIME_ELEMENTS = { 'end_time' => 0x01, 'tick' => 0x02 } TIME_ELEMENTS_TEMPLATES = { # 32 bit time, FFFFFFFF - infinite 'end_time' => 'L>', 'tick' => 'E' } field name: 'end_time', type: :float...
module Api module Docs class Dsl def response_messages @response_messages ||= [] end def response(status, text = nil, model = nil) if status.is_a? Symbol status = :ok if status == :success status_code = Rack::Utils.status_code(status) response_messa...
class TuanTemp < ActiveRecord::Base belongs_to :tuan_website, :counter_cache => true before_save :set_discount,:set_save_money, :if=>Proc.new{|t| t.origin_price and t.current_price} attr_protected :tid def change_to_tuan(params) configures = TuanWebsite.configures - %w{root logo} params...
class ServiceTypeVendor < ApplicationRecord belongs_to :vendor belongs_to :service_type end
# # Author:: Matheus Mina (<mfbmina@gmail.com>) # © Copyright IBM Corporation 2015. # # LICENSE: MIT (http://opensource.org/licenses/MIT) # module Fog module Softlayer class Product class Mock def place_order(order_template) response = Excon::Response.new response.body = place_or...
# -*- coding: utf-8 -*- require 'resume' require 'tempfile' require 'date' resume = Resume::Resume.new do |r| r.name "Micah Wylde" r.email "mwylde@wesleyan.edu" r.address ["Wesleyan University", "45 Wyllys Ave. #93026", "Middletown, CT 06459"] r.url "http://www.micahw.com/" r.phone ...
class GuestSeatsController < ApplicationController before_action :set_guest_seat, only: [:show, :edit, :update, :destroy] # GET /guest_seats # GET /guest_seats.json def index @guest_seats = GuestSeat.all end # GET /guest_seats/1 # GET /guest_seats/1.json def show end # GET /guest_seats/new ...
require 'rails_helper' RSpec.describe Item, type: :model do before do @user = FactoryBot.create(:user) @item = FactoryBot.build(:item, user_id: @user.id) #user_id: user[:id] @item.image = fixture_file_upload('public/images/test_image.jpg') end describe '出品機能' do context '出品機能がうまく行くとき' do i...
class FontGayathri < Formula head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/gayathri" desc "Gayathri" homepage "https://fonts.google.com/specimen/Gayathri" def install (share/"fonts").install "Gayathri-Bold.ttf" (share/"fonts").install "G...
require 'rails_helper' RSpec.describe Follow, type: :model do # Associations describe 'associations' do it { is_expected.to belong_to(:followed) } it { is_expected.to belong_to(:follower) } end end
class AddEmailToContact < ActiveRecord::Migration def change add_column :contacts, :email, :string #which table, column name, data type end end
module MomentumCms module HasFiles module Base def self.included(base) base.class_eval do # == Constants ============================================================ # == Attributes =========================================================== # == AR Extensions =======...
class Team < ActiveRecord::Base include Auditable attr_accessible :name, :address1, :address2, :city, :state, :zip, :country, :phone, :website, :email, :avatar, :avatar_delete phone_regex = /^[\(\)0-9\- \+\.]{10,20}$/ email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i validates :name, :presence => true, :len...
class UsersController < ApplicationController before_action :set_user, only: [:show, :edit, :update, :destroy] # GET /users def index @users = User.all end # GET /users/1 def show @users = User.all @reviews = Review.where :user_id => @user.id @messages = Message.all @reports = Report.a...
# frozen_string_literal: true require "test_prof/ext/string_strip_heredoc" require "test_prof/factory_bot" using TestProf::StringStripHeredoc module TestProf::EventProf::CustomEvents module FactoryCreate # :nodoc: all module RunnerPatch def run(strategy = @strategy) return super unless strategy =...
class Api::FriendshipsController < ApplicationController def create @friendship = current_user.friendships.new(friendship_params) @friended_id = params[:friendship][:friended_id] if @friendship.save @friendship2 = current_user.friendedships.create(friender_id: @friended_id) if @friendship2.s...
class AddOperationIdToPatientInteraction < ActiveRecord::Migration def self.up add_column :patient_interactions, :operation_id, :integer end def self.down remove_column :patient_interactions, :operation_id end end
class StickArt attr_accessor :art private :art, :art= def initialize self.art = read_art_file end def draw(step) starting_line = 10 * (step - 1); ending_line = 10 * step - 1; art[starting_line..ending_line] end private def read_art_file File.read("stick_art.txt").split("\n") en...
class CreateSubscriptions < ActiveRecord::Migration[5.0] def change create_table :subscriptions do |t| t.references :card, foreign_key: true t.float :amount t.string :duration t.date :start_at t.date :end_at t.timestamps end end end
require_relative('../db/sql_runner') require_relative('./lease') require "pry-byebug" class Equipment attr_reader :id, :type, :size, :total_quantity, :cost def initialize(options) @id = options["id"].to_i if options["id"] @type = options["type"] @size = options["size"] @total_quantity = options[...
# # This module contains constants that are useful in multiple places inside the provider. # module ManageIQ::Providers::Kubevirt::Constants # # The vendor name. # VENDOR = 'kubevirt'.freeze # # The product name. # PRODUCT = 'KubeVirt'.freeze # # The version of KubeVirt. # VERSION = '0.1.0'.fr...
class AddCompletedAtToTasks < ActiveRecord::Migration def change add_column :tasks, :completedAt, :date end end
require 'game' describe Game do subject(:game) {described_class.new(player1,player2)} let(:player1) {double :player, name: "Tim", healthpoints: 100} let(:player2) {double :player, name: "Mali", healthpoints: 100} let(:player3) {double :player, name: "Tommy", healthpoints: 0} describe '#attack' do it 're...
class CompanyEmployee < ApplicationRecord belongs_to :user belongs_to :company scope :employees, -> { where.not role: 'company_admin' } after_destroy { |c| User.all.where.not(role: 'applicant').where(id: c.user_id).destroy_all } end
# frozen_string_literal: true class CreateItems < ActiveRecord::Migration[5.1] def change create_table :items do |t| t.integer :user_id t.integer :cordinate_id t.integer :super_item t.integer :season t.integer :tpo t.integer :color t.integer :content t.text :memo ...
require "ostruct" module Watir # Adds helper for window.performance to Watir::Browser. # # This module is provided by an optional require: # # require "watir-webdriver/extensions/performance" # # @see http://dev.w3.org/2006/webapi/WebTiming/ # module PerformanceHelper def performance d...
FactoryBot.define do factory :private_conversation, class: 'Private::Conversation' do # needs sender and recipient both are of factory user association :recipient, factory: :user association :sender, factory: :user factory :private_conversation_with_messages do transient do messages_co...
class Fermenter < ActiveRecord::Base has_many :batches belongs_to :flavor STATES = ['empty', 'full', 'clean', 'dirty', 'cooler'] STATES.to_enum.with_index(0).each { |v, idx| self.const_set(v.to_s.upcase, idx) } def state_name STATES[self.state] end end
require 'rails_helper' RSpec.describe Cart, type: :model do it "it has intital contents" do cart = Cart.new("1" => 1) contents = { "1" => 1 } expect(contents).to eq(cart.contents) end it "can add an item" do cart = Cart.new("1" => 1) cart.add_item(1) cart.add_item(2) contents = { "1...
class CreateRequests < ActiveRecord::Migration def change create_table :requests do |t| t.integer :responder_id t.belongs_to :user #the requestor end end end
class List < ActiveRecord::Base hobo_model # Don't put anything above this include XmlUtilities # The "show_xxx" fields let the user customize which attributes of the listed docs to display # when viewing the list. fields do name :string comment :text timestamps show_docid :boolean, :default...
# # Cookbook:: bash # Recipe:: default # # Copyright:: 2019, avlos, llc, All Rights Reserved # Don't forget to set the bash user on the parent cookbook default["bash"]["user"] = "obi-wan" default["bash"]["target"] = ".config" default["bash"]["env_variables"] = { # a temporary file directory tmp_dir: nil, # Your ...
dep 'iptables' do requires 'iptables rules' def script; '/etc/network/if-pre-up.d/iptables'; end met? { script.p.exists? } meet do render_erb "iptables/iptables.erb", :to => script, :sudo => true sudo 'chmod +x /etc/network/if-pre-up.d/iptables' end end dep 'iptables rules' do def rul...
require "minitest/autorun" require_relative "game_logic.rb" class TestHangmanGame < Minitest::Test def test_word_generator_works word = generate_random_word() assert_equal(String, word.class) end def test_number_of_blanks blank_spaces = generate_number_of_blank_spaces("Aaron") assert_equal(5, blank_space...
require 'selenium-webdriver' require 'rspec' require 'fileutils' require 'cucumber' module AppHelper def create_driver device suppress_location_service local_user=File.expand_path('~') app_path = "#{local_user}/Desktop/transporter.app" capabilities = { 'device' => "#{device} Simulator", ...
# frozen_string_literal: true require 'jiji/test/test_configuration' describe Jiji::Model::Agents::AgentRegistry do include_context 'use data_builder' include_context 'use container' before(:example) do @repository = container.lookup(:agent_source_repository) @registory = container.lookup(:agent_r...
require 'test_helper' class DeviceInfsControllerTest < ActionController::TestCase setup do @device_inf = device_infs(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:device_infs) end test "should get new" do get :new assert_response :s...
$: << 'lib' require 'spiral' spiral = Spiral.new if ARGV.length != 1 puts "USAGE: ruby spiral.rb <value>" exit(1) else arg = ARGV.first.to_i if arg > 0 and spiral.perfect_square?(arg.to_i) print spiral.format_matrix(spiral.generate_spiral(arg)) exit(0) else puts "You must provide an integer that...
class AddFromFileToTestResults < ActiveRecord::Migration def change add_reference :test_results, :test_results_from_file, index: true end end
class Project < ActiveRecord::Base has_many :builds has_and_belongs_to_many :users end
class FixTables < ActiveRecord::Migration def change remove_column :triggers, :email_id create_table :trigger_email do |t| t.integer :trigger_id t.integer :email_id end end end
class Finger < ActiveRecord::Base belongs_to :user attr_accessible :comment, :size validate :validate_ring_size validates :user_id, :presence => true =begin 0 = left 1 = right =end validates :side, :presence => true, :numericality => { :only_integer => true, ...
#! /usr/bin/env ruby # frozen_string_literal: true require_relative "../lib/sidekiq-process_manager" # Scan the command line args and remove the named one. Values can be specified # either in the next argv element or in the same element after an equals sign. def extract_option_value!(name) value = nil ARGV.each_...
module ApplicationHelper def display_datetime(dt) dt.strftime("%m/%d/%Y %l:%M%P") end def display_date(dt) dt.strftime("%m/%d/%Y") end def display_time(dt) dt.strftime("%l:%M%P") end def display_song_length(time) Time.at(time).utc.strftime("%M:%S") end def display_yes_no(boolean) ...
# encoding: UTF-8 module WineDb module Model class Wine < ActiveRecord::Base extend TextUtils::TagHelper # will add self.find_tags, self.find_tags_in_attribs!, etc. # NB: use extend - is_<type>? become class methods e.g. self.is_<type>? for use in # self.create_or_update_from_values extend TextUtils::V...
class DatabasePolicy < ApplicationPolicy def manage? super_manager: nil user.administrator? || record.managed_by?(user, super_manager: super_manager) end def show? manage? end def new? user.present? end def create? manage? super_manager: true end def update? manage? end d...
# frozen_string_literal: true class AspaceFixtureGenerator # EAD IDs to pull down from ArchivesSpace. EAD_IDS = [ "MC147", "C0662", "C0062", "C0251", "C0776", "MC085", "MC152", "C1588", "MC221", "WC064", "MC148", "WC127", "C1408", "MC001.02.06", "C1491", ...
require_relative "../lib/parentesis" describe Parentesis do describe ".correct?" do context "check the balancement" do expected_parentesis = {"{{)(}}": false, "({)}": false, "[({})]": true, "{}([])": true, "{()}[[{}]]": true} expected_parentesis.each do |value, expected| it "Input: #{value}\...
class RefManyUser < ActiveRecord::Base # has_and_belongs_to_many :troles, :class_name => 'Role' troles_strategy :ref_many do |c| c.valid_roles = [:user, :admin, :blogger, :editor] end.configure! end
class Doctor < ActiveRecord::Base geocoded_by :address before_validation :geocode validates :address, presence: true validate :address_must_exists def address_must_exists errors.add(:address, "must be a valid address") if latitude.blank? end end
# frozen_string_literal: true require 'rails_helper' RSpec.describe Like, type: :model do let(:user) { create(:user) } let(:avatar) { create(:avatar) } let(:comment) { create(:comment) } describe 'validation' do it { is_expected.to validate_presence_of :user_id } it { is_expected.to validate_presence_...
class TasksController < ApplicationController before_action :find_task, except: %i[index create] def index load_index_data filter_data(search_input: params[:search_input]) if params[:search_input] end def create @task = Task.new(task_params) if @task.save NotificationService.notify(tas...
require "spec_helper" require "heroku/command/maintenance" module Heroku::Command describe Maintenance do before(:each) do stub_core api.post_app("name" => "example", "stack" => "cedar") end after(:each) do api.delete_app("example") end it "displays off for maintenance mode o...
class Article < ActiveRecord::Base belongs_to :user has_many :comments validates :title, :body, :user_id, presence: true validates :title, length: { maximum: 70 } has_attached_file :picture, storage: :dropbox, dropbox_credentials: Rails.root.join('config/dropbox.yml')...
module ActiveUrl module BelongsTo def belongs_to(object_name) begin object_name.to_s.classify.constantize attribute_name = "#{object_name}_id" attribute attribute_name define_method object_name do begin object_name.to_s.classify.constantize.f...
# U2.W4: Calculate the mode! # Complete each step below according to the challenge directions and # include it in this file. Also make sure everything that isn't code # is commented in the file. # I worked on this challenge [by myself and then later with Tony Leung to extract my keys of highest value]. ----------...
#!/usr/bin/env ruby gem 'activesupport' require 'colored' require 'thor' require 'git' require 'active_support/all' require 'action_view' module Git class Lib def remote_prune(name) command("remote prune", [name]) end end class Remote < Path def prune @base.lib.remote_prune(@name) ...
require 'test_helper' class FavoritesControllerTest < ActionDispatch::IntegrationTest # # Create # test 'Allow favorite agent' do sign_in users(:admin) post favorites_url, params: { agent_id: agents(:weather).id, format: :js } assert response.body.include?("...
require_relative 'owner.rb' require_relative 'bank-details.rb' require 'csv' class Checking < BankAccount BALANCE_MIN = 0 WITHDRAWL_FEE = 1 CHECK_FEE = 2 def initialize super() @account = Account.new(balance) @balance += 0 end def check_withdraw(val) super() count = 0 #se...
# == Schema Information # # Table name: standings # # id :integer not null, primary key # team_id :integer # year_id :integer # created_at :datetime not null # updated_at :datetime not null # class StandingsController < ApplicationController def index @league = League...
class CreateActionsContacts < ActiveRecord::Migration def self.up create_table :actions_contacts, :id => false do |t| t.integer :action_id t.integer :contact_id end add_index :actions_contacts, [:contact_id, :action_id] end def self.down drop_table :actions_contacts end end
module Ruboty module Cron class Job attr_reader :attributes, :thread def initialize(attributes) @attributes = attributes.stringify_keys end def start(robot) @thread = Thread.new do Chrono::Trigger.new(schedule) do Message.new( attribute...
Given /^I am signed in as a known user$/ do email = "test@example.com" password = "testpassword" @user = User.create(email: email, password: password) visit '/users/sign_in' fill_in 'user_email', with: email fill_in 'user_password', with: password click_button "Log in" end When /^I create a new entry$/ d...
class BalanceSheet include ActiveModel::Model def initialize(forecast, opts = {}) @forecast = forecast @options = opts @start_date = @forecast.forecast_start_date @end_date = @start_date + 60.months @accounts_totals = AccountTotals.new(forecast, frequency) end def assets @forecast.ass...
require 'rails_helper' RSpec.describe Invoice, type: :model do describe 'attributes' do it { should respond_to(:customer_id) } it { should respond_to(:sales_order_id) } it { should respond_to(:invoice_dt) } it { should respond_to(:ref_no) } it { should respond_to(:net_cost) } it { should resp...
MRUBY_CONFIG=File.expand_path(ENV["MRUBY_CONFIG"] || ".travis_build_config.rb") MRUBY_VERSION=ENV["MRUBY_VERSION"] || "2.0.1" file :mruby do sh "git clone --depth=1 git://github.com/mruby/mruby.git" if MRUBY_VERSION != 'master' Dir.chdir 'mruby' do sh "git fetch --tags" rev = %x{git rev-parse #{MRU...
module AccommodationsHelper cattr_accessor :params def accommodation_start_before_end if self.check_in > self.check_out errors.add(:check_in, "cannot be after check out.") end end def accommodation_trip_date_confirm @trip = Trip.find_by(id: params[:trip_id]) if self.check_out > @trip.end...
require "thor" module Coveralls class CommandLine < Thor desc "push", "Runs your test suite and pushes the coverage results to Coveralls." def push return unless ensure_can_run_locally! ENV["COVERALLS_RUN_LOCALLY"] = "true" cmd = "bundle exec rake" if File.exist?('.travis.yml') ...
require 'pry' class CashRegister attr_accessor :discount, :total, :items, :transactions, :transaction_id #Initializes register with a total of zero, an empty items array, and an #empty transaction hash. The discount defaults to zero but the user can #enter their discount as an interger (converted to a percen...
class Api::V1::GenresController < ApplicationController private def genre_params params.require(:genre).permit(:name) params.permit(:query) end end
# frozen_string_literal: true require 'rails_helper' RSpec.describe PostsController, type: :controller do describe 'GET /index' do it 'render index page' do get :index expect(response).to render_template(:index) end end describe 'GET #new' do it 'render new page' do get :new ...
class CreateChores < ActiveRecord::Migration def change create_table :chores do |t| t.string :name t.time :time t.date :startDate t.boolean :monday t.boolean :tuesday t.boolean :wednesday t.boolean :thursday t.boolean :friday t.boolean :saturday t.boolea...
require 'test_helper' class DailyinterestsControllerTest < ActionController::TestCase setup do @dailyinterest = dailyinterests(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:dailyinterests) end test "should get new" do get :new asser...
class AdsController < ApplicationController before_action :set_ad, only: [:show, :edit, :update, :destroy] def index search = Ad.where("sticky_note LIKE ?" , "%new%").order("sticky_note DESC") ads = Ad.all diff = ads - search @ads = search + diff end def show @reviews = @ad.reviews end ...
class TaxonSweeper < ActionController::Caching::Sweeper observe Spree::Taxon def after_save(taxon) expire_fragment('main_product_categories_menu') end end
# == Schema Information # # Table name: events # # id :integer not null, primary key # start :datetime # stop :datetime # description :string # coach_id :integer # area_id :integer # order_id :integer # user_...
# frozen_string_literal: true module Vedeu module Renderers # Renders a {Vedeu::Buffers::Terminal} as a HTML snippet; a table # by default. # # @api private # class HTML < Vedeu::Renderers::File include Vedeu::Renderers::Options # @return [String] def html_body i...
class Game attr_accessor :board, :player_1, :player_2 WIN_COMBINATIONS = [ [0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6] ] def initialize(player_1=Players::Human.new("X"), player_2=Players::Human.new("O"), board=Board.new) @...