blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
4
137
path
stringlengths
2
355
src_encoding
stringclasses
31 values
length_bytes
int64
11
3.9M
score
float64
2.52
5.47
int_score
int64
3
5
detected_licenses
listlengths
0
49
license_type
stringclasses
2 values
text
stringlengths
11
3.93M
download_success
bool
1 class
8da9a3fca2fbcf0ced0f6f12fddd7dc430e066d3
Ruby
justinddaniel/ttt-with-ai-project-v-000
/lib/board.rb
UTF-8
1,042
3.765625
4
[]
no_license
class Board attr_accessor :cells, :game, :player def initialize self.cells = Array.new(9, " ") end def reset! self.cells = Array.new(9, " ") end def display puts " #{@cells[0]} | #{@cells[1]} | #{@cells[2]} " puts "-----------" puts " #{@cells[3]} | #{@cells[4]} | #{@cells[5]} " p...
true
9d4bffaf8b52dcfa521089a4f96fb8f7d2e00c87
Ruby
hereserin/Chess
/pieces/sliding_piece.rb
UTF-8
939
3.09375
3
[]
no_license
require_relative "../errors/piece_not_initialized_error" require 'byebug' module SlidingPiece HORIZONTAL_DIRS = [ [0, -1], [0, 1], [-1, 0], [1, 0] ] DIAGONAL_DIRS = [ [-1, -1], [-1, 1], [1, -1], [1, 1] ] attr_reader :HORIZONTAL_DIRS, :DIAGONAL_DIRS def moves moves_arr ...
true
71f48ca962193e600fafe716473a3bb51eaac7d4
Ruby
wesmangum/zss
/spec/integration/skill_menu_spec.rb
UTF-8
1,405
2.734375
3
[ "MIT" ]
permissive
RSpec.describe "Viewing the skill menu", :integration do let!(:path1){ TrainingPath.create(name: "Running") } let!(:path2){ TrainingPath.create(name: "Hand-to-Hand Combat") } context "a training path that is in the list" do let(:output){ run_zss_with_input('2') } # Hand-to-Hand Combat before do Sk...
true
3bb0408b07e437691069cf1578d27ee6320203de
Ruby
jchuerva/codewars
/ruby/magic_three.rb
UTF-8
1,230
4.375
4
[]
no_license
# frozen_string_literal: true # Magic Three # Level: 6kyu # In this Kata, you have to write a function that will accept an array of numbers, in which you will need to check whether any combination of 3 numbers sum to 0. # You are allowed to use a number more than once, as long as you use only 3 numbers total (e.g. 0+...
true
b7e19a26f1aebe017d492b23f1bdaa47d08442ed
Ruby
rshiva/MyDocuments
/01-notes-programming /04-ruby+rails/ruby1.9/samples/tutnamespaces_8.rb
UTF-8
748
2.609375
3
[]
no_license
#--- # Excerpted from "Programming Ruby", # published by The Pragmatic Bookshelf. # Copyrights apply to this code. It may not be used to create training material, # courses, books, articles, and the like. Contact us if you are in doubt. # We make no guarantees that this code is fit for any purpose. # Visit http://www...
true
dd9a48a32b02e2f5b41feb5c3c11b91c3bf19c68
Ruby
makandra/cucumber_spinner
/lib/cucumber_spinner/progress_bar_formatter.rb
UTF-8
4,753
2.671875
3
[ "MIT" ]
permissive
require 'cucumber_spinner/formatted_io' require 'cucumber/formatter/io' require 'cucumber/formatter/pretty' require 'rtui' module CucumberSpinner class ProgressBarFormatter include Cucumber::Formatter::Io attr_reader :step_mother def initialize(step_mother, path_or_io, options) @step_mother, @io...
true
5f69cfcc128d0dc4e68922beb1e827e1ab5b62cb
Ruby
ray-alvarez/project-recursion
/fibonacci.rb
UTF-8
538
4.53125
5
[]
no_license
# write a method #fibs which takes a number and # returns that many members of the fibonacci sequence. # Use iteration for this solution. def fibs(n) return n if n <= 1 fibs(n - 1) + fibs(n - 2) end # Now write another method #fibs_rec which solves # the same problem recursively. This can be done # in just ...
true
199db2bd2e6e36aa467ad05ab7404a3e27983439
Ruby
emmanuel/clockwork_mango
/lib/clockwork_mango/occurrence_solver.rb
UTF-8
2,013
2.78125
3
[ "MIT" ]
permissive
require "enumerator" %w[date date_time time].each do |temporal| require "active_support/core_ext/#{temporal}/calculations" end module ClockworkMango module OccurrenceSolver def self.next_occurrence(predicate, after = Time.now.utc) solver = self.for(predicate) solver.next_occurrence(after) end ...
true
ac17ee2dfa99f38e0cf9e89395fa2b398df6d27c
Ruby
sul-dlss-deprecated/gdor-indexer
/bin/indexer
UTF-8
2,293
2.609375
3
[]
no_license
#!/usr/bin/env ruby # Look in the lib directory for .rb files $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'rubygems' require 'bundler/setup' require 'trollop' require 'gdor/indexer' # Define the collections that this script knows how to harvest per yml files in the config/collections d...
true
b0f4bb2e3d1d958b6f801a8a5665f59676bf0c36
Ruby
amhursh/black_thursday
/test/merchant_repository_test.rb
UTF-8
4,607
2.640625
3
[]
no_license
require_relative 'test_helper' require_relative '../lib/merchant_repository' require_relative '../lib/sales_engine' class MerchantRepositoryTest < Minitest::Test def test_merchant_repo_exists mr = MerchantRepository.new('./data/merchants.csv', self) assert_instance_of MerchantRepository, mr end def te...
true
9b09632948c4b7f76bda3aac01bba4c4bf10894a
Ruby
tompng/ar_sync
/test/model.rb
UTF-8
2,607
2.546875
3
[ "MIT" ]
permissive
require_relative 'db' require 'ar_sync' class BaseRecord < ActiveRecord::Base include ArSync::ModelBase self.abstract_class = true end class User < BaseRecord self.table_name = :users has_many :posts, dependent: :destroy sync_has_data :id, :name sync_has_many :posts sync_has_one(:postOrNull, type: ->{ [...
true
8196e1e3304f0c878006297f76f83da83c28d787
Ruby
retailnext/fake_dynamo
/lib/fake_dynamo/filter.rb
UTF-8
4,116
2.671875
3
[ "MIT" ]
permissive
module FakeDynamo module Filter include Validation def comparison_filter(value_list, size, target_attribute, fail_on_type_mismatch, supported_types, comparator) return false if target_attribute.nil? validate_size(value_list, size) if fail_on_type_mismatch value_list.each do |value...
true
3fb32f03bdf930165881353f9f093e2c04e54924
Ruby
gittygitgit/ruby-sandbox
/db/simple3.rb
UTF-8
266
2.640625
3
[]
no_license
#!/bin/ruby require "mysql" dbhandle=Mysql.connect("localhost", "root", "j6w1o2010", "test") rs= dbhandle.query("SELECT id, name FROM foo") while row = rs.fetch_row do printf "%s, %s\n", row[0], row[1] end puts "Number of rows returned: #{rs.num_rows}" rs.free
true
a4b92fc7352068dc481c9b25b6562af7562e5eca
Ruby
gperl27/ironhack-web-development
/Week2/todolist/spec/todolist_spec.rb
UTF-8
1,153
3.09375
3
[]
no_license
require_relative("../lib/todolist.rb") RSpec.describe TodoList do before :each do @todo = TodoList.new("Josh") @todo.add_task("test") @todo.add_task('new test') @todo.add_task('newest test') @todo.add_task('another one') @todo.add_task('anotha one') end #todo.save describe "create todolist" do it "...
true
034b3cc1a79524bd99be48b7d1b9e3bede569056
Ruby
sheilacodonnell/ttt-with-ai-project-v-000
/lib/player.rb
UTF-8
139
2.65625
3
[]
no_license
class Player attr_reader :token #cannot be changed once assigned in initialize def initialize(token) @token = token end end
true
7b0d2715502cc44d5ecdbbcebd0811034f841876
Ruby
hopegiometti/rails-form_for-lab-dumbo-web-100719
/db/seeds.rb
UTF-8
845
2.515625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
true
759f42c0c577f25971840e61ead7e3a78458c406
Ruby
codigonet/E6CP1A1
/2 ciclos/ejercicio3.rb
UTF-8
228
3.75
4
[]
no_license
# Mostrar todos los divisores del número 990 con: # while, for, times. number = 990 divisores = [number] (number / 2).times do |indice| indice += 1 divisores << indice if number % indice == 0 end print divisores.sort
true
ce876cc54512dd1bc3807dda04ee9a4eddf3e591
Ruby
ymason/ironhack
/Week_03/imdb_chart/app.rb
UTF-8
892
3.234375
3
[ "MIT" ]
permissive
require("imdb") require_relative("lib/chart") ghostbusters_search = Imdb::Search.new("Ghostbusters") diehard_search = Imdb::Search.new("Die Hard") godfather_search = Imdb::Search.new("The Godfather") homealone_search = Imdb::Search.new("Home alone") trek_search = Imdb::Search.new("Star Trek, the new generation") livin...
true
8e16747e6a0dad821f22d740ded2adc3ca0e73e6
Ruby
timolehto/opto
/lib/opto/extensions/hash_string_or_symbol_key.rb
UTF-8
594
2.703125
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Opto module Extension # Refines Hash so that [] and delete work with :symbol or 'string' keys module HashStringOrSymbolKey refine Hash do def [](key) return nil if key.nil? super(key.to_s) || super(key.to_sym) end def has_key?(key) if key.nil...
true
2b875bd96cdf9645569a48189ab92bd1c2aa7ae8
Ruby
sergio-fry/blah_machine
/lib/blah_machine/processor.rb
UTF-8
2,542
2.90625
3
[ "MIT" ]
permissive
module BlahMachine class Processor class UnknownInstruction < StandardError; end; include ProcessorRegisters include ProcessorInstructions def initialize @registers = {} initialize_registers end # start next processor cycle def next_cycle pre_cycle user_cycle ...
true
e9b4349757996e35027b20314c240957acd183e0
Ruby
itchy/Google-Code-Jam
/2011/0/Problem_C/run_me.rb
UTF-8
2,136
3.390625
3
[]
no_license
#! ruby # needs to output following example for each line # Case #1: NO # Case #2: 11 require 'parser' # require 'patrick' if false data_set = 'C-small-practice.in' result_file = "Small-results.txt" else data_set = 'C-large-practice.in' result_file = "Large-results.txt" end results = "" piles = parse_data...
true
a3200dfc86bcc2db976d0059c948b97d005d8206
Ruby
summitdoodles/SummitDoodles
/app/models/puppy.rb
UTF-8
1,510
2.671875
3
[]
no_license
# == Schema Information # # Table name: puppies # # id :integer not null, primary key # name :string(255) # gender_id :integer # color_id :integer # date_sold :date # litter_id :integer # collar_color_name :string(255) # client_id :int...
true
3181cfa5f40653d8c9dd7932a59d8b4087e7e102
Ruby
wkzyonna/yannbaru_ruby_practice1
/review_time.rb
UTF-8
555
2.96875
3
[]
no_license
review_time = 0 if review_time >= 10 puts "それぐらい出来て当たり前です!by土海" elsif review_time >= 8 puts "#{review_time}回しか復習しないなんて、管理栄養士になれると思っているのですか?by土海" elsif review_time > 5 puts "そんな#{review_time}回なんて復習したと思っているのですか?by土海" elsif review_time > 0 puts "復習の回数が少ないと思わないのですか?by土海" else puts "なめてるんですか?なめないでくださいよ!by土海" end
true
0b1144369a9a863c1bb67fb0b61df145258bd2e1
Ruby
toshi120/follow_friends
/spec/models/user_spec.rb
UTF-8
2,772
2.640625
3
[]
no_license
require 'rails_helper' RSpec.describe User, type: :model do before do @user = FactoryBot.build(:user) end describe 'ユーザー新規登録' do context 'ユーザー登録ができる場合' do it '全ての項目が入力されていれば登録できる' do expect(@user).to be_valid end it '名前が10文字以下なら登録できる' do @user.name = 'aaaaaaaaaa' ...
true
b5646a177f65a0c824adb8e3523d64d59c3d259e
Ruby
beezwax/fmrest-ruby
/lib/fmrest/spyke/model/rescuable.rb
UTF-8
2,189
2.640625
3
[ "MIT" ]
permissive
# frozen_string_literal: true module FmRest module Spyke module Model # This mixin allows rescuing from errors raised during HTTP requests, # with optional retry (useful for solving expired auth). This is based # off ActiveSupport::Rescuable, with minimal added functionality. Its # usage ...
true
d8ce43045208b4f01f93c323c2fa7d495f4f7fd3
Ruby
johnschoeman/onitama
/lib/piece.rb
UTF-8
1,231
3.703125
4
[]
no_license
class Piece attr_reader :side, :number, :value attr_accessor :position #if @number == 0 the piece is a Sensei(King Piece) #if @number is 1,2,3 or 4 the piece is a pawn def initialize(side, number, value = 1.0) @side = side @number = number @value = value @position = nil end def self.initi...
true
c977662276ded96d9d2f63a8fab99db0f0be27bc
Ruby
aniasobo/tech-test-bank
/lib/statement.rb
UTF-8
574
3.1875
3
[]
no_license
require_relative 'date_helper.rb' class Statement def self.begin_history(balance, current_date = Today) @history = ["date || credit || debit || balance"] @current_date = current_date save_credit(balance, balance) end def self.print_statement @history.join("\n") end def self.save_credit(dep...
true
99b03d2c33c4d5bbe7811385d7577676553b887a
Ruby
ylansegal/game_of_life
/lib/game_of_life/grid.rb
UTF-8
456
3.0625
3
[ "MIT" ]
permissive
require "matrix" module GameOfLife class Grid < Matrix def adjacent(row, column) x_min = [row - 1, 0].max x_max = [row + 1, column_size - 1].min y_min = [column - 1, 0].max y_max = [column + 1, row_size - 1].min minor(x_min..x_max, y_min..y_max).to_a.flatten - [self[row, column]] ...
true
964508e565f184c948253801f324d45da3f9cbc2
Ruby
dittmar/Tetris-AI
/tetris/src/lib/z_block.rb
UTF-8
1,504
3.859375
4
[]
no_license
# Kevin Dittmar # 1 December 2015 # Artificial Intelligence Project: Tetris # A ZBlock represents the Tetromino that # looks like this: # _____ # _XX__ # __XX_ # _____ class ZBlock < Tetromino # Constructor # param row is the row of the block used to position # all other blocks in the ZBlock. # param col...
true
a8596f3d4428a51436a1a085abef0fafd7f296f2
Ruby
kahfei/csrb
/chap_3/rectangle.rb
UTF-8
134
3.546875
4
[]
no_license
puts "what is the length?" length = gets.to_i puts "what is the width?" width = gets.to_i area = length * width puts "area is #{area}"
true
f7b634679912b3eb79c937ea70b165c0f96a710c
Ruby
emacca/wdi_sydney_3
/students/emily_mccartney/w1d2/calculator.rb
UTF-8
1,879
4.1875
4
[]
no_license
# A user should be given a menu of operations # A user should be able to choose from the menu def menu puts "Please type the menu number for the calculation you'd like to perfrom: " puts " Put 1 for Basic calculator and 2 for Advanced calculator" calculator = gets.chomp.to_i if calculator == 1 basic_calc ...
true
57d2ef0274d9b61d6a568a0b8e60b70c78567e48
Ruby
petermrecords/phase-0-tracks
/ruby/alias_manager.rb
UTF-8
1,388
3.984375
4
[]
no_license
=begin -input: the spys first & last name -switch first & last name -change vowels for the next vowel -change consonants to next consonant -output: the aliased name =end def next_vowel(chars) next_vowels = { 'a' => 'e', 'e' => 'i', 'i' => 'o', 'o' => 'u', 'u' => 'a' } chars.map!{|char| next_vowe...
true
324741c0b0351b2b285f6810f2015e4dd7eae234
Ruby
collabital/platforms-core
/spec/platforms/core/o_auth_2_spec.rb
UTF-8
2,184
2.578125
3
[ "MIT" ]
permissive
require 'rails_helper' require 'hashie' require 'platforms/core/o_auth_2' module Platforms module Core # Use a shared examples block because it's easier. # Also the routes.draw method doesn't work in a before block RSpec.shared_examples "treats boolean" do |input, output| it "returns #{output}" do...
true
d3a525126f58fe44b0c78c38c2350c02286c1efe
Ruby
josephine-c/Vowels
/vowels.rb
UTF-8
751
4.71875
5
[]
no_license
# Core: # Create a method that takes a string, and returns the amount of vowels in that string. # E.g. number_of_vowels("How many vowels") -> "There are 4 vowels in this word" # E.g. number_of_vowels("I fly") -> "There is 1 vowel in this word" # E.g. number_of_vowels("Fly") -> "There are no vowels in this word" ...
true
e28647818753050ee12be7325a50df9f2d80b62b
Ruby
osorubeki-fujita/odpt_tokyo_metro
/lib/tokyo_metro/api/mlit_station/list.rb
UTF-8
454
2.59375
3
[ "MIT" ]
permissive
# 駅情報 mlit:Station の配列のクラス class TokyoMetro::Api::MlitStation::List < TokyoMetro::Api::MlitRailwayLine::List end __END__ # 駅情報 mlit:Station の配列のクラス class TokyoMetro::Api::MlitStation::List # インスタンスの情報を整形した文字列にして返すメソッド # @param indent [Integer (>=0)] インデントの幅 # @return [String] def to_strf( indent = 0 ) su...
true
f24011eb9570e1899f425adadedff8bd66dc8e1c
Ruby
kbehnfeldt/RB101
/rb101-lesson5/practice_problems/exercise13.rb
UTF-8
214
3.578125
4
[]
no_license
=begin sub arrays are sorted based on odd numbers in each sub array sort_by and select =end arr = [[1, 6, 7], [1, 4, 9], [1, 8, 3]] p (arr.sort_by do |sub_arr| sub_arr.select do |num| num.odd? end end)
true
5713884659700fb0403d2d12689e9b14ade76593
Ruby
danielleschechter/BEWD_NYC_5_Homework
/Danielle_Schechter/midterm/outfit.rb
UTF-8
1,117
3.578125
4
[]
no_license
require_relative 'city.rb' class Outfit CHOICES = { "Partly Cloudy" => "Umbrella", "Snow" => "Rain Boots", "Clear" => "Whatever You want dude" } attr_accessor :conditions, :weekday, :month, :day def initialize conditions, weekday, month, day @conditions = conditions @weekday = weekday...
true
78aaacfbc8a32e0e5b03058aaab6fa28ebbc30c9
Ruby
arnabc74/arnabc74.github.io
/pgdas/b1_3.rb
UTF-8
1,133
2.71875
3
[]
no_license
@{<NOTE> <HEAD1>Module 3: Central tendency</HEAD1> <HEAD2>Lesson 1, Video 1: The concept</HEAD2> Let me ask you a simple question: <B>what is the average life span of Indians?</B> You may not know the exact answer, but you'll guess that it is around 70. Now let me ask you another question: <B>what is the average body ...
true
03253385b98b9be7f1fae96db38dad849eaff247
Ruby
itsmumar/Hellobar
/app/services/calculate_internal_metrics.rb
UTF-8
2,917
2.53125
3
[]
no_license
class CalculateInternalMetrics def call calculate_internal_metrics end private def calculate_internal_metrics OpenStruct.new( beginning_of_current_week: beginning_of_current_week, beginning_of_last_week: beginning_of_last_week, users: users, sites: sites, installed_sites:...
true
c2f57de18d9d004e129ae71203284d57d83f647e
Ruby
neomantra/rubyluabridge
/tests/lua_in_ruby_test.rb
UTF-8
16,237
2.640625
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/ruby -w require 'rubyluabridge' require 'stringio' require 'test/unit' class LuaInRuby_Test < Test::Unit::TestCase # test module-level entities def test_module assert_not_nil( Lua::BRIDGE_VERSION ) assert_not_nil( Lua::BRIDGE_VERSION_NUM ) assert_not_nil( Lua::LUA_VERSION ...
true
f48c89546b3befc801ada7756ec72947b6dd7704
Ruby
flipstone/alchemist-server
/lib/alchemist-server/commands/who.rb
UTF-8
397
2.515625
3
[]
no_license
module Alchemist module Commands class Who < Base pattern "who" def run a = history.world.avatar avatar_name avatars = history.world.nearby_avatars a locations = avatars.map do |avatar| "#{avatar.name} #{avatar.x} #{avatar.y}\n" end outcome (["avata...
true
6452fc918911ff7fd3f97d7a110eeb1705d8f367
Ruby
ChrisWhite12/Subway-Trip-Planner
/src/classes/Train.rb
UTF-8
8,796
3.515625
4
[]
no_license
require_relative "./Line.rb" class Train attr_reader :start_point, :train_direction, :timetable, :line_name @@all_trains = [] #array of train objects def initialize (start_num, train_direction, line, speed = 1) @start_num = start_num #sta...
true
d02deb8f42bc05b6e03e7d34688650f2cf90e8e9
Ruby
mevansjr/Redux-Project-Template
/setup/TemplateConfigurator.rb
UTF-8
4,155
2.546875
3
[ "MIT" ]
permissive
require 'fileutils' require 'colored' module Pod class TemplateConfigurator attr_reader :project_name, :pods_for_podfile, :prefixes, :test_example_file, :username, :email def initialize(project_name) @project_name = project_name @pods_for_podfile = [] @prefixes = [] @message_bank = ...
true
1b006721b263d6ee8d377e4062529edc3200726e
Ruby
zendesk/arturo
/spec/dummy_app/app/models/user.rb
UTF-8
344
2.625
3
[ "Apache-2.0" ]
permissive
# frozen_string_literal: true class User attr_reader :name, :id def initialize(options = {}) @name = options[:name] @admin = options[:admin] @id = options[:id] end def admin? !!@admin end def to_s name end def inspect type = @admin ? 'Admin' : 'User' "<Mock #{type} ##{id...
true
6534ff3c53ed4e3c6efa5b97f17cead69e6f0960
Ruby
aliyamerali/flash_cards
/lib/card_generator.rb
UTF-8
815
3.203125
3
[]
no_license
require './lib/card' class CardGenerator attr_reader :file def initialize(filename) @file = File.open(filename) end def cards card_set = [] cards_as_array = @file.readlines("\n") cards_as_array.each do |card_in_array| card_info = card_in_array.split(",") card = Card.new(card_info[...
true
52a15836cc9df47601db0dda3e1ac05f2738049a
Ruby
JEG2/ICFP-2009
/lib/j_ed_i/program.rb
UTF-8
2,999
2.734375
3
[]
no_license
#!/usr/bin/env ruby -wKU module JEdI class Program G = 6.67428 * 10 ** -11 M = 6 * 10 ** 24 GM = G * M def self.subclasses @subclasses ||= Array.new end def self.inherited(program) subclasses << program end def self.for_configuration(configuration) s...
true
5aa140b8eeeac062e58f6656194c3bac0ccf7879
Ruby
vlobanov/uber_settings
/lib/uber_settings/defaults_dsl.rb
UTF-8
1,131
2.640625
3
[ "MIT" ]
permissive
module UberSettings class DefaultsDSL def initialize(data_provider, &block) @data_provider = data_provider instance_eval(&block) if block end def field(name, default_value, options = {}) check_name!(name) check_options!(options) @data_provider.create_setting_with_default(nam...
true
6a88bff4d94ccb712db8fe28ef9548b20cbca86d
Ruby
mobiledataanywhere/job_dispatch
/lib/job_dispatch/client/synchronous_proxy.rb
UTF-8
934
2.53125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# encoding: UTF-8 module JobDispatch # This is a simple class for making synchronous calls to the Job Queue dispatcher. class Client class SynchronousProxy < Proxy def method_missing(method, *args) job_spec = @client.enqueue(queue: queue, target: @target, method: method.to_s, parameters: args)...
true
a1a10efe78b23de2018a2789bc3a6fbeeb1ebcb3
Ruby
John-Odom/Footy-Lineups-backend
/db/seeds.rb
UTF-8
2,328
2.859375
3
[]
no_license
require 'faker' require 'rest-client' require'pry' Player.delete_all LineupPlayer.delete_all Lineup.delete_all SimulatedLineup.delete_all Simulation.delete_all Comment.delete_all Like.delete_all Team.delete_all User.delete_all # get the entire prem league data and parse to recieve an array of teamObjects with nest...
true
9247c75175fa7498673abaded264aeaedb5d10f0
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/raindrops/6732ef5925394bac9cf7e28bf25a3771.rb
UTF-8
1,313
3.5625
4
[]
no_license
require 'contracts' module Raindrops include Contracts Contract Num => String def self.convert(number) sounds = sounds_for(prime_factors_of(number)) if sounds.empty? number.to_s else sounds end end private # Find the sounds associated with this list of factors # Look throu...
true
d75aaca5a7d84bc54c85dac1b1a4abc982e8ba84
Ruby
sim51177/time-math
/specs/time_spec.rb
UTF-8
2,425
3.859375
4
[]
no_license
require "rspec" require "./time" describe "Our Time" do it "should follow argument scheme given" do t = Our::Time.new t.AddMinutes "7:17 AM", 10 t.to_s.should == "7:27 AM" end it "should be able to roll over hours by type regular" do t1 = Our::Time.new "08:55 AM" t1 = t1 + "10m" t1.to_s....
true
a742a25cf75a62ee29b8793c2163b9368a232d88
Ruby
marceloeloelo/ruby_interpreter
/tests/unit/classes/classes_2.rb
UTF-8
365
4
4
[]
no_license
# define la clase Perro class Perro def initialize(raza, nombre) # atributos @raza = raza @nombre = nombre end # metodo ladrar def ladrar puts('Guau! Guau!') end # metodo saludar def saludar raza = @raza puts("Mi raza es #{raza}") end end a = Perro.new("Labrador", "Chicho") #...
true
084780956ab9307dcb3063a9aa8497fb36e98c6a
Ruby
notmoebius/sem4j1
/lib/controller.rb
UTF-8
1,148
2.671875
3
[]
no_license
require 'gossip' class ApplicationController < Sinatra::Base # Affiche la homepage et tous les potins, passe les objets Gossip de tous les potins get '/' do erb :index, locals: {gossips: Gossip.all} end # url qui permet de créer un ragot get '/gossips/new/' do erb :new_gossip end # permet de po...
true
e65703453680a1e4946b772dbaaa741e942fbb82
Ruby
JoriPeterson/module_0_capstone
/day_3/what_if.rb
UTF-8
516
3.78125
4
[]
no_license
people = 20 cats = 30 dogs = 16 if people < cats puts "Too many cats! The world is doomed!" end if people > cats puts "Not many cats! The world is saved!" end if people > dogs puts "The world is dry!" end dogs += 5 if people >=dogs puts "People are greater than or equal to dogs." end if people <= dogs ...
true
d7457781e184f5e8938d369d1da825c5bb94705f
Ruby
franktank/practice-ruby
/algorithms/2same.rb
UTF-8
484
3.984375
4
[]
no_license
# Write an algorithm that tells me if 2 and only two numbers in a 1x3 array are the same. a1 = [1,1,2] a2 = [1,2,3] a3 = [1,1,1] def only_two_same?(a) count = Hash.new(0) a.each do |e| count[e] += 1 end count.each do |key, val| if val == 2 return true end ...
true
544eb32f5a291c76535a2d4bc9300af3ab2ed363
Ruby
rafidude/Samples
/features/step_definitions/step_definitions.rb
UTF-8
336
2.984375
3
[]
no_license
require 'calculator' Before do @calc = Calculator.new end After do end Given /^I have entered (\d+) into the calculator$/ do |n| @calc.push n.to_i end When /^I press (\w+)$/ do |op| @result = @calc.send op end Then /^the result should be (.*) on the screen$/ do |result| @result.should == ...
true
ffd25972b1e92ffc51b0d7d6e094d5388f6cb630
Ruby
Jbern16/algos
/quicksort.rb
UTF-8
411
3.625
4
[]
no_license
def quicksort(arr) if arr.length < 2 return arr else pivot = arr[0] less = arr.select { |e| e < pivot } greater = arr.select { |e| e > pivot } end quicksort(less) + [pivot] + quicksort(greater) end arr = [10, 5, 2, 3] arr2 = (0..1000).to_a.shuffle arr3 = (0..1000).to_a.reverse puts quic...
true
bcf2e1d98c04400bc0f31f2293035af57c3c1829
Ruby
janicky/fifteen-puzzle-solver
/spec/fifteen_puzzle_solver_spec.rb
UTF-8
2,358
3.125
3
[]
no_license
require "fifteen_puzzle_solver" RSpec.describe "FifteenPuzzleSolver" do before do @blocks = [1, 2, 3, 4, 5, 6, 7, 0] end it "raise exception when empty width" do expect { FifteenPuzzleSolver.new(blocks: @blocks) } .to raise_error(Exception, "Width can't be empty") end it "raise exception when...
true
da9bde268a893b7230c02128fb95133b688d0e56
Ruby
EmmanuelOga/doc_scan
/lib/doc_scan/name_cleaner.rb
UTF-8
970
3.125
3
[ "MIT" ]
permissive
module DocScan NameCleaner = Struct.new(:keywords) class NameCleaner def clean(name) name.downcase! clear_non_sentence_chars!(name) clear_keywords!(name) titleize!(name) strip_char!(name, "-") normalize_spaces!(name) name end private def regexp_to_cleanup ...
true
202d077ab3d238edeae3bbe366f6d5af0b84181d
Ruby
auser/toystore
/spec/toy/extensions/date_spec.rb
UTF-8
1,147
3
3
[ "BSD-3-Clause" ]
permissive
require 'helper' describe "Date.to_store" do it "should be time if string" do date = Date.to_store('2009-10-01') date.should == Time.utc(2009, 10, 1) date.should == date date.month.should == 10 date.day.should == 1 date.year.should == 2009 end it "should be time if date" do Date.to_s...
true
30384d7c86e85d24fe67125f954e14aad92a3a3e
Ruby
muupan/project_euler
/53/pe53.rb
UTF-8
237
3.1875
3
[]
no_license
def com(n, r) @cache ||= [] @cache[n] ||= [] return @cache[n][r] ||= (n == r || r == 0) ? 1 : com(n - 1, r - 1) + com(n - 1, r) end count = 0 for n in 1..100 do for r in 0..n do count += 1 if com(n, r) > 1000000 end end p count
true
c4f88ddfb2632284ff429b62a0c52929af011497
Ruby
Blueibis/roll-of-the-die
/permutations.rb
UTF-8
207
3.71875
4
[]
no_license
(1..6).each do |die1| (1..6).each do |die2| puts "#{die1} #{die2}" end end # array = [1, 2, 3, 4, 5, 6] # # array.permutation(2).to_a.each do |outcome| # puts "#{outcome[0]} #{outcome[1]}" # end
true
246b6b3cf5c33e986c77d8df334a6d27da754bd9
Ruby
useed/code_challenges
/questions/advent_of_code_day_3/solutions/robcole/injecting_santa.rb
UTF-8
1,718
3.921875
4
[]
no_license
class Santa attr_accessor :x, :y, :houses, :name def initialize(x:0, y:0, houses: [], name: "Santa") @x = x @y = y new_house = House.new(x: x, y: y) @houses = houses.push(new_house) @name = name end def move(instruction) coordinates = next_position(instruction) clone_and_update(coo...
true
8bfc6db45994c616a0e06bc0f2ddbe868ab7c9b2
Ruby
kentaro/chanko
/lib/chanko/tools.rb
UTF-8
228
2.53125
3
[ "MIT" ]
permissive
module Chanko module Tools module_function def nested_hash(number=1) if number > 0 Hash.new { |h,v| h[v] = Chanko::Tools.nested_hash(number - 1 ) } else Hash.new end end end end
true
d04084fae5c95d5341ea9b89e2d484f4f992064a
Ruby
jpatel531/battleships
/spec/player_spec.rb
UTF-8
3,566
3.125
3
[]
no_license
require 'player' require 'coordinate' # require 'game' describe Player do let(:game) {Game.new} let (:player) {game.player1 } before {player.defending_coordinates.existing_coordinates.clear} context "when initialized" do it "should have an aircraft carrier, battleship, destroyer, submarine and tug" do ship...
true
ef6b291be9018dc43e351839d619a681cb3d0b15
Ruby
nysdin/AtCoder
/ABC/122/c.rb
UTF-8
324
2.875
3
[]
no_license
n, q = gets.split.map(&:to_i) s = gets.chomp lr = [] seq = Array.new(n+1, 0) q.times do |_| l, r = gets.split.map(&:to_i) lr.push([l,r]) end 1.upto(n-1) do |i| if s[i-1] == 'A' && s[i] == 'C' seq[i] = seq[i-1] + 1 else seq[i] = seq[i-1] end end lr.each do |l, r| ans = seq[r-1] - seq[l-1] puts ans ...
true
6dd96f28904affa1935630e9b7d508abc8c83c95
Ruby
AlejandroHuerta/PageObjectTesting
/spec/dsl_spec.rb
UTF-8
4,399
2.734375
3
[]
no_license
require_relative '../lib/page_object/page' require_relative '../lib/page_object/page_builder/page_builder' require_relative '../lib/page_object/page_builder/element_builder' require_relative '../lib/page_object/page_builder/click_builder' require_relative '../lib/page_object/page_builder/checkbox_builder' require_relat...
true
cd5119cec96aa73f350fbaa9d615bbde507e8a40
Ruby
dora1405/slack-cli
/test/channel_test.rb
UTF-8
937
2.71875
3
[]
no_license
require_relative 'test_helper' require_relative '../lib/channel' require_relative '../lib/recipient' require 'pry' require 'httparty' require 'dotenv' Dotenv.load describe "Channel class" do it "instantiate the Channel class" do expect(Channel.new(slack_id: 123, name: "John", topic: "Smiths", member_cou...
true
c8586f801f4ceb68631c9093da5e9343132b0344
Ruby
macabreb0b/lectures
/w2d2/w2d2.rb
UTF-8
1,765
3.375
3
[]
no_license
# Object-Orientation class Bug attr_reader :eye_count, :leg_count, :body_segments def initialize(eye_pairs, leg_count, body_segments) @eye_pairs, @leg_count, @body_segments = eye_pairs, leg_count, body_segments end def draw_legs @leg_count.times { print "| " } puts end def s...
true
e81ca7183a8ceac3fdc0dd78bbf8a37818360a98
Ruby
quintel/etmodel
/lib/tasks/rename.rake
UTF-8
846
3.078125
3
[ "LicenseRef-scancode-free-unknown", "MIT" ]
permissive
require 'csv' desc "Rename InputElement#key using CSV file specified by path=path/to/file." task :rename => [:environment] do file_path = ENV['path'] force = ENV['force'] unless file_path raise ArgumentError.new("ArgumentError: You should specify which `path`") end raise "#{ file_path } does not exi...
true
bbcefc356e6c4b84cd5a6566fe6330f9b01a0fde
Ruby
codyscapes/word_calculator
/lib/word_calculator.rb
UTF-8
495
3.328125
3
[]
no_license
def calculator(originalString) operators = {"plus" => :+, "minus" => :-, "divided" => :/, "times" => :*} originalString=originalString.sub!(/[^a-zA-Z0-9_\s]/, "") words=originalString.split answer=0 calculations = [] words.each do |word| if operators.include? word calculations.push(operators[w...
true
609eae0b09ac6fad314e6a7a2316db44632fcfb6
Ruby
bdezonia/ian
/analyses/ED.rb
UTF-8
2,408
3.03125
3
[ "MIT" ]
permissive
# Perimeter - Area Ratio by class require InstallPath + 'AnalysisType' require InstallPath + 'OutputSummary' require InstallPath + 'Units' class Analysis def initialize(engine,options,image,distUnit,areaUnit,args) @image = image @options = options @distUnit = distUnit @areaUnit = area...
true
401b91c588f64731986341d05f4711ca5fa5a665
Ruby
mobile-km/edushare_mobile_app_demo
/app/models/demo_model.rb
UTF-8
300
2.765625
3
[]
no_license
class DemoModel def initialize(options = {}) options.each do |k, v| self.send "#{k}=", v end end def self.find(id) return nil if id.blank? self.all[id.to_i - 1] end def self.all @all ||= self.make_all end def id self.class.all.index(self) + 1 end end
true
1208607c8d01c7217cf05af1dc6cfee1114d4d78
Ruby
evizitei/ruby-tanks
/src/lib/bots/ginger_bot.rb
UTF-8
367
2.609375
3
[]
no_license
require_relative './base_bot' class GingerBot < BaseBot def choose_action(game_state, bot_info, shots, battery_position) if @my_energy <= 100 return move_towards_battery elsif facing_enemy? return :shoot else return move_towards_closest_enemy(@current_game_state, @current_bots) en...
true
261e1352a2a38c866691b8a6881880a5f2ac5bee
Ruby
deepikacs/ruby-oops
/car.rb
UTF-8
248
3.046875
3
[]
no_license
class Car def initialized(para) puts "initialize" end def start puts "car is strated" end def stop puts "car is stopped" end def move puts "car is motion" end end ob1=Car.new ob1.initialized ob1.start ob1.stop ob1.move
true
776d20292e0b02350ff26269c54e2cafb690da3c
Ruby
mrwalruss/cqrs-es-sample-with-res
/pricing/lib/pricing.rb
UTF-8
3,741
2.734375
3
[ "MIT" ]
permissive
module Pricing class Configuration def initialize(cqrs) @cqrs = cqrs end def call @cqrs.register(AddItemToBasket, OnAddItemToBasket.new) @cqrs.register(RemoveItemFromBasket, OnRemoveItemFromBasket.new) @cqrs.register(SetPrice, SetPriceHandler.new) @cqrs.register(CalculateTo...
true
28864d26a96f4c350f19b200758c4b8ffeddc892
Ruby
aBuiDev/theAugmented
/models/boss_fight/bosses.rb
UTF-8
893
3.375
3
[]
no_license
# Bosses class HermesHimler attr_reader :boss_name, :attacks attr_accessor :hit_points, :power_level def initialize @hit_points = 0 @power_level = 0 @augmentations = [] end def self.boss_name(name = "Hermes Himler") puts name end def self.hit_points ...
true
d677f80cbbcfbda0c362df8f37b3e6231cb67aa1
Ruby
nulib/donut
/app/services/donut/validation_service.rb
UTF-8
491
2.59375
3
[]
no_license
module Donut class ValidationService attr_reader :trashable_instance delegate :valid?, :errors, to: :trashable_instance class << self def errors(klass:, attributes:) new(klass: klass, attributes: attributes).errors end def valid?(klass:, attributes:) new(klass: klass, a...
true
8df9c0adcdd528b77f37a47d9b94d9f8dd224437
Ruby
ArthurGAUTHIER/AGORA
/app/controllers/users_controller.rb
UTF-8
1,805
2.625
3
[]
no_license
class UsersController < ApplicationController def show @media_count = media_count @time_spent = time_spent @average_duration = average_duration @favorite_category = favorite('categories') @favorite_actor = favorite('actors') @favorite_director = favorite('directors') @favorite_studio = fav...
true
d9eb33adfe82f2b3cc2be80893f9105cd23a6e06
Ruby
mvpmvh/developer-exercise
/ruby/cardgame/tests/cardgame/test_deck.rb
UTF-8
1,350
3.1875
3
[]
no_license
require 'test_helper' module CardGame class DeckTest < Minitest::Test def setup @deck = Deck.new end def test_new_deck_has_52_cards assert_equal @deck.cards.size, 52 end def test_shuffled_deck_has_52_cards @deck.shuffle assert_equal @deck.cards.size, 52 end ...
true
a5acdd3db9604bc3fa697815642c83189d37fdb7
Ruby
BOSSTHROSS/_Behance
/app.rb
UTF-8
809
2.859375
3
[]
no_license
require 'nokogiri' require 'open-uri' class ImageFetcher EXCLUDES = [ "http://a2.behance.net/img/site/grey.png" ] def self.get_all_img_src(url) doc = Nokogiri::HTML(open(url)) imgs = doc.css('.module img').map do |img| img.attributes['src'].value end return imgs - EXCLUDES end end ...
true
7a528ff897108d626df97ed69f975395103b7ce1
Ruby
crdx/enparallel
/lib/enparallel/picker.rb
UTF-8
345
3.234375
3
[ "GPL-3.0-only" ]
permissive
module Enparallel class Picker def initialize(items, rule) if rule == :random items = items.shuffle end @items = items @i = -1 end def next @items[next_index] end def next_index @i += 1...
true
1b215296bfc3afa7dd5fa8d08b2e07abcb93ca19
Ruby
theand/our-boxen
/.bundle/ruby/2.0.0/gems/puppet-lint-0.3.2/lib/puppet-lint/lexer/token.rb
UTF-8
1,949
3.125
3
[ "MIT" ]
permissive
class PuppetLint class Lexer class Token # Internal: Returns the Symbol type of the Token. attr_reader :type # Internal: Returns the String value of the Token. attr_reader :value # Internal: Returns the Integer line number of the manifest text where # the Token can be found. ...
true
65419a17eb386885d877c4f2cce1933f08611886
Ruby
nitanshu/ruby-cracker
/DS_AND_DAA/fibonaaci1.rb
UTF-8
94
2.828125
3
[]
no_license
a=0 b=1 i=0 while i < 20 do if i == 0 || i == 1 puts i else a+i end i+=1 end
true
bdc05aa19330168a2851fd0e8b9b744f05c6223a
Ruby
faisal-iqbal/premier-payroll
/app/helpers/application_helper.rb
UTF-8
723
2.578125
3
[]
no_license
module ApplicationHelper def clear_flash %w(notice warning error).each do |msg| unless flash[msg.to_sym].blank? flash[msg.to_sym] = '' end end end def get_working_days(d1, d2) diff = d2 - d1 diff - holidays(d1, d2) end def holidays(d1, d2) holidays = 0 ret = (...
true
70e589670661a9bafa4592d8494f6123b8062956
Ruby
SebastianPetak/learn-ruby-the-hard-way
/ex39databases/promptuser.rb
UTF-8
2,615
3.90625
4
[]
no_license
require "./dict.rb" # states is a database that will hold the key "#state name" and the value "#state abbreviation" states = Dict.new() Dict.set(states, 'Oregon', 'OR') Dict.set(states, 'Wisconsin', 'WI') Dict.set(states, 'Illinois', 'IL') Dict.set(states, 'Florida', 'FL') Dict.set(states, 'Indiana', 'IN') Dict.set(st...
true
8ad32e9b394968254ba22939c26e6d39182f1b91
Ruby
nate00/ascii_paint
/lib/ascii_paint/config.rb
UTF-8
4,455
3.59375
4
[ "MIT" ]
permissive
# An instance of class +AsciiPaint::Config+ is used to set global configuration # options for ASCII paint. Pass a block to {AsciiPaint.config} to access this # object. module AsciiPaint class Config TRANSPARENT = ChunkyPNG::Color::TRANSPARENT SPECIAL_SYMBOL_MAP = { transparent: TRANSPARENT } p...
true
1596d5b9465db25489515da19e5c6cea57bbf39e
Ruby
seak0503/design_patterns_ruby
/convention_over_configuration/gateway/lib/adapter/file_adapter.rb
UTF-8
282
2.875
3
[ "MIT" ]
permissive
require 'message' # メッセージをファイルをコピーすることで送信するアダプタ class FileAdapter def send_message(message) to_path = message.to.path to_path.slice!(0) File.open(to_path, "w") do |f| f.write message.body end end end
true
a56fbdfc62d182262c54d3dba33ea87d0b1fc0dd
Ruby
jmercedes/abacus
/app/models/payment.rb
UTF-8
529
2.765625
3
[]
no_license
class Payment < ActiveRecord::Base belongs_to :loan validates :amount, presence: true, numericality: { greater_than: 0 } validate :enough_amount def for_close(value) @for_close = value end private def enough_amount if @for_close values = self.loan.values_for_now balance = (values.t...
true
a2710a5ac5d7c5164f272b83646b2e4751313c0e
Ruby
wilsonokibe/BasicRuby
/fibonacci_yield/lib/fixnum.rb
UTF-8
152
3.203125
3
[]
no_license
class Fixnum def fibonacci fib = [0, 1] until fib[-1] + fib[-2] >= self fib.push(fib[-2] + fib[-1]) end yield fib end end
true
eaa9a2659d81a8711b9e962e953f5f0b4514cc11
Ruby
jpietrzyk/riderank_api
/app/services/create_advanced_stats.rb
UTF-8
1,920
2.671875
3
[]
no_license
class CreateAdvancedStats def initialize(user) @user = user end def perform! advanced_stats end private attr_reader :user def advanced_stats Result.new(status: :success, response: build_stats) rescue => e Result.new(status: :failure, response: e) end def build_stats days = ...
true
56d91388a7affb2c57cd9858838076c0492d58fd
Ruby
mikbe/commandable
/lib/commandable/help_text.rb
UTF-8
3,172
2.828125
3
[ "MIT" ]
permissive
module Commandable # Default command that always gets added to end of the command list HELP_COMMAND = {:help => {:description => "you're looking at it now", :argument_list => "", :class=>"Commandable", :class_method=>true}} class << self # Describes your application, printed at the top of help/usage ...
true
aa087d7f7cf192caaf450f1ac15d2750001e87b8
Ruby
simons-n/contact-list
/else.rb
UTF-8
211
3.109375
3
[]
no_license
def elseTest(val) if 0 < val if val % 2 == 0 puts "even" puts "positive" else puts "not positive" end # if one of these ends were not here, end # there would be a syntax error end elseTest(4)
true
55bf78eb52e9804776fe036bbc0618470f7dd313
Ruby
gabynaiman/xlsx_sax_reader
/lib/xlsx_sax_reader/sheet_collection.rb
UTF-8
310
2.546875
3
[ "MIT" ]
permissive
module XlsxSaxReader class SheetCollection include Enumerable def initialize(file_system, shared_strings) @file_system = file_system @shared_strings = shared_strings end def each(&block) SheetCollectionParser.parse @file_system, @shared_strings, &block end end end
true
eb542da062607beaca0dee74621e7ff4b7081d3f
Ruby
pdennis33/Ruby_Udemy
/Arrays/array_inject_and_reduce.rb
UTF-8
490
3.90625
4
[]
no_license
# Rolling sum result = [3, 4, 5, 6, 7].reduce(0) do |prev, current| puts "The previous value is #{prev}" puts "The current value is #{current}" prev + current end puts result puts # Rolling product result = [3, 4, 5, 6, 7].reduce(1) do |prev, current| puts "The previous value is #{prev}" puts "The current val...
true
aff576c05503a43dab3f0332395a5bcadfb766a0
Ruby
DBurkeGGC/mini04
/things.rb
UTF-8
659
2.890625
3
[]
no_license
require 'sinatra' require 'json' enable :sessions get '/' do if session['login'] song = { 'rick' => 'never gonna give you up' } return JSON.generate(song) else return "You are not logged in!" end end get '/names' do return JSON.generate(["Larry","Moe","Curly"]) end post '/login' do session['lo...
true
b6c3d495de93b0eb3dc3c2466790b0efa0f46ee5
Ruby
princybathla999/NuPack
/lib/Nupack.rb
UTF-8
2,143
3.265625
3
[ "MIT" ]
permissive
require "Nupack/version" class CostEstimation attr_accessor :base_price, :person, :material attr_reader :price Flat_Markup_Rate = 0.05 Person_Markup_Rate = 0.012 Material_Markup_Rate = { "drugs" => 0.075, "food" => 0.13, "electronics" => 0.02, } def initialize(base_price, person, mat...
true
054d39f3ddad97737b580595107c46715d43ae76
Ruby
sasharonaghi/learn-co-sandbox
/arrays.rb
UTF-8
278
3.734375
4
[]
no_license
#create an Array a = ["ruth", "lily", "bicondova", "john", "dicaprio"] puts "what is your name?" name = gets.strip if name == "sasha" puts "your celebrity crush is " + a[0] puts "your celebrity crush is #{a[0]}" end a.delete_at(0) puts a puts a.size a.each do
true
8d435837c16f50afb1af053ba1f54af722fef81a
Ruby
Blueibis/learn_ruby
/04_pig_latin/pig_latin.rb
UTF-8
989
3.171875
3
[]
no_license
def translate(words) pig = words.split(" ") pig.map do |word| if word[0] == "a" || word[0] == "e" || word[0] == "i" || word[0] == "o" || word[0] == "u" else if word[0] == "a" || word[0] == "e" || word[0] == "i" || word[0] == "o" || word[0] == "u" elsif word[0..2] == "sch" word <<...
true
308a8f5f97bbac90dae1ccc008dbe47b06719998
Ruby
vs4vijay/golife
/lib/golife.rb
UTF-8
3,318
3.78125
4
[ "MIT" ]
permissive
# Conway's Game of Life Implementation in Ruby # Author: Vijay Soni(vs4vijay@gmail.com) require "golife/version" SLEEP_INTERVAL = 0.2 GAME_HEADING = "Game of Life" class Golife::Game attr_accessor :playground, :width, :height, :generation def initialize self.generation = 0 self.width = 10 self.height...
true