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
7d5fbe5d2fd004a12cac36c2b4900841999a16a6
Ruby
mnajd/learn_ruby
/run_ninja_threads.rb
UTF-8
325
2.8125
3
[]
no_license
require 'load_runner' require_relative 'lib/ninja/game' ########################### # Run Program ########################## queue = LoadRunner::Queue.new puts 'play 100 games' puts "start #{Time.now}" # play 100 games queue.load(100) do game = Game.new result = game.play end queue.run puts "end #{Time.now}...
true
02084e8d78646deb5e0d022124b1e3bcfc95e70c
Ruby
jadelarosac/Practicas_PDOO_Ruby
/lib/Dice.rb
UTF-8
3,195
3.4375
3
[]
no_license
#encoding:utf-8 require_relative 'GameCharacter' module Deepspace # Esta clase implementa todo lo que tiene que ver con el azar class Dice # Constructor. Sin parámetros def initialize @NHANGARSPROB = 0.25 @NSHIELDSPROB = 0.25 @NWEAPONSPROB = 0.33 @FIRSTSHOTPROB = 0....
true
3fb66420f7682c5e59d29cd36c634b43a4112238
Ruby
HuebnerMedieval/lesson_plans
/app/controllers/subject_controller.rb
UTF-8
814
2.53125
3
[ "MIT" ]
permissive
class SubjectController < ApplicationController # index route for subjects get "/subjects" do if logged_in? # instance variable to be used by the erb file @subjects = [] # iterates through all Subjects. Only subjects with lessons are passed to the view ...
true
e289634ee5b856cbae9cc0f3d674db3785c7e821
Ruby
ankurjoshi54/coffee_machine
/lib/coffee_machine/validator/input_data.rb
UTF-8
3,373
3.203125
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'coffee_machine/constant' require 'coffee_machine/error' require 'coffee_machine/util' module CoffeeMachine module Validator class Error < CoffeeMachine::Error; end # Validator is used to validate the input data. This will make subsequent # logic easy to write as w...
true
163f9038236cbf19b608a67e8b6e7def710795a1
Ruby
tkadauke/symbols
/lib/math/logarithm.rb
UTF-8
286
2.921875
3
[]
no_license
# encoding: UTF-8 module Kernel [:₁, :₂, :₃, :₄, :₅, :₆, :₇, :₈, :₉, :₁₀].each_with_index do |name, index| define_method "log#{name}" do |val| Math.log(val) / Math.log(index + 1) end end def ln(val) Math.log(val) / Math.log(e) end end
true
43d12be1519760131c692652905a7dde7eada53c
Ruby
felixflores/magnolia
/lib/magnolia/tree.rb
UTF-8
263
2.671875
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
module Magnolia class Tree def add_node(parent_path, current_path) nodes << {:parent_path => parent_path, :current_path => current_path} self end def nodes @nodes ||= [] end def clear nodes.clear end end end
true
1892886439f5dc7a5858f475c4ecdebb7ecee308
Ruby
falegk/solving-maze
/lib/point.rb
UTF-8
317
3.390625
3
[]
no_license
class Point attr_accessor :point_x, :point_y def initialize(point_x, point_y) @point_x, @point_y = point_x, point_y end def is_valid_point? @point_x > 0 && @point_y > 0 end def is_point_in_world?(dimensions_x,dimensions_y) @point_x <= dimensions_x && @point_y <= dimensions_y end end
true
1aae8e3c2d2619f0a7425ee93bb461c1eab5a5c5
Ruby
Vizzuality/vizz_trackr
/test/models/concerns/has_state_machine_test.rb
UTF-8
797
2.609375
3
[ "MIT" ]
permissive
require "test_helper" class DummyClass include AASM include HasStateMachine aasm do state :unstarted, initial: true state :started state :finished event :start do transitions from: :unstarted, to: :started end event :finish do transitions from: :started, to: :finished en...
true
5b9f7b4fa8d6ee9e5b85ad51fddc140aea6f06e4
Ruby
manchester-tech-events/techevents-nw
/gems/ruby/2.2.0/gems/rack-1.6.1/lib/rack/backports/uri/common_18.rb
UTF-8
1,667
2.6875
3
[ "MIT" ]
permissive
# :stopdoc: # Stolen from ruby core's uri/common.rb, with modifications to support 1.8.x # # https://github.com/ruby/ruby/blob/trunk/lib/uri/common.rb # # module URI TBLENCWWWCOMP_ = {} # :nodoc: 256.times do |i| TBLENCWWWCOMP_[i.chr] = '%%%02X' % i end TBLENCWWWCOMP_[' '] = '+' TBLENCWWWCOMP_.freeze ...
true
944690b06383ccfa4185ff86ce7a6fc9e0097fda
Ruby
davidrichards/statisticus
/spec/lib/overrides/module_spec.rb
UTF-8
1,036
2.734375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require File.join(File.dirname(__FILE__), "/../../spec_helper") describe Module do it "should have alias_method_chain" do class A def go 'go' end def go_with_flair go_without_flair + " flair" end alias_method_chain :go, :flair end a = A.new a.go.should eq...
true
659cdba238ea88591e171e42ba72fb009b268e36
Ruby
jmoses/static
/app/models/page.rb
UTF-8
592
2.546875
3
[ "MIT" ]
permissive
class Page < ActiveRecord::Base attr_accessible :title, :body before_validation :generate_slug validates_presence_of :title, :body, :slug validates_uniqueness_of :title, :slug def generate_slug self.slug = to_param rescue nil end def self.home find_by_slug!('home') rescue ActiveRe...
true
2ad569f9cb95c2208a12617530578d4afc9ca84b
Ruby
jimm/advent_of_code
/ruby/y2021/day24.rb
UTF-8
3,486
3.59375
4
[]
no_license
#!/usr/bin/env ruby # # Arithmetic Logic Unit require_relative '../day' # # w = x = y = z = 0 # loop # read digit # x = z # x mod 26 (alphabet?) # z = z / 1 OR 26 (rounding here) # x += NNN # x = x == digit ? 1 : 0 # x = not x (that is, x != digit here) # y = 25 * x + 1 (1 OR 26) # z = z * y # y = ...
true
b16f019f5c4b454a6d63261770f7e00df738d507
Ruby
furtivesock/rubyworkshop
/flashcards/card.rb
UTF-8
135
3.015625
3
[ "MIT" ]
permissive
class Card attr_reader :question, :answer def initialize(question, answer) @question = question @answer = answer end end
true
db3a25bf39239c991940f296b7d7618fc06c33a5
Ruby
treble37/rdevch
/dictionary_search/lib/dictionary_search.rb
UTF-8
707
3.46875
3
[]
no_license
class DictionarySearch attr_accessor :pairs def initialize(file_path) @file_path = file_path @pairs = [] @pair_found = {} process_word_pairs end def word_pairs pairs end def process_word_pairs swap_word = "" @dictionary = File.open(@file_path) @dictionary....
true
e354dac67d39bde43cea591e305f52cd518103ac
Ruby
andreacfm/active_metadata
/spec/support/watcher_notifier.rb
UTF-8
596
2.546875
3
[]
no_license
class WatcherNotifier attr_accessor :matched_label, :old_value, :new_value, :model_class, :model_id, :type, :created_by def initialze puts "---------------------------------------->" end def notify(matched_label, old_value, new_value, model_class, model_id,owner_id,type, created_by) @matched_label= m...
true
dd98e4db7ead605a2eb514eda0517dc112a22134
Ruby
theadampalmer/ruby-objects-has-many-through-readme-onl01-seng-ft-070620
/lib/waiter.rb
UTF-8
522
3.125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Waiter attr_accessor :name, :years @@all = [] def initialize(name, years) @name = name @years = years @@all.push(self) end def new_meal(customer, total, tip = 0) Meal.new(self, customer, total, tip) end def meals Meal.all.select do |meals| meals.waiter == se...
true
4845bdd343c9a435d3c07677bf382f9ee31ca191
Ruby
Pistos/Mathetes
/lib/mathetes/plugins/google.rb
UTF-8
1,582
2.890625
3
[]
no_license
require 'cgi' require 'open-uri' module Mathetes; module Plugins class Google MAX_RESULTS = 5 def initialize( mathetes ) mathetes.hook_privmsg( :regexp => /^!g(oogle)?\b/ ) do |message| args = message.text[ /^\S+\s+(.*)/, 1 ] nick = message.from.nick num_results = 1 ...
true
aae9a15e73e10c5344d449a2e4785a278ba9adbb
Ruby
mozillo/goSelf
/file.rb
UTF-8
1,012
3.171875
3
[]
no_license
require "C:/Sites/demo/sort" require "C:/Sites/demo/Person" #File.dirname(__FILE__) =begin =end filename = "C:/Sites/demo/goSelf/测试文件2.txt" puts "是否存在.....................#{File.exist?(filename)}........#{File.open(filename).size} " file = File.open(filename) puts "最后一次读取时间#{file.atime}" puts "最后一次修改时间#{file.mtime}" p...
true
5f4343235336bb859b63de03831a4f0b80f30022
Ruby
ababup1192/RubyTutorial-for-SCCP
/src/hello.rb
UTF-8
268
3.421875
3
[]
no_license
# -*- coding: utf-8 -*- puts 'Hello' #=> Hello x = 10 puts "x=#{x}" #=> x=10 ダブルクォート文字列では、#{}には任意の式が書ける。 puts 'x=#{10}' #=> 'x=#{x}' シングルクォート文字列では、すべてがエスケープされる。
true
0dd43d610b01f1be80ae0bb2c263be7f6782c886
Ruby
bjoernalbers/check_zfs
/bin/check_zfs
UTF-8
1,066
2.671875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/usr/bin/env ruby -w begin require 'nagiosplugin' rescue LoadError require 'rubygems' require 'nagiosplugin' end class ZFS < NagiosPlugin::Plugin # Check the ZFS status (required method by nagiosplugin) def check critical(output) if !pools(:faulted).empty? warning(output) if !pools(:degraded).emp...
true
10bcc1500713f76b7d57c09aa402ca020703dc46
Ruby
helenosheaa/my_studio_project
/models/specs/member_spec.rb
UTF-8
511
2.96875
3
[]
no_license
require("minitest/autorun") require_relative("../member") class TestMember < MiniTest::Test def setup options = {"id" => 1, "first_name" => "Michelle", "last_name" => "Brown", "level" => "Beginner" } @member = Member.new(options) end def test_first_name() assert_equal("Michell...
true
ca4c47da216aa2ec19b8515070d3215b1efba094
Ruby
itgsod-pontus-wistrom/Funktioner-uppgift-1
/uppgift1e.rb
UTF-8
50
2.890625
3
[]
no_license
def rot(a) return Math.sqrt(a) end puts rot(6)
true
b4d60cae2b30425d65181139566505963f8120a7
Ruby
wlei6277/terminal_app
/src/classes/location.rb
UTF-8
1,125
3.640625
4
[]
no_license
require_relative "criteria.rb" #Define a class Location which is a child of the Criteria class #Location should have a special initialize function to take input from the user about which location they are based in #The init function should loop until the user has entered a valid option class Location < Criteria ...
true
3618083a9159eee5ed21546488434a273715fa7f
Ruby
dianorlova/Ruby
/Ruby_practice/pract-3-2/powers_of_two.rb
UTF-8
1,877
3.796875
4
[]
no_license
require_relative "str_to_num" def main puts "\nПриложение печатает те элементы массива, индексы которых являются степенями двойки (1,2,4,8,16...)." print "\nВведите последовательность целых чисел: " arr = data_input_check() while arr.nil? puts "Упс! Вы ввели некорректные данные. Попробуйте ещё ...
true
f5dfa449c7d92ae9ffcc0a6ba93b03661b342e7b
Ruby
vjctqr/ecosystem
/bear.rb
UTF-8
319
3.03125
3
[]
no_license
class Bear attr_reader :name, :fish_population def initialize(name) @name = name @stomach = [] end def def empty() @fishes.clear() end def take_river_fish(river) for fish in river.fish_population() take(fish) end end end
true
24ea0ac29d57057ab8b0deac9eed6f8eb78c3420
Ruby
testwisely/test-recipes
/api-tests/spec/restful_spec.rb
UTF-8
1,442
2.53125
3
[]
no_license
load File.dirname(__FILE__) + '/../test_helper.rb' require 'net/http' require 'httpclient' require 'rexml/document' describe "REST WebService" do include TestHelper it "REST - List all records" do list_rest_url = "http://www.thomas-bayer.com/sqlrest/CUSTOMER" resp = HTTPClient.new.get(list_rest_url) ...
true
42b1ed92703b304fa4a6591c5565b00f59e234cc
Ruby
clintonjnelson/twitteresque_webapp_rails
/app/helpers/sessions_helper.rb
UTF-8
1,527
2.765625
3
[]
no_license
module SessionsHelper # HELPER IS SHARED THROUGH ALL CONTROLLERS THROUGH APPLICATION_CONTROLLER INCLUDE # Method that sets browser cookie to the db value for permanent signin reference def sign_in(user) cookies.permanent[:remember_token] = user.remember_token self.current_user = user end def sign_out ...
true
7c93d2f2c93d781d0abfca8660935f531f6e5a83
Ruby
Pair-coding-THP-with-Jeremy-Vincent/exercice_ruby_initiation
/exo_04.rb
UTF-8
304
3.203125
3
[]
no_license
puts "Salut, ça farte ? #Que se passe-t-il #Le terminal nous renvoie : 'unterminated string meets end of file', puis nous affiche ''puts 'Salut, ça farte ?'' #Cette erreur vient simplement du fait qu'il manque un guillemet pour finir la chaîne de caractère que l'on souhaite affiche après le 'puts'
true
9a345f001df00b9c8b0bf11f546349a41f2a9dd2
Ruby
notmarkmiranda/black_thursday
/lib/sales_analyst.rb
UTF-8
5,117
2.765625
3
[]
no_license
require_relative 'sales_engine' require 'pry' class SalesAnalyst include AnalystAssistant attr_reader :se, :merch_ids def initialize(se) @se = se end def average_items_per_merchant (items.all.size.to_f / all_merchants.size).round(2) end def average_items_per_merchant_standard_deviation ite...
true
2f229f4bf3cfe84778170f7bdfe25d38599a6c0b
Ruby
JustinData/GA-WDI-Work
/w04/d03/Julie/morning.rb
UTF-8
330
3.59375
4
[]
no_license
def cipher (word) plain_array = ("a".."z").to_a cipher = ("n".."z").to_a cipher_array = cipher + ("a".."m").to_a letter_hash = Hash[plain_array.zip(cipher_array)] array = [] plaintext_array = word.split(//) plaintext_array.map do |char| array << letter_hash[char] end puts array.join end ciphe...
true
b2c95ef80ab8b1e33cc57e4a18e3c1431a206823
Ruby
kathf/flight-planner
/app/models/route.rb
UTF-8
828
2.8125
3
[]
no_license
require 'set' class Route < ActiveRecord::Base belongs_to :origin, class_name: "Airport", foreign_key: 'origin_id' belongs_to :destination, class_name: "Airport", foreign_key: 'destination_id' validates :destination_id, :origin_id, presence: true def self.leave_from(start) where('origin_id = ?', start).p...
true
c248f1c69f135ecbce3569dc6d2d4bb258b0164f
Ruby
ButenkoT/WDI11_Homework
/gregory_mcintyre/week_04/01-loops.rb
UTF-8
990
4.5
4
[]
no_license
# JS: # for (var i = 1; i <= 10; i++) { # # } i = 1 while i <= 10 # stuff in here i += 1 end # for (var i = 0; i <= a.length; i++) { # console.log(a[i]); # } # _.forEach(a, function(item){ # console.log(item); # }) a = [10, 20, 30] a.each { |item| # Array's each method p item } 5.times {|n| p n...
true
a385f0af66eab9effe08b876d1cfb34c6bdfc0ea
Ruby
nmking22/sweater_weather
/spec/facades/location_facade_spec.rb
UTF-8
1,953
2.609375
3
[]
no_license
require 'rails_helper' describe 'location facade' do describe 'class methods' do it 'find_coordinates' do location = 'new orleans,la' coordinates = LocationFacade.find_coordinates(location) expect(coordinates).to be_a(Hash) expect(coordinates).to have_key(:lat) expect(coordinates[:...
true
84412233c79f7cdf0dd3976e78be28159e981321
Ruby
jacindaz/Launch-Academy
/hangman/hangman.rb
UTF-8
3,158
4.5
4
[]
no_license
#!/usr/bin/env ruby =begin - generate a random word, save in a variable - set chances to 8 (or later can change for user to set # of chances) - loop until chances = 0 or when user guesses the word if correct: - update word: _____ with appropriate letters - found x occurences of the particular ...
true
e345b33aa59c828091d02b8cc1e7c9bee68280c0
Ruby
lukew244/nfl-simulator
/lib/tiebreakers/single_tiebreaker.rb
UTF-8
1,696
2.9375
3
[]
no_license
require_relative '../constants/non_div_opponents' module SingleTiebreaker extend self TIEBREAKERS = %w[head_to_head division_wins common_games conference_wins coin_toss] PLAYOFF_TIEBREAKERS = %w[head_to_head conference_wins common_games_minimum coin_toss] def run(teams) first_team_advantage = find_succes...
true
e631bb8b5452deaa6e1290791bea216f1628523a
Ruby
SidharthNambiar/Launch-School
/backend_prep/ruby_basics/user_input/ex_4.rb
UTF-8
1,319
4.53125
5
[]
no_license
# Ruby Basics # User Input # Exercise 4: Print Something (Part 2) # In the previous exercise, you wrote a program that asks the user # if they want the program to print "something". # However, this program recognized any input as valid: # if you answered anything but y, it treated it as an n response, # and quit w...
true
2067be0f3ad36000eba7c10d9a10f463f3d2c07a
Ruby
jdliss/task_manager
/test/models/task_manager_test.rb
UTF-8
1,477
2.765625
3
[]
no_license
require_relative '../test_helper' class TaskManagerTest < Minitest::Test include TestHelpers def test_it_creates_a_task create_tasks(1) task = task_manager.find(1) assert_equal "a title 1", task.title assert_equal "a description 1", task.description assert_equal 1, task.id end def test_...
true
9efc4096af83fcb3557f1fa531f26cbfaeacbca7
Ruby
natalietagher/ttt-3-display_board-example-wework-bc-000
/lib/display_board.rb
UTF-8
601
3.53125
4
[]
no_license
# Define a method display_board that prints a 3x3 Tic Tac Toe Board # puts "A Tic Tac Toe Board" # phrase = "A Tic Tac Toe Board" # puts first_line = [" | | "] # puts second_line = [" ------------"] # puts third_line = [" | | "] # puts fourth_line = [" ------------"] # puts fifth_line = [" | | ...
true
40bc7e40b2832e9c75107e7ab8f3327902052bf8
Ruby
differential-med/differential-web
/lib/datasource.rb
UTF-8
3,617
2.53125
3
[]
no_license
require "excon" require "tmpdir" require "open3" # ugh, datasource? having trouble finding a good name for this class Datasource # TODO: move to ENV var GITHUB_REF = "differential-med/differential-data@master" def initialize(github_ref:) @owner, @repo, @ref = github_ref.split(/\/|@/) end def self.load...
true
dfff08653b440282aaba1dde5cebac51ad13a9b9
Ruby
Shopify/ghostferry
/test/helpers/ghostferry_helper.rb
UTF-8
12,809
2.609375
3
[ "MIT" ]
permissive
require "fileutils" require "json" require "logger" require "open3" require "thread" require "tmpdir" require "webrick" require "cgi" module GhostferryHelper GHOSTFERRY_TEMPDIR = File.join(Dir.tmpdir, "ghostferry-integration") def self.remove_all_binaries FileUtils.remove_entry(GHOSTFERRY_TEMPDIR) if Dir.exis...
true
b310d08a401e36bce7c17cb7f7ba99a433cf7dc4
Ruby
hkhajehamiri-ut/ruby-codecademy
/ternary-js-ruby.rb
UTF-8
164
3.265625
3
[]
no_license
#JS version # 3 < 4 ? console.log('3 is less than 4') : console.log('3 is not less than 4'); #ruby version puts 3 < 4 ? "3 is less than 4" : "3 is not less than 4"
true
0b7fd6e7df2d4bafacc3eec85d278d94a6e8275a
Ruby
WodaKyon/RGSS
/Game Scripts/世紀之卡(Carte-De-Sentinelle)/Scripts/013 - Game_Message.rb
UTF-8
4,279
3.171875
3
[ "Apache-2.0" ]
permissive
#encoding:utf-8 #============================================================================== # ■ Game_Message #------------------------------------------------------------------------------ #  處理信息窗口狀態、文字顯示、選項等的類。本類的實例請參考 $game_message 。 #==============================================================================...
true
6e4e038620c59a6d534479fd3ff3d0c6c6411da9
Ruby
alexdonets/fitit
/app/models/food.rb
UTF-8
707
2.515625
3
[]
no_license
class Food < ActiveRecord::Base belongs_to :user CATEGORIES = { "Dairy & Eggs" => "Dairy", "Meat & Fish" => "Animal", "Fruits & Vegetables" => "Plant", "Nuts, beans & legumes" => "Nuts", "Grains" => "Grains", "Drinks" => "Beverages", ...
true
60afcc28035ebeeb615ad1afea4a60242c5319ea
Ruby
thechanmoon/ruby-oo-relationships-practice-recipes-exercise-atlanta-web-021720
/app/models/RecipeCard.rb
UTF-8
484
2.921875
3
[]
no_license
class RecipeCard attr_reader :date, :rating, :user, :recipe @@all = [] def initialize(date, rating, user, recipe) @date = date @rating = rating @user = user @recipe = recipe @@all << self end def self.all @@all end end # u= User.new("Ian") # i...
true
fbe173685e939b8a61ff41c3ac4e0ea4e49e74c8
Ruby
milos381/orm-update-lab-online-web-sp-000
/lib/student.rb
UTF-8
1,388
3.25
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_relative "../config/environment.rb" class Student attr_accessor :name, :grade attr_reader :id def initialize(id = nil, name, grade) @id = id @name = name @grade = grade end def self.create_table sql = <<-SQL CREATE TABLE IF NOT EXISTS students ( id INTEGER PRIMARY KEY, name TEXT, ...
true
1579a7cac8b508e06cdeae10c4b51094f1549194
Ruby
stacksonstack/advanced-hashes-hashketball-nyc01-seng-ft-091420
/hashketball.rb
UTF-8
6,722
3.4375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Write your code below game_hash def game_hash { home: { team_name: "Brooklyn Nets", colors: ["Black", "White"], players: [ { player_name: "Alan Anderson", number: 0, shoe: 16, points: 22, rebounds: 12, assists: 12, s...
true
f1e5331d4ed91e68cd1e46769f82341d62b2e65d
Ruby
lowtjie/E10CP1A1
/ejercicio6.rb
UTF-8
674
3.578125
4
[]
no_license
module Test def result # Ternario: ((nota1 + nota2) / 2.0 > 4) ? "Estudiante aprobado" : "Estudiante reprobado" if ((nota1 + nota2) / 2.0) > 4 "Estudiante aprobado" else "Estudiante reprobado" end end end module Attendance def student_quantity @@quantity end end class Student include Test, Attend...
true
3f495f37088b15f12d43b122db24763a43ff43b5
Ruby
kedar123/bsg
/current/app/models/group.rb
UTF-8
3,666
2.671875
3
[]
no_license
# == Schema Information # Schema version: 20181126085723 # # Table name: groups # # id :integer(4) not null, primary key # user_id :integer(4) # title :string(255) # description :text # state :string(255) # viewed_number :integer(4) default(0) # rates_aver...
true
526d6fa01443647bfe1de45dbedc4bf6458c21ba
Ruby
strychemi/assignment_recursion_sprint
/digit_sum.rb
UTF-8
416
4.0625
4
[]
no_license
#recursive sumdig def sumdig_r(number) return number if number.to_s.length == 1 return (number % 10) + sumdig_r(number / 10) end #iterative sumdig def sumdig_i(number) sum = 0 until number.to_s.length == 1 && number == 0 sum += number % 10 number = number / 10 end return sum end #puts "#{sumdig_r(...
true
5865f5fddbf4939c30745509106e5f57f6614f9e
Ruby
jrcode7/Introduction_To_Programming
/Hashes/test.rb
UTF-8
383
3.765625
4
[]
no_license
arr = ["laboratory", "experiment", "Pans Labyrinth", "elaborate", "polar bear"] arr.each do |this| if this =~ /b/ puts this end end # another way to write this (with method) puts puts def checkword(word) if word =~ /b/ puts word end end checkword("laboratory") checkword("experiment") checkword("...
true
bf28adf64112091bc2c22263c2087bcf21709ab5
Ruby
SadiaBe/programming-univbasics-4-square-array-dumbo-web-102819
/lib/square_array.rb
UTF-8
174
3
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
numbers = [1,2,3] squared_numbers = [] counter = 0 def square_array(numbers) while counter < array.lenth do squared_numbers << (array[counter] ** 2) counter +=1 end
true
8919c62b2a30d6a1ae7936bd67ee142d91a4ecc7
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/anagram/988dfa00cd69486b876da064aae9ba19.rb
UTF-8
596
3.859375
4
[]
no_license
class Word def initialize(word) @word = word end def different?(candidate) @word.downcase != candidate.downcase end def same_letters?(candidate) sort_letters(@word) == sort_letters(candidate) end private def sort_letters(word) word.downcase.chars.sort end end class Anagram att...
true
abe662adfa58d19e73c04fc5c7768b722c6ec249
Ruby
kswhyte/black_thursday
/lib/sales_analyst_support.rb
UTF-8
4,039
2.640625
3
[]
no_license
module SalesAnalystSupport def sample_standard_deviation(sample, average) differences_squared = sample.map do |number| (number - average) ** 2 end Math.sqrt( differences_squared.reduce(:+) / (sample.count - 1).to_f ).round(2) end def items_per_merchant @all_merchants.keys.map do |mercha...
true
2e6d6810caf8c5ab4d63c8cb6f2ab5ab88a4108b
Ruby
GoBeyond87/URI-Ruby
/1015.rb
UTF-8
273
2.90625
3
[]
no_license
# frozen_string_literal: true p1 = gets.split(' ') p2 = gets.split(' ') dist1 = ((p2[0].to_f - p1[0].to_f) * (p2[0].to_f - p1[0].to_f)) dist2 = ((p2[1].to_f - p1[1].to_f) * (p2[1].to_f - p1[1].to_f)) distf = Math.sqrt(dist1 + dist2) puts format('%.4f', distf)
true
93880d476b02c2b984dd3cf6d0aa16478404c3cc
Ruby
Juventino13/Ruby_programas
/est_if_01.rb
UTF-8
192
2.515625
3
[]
no_license
today = Time.now if today.wednesday? puts "salimos mas temprano" elsif today.sunday? puts "vamos a la playa" else puts "Resolver los programas de condesignal" end
true
301637746c90c53eaa9bd2d3f64a72470341747f
Ruby
manonja/ruby-instance-variables-lab-london-web-career-031119
/lib/dog.rb
UTF-8
779
4.4375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# class Dog # # we create two instance methods: the name= method and the name method. # # set an individual dog's name # def name=(dog_name) # this_dog_name = dog_name # end # # get this individual dog's name # def name # # local variable: this_dog_name cannot be accessed in the name method. # t...
true
b5ea63948dd9cb0d80895cbe5964e3f733b664ad
Ruby
blrobin2/enterprise-patterns-ruby
/domain-logic-patterns/transaction-script/gateway.rb
UTF-8
1,647
2.640625
3
[]
no_license
# frozen_string_literal: true # Gateway between database and application services class Gateway def initialize(connection) @connection = connection end def find_recognitions_for(contract_id, as_of) @connection.execute(self.class.find_recognitions_statement, [ contract_id, ...
true
59249d423430d165faa459065ad7b0d58cb35c84
Ruby
otiai10/rei
/training/hanging.rb
UTF-8
560
2.6875
3
[]
no_license
require 'mondai' require 'mondaiwind' require 'curses' include Curses init_screen cbreak begin puts "問題作成中..." m = Mondai.new mondai = m.make mon_win = MondaiWind.new(stdscr) mon_win.display(mondai) max_input = mondai.length * 2 max_input.times do if m.all_collect? mon_win.seikai break...
true
1eb69c597901ce17c464a1811dec4e853b717fa9
Ruby
moviepilot-de/omdb
/app/models/common/popularity_history.rb
UTF-8
796
2.765625
3
[ "MIT" ]
permissive
class PopularityHistory < RatingHistory def self.generate_report(year, week) start_date = DateTime.commercial(year,week) #I'm catching the case when the week is in the new year end_date = DateTime.commercial(year,week+1) rescue DateTime.commercial(year+1,1) movies = Movie.find_by_sql ["select fo...
true
7d8839bd388a073b120bad1d95ea3daa2f294864
Ruby
unfodev/multiply
/lib/multiply/multiplier.rb
UTF-8
1,209
3.203125
3
[]
no_license
module Multiply class Multiplier def initialize(options = {}) raise ArgumentError, "missing :texts option" if options[:texts].nil? @words = Words.new({ :words => options[:words] || nil }) @texts = Texts.new(*options[:texts]) @indexes = ([0] * @texts.texts.length) end def curr...
true
531f6a286980f29ff0953faefd2038cafea4b89d
Ruby
masayoshikuroda/hiratsuka-train
/yahootransit.rb
UTF-8
791
3.078125
3
[ "Apache-2.0" ]
permissive
require 'nokogiri' require 'net/http' require 'open-uri' class YahooTransit attr_reader :title, :icon, :status, :info BASE_URL = 'https://transit.yahoo.co.jp/traininfo/detail' def initialize(a, b) url = getUrl(a, b) html = open(url) do |f| f.read end page = Nokogiri::HTML.parse(html, nil, 'UTF-8') ...
true
e1b568c9dc0552aa454afbeec6066126e8378347
Ruby
kharigai/ruby
/atcoder/abc107_b2.rb
UTF-8
648
3.484375
3
[]
no_license
h, w = gets.chomp.split.map(&:to_i) arr = [] h.times{ line = gets.chomp arr << line if line.count("#") != 0 } p arr # => ["##.#", "##.#", ".#.#"] (w-1).downto(0){|x| if arr.all?{|line| line[x] == "."} arr.each{|line| line[x, 1] = ""} end } arr.each{|line| puts line} ・行すべてが'.'のものを除外して配列を作る ・...
true
af9e63acdc92fef57748dadb85f08bb3140e38f1
Ruby
andreaflether/Escambee
/app/models/proposal_answer.rb
UTF-8
981
2.5625
3
[]
no_license
class ProposalAnswer < ApplicationRecord belongs_to :proposal belongs_to :user enum direction: [:forward, :backward] validates_presence_of :direction validates_inclusion_of :answer, in: [true, false] before_validation do self.direction = proposal_direction end def accepted? answer end de...
true
82c488793c830e8e3f036555fbadd528eef488ff
Ruby
jimberlage/ActiveRecord-lite
/lib/active_record_lite/associatable.rb
UTF-8
2,970
2.703125
3
[]
no_license
require 'active_support/core_ext/object/try' require 'active_support/inflector' require_relative './db_connection.rb' class AssocParams def underscore_to_camelcase(word) word.split('_').map { |word| word.capitalize }.join('') end def add_underscored_words(original, *new_words) ([original] + new_words).j...
true
ba5a4611be46a9ed5a96d638fcbdfa31c14c1c42
Ruby
kkoutoup/find_a_coding_buddy
/db/seeds.rb
UTF-8
2,992
2.6875
3
[]
no_license
# Dependencies require 'csv' require 'open-uri' def image_fetcher URI.open("https://kitt.lewagon.com/placeholder/users/random") end # Destroy entries puts "=> Destroying existing entries" User.destroy_all if Rails.env.development? Technology.destroy_all if Rails.env.development? Project.destroy_all if Rails.env.dev...
true
4d751fee846b3b23a67e174efee2eff54b333bea
Ruby
compwron/setalyze
/spec/setalyze/card_spec.rb
UTF-8
873
2.890625
3
[ "MIT" ]
permissive
require_relative 'spec_helper' describe Card do let(:c1) { Card.new(1, Card::Symbol::Diamond, Card::Shading::Solid, Card::Color::Red) } let(:c2) { Card.new(2, Card::Symbol::Squiggle, Card::Shading::Striped, Card::Color::Green) } describe 'self.resurrect' do it 'should create a card from a user input' do ...
true
c6625fc89ba9a3e06f2a71dbc25df60c88a68ef8
Ruby
VadimBrodsky/tealeaf_oop
/oop_workbook/easy/q2_e7.rb
UTF-8
280
3.625
4
[]
no_license
class Cat @@cats_count = 0 def initialize(type) @type = type @age = 0 @@cats_count += 1 end def self.cats_count @@cats_count end end # The @@cats_count variable keeps track of the number of cats / object instatated from the class Cat Cat.cats_count
true
0b6c0000b51db52fa26465ebda927a2839085cec
Ruby
kinvojoshua/duel-master
/duel.rb
UTF-8
1,354
3.671875
4
[]
no_license
class Duel def duel(hero1, hero2) number = rand(1..2) if number == 1 then attacker = hero1 defender = hero2 else attacker = hero2 defender = hero1 end puts "attacker: #{attacker}" puts "defender: #{defender}" puts "#{attacker.name} attacked #{defender.na...
true
3941a6412383ffd6ef9129eb7969f0b638d68bcd
Ruby
JoshCheek/activerecord_deliberate_practice
/4_making_records.rb
UTF-8
6,879
3.09375
3
[]
no_license
require_relative 'setup' ActiveRecord::Schema.define do self.verbose = false create_table :cars do |t| t.integer :year t.integer :make_id t.integer :model_id end create_table :makes do |t| t.string :name end create_table :models do |t| t.string :name end # <-- your work goes here...
true
5cf17235beae3e6dedc10349e5065d6cc32f182e
Ruby
DevDave0/advanced-hashes-hashketball-wdc01-seng-ft-060120
/hashketball.rb
UTF-8
4,588
3.390625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' def game_hash { home: { team_name: "Brooklyn Nets", colors: ["Black", "White"], players: [ { player_name: "Alan Anderson", number: 0, shoe: 16, points: 22, rebounds: 12, assists: 12, steals: 3, ...
true
a899cf2f6449eafdf4a38d4d9c8d99b0179ee0a6
Ruby
frankmt/asrc_sw_dev
/lrthw/mansoor/Tash Challenges/game.rb
UTF-8
784
3.765625
4
[]
no_license
require_relative "./player.rb" class Game attr_reader :player1, :player2 def initialize(player1, player2) @player1 = player1 @player2 = player2 end def play @player1.take_turn @player2.take_turn end def winner puts "#{@player1.name} #{@player1.latest_roll}" puts "#{@player2.name} #{@p...
true
54809d2c72d95c3618dde650739deddc04f7610c
Ruby
amaysim-au/amaysim-logger-ruby
/lib/amaysim_logger/keyword_filter.rb
UTF-8
1,790
2.921875
3
[ "MIT" ]
permissive
class AmaysimLogger class KeywordFilter MASK = '[MASKED]'.freeze class << self def filter(content, filtered_keywords) return content unless filtered_keywords.any? content = filter_hash(content, filtered_keywords) if content.respond_to?(:keys) content = filter_json(content, filte...
true
00e48ec2a73c85b7b13d2870b8a2e87a03bcea52
Ruby
tortus/business_catalyst
/spec/lib/business_catalyst/csv/transformers_spec.rb
UTF-8
2,159
2.859375
3
[ "MIT" ]
permissive
# encoding: utf-8 require 'spec_helper' module BusinessCatalyst::CSV describe GenericTransformer do subject { GenericTransformer } it "calls to_s on input" do input = double("some input") input.should_receive(:to_s).and_return("string value") subject.transform(input).should eq("string valu...
true
a1d1533aeb9751311534a88a98def46a707a93ac
Ruby
beergit/AoC-2020
/advent3/tc_advent3.rb
UTF-8
1,013
3.09375
3
[]
no_license
#!/usr/bin/ruby require_relative 'advent3' require 'test/unit' class TestAdvent3 < Test::Unit::TestCase TestInput = <<EOF ..##....... #...#...#.. .#....#..#. ..#.#...#.# .#...##..#. ..#.##..... .#.#.#....# .#........# #.##...#... #...##....# .#..#...#.# EOF def setup @test1_1 = [TestInput, [0], 2] @test1_...
true
508aa740a0828c14eee3d8d2d44beec5d35168a6
Ruby
Ethan-B123/topological-sort
/lib/topological_sort.rb
UTF-8
578
2.875
3
[]
no_license
require_relative 'graph' def topological_sort(vertices) vertices_2 = vertices.dup sorted = [] no_ins = [] loop_count = 0 vertices_2.each do |vert| if vert.in_edges.length == 0 no_ins << vert end end while no_ins.length > 0 working = no_ins.shift sorted << working no_ins.concat( ...
true
6fbd51451aa12544bbea9aaebd09c43344985cd9
Ruby
kthibodeaux/pull-review
/lib/pull_review/requests/post_comment.rb
UTF-8
383
2.515625
3
[ "MIT" ]
permissive
module PullReview class Request::PostComment < PullReview::PostRequest def initialize(number:, comment:) @number = number @comment = comment end private attr_reader :number, :comment def url "https://api.github.com/repos/#{ PullReview::REPO }/pulls/#{ number }/comments" end...
true
4564cd77c00035663264059434c6779d367dd80f
Ruby
technion/paddingoracle
/lib/paddingoracle.rb
UTF-8
2,717
3.265625
3
[ "MIT" ]
permissive
require "paddingoracle/version" require 'openssl' require 'base64' require 'uri' module Paddingoracle extend self def remove_pad(str) # Remove PKCS #7 padding raise "Incompatible remove_pad input" unless str.kind_of? String last = str[-1,1] raise "Invalid padding" unless last.ord > 0 && last.ord ...
true
950602bce42a6a7c843a8a5ab03d1ea76a6decbc
Ruby
Andria177/Ruby0704
/exo_07_b.rb
UTF-8
182
3.46875
3
[]
no_license
puts "C'est quoi ton blase?" print "> " # Attends une valeur avant de passer à la ligne user_name = gets.chomp #Demande d'entrée une valeur à assigner à user_name puts user_name
true
adcb57f5614ab1a11a98b64b4a24d6f40d4d2fae
Ruby
AddisonDesign/custom_fields
/test/test_custom_fields.rb
UTF-8
1,362
2.71875
3
[ "MIT" ]
permissive
require 'minitest_helper' class User < ActiveRecord::Base include CustomFields custom_field :hometown end class TestCustomFields < Minitest::Test def test_user_should_have_custom_field_hometown assert User.custom_fields.include?(:hometown) end def test_get_custom_field_store_should_build_store user...
true
2fa330190e803dc00024b4a6c545b957f83b0f1c
Ruby
MadManLabs/campaign-monitor-trace-ip
/lib/ip_tracer.rb
UTF-8
3,113
3.21875
3
[]
no_license
require 'createsend' require 'geoip' require 'toc' class IPTracer attr_accessor :api_key, :list_id, :file, :database def initialize(api_key, list_id, file = './records.csv', database = './GeoLiteCity.dat') @api_key, @list_id, @file, @database = api_key, list_id, file, database end # Traces the location o...
true
fc2f906e030490d6249004095e82ff978875473f
Ruby
dineshtbits/datastructures_in_ruby
/problems/fibonacci.rb
UTF-8
218
4.40625
4
[]
no_license
# Finding the nth number in fibonacci. # using method def fibonacci(n) n < 2 ? n : fibonacci(n-1) + fibonacci(n-2) end # Using lamba lam = ->(n) {n < 2 ? n : lam[n-1] + lam[n-2]} puts fibonacci(6) puts lam.call(6)
true
81e4e6b301a41cc7a4b930b1db5946c530035496
Ruby
NiketaJen/ruby-enumerables-hash-practice-nyc-pigeon-organizer-lab-hou01-seng-ft-060120
/nyc_pigeon_organizer.rb
UTF-8
469
2.796875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' def nyc_pigeon_organizer(data) pigeon_list= {} data.each do |three_attributes, value| value.each do |inside_keys, names| names.each do |names| if pigeon_list[names] == nil pigeon_list[names] = {} end if pigeon_list[names][three_attributes] == nil pigeon_lis...
true
ebada19c303bd0a63199e01ba7e0611e1561d383
Ruby
lastgleam/atcoder-solutions
/src/B-UnevenNumbers.rb
UTF-8
272
3.578125
4
[]
no_license
# B - Uneven Numbers # https://atcoder.jp/contests/abc136/tasks/abc136_b # n = gets.strip.to_i c = 0 c += n if n > 0 && n <= 9 c += 9 if n > 9 c += (n - 99) if n > 99 && n <= 999 c += 900 if n > 999 c += (n - 9999) if n > 9999 && n <= 99999 c += 90000 if n > 99999 puts c
true
9b90709c4267162caf32f002b56382d1f77f110c
Ruby
topealabi/Ruby_hardaway
/rakefile.rb
UTF-8
277
2.578125
3
[]
no_license
task :mac_and_cheese => [:buy_pasta, :buy_cheese, :boil_water]do puts "making mac and cheese" end task :buy_pasta do puts "buying pasta" end task :buy_cheese do puts "buying cheese" end task :boil_water => [:buy_pasta, :buy_cheese] do puts "boiling water" end
true
44f6e6884837b29602f3c9532d5273f1cb45de6c
Ruby
bwdev/puzzles
/Ruby/EvenFibonacciNumbers/EvenFibonacciNumbers.rb
UTF-8
162
3.328125
3
[]
no_license
_answer = 0 _cap = 4000000 _x = 0 _y = 1 _z = _x + _y while _z < _cap _x = _y _y = _z _z = _x + _y _answer += _y if _y % 2 == 0 end puts _answer.to_s
true
99c619a98878a3d42d8efe6b5b26a121a75b9dcf
Ruby
Calum-Chisholm/EasyShop
/start/models/purchase.rb
UTF-8
2,363
3.09375
3
[]
no_license
require_relative("../db/sql_runner") class Purchase attr_accessor :stock_id, :customer_id, :quantity attr_reader :id def initialize(details) @id = details['id'].to_i if details['id'] @stock_id = details['stock_id'] @customer_id = details['customer_id'] @quantity = details['quantity'] end ...
true
1700bb51be5c8f138a538cc82444c9c5e5f428fb
Ruby
rpazyaquian/practice_game_of_life
/lib/game_of_life.rb
UTF-8
1,761
3.734375
4
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class GameOfLife def initialize(board) @board = board end def tick original_board = @board new_board = original_board.each_with_index.map do |row, y| row.each_with_index.map do |cell, x| next_status(cell, y, x) end end @board = new_board end def center_cell find_c...
true
d27e66740a5a5266ec22b9bf770c78e7ad4ae2b6
Ruby
FilmonFeMe/phase-0-tracks
/ruby/iteration_drill.rb
UTF-8
4,788
3.65625
4
[]
no_license
# Array Drills zombie_apocalypse_supplies = ["hatchet", "rations", "water jug", "binoculars", "shotgun", "compass", "CB radio", "batteries"] # 1. Iterate through the zombie_apocalypse_supplies array, # printing each item in the array separated by an asterisk # ---- # zombie_apocalypse_su...
true
7ffad5d461f3c06e342aae786b284f5fffc7bd13
Ruby
o1810156/fp
/L1/prac_1_3.rb
UTF-8
958
4.5625
5
[]
no_license
# a def plus(a, b) return a + b end def minus(a, b) return a - b end def product(a, b) return a * b end def quotient(a, b) return a / b.to_f end puts plus(1, 2) # => 3 puts minus(1, 2) # => -1 puts product(1, 2) # => 2 puts quotient(1, 2) # => 0.5 # classで再定義が可能らしい... class Integer def +(other...
true
832ddd47f7be4059ac4b52ea07a75af7e345a3c7
Ruby
ansd/mysql-concourse-resource
/check.rb
UTF-8
1,118
2.96875
3
[]
no_license
#!/usr/bin/env ruby # { # "source": { # "host": "...", # "user": "...", # "password": "..." # "database": "..." # "table": "..." # }, # "version": { "id": 1423 } # } require 'mysql2' require 'json' # Parse the parameters passed to the script over STDIN sSource = ARGF.read source = JSON.pars...
true
ce2a6e2d7bed95a0c6fb93c436e90c593f8af648
Ruby
david-brooks/learn_ruby
/06_hello_friend/friend.rb
UTF-8
65
2.640625
3
[]
no_license
class Friend def greet(person="") "Hello #{person}!" end end
true
3e8e8be19411daee7394532f10c7b01b8ad2b909
Ruby
keithyow/code-katas
/day7.rb
UTF-8
376
3.390625
3
[]
no_license
def SimpleSymbols(str) # code goes here if str =~ /[a-z]/ num_of_letters = str.scan(/[a-z]/).size if str.scan(/(\+[a-z]\+)/).size == num_of_letters return true else return false end else return false end end # keep this ...
true
4aa3641e3b3ba5c899e6ed09598907d60ff95843
Ruby
kellyredding/test-belt
/lib/test_belt/testcase.rb
UTF-8
1,198
2.96875
3
[ "MIT" ]
permissive
module TestBelt module TestCase # This overrides the TestCase suite building behavior. It uses # the local_public_instance_methods util to builde the suite of # tests. What this gives you is only the tests defined or mixed # in to the class will be run as part of the suite (non of the super # c...
true
8366f9600081580c279cd891f819891c743499ae
Ruby
K-kind/Memorizer
/spec/models/question_spec.rb
UTF-8
1,696
2.59375
3
[]
no_license
require 'rails_helper' RSpec.describe Question, type: :model do describe 'questionの作成や削除' do let(:question) { build(:question) } it 'questionが有効であること' do expect(question).to be_valid end it 'learned_contentがなければ無効であること' do question.learned_content = nil expect(question).to be_inva...
true
61501fb6e6e9ea606f3bfb599c59788d525b239c
Ruby
mschuchard/rapid-vaults
/lib/rapid_vaults.rb
UTF-8
3,379
2.671875
3
[ "MIT" ]
permissive
require_relative 'rapid-vaults/decrypt' require_relative 'rapid-vaults/encrypt' require_relative 'rapid-vaults/generate' require_relative 'rapid-vaults/binding' # interfaces from cli/api, validates settings, and then distributes actions to appropriate classes class RapidVaults # main runner for software def main(s...
true
f52145c84ba653bd27a021d99a0916d60ef17fef
Ruby
ahe/choco
/lib/choco/cli.rb
UTF-8
2,272
2.515625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'pathname' module Choco class CLI def initialize(args) @args = args @output = "" end def run @args << '--help' if @args.empty? aliases = { "g" => "generate", "s" => "server" } command = @args.shift command = aliases[comm...
true
ef3741e293343472b45d2d0da8c5828ea2ae555c
Ruby
whoisowenjones/code_library
/ruby/truncate_exp_security_hashes.rb
UTF-8
1,318
2.671875
3
[]
no_license
#!/usr/bin/env ruby USAGE = "USAGE: #{File.basename(__FILE__)} <environment> <path_to_database_file>\n\n" if ARGV[0].nil? unless ARGV[0] == ( "dev" || "prod" || "staging" ) puts "\nERROR: Must supply environment as 'dev', 'staging' or 'prod'." puts "#{USAGE}" exit end end if ARGV[1].nil? puts "ERRO...
true
2e902427e49a11435ea17c2deb60b0807754b11d
Ruby
seyoumha/Order-Processing
/lib/client_order.rb
UTF-8
380
2.875
3
[]
no_license
class ClientOrder def initialize data @data = data end # name,email,full_address,cc_num,phone,make,model,milage,price def to_order { name: @data[0], email: @data[1], full_address: @data[2], cc_num: @data[3], phone: @data[4], make: @data[5], model: @data[6], ...
true
886e4af1fb264969ff02953e4acbf7f3af8b58c4
Ruby
igor972/codewars
/ruby/exercise6.rb
UTF-8
2,054
3.90625
4
[]
no_license
class Exercise6 # https://www.codewars.com/kata/529bf0e9bdf7657179000008/train/ruby def validSolution(board) return false if board.flatten.include?(0) return verify_line_row(board) && verify_line_row(board.transpose) && verify_little_square(board) end def verify_line_row(board) (board.map {|row| (ro...
true
f6e7692ea4b70c950418e1ec025530c86e07100b
Ruby
sushadore/doctors
/Volunteer/lib/volunteer.rb
UTF-8
1,213
2.96875
3
[ "MIT" ]
permissive
class Volunteer attr_accessor :volunteer_name, :project_id, :id def initialize (attributes) @volunteer_name = attributes[:volunteer_name] @project_id = attributes[:project_id] @id = attributes[:id] end def Volunteer.all volunteers = [] (DB.exec"SELECT * FROM volunteers;").each do |voluntee...
true