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
016672e432d58c7fd32f45e97e49805cb29d1d55
Ruby
yurkaronin/rubyrush
/rubles-to-dollars-converter/1.rb
UTF-8
756
3.453125
3
[]
no_license
# Напишите конвертер валют рубли-доллары: # программу, которая спрашивает курс, потом спрашивает у пользователя, # сколько у него рублей, а потом выдает результат в долларах. today = Time.now puts "Сколько сейчас стоит 1 доллар на бирже?" rate = gets.to_f.round(2) puts "на сегодня #{today}", "Курс $ по отношению к ...
true
b26ed65cd4239183b94ca017a685b868d58bb518
Ruby
habutai/Bears-have-Teeth-and-Claws
/my_sort.rb
UTF-8
334
3.0625
3
[]
no_license
def my_sort(sortlist) return sortlist if sortlist.size <= 1 for i in 0..(sortlist.length - 1) for j in 0..(sortlist.length - i - 2) if (sortlist[j + 1] <=> sortlist[j]) == -1 sortlist[j], sortlist[j + 1] = sortlist[j + 1], sortlist[j] end end end return ...
true
46c67e011082436b84ad18098b85fd2052895fe3
Ruby
ZongZiWang/E-PKUer-Server
/app/models/restaurant.rb
UTF-8
2,934
2.59375
3
[]
no_license
class Restaurant < ActiveRecord::Base attr_accessible :average_cost, :status_busy, :status_normal, :status_loose, :category, :description, :dishes, :evaluation, :image_url, :info_summary, :info_tel, :info_time, :location_latitude, :location_longitude, :location_name, :location_zone, :name has_many :dishes, :depende...
true
aea35615e3b7ce8c184b09115ce25fa93951e0d1
Ruby
leotangram/Saludame3
/solution.rb
UTF-8
300
2.625
3
[]
no_license
require 'sinatra' get '/' do erb :index end post '/views/:name' do @name = params[:nick] erb :hola end # # get '/' do # # if params[:nombre] # # name = params[:nombre] # # "<h1>Hola #{name}!</h1>" # # else # # "<h1>Hola #{name = "desconocido"}!" # # end # # redirect '/' # # end
true
b530bf889d0067a56fd2ff30ba460850252e0f48
Ruby
alexwlchan/alexwlchan.net
/src/_plugins/tag_separator.rb
UTF-8
908
2.640625
3
[ "CC-BY-4.0", "LicenseRef-scancode-unknown-license-reference", "MIT", "AGPL-3.0-or-later" ]
permissive
# This plugin allows me to include a small SVG as an image as a separator. # # Example usage: # # {% separator "scroll.svg" %} # # References: # # - Accessible SVGs https://css-tricks.com/accessible-svgs/ # Explains in more detail how to ensure accessibility is preserved with # inline SVGs. # module Jeky...
true
89bdc88d8506477337a2260e71540e272d7779a5
Ruby
pheinrich/euler
/solved/problem_0190.rb
UTF-8
3,032
3.0625
3
[ "MIT" ]
permissive
require 'projectEuler' class Problem_0190 def title; 'Maximising a weighted product' end def difficulty; 50 end # Let S_m = (x_1, x_2, ... , x_m) be the m-tuple of positive real numbers # with x_1 + x_2 + ... + x_m = m for which P_m = x_1 * x_2^2 * ... * x_m^m # is maximised. # # For example, it can be ...
true
4ec3392ab565868c916fa2e2df8434277d130684
Ruby
hirengondhiya/HirenGondhiya_T1A1
/q16.rb
UTF-8
2,571
4.125
4
[]
no_license
# An allergy test produces a single numeric score which contains the information about all the allergies the person has (that they were tested for). The list of items (and their value) that were tested are: # eggs (1) # peanuts (2) # shellfish (4) # strawberries (8) # tomatoes (16) # chocolate (32) # pollen (64) # cat...
true
02cdec48a48183a488fcc813cd4831b352033a6f
Ruby
ipc103/intro-ruby
/02_book_finder.rb
UTF-8
1,008
3.75
4
[]
no_license
require 'rest-client' require 'json' require 'pry' def title(book) book['volumeInfo']['title'] end def authors(book) book['volumeInfo']['authors'].join(" and ") end def list_price(book) if book['saleInfo'].has_key?('listPrice') book['saleInfo']['listPrice']['amount'] else 'Not For Sale' end end de...
true
7aa425c57f6c58d1e5c55ed7be911e860fa1ac14
Ruby
Jalindner/phase-0-tracks
/ruby/solo.rb
UTF-8
4,257
3.796875
4
[]
no_license
class Dragon attr_accessor :type, :favorite_treasure, :egg_amt #initialize for Dragon #Dragon type #favorite_treasure #number of eggs def initialize(type, favorite_treasure) @type = type @favorite_treasure = favorite_treasure @egg_amt = 0 #print_dragon end #breathe ...
true
93665b2880bde9d2c796911473836af971aae86f
Ruby
danshep/tabletop-dice
/lib/dice/parser.rb
UTF-8
6,068
3.140625
3
[]
no_license
module Dice class ParserError < StandardError;end class Parser SPACE = ' '[0] def initialize(string) #p ['parsing', string] @stack = [] @string = string @index = -1 state_start end def output @stack.first end private def next_char @string[@in...
true
471093acd1db22289ba872051e44e2229b34e144
Ruby
milo-codes/ecosystem_model_tdd_hw
/specs/bear_spec.rb
UTF-8
1,000
3.34375
3
[]
no_license
require("minitest/autorun") require("minitest/rg") require_relative("../bear.rb") require_relative("../river.rb") require_relative("../fish.rb") class BearTest < MiniTest::Test def setup() @bear1 = Bear.new("Yogi", "Grizzly", "Howdie!") @river1 = River.new("Elb", 27) @fish1 = Fish.new("Joe") end de...
true
fac2188f701c9f9381594f460016b65d46c7d154
Ruby
makerscraft/labs_interview
/source/app/models/school.rb
UTF-8
241
2.5625
3
[]
no_license
class School < ActiveRecord::Base attr_accessible :name, :school_url, :school_img_url has_many :courses def self.short_school_name(school_name) max_school_name_length = 39 school_name.slice(0, max_school_name_length) end end
true
05dcda0eb681ae6f7ef5dd855b3d89814b77ef1d
Ruby
ilke-zilci/sdl-ng
/lib/sdl/types/sdl_type.rb
UTF-8
548
2.796875
3
[ "Apache-2.0" ]
permissive
## # An SDLType is a wrapper around a basic Ruby type module SDL::Types::SDLType def self.included(base) base.extend ClassMethods end module ClassMethods ## The Ruby type, which is to be wrapped attr :wrapped_type ## The codes, which are to be used to refer to this type attr :codes ## ...
true
09de5b5ee354eb96ef23bdf91f8736d795203efa
Ruby
Shopify/liquid
/test/integration/tags/if_else_tag_test.rb
UTF-8
9,528
2.59375
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'test_helper' class IfElseTagTest < Minitest::Test include Liquid def test_if assert_template_result(' ', ' {% if false %} this text should not go into the output {% endif %} ') assert_template_result( ' this text should go into the output ', ' {% if t...
true
224b584e22675b6a6c857eacd58946819d111952
Ruby
kamarsh1/connect-four
/spec/human_player_spec.rb
UTF-8
767
3.296875
3
[]
no_license
require_relative '../app/models/player' require_relative '../app/models/human_player' describe 'HumanPlayer' do let(:some_name) { 'Charmander' } let(:color) { 'Orange' } let(:humanPlayer) { HumanPlayer.new(some_name, color) } let(:pick_col_message) { "#{some_name} pick a column (1 through 7)\n" } describe '...
true
9a77d30cdb057a10bd419cca473ab05ba386b652
Ruby
brittmmendez/oo-kickstarter-v-000
/lib/backer.rb
UTF-8
209
2.703125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Backer attr_accessor :backed_projects, :name def initialize(name) @name=name @backed_projects=[] end def back_project(project) @backed_projects<<project project.backers<<self end end
true
898d0997c3b2d4c6dc87b53e99cef440d7be0c47
Ruby
eval/mollie-payment
/spec/mollie/ideal_spec.rb
UTF-8
2,353
2.53125
3
[ "MIT" ]
permissive
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Mollie::Ideal do context "#banks" do it "returns an array with hashes containing keys :id and :name" do VCR.use_cassette('banks') do banks = described_class.banks banks.class.should == Array banks.first.ke...
true
2cb80c593c962ea4c711c4f936f91f2af6e8b65b
Ruby
Jbeltrez/oo-inheritance-code-along-onl01-seng-pt-070620
/lib/car.rb
UTF-8
505
3.953125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_relative "./vehicle.rb" class Car < Vehicle def go "VRRROOOOOOOOOOOOOOOOOOOOOOOM!!!!!" end end #Well, when your program is being executed, at the point at which the #go method is invoked, the compiler will first look in the class to which the instance of car that we are calling the method on...
true
45004d5ef703224915bd2754c32cce45b0d5fb05
Ruby
brianqhe/terminal-card-app
/src/spec/test_spec.rb
UTF-8
726
3.15625
3
[]
no_license
require_relative '../model/game' # Rspec test to ensure a random card is picked from its corresponding value describe 'card number' do it 'picks a key in a hash' do expect(Game.random_key({'key' => 'value'})).to eq('key') expect(Game.random_key({'key1' => 'value 1', 'key2' => 'value2'})).to eq('key...
true
5c15174ec5f544957811b6f506f5ce53b2327a3e
Ruby
chihaso/memo_app
/lib/memo.rb
UTF-8
503
2.71875
3
[]
no_license
# frozen_string_literal: true require "securerandom" module MyMemoApp class Memo def initialize(path) @path = path end def save(memo_text) File.open("#{@path}#{SecureRandom.uuid}", "w", 0o0666) do |file| file.puts memo_text end end def memo_text File.read(@path)...
true
d53381b388f50f542b40714163ef75946950735b
Ruby
Contactability/em-synchrony
/examples/all.rb
UTF-8
1,078
2.53125
3
[ "MIT" ]
permissive
require "lib/em-synchrony" EM.synchrony do # open 4 concurrent MySQL connections db = EventMachine::Synchrony::ConnectionPool.new(size: 4) do EventMachine::MySQL.new(host: "localhost") end # perform 4 http requests in parallel, and collect responses multi = EventMachine::Synchrony::Multi.new multi.ad...
true
2ddc7577c86ef6eb5450a0dc9d6bf18ed13285af
Ruby
mahendhar9/programming_problems
/fibonacci_sequence_generator.rb
UTF-8
490
4.3125
4
[]
no_license
# Build a method that returns an array of the Fibonacci sequence of a pre-defined number of values. # Input # fibonacci 10 # Expected Output # [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] require 'rspec' def fibonacci(num) (1..num).inject([0, 1]) {|arr| arr << arr.last(2).inject(:+)} end # print fibonacci(10) descr...
true
d24ec7ad976a88267720b3a494d7b37d118f3e09
Ruby
chandley/precourse
/Hardway/adventure.rb
UTF-8
1,288
3.59375
4
[]
no_license
rooms = ['inventory','dining room','kitchen','drawing room','hall'] room_moves = [{},{"n" => 3, "e" => 2},{'w' => 1},{'n' => 4, 's' => 1},{'s' => 3}] items = {'plate of food' => 1, 'butter knife' =>1, 'sofa' => 3} monsters = {'hobgoblin' => 2} def show_room room_number, rooms, room_moves, items, monsters ...
true
488f2ce77a554cb5b3275525f25c971a73ac6a95
Ruby
millarj/tealeaf_ruby_exercises
/exercises/solution_10.rb
UTF-8
295
3.4375
3
[]
no_license
hash_with_array_values = {teams: ['Packers', 'Seahawks', '49ers']} # hash values as arrays puts hash_with_array_values puts hash_with_array_values.class array_of_hashes = [{model: 'Toyota'}, {model: 'Jeep'}, {model: 'Range Rover'}] # array of hashes p array_of_hashes p array_of_hashes.class
true
7137306dc5a7cf042936422dbb384689f30b6980
Ruby
jaimelr/game-of-life
/lib/life.rb
UTF-8
5,145
3.71875
4
[]
no_license
class Board attr_accessor :array, :width, :height def initialize(width, height) @width = width @height = height @array = Array.new(@width) do Array.new(@height) { Cell.new(rand(0..1)) } end end def reset @array.each do |row| row.each { |cell| cell.id = 0 } end end def ...
true
e88def9d4ea72dd69219583553c7c860f73400bc
Ruby
marcjrayner/OO_karaoke_practice
/guest.rb
UTF-8
160
2.671875
3
[]
no_license
class Guest attr_reader :name, :fav_song def initialize(name, wallet, fav_song) @name = name @wallet = wallet @fav_song = fav_song end end
true
7083da9f568150ee1a1e0ba402cb7ae5ce9f5b14
Ruby
artyom-ukhabin/AdviceMeAgain
/app/services/content_based_filtering/vector_objects/user_content_preference.rb
UTF-8
2,034
2.828125
3
[]
no_license
module ContentBasedFiltering module VectorObjects class UserContentPreference #TODO: dependencies #TODO: 1) content genres #TODO: 2) content vectors #TODO: 3) content rates => likes DATASTORE_CONNECTOR_CLASS = DatastoreConnectors::UserContentPreferencesConnector INITIAL_VECTOR...
true
bd70a74aa34eb7f51d2b6087b0ee530b3a006e77
Ruby
ahamedali95/dice-roll-ruby-prework
/dice_roll.rb
UTF-8
242
3.890625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Create method `roll` that returns a random number between 1 and 6 # Feel free to google "how to generate a random number in ruby" # def roll # rand(1...7) # end # # # puts roll() def roll nums = Array (1...7) nums[rand(0...6)] end
true
0d0a37ba90edea7b7d2b6ab58251f157f4d6e131
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/gigasecond/d6efb0026bad44a184d082e9cac1c26a.rb
UTF-8
113
2.8125
3
[]
no_license
require 'date' require 'time' class Gigasecond def self.from(date) date + (10**9) / (24*60*60) end end
true
68dacbd744d5c3f7c422adf579b63e7344e0be3b
Ruby
MarvinClerge/OO-mini-project-web-112017
/app/models/RecipeIngredient.rb
UTF-8
398
3.21875
3
[]
no_license
class RecipeIngredient @@all = [] attr_accessor :recipe, :ingredient def initialize(recipe: nil, ingredient: nil) @recipe = recipe @ingredient = ingredient @@all << self end def self.all @@all end def self.recipes self.all.map do |inst| inst.recipe end end def self.in...
true
2769e3734d905368c92451524df753fe44124fb2
Ruby
ivncastillo/desafio_patrones_anidados
/patrones.rb
UTF-8
2,922
3.125
3
[]
no_license
def letra_o(n) # Parte superior n.times do print "*" end print "\n" # Parte del medio (n - 2).times do print "*" (n - 2).times do print " " end print "*" print "\n" end # Parte inferior n.times do print "*" ...
true
2ff13e7e334071615ef923a6056784b9125c23ee
Ruby
paulmillen/tic_tac_toe
/lib/board.rb
UTF-8
1,568
3.546875
4
[]
no_license
class Board attr_reader :grid def initialize @grid = [ [1,1,1], [1,1,1], [1,1,1] ]; end def claim_field(row, column, player) fail ArgumentError, 'field occupied' if field_occupied?(row, column) @grid[row][column] = player return "#{player.to_s} Wins" if winn...
true
f2e180da2f5137f1951a52029db2cbde6ac56b3f
Ruby
prashantmukhopadhyay/Cats2
/app/models/cat.rb
UTF-8
352
2.796875
3
[]
no_license
class Cat < ActiveRecord::Base COLORS = ["black","brown","white", "spotted"] SEX = ["M","F"] attr_accessible :age, :birth_date, :color, :name, :sex validates :age, :birth_date, :color, :name, :sex, presence: true validates :age, numericality: true validates :color, inclusion: { in: COLORS } validates :s...
true
7343b0383d4c5c37dff3bec5fae7bf9f9df289ab
Ruby
jfoong/ruby-ucsc-api
/lib/ucsc/hg18/activerecord.rb
UTF-8
15,906
3.078125
3
[]
no_license
def overlap_sql(slice, start, stop) ' WHERE chrom = "' + slice.chromosome + '" AND ((chromStart BETWEEN ' + start.to_s + ' AND ' + stop.to_s + ')' + ' OR (chromEnd BETWEEN ' + start.to_s + ' AND ' + stop.to_s + ')' + ' OR (chromStart <= ' + start.to_s + ' AND chromEnd >= ' + stop.to_s + ')' + ' );'...
true
9361bf59183aedda54a1b34476fc0b795543bbb3
Ruby
isabelgm/The-Well-Grounded-Rubyist
/lib/chapter 5/class_variables_and_class_hierarchy.rb
UTF-8
809
3.78125
4
[]
no_license
class Parent @@value = 100 end class Child < Parent @@value = 200 end class Parent puts @@value end # What gets printed is 200. The Child class is a subclass of Parent, and that means # Parent and Child share the same class variables—not different class variables with the # same names, but the same actual vari...
true
36605547f4a096fa6e4de70a0a2645be90193376
Ruby
XertyBoi/NumberStrings
/number_string/bounds_object.rb
UTF-8
271
2.59375
3
[]
no_license
class Bound attr_accessor :max_bounds,:divide,:size_string,:array_to_select,:needs_and def initialize(max,div,string,need_and,array) @max_bounds = max @divide = div @size_string = string @array_to_select = array @needs_and = need_and end end
true
1d37d86527249e46e93d381c357005aa8949de5e
Ruby
michelleroos/rspec-debugging-blocks-procs
/rspec/lib/part_1.rb
UTF-8
553
4.15625
4
[]
no_license
def average(num_1, num_2) sum = num_1 + num_2 avg = sum / 2.0 avg end def average_array(arr) sum = 0.0 arr.each { |num|sum += num } avg = sum/arr.length avg end def repeat(str, num) str*num end def yell(string) string.upcase + "!" end def alternating_case(sentence) new_sente...
true
a4876cec7bff5c5dfe979fa4fc5f61c37cd76a47
Ruby
tony2nite/amzwish
/lib/amzwish/wishlist.rb
UTF-8
1,801
3.078125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require 'nokogiri' module Amzwish class Wishlist include Enumerable attr_accessor :list_id, :email class << self def find(email, website = Services::WebsiteWrapper.new) website.find_for(email) end end def initialize(email, wishlist_id = "WISHLIST-ID", website =...
true
94ae50b954e3147fb608bca26904ba6012580d31
Ruby
vivianafb/MetodosRuby
/3 strings/Ejercicio1.rb
UTF-8
402
4.34375
4
[]
no_license
# Dado el siguiente string y caracter, crear un metodo que reciba como parametro el string # y el caracter. Luego debe buscar si existe ese caracter dentro del string. # hint: El metodo .include? de un string busca si un caracter # o string dado esta contenido en este. cadena = 'Hola Mundo!' caracter = 'o' def inside...
true
3179555662daf4aabc7f45d0e5ca1911a227d1a7
Ruby
Kirbstomper/hw-ruby-intro
/lib/ruby_intro.rb
UTF-8
2,054
4.125
4
[]
no_license
# When done, submit this entire file to the autograder. # Christopher Smith # Marcus Andra # Part 1 def sum(x) # YOUR CODE HERE sum = 0 x.each{|el| sum += el}# for each element in the array, adds it to the overall sum return sum end def max_2_sum arr # YOUR CODE HERE arr = arr.sort.reverse size = arr.si...
true
9aeaa7267baab74b53a0e1b20ab9dca7d6a2f1ec
Ruby
sharonsheah/coding-challenges2
/01-Ruby/01-Programming-basics/Optional-01-Colorful-Algorithm/spec/colorful_spec.rb
UTF-8
577
3.25
3
[]
no_license
require "colorful" describe "colorful?" do it "returns false if provided with something other than a number" do expect(colorful?("not_a_number_but_a_string")).to eq false end colorful_numbers = [ 5, 34, 263 ] not_colorful_numbers = [ 70, 236 ] colorful_numbers.each do |number| it "returns true for...
true
1c30177a3a3ae3e1055f113d69845cc3d7290acc
Ruby
vase4kin/test_rail_integration
/lib/test_rail_integration/generator/test_run_parameters.rb
UTF-8
904
2.640625
3
[ "MIT" ]
permissive
require_relative 'API_client' module TestRail class TestRunParameters VENTURE_REGEX ||= TestRail::TestRailDataLoad.test_rail_data[:ventures] ENVIRONMENT_REGEX ||= TestRail::TestRailDataLoad.test_rail_data[:environments] CHECK_TEST_RUN_NAME ||= TestRail::TestRailDataLoad.test_rail_data[:check_test_run_nam...
true
fda21af91438e62768255710bbf715399f7a347f
Ruby
biancapower/ruby-exercises-week2
/atm/atm.rb
UTF-8
268
3.734375
4
[]
no_license
puts "Welcome to the bank!" puts "What transaction would you like to do? 'withdraw' or 'deposit'?" transaction = gets.chomp if transaction == "withdraw" puts "Thank you for your withdrawal" elsif transaction == "deposit" puts "Thank you for your deposit" end
true
4ef7a8e2558f120d1a99bb1418ad2c508b088bca
Ruby
Wumingla/rubymotion_cookbook
/ch_6/06_custompins/app/my_annotation.rb
UTF-8
943
2.875
3
[]
no_license
class MyAnnotation #pin constants from the header file REUSABLE_PIN_RED = "Red" REUSABLE_PIN_GREEN = "Green" REUSABLE_PIN_PURPLE = "Purple" # this portion needs to be settable attr_accessor :pinColor # these need to be implemented this way as part of MKAnnotation def coordinate; @coordinate; end de...
true
6f41a0dcb3ef8ea139e41608b57c870a87ebff38
Ruby
KellyMarcilliat/black_thursday
/lib/item_repository.rb
UTF-8
863
3.0625
3
[]
no_license
require 'csv' require_relative '../lib/item' require_relative '../lib/repository_helper' require 'bigdecimal' class ItemRepository include RepositoryHelper attr_reader :items, :all def initialize(filepath) @filepath = filepath @items = [] @all= [] end def create_items CSV.fore...
true
65971a9f86d026ce36836dd3eba254c7fc7be1c7
Ruby
CamillaCdC/seic38-homework
/Stacey Brosnan/week04/monday/mortgageCalculator.rb
UTF-8
301
3.53125
4
[]
no_license
print "What is the fixed yearly interest rate? " i = gets.to_f/12 print "What is the principle? " p = gets.to_i print "What is the number of monthly payments? " n = gets.to_i monthly_payment = p * (i * (1 + i) ** n) / ((1 + i) ** n - 1) print "Your montly payment will be #{monthly_payment} \n"
true
bb5e17d3f878f4d87cfebb7d317be63ddaf36d8a
Ruby
bloopletech/gistory
/lib/gistory/diff_to_html.rb
UTF-8
4,431
2.671875
3
[ "MIT" ]
permissive
class Gistory::DiffToHtml #FIXME LOLWUT def self.h(str) Rack::Utils.escape_html str end #TODO All the below needs to be tested def self.diff_to_html_rename(diff) { :type => 'rename', :message => diff.diff.ucfirst.gsub("\n", " => "), :content => [] } end def self.diff_to_html_binary(diff) if ...
true
aedb1cf458e073d34f7157c3df0b50010cb9fb57
Ruby
codereport/LeetCode
/0202_Problem_1.rb
UTF-8
444
2.984375
3
[]
no_license
# code_report Solution # Problem Link (Contest): https://leetcode.com/contest/weekly-contest-202/problems/three-consecutive-odds/ # Problem Link (Practice): https://leetcode.com/problems/three-consecutive-odds/ # Note this problem is very similar to MCO (Max Consecutive Ones) def three_consecutive_odds(arr) retu...
true
eb30d762ea41bf46232bd9951d2f0a0e47cb5183
Ruby
StarPerfect/pets_and_customers
/test/day_care_test.rb
UTF-8
1,520
2.859375
3
[]
no_license
require 'Minitest/autorun' require 'Minitest/pride' require './lib/day_care' require './lib/customer' require './lib/pet' class DayCareTest < Minitest::Test def setup @daycare = DayCare.new('AAA DayCare') @spaz = Pet.new({name: 'Spaz', type: 'Boxer'}) @sativa = Pet.new({name: 'Sativa', type: 'Boxer'}) ...
true
8ed084a6b8ab5a335410c5a57da5282f0e5d5615
Ruby
s34rching/ruby-basics
/s12-hashes-part-1/length_empty_methods.rb
UTF-8
144
2.859375
3
[]
no_license
menu = { burger: 1.52, taco: 10.4, chips: 5.12 } menu_1 = {} p menu.length # counts pairs p menu_1.length p menu.empty? p menu_1.empty?
true
566faec565629bc8a51f2a198964d7530bf3bcad
Ruby
jatin-baweja/advanced-ruby-exercise
/exercise5/bin/main.rb
UTF-8
246
3.40625
3
[]
no_license
#!/usr/bin/env ruby string1 = "Sample String" string2 = "Another Sample String" def string1.inspect_value inspect end class << string1 def uppercase upcase end end puts string1.inspect_value puts string1.uppercase puts string2.uppercase
true
c5dee900ee9d0d2dd2b70963ef60834469d73afb
Ruby
thuongho/awktion
/lib/place_bid.rb
UTF-8
1,119
3.34375
3
[]
no_license
# a class to make sure that new bids are not less than current bid class PlaceBid # makes that auction variable public to the outside attr_reader :auction, :status def initialize options @value = options[:value].to_f @user_id = options[:user_id].to_i @auction_id = options[:auction_id].to_i end d...
true
57fe4b6d80afb538fa4859a3ec5f95fff5928f3e
Ruby
C-FO/zaim
/lib/zaim/api/users.rb
UTF-8
835
2.71875
3
[ "MIT" ]
permissive
require 'zaim/api/utils' require 'zaim/user' module Zaim module API module Users include Zaim::API::Utils # Returns the requesting user if authentication was successful, otherwise raises {Zaim::Error::Unauthorized} # # @see https://dev.zaim.net/home/api#user_verify # @note Authenti...
true
31252031a890875cf12ed0ab92a613e180fd8c03
Ruby
gsaslis/github-release-downloads-count
/count.rb
UTF-8
2,100
3.03125
3
[ "MIT" ]
permissive
require 'net/http' require 'json' def countReleaseDownloads(release) releaseDownloadsTotal = 0 releaseAssets = release['assets'] unless releaseAssets.nil? releaseAssets.each do |asset| releaseDownloadsTotal += asset['download_count'] end puts " ; #{release['name']} ; #{release['published_at']}...
true
49d15d1a34d7acf435934f33b39e5e6175ec55c0
Ruby
mikekarnes123/backend_prework
/day_7/fizzbuzz.rb
UTF-8
139
3.34375
3
[]
no_license
1.upto 100 do |x| if x % 3 == 0 && x % 5 == 0 p "FizzBuzz" elsif x % 5 == 0 p "Buzz" elsif x % 3 == 0 p "Fizz" else puts x end end
true
a36e221280d280c71b526c8fe5837cb2ed9f1f45
Ruby
jshwartz/palindrome
/lib/palindromes.rb
UTF-8
436
3.625
4
[]
no_license
require ('pry') class String define_method(:palindrome?) do if self == self.reverse "You have a Palindrom" else "You do not have a Palindrom" end end end class String define_method(:reverse_string) do char_array = self.split("") char_number = char_array.count() rev_char_arra...
true
bc0797bb81ecf305cbce4c2473ff1ae4487ca12c
Ruby
diogobira/mc4arm
/dispatcher.rb
UTF-8
323
2.90625
3
[]
no_license
require 'parametros' require 'simulador' class Dispatcher def initialize(file,runtimes) @p = Parametros.new(file) @s = Simulador.new(@p) @t = runtimes end def run threads = Array.new (1..@t).each do |i| #threads << Thread.new {@s.executar} @s.executar end #threads.each {|thr| thr.join} end e...
true
274de3fb9614bde44c9677c7af041929566611df
Ruby
astine/ROQTI
/spec/chapter_1_spec.rb
UTF-8
1,836
3.109375
3
[]
no_license
require_relative '../lib/ROQTI' #Exercise 1 describe InterestRates,"#Annualized_interest_rate" do it "should return the annualized rate of an investment for a gross rate of 10% for the time period between 30 November 2006 and 1 March 2008" do #Y + m/12 + D/360 = periods periods = (1 + (2/12) + (29/360)) ...
true
c07fc79912b2db1f94e33b1e85a9e74bf0a10247
Ruby
beaucouplus/launchschool_ruby_more_topics
/challenges/diamond.rb
UTF-8
1,200
3.828125
4
[]
no_license
# Requirements # The first row contains one 'A'. # The last row contains one 'A'. # All rows, except the first and last, have exactly two identical letters. # The diamond is horizontally symmetric. # The diamond is vertically symmetric. # The diamond has a square shape (width equals height). # The letters form a diamon...
true
7816411a4f69b8d28203af0a447839903c171f0a
Ruby
chetan/continuum
/lib/continuum/http/httpi.rb
UTF-8
668
2.734375
3
[]
no_license
module Continuum class BaseClient private # Fetch a list of URLs. HTTPI adapter fetches each serialily. # # @param [Array<String>] def do_multi_get_http(uris) uris = [uris] if not uris.kind_of? Array uris.map do |uri| HTTPI.get(uri).body end end # POST the g...
true
398696bad381cc1188363b88578760ec3aa221e5
Ruby
tcannonfodder/duck-hunt
/test/validators/rejected_values_test.rb
UTF-8
1,328
2.875
3
[ "MIT" ]
permissive
require File.expand_path('../../test_helper', __FILE__) class DuckHuntRejectedValuesValidatorTest < DuckHuntTestCase def setup @validator = DuckHunt::Validators::RejectedValues.new([1,2,3]) end test "should create an instance with the provided value" do validator = DuckHunt::Validators::RejectedValues.n...
true
021c918c9c6215bb36a29487a518d43f3b8e5703
Ruby
LuisMarta/lab1
/case-control.rb
UTF-8
236
2.65625
3
[]
no_license
def validar_ip_servidor_pop(ip_para_validar) case ip_para_validar when "192.168.2.1" puts "Ip invlido" when "192.168.2.3" puts "ip invalido" when "192.168.2.2" puts "Ip valido" end end validar_ip_servidor_pop("192.168.2.2")
true
4b560aa152c39b65a70e6322a73cf4f6f041ad9b
Ruby
jeffgrayjr/aA-homework
/data-structures/skeleton/lib/knightpathfinder.rb
UTF-8
1,944
3.671875
4
[]
no_license
require_relative "00_tree_node.rb" class KnightPathFinder def initialize(starting_pos) @root_node = PolyTreeNode.new(starting_pos) @considered_positions = [] self.build_move_tree end def self.valid_move(pos) possible_moves = [] [-2, -1, 1, 2].each do |x| ...
true
e05cccb2347c34daa28940c99f046588d6d530cb
Ruby
sirivatd/UrlShortener
/URL_Shrntr/URLShortener/bin/cli
UTF-8
1,206
3.171875
3
[]
no_license
#!/usr/bin/env ruby require 'launchy' def get_input puts "Enter your email." email = gets.chomp current_user = User.where(email: email) raise "User does not exists" if current_user == [] puts "Logged in succesfully" while 1 puts "Would you like to visit or shorten a URL? ('v' for visit, 's' for sho...
true
178c134a74695ca4829f641b4189a90b5b163e80
Ruby
letianpai/letian.fight
/code_library/ruby/lang/hashmap.rb
UTF-8
4,839
3.9375
4
[]
no_license
#!/usr/bin/env ruby # coding: utf-8 # 建立hash months = Hash.new # 使用 empty? 测试 Hash 是否为空 p months.empty? # 使用 length, size返回 Hash的大小 p months.length p months.size # 如果指定了默认参数, 则当没有指定元素时候,则返回默认元素 months2 = Hash.new('abc') p months2[:aa] # 可以使用类方法[] 来建立一个 Hash. months3 = Hash[:aaa, 10, :bbb, 20, :ccc, 30] p months3[...
true
9a3c2e695c2a788f9bef42412e5d85e29e39c4d1
Ruby
richieganney/runlength
/lib/runlength_decode.rb
UTF-8
245
2.859375
3
[]
no_license
def runlength_decode(s) str1 = s.scan /A+|B+|C+|D+|E+|F+|G+|H+|I+|J+|K+|L+|M+|N+|O+|P+|Q+|R+|S+|T|U+|V+|W+|X+|Y+|Z+/ str2 = s.gsub(/[A-Z]/, ',').split(',').map(&:to_i).zip(str1).map { |rl| rl[0].to_i.zero? ? 0 : rl[1] * rl[0].to_i }.join end
true
5b6fcfe946755a90cd22e9c992e940c194d8a7ea
Ruby
maetl/nanogenmo2015
/encounter.rb
UTF-8
3,100
3.140625
3
[]
no_license
require 'calyx' class Encounter < Calyx::Grammar start :monster rule :monster, '{monster_stats}. {monster_state}' rule :monster_description, '' rule :monster_stats, 'GIANT SPIDER (STRENGTH 18, STAMINA 12)', 'GOBLIN (STRENGTH 12, STAMINA 8)' rule :monster_state, :aggressive, :timid, :watchful, :inattentive ...
true
43082869d31791bc5a20d675e653b1a3f30a6c75
Ruby
hugovila/polygon
/spec/square_spec.rb
UTF-8
1,933
3.390625
3
[]
no_license
require './polygon' require './quadrilateral' require './parallelogram' require './square' describe Polygon do describe Quadrilateral do describe Parallelogram do describe Square do it "is a child of Polygon" do one_ancestor_to_expect = Polygon expect(Square.ancestors).to i...
true
7f9bd84814153f40c8d51c0091408f9ddb4b91b9
Ruby
landongrindheim/dry-configurable
/lib/dry/configurable/class_methods.rb
UTF-8
2,209
2.609375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# frozen_string_literal: true require 'set' require 'dry/configurable/constants' require 'dry/configurable/dsl' require 'dry/configurable/methods' require 'dry/configurable/settings' module Dry module Configurable module ClassMethods include Methods # @api private def inherited(klass) ...
true
3745988992e0f4b7252eef776815bffa8f0f825a
Ruby
nakaaza/AtCoder
/practice/practice_contest/A.rb
UTF-8
160
3.234375
3
[]
no_license
# https://atcoder.jp/contests/practice/tasks/practice_1 a = gets.to_i b, c = gets.chomp.split(' ').map { |e| e.to_i } s = gets.chomp print "#{a + b + c} #{s}"
true
bea69fbcf540c9247e421c54f4a25302e75dcf9f
Ruby
ahrke/Launch_School
/lesson_5/practice_problems_1.rb
UTF-8
8,106
3.796875
4
[]
no_license
# Problem 1 # How would you order this array of number strings by descending numeric value? arr = ['10', '11', '9', '7', '8'] puts "#{arr.map {|value| value.to_i }.sort.reverse}" # alternatively arr.sort do |a,b| b.to_i <=> a.to_i end # Problem 2 # How would you order this array of hashes based on the year of pub...
true
e3ae227dc2c38ddea73c987f6b017f8b414359de
Ruby
jasongutierrez1989/badges-and-schedules-online-web-pt-031119
/conference_badges.rb
UTF-8
382
3.234375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Write your code here. def badge_maker(name) puts ('Hello, my name is #{name}.') end def batch_badge_creator(nameArray) count = 0 nameArray.each {|name|} do array[count] = 'Hello, my name is #{name}.' count += 1 end end def assign_rooms(speakerArray) count = 0 speakerArray.map {|speaker| "Hello, #{...
true
0b71972bfbb28b810413284ed48706b338cb7c0a
Ruby
KahTim/bitly-clone
/app/models/url.rb
UTF-8
438
2.59375
3
[ "MIT" ]
permissive
class Url < ActiveRecord::Base # This is Sinatra! Remember to create a migration! validates :ori_url, presence: true validates :short_url, :ori_url, uniqueness: true validates :ori_url, format: {with: /(((ftp|http|https):\/\/)|(\/)|(..\/))(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/, message: "val...
true
02aa104f698d0ab50dbc60cf8a79595345875f3d
Ruby
GoldenLion07/Ruby_on_Rails_Excercises
/Numerology.rb
UTF-8
2,291
3.75
4
[]
no_license
puts "Please enter your birthdate in the Month/Day/Year format" birthdate = gets.chomp def birth_path_number(birthdate) birth_path_number = birthdate[0].to_i + birthdate[1].to_i + birthdate[2].to_i + birthdate[3].to_i + birthdate[4].to_i + birthdate[5].to_i + birthdate[6].to_i + birthdate[7].to_i + birthdate[8].to_i...
true
2e9bb563913d17a3febad6d41ea8aeba7bfca37b
Ruby
azimux/ax_boolean_radio
/lib/azimux/boolean_radio_helper.rb
UTF-8
3,155
2.765625
3
[ "MIT" ]
permissive
module Azimux module BooleanRadioHelper VALID_OPTIONS = [:label, :additional_row_classes, :omit_clear_link] def invalid_boolean_radio_options?(options) options.keys.each do |key| unless VALID_OPTIONS.include? key.to_sym return key end end false end def bo...
true
03d4f2a2ec174a454e78790c19147a2fc4798a1f
Ruby
orenomba/ruby_learn_to_program
/lib/chapter09/baby_dragon.rb
UTF-8
475
3.625
4
[]
no_license
# encoding: utf-8 class BabyDragon attr_reader :fullness def initialize @fullness = 0 end def eat if 100 < @fullness + 10 @fullness = 100 "お腹いっぱい" else @fullness += 10 yield if block_given? end end def walk @fullness -= 5 if @fullness < 0 ...
true
5b7ae31fbee8e93ddc7a975ab8599a873c85ccb7
Ruby
avallabh/project_management
/spec/features/add_owner_spec.rb
UTF-8
1,066
2.59375
3
[]
no_license
require 'spec_helper' feature 'user adds a building', %Q{ As a real estate associate I want to record a building owner So that I can keep track of our relationships with owners } do # Acceptance Criteria: # I must specify a first name, last name, and email address # I can optionally specify a company name...
true
fca79883911bacb142b6904b4e05347a01714221
Ruby
semahawk/harr
/test/interpreter_test.rb
UTF-8
1,609
3.484375
3
[ "MIT" ]
permissive
require "test_helper" require "interpreter" class InterpreterTest < Test::Unit::TestCase def test_comment assert_equal 4, Interpreter.new.eval("a = 8 + 4 - 8; a % Could have done it better but its midnight.").ruby_value end def test_number assert_equal 1, Interpreter.new.eval("1").ruby_value end de...
true
7a8c35888fd3ebb502fc3aee103957021ae2e816
Ruby
smthom05/cross_check
/lib/game_teams.rb
UTF-8
1,139
2.921875
3
[]
no_license
class GameTeams attr_reader :game_id, :team_id, :hoa, :won, :settled_in, :head_coach, :goals, :shots, :hits, :pim, :powerPlayOpportunities, :powerPlayGoals, ...
true
9e3b0c2e11c71c7586434995e7ee127666db893a
Ruby
sidk/ruby-code-sample-2
/challenge.rb
UTF-8
992
4.03125
4
[]
no_license
# SMS can only be a maximum of 160 characters. # If the user wants to send a message bigger than that, we need to break it up. # We want a multi-part message to have this added to each message: # " - Part 1 of 2" # You need to fix this method, currently it will crash with > 160 char messages. def slice_string(str...
true
515d59f5a18d130779eee79dda918e5ce9d13b25
Ruby
masa-1013/atcoder
/abc158/B_CountBalls.rb
UTF-8
128
2.71875
3
[]
no_license
n, a, b = gets.split().map(&:to_i) tmp = n.divmod(a+b) if tmp[1] >= a puts tmp[0] * a + a else puts tmp[0] * a + tmp[1] end
true
09174aba5bd21eb70213cb2b635436d22e702ad7
Ruby
js658g/SAF
/learn/savon/savon_test.rb
UTF-8
1,453
3.5625
4
[]
no_license
# $Id: savon_test.rb 95 2016-04-06 20:35:25Z e0c2506 $ # Simple demo calling a webservice that converts between temperature units. require 'savon' # First we create the client. client = Savon.client do # Tell em where the WSDL is wsdl "http://www.webservicex.net/ConvertTemperature.asmx?WSDL" # And this...
true
674f71961b355d46f5321519da9d8b255d64a502
Ruby
dmcouncil/data_works
/lib/data_works/works.rb
UTF-8
2,726
2.703125
3
[ "MIT" ]
permissive
module DataWorks class Works include Visualization def initialize # we keep a registry of all models that we create @data = {} # keep a registry of the 'current default' model of a given type @current_default = {} # keep a registry of the 'limiting scope' for parentage @b...
true
f75518a7185cb8f7a44cd085662d21711e90d0c2
Ruby
antarestrader/jzform
/spec/validation_spec.rb
UTF-8
3,142
2.546875
3
[ "MIT" ]
permissive
require File.join( File.dirname(__FILE__), '..', 'lib',"jzform" ) describe "JZForm::Form Validations:" do before(:each) do @form = JZForm.new(:name=>'form') @form << {:name=>'basic',:datatype=>:string} @answer = {'basic'=>'foobar'} end describe "values" do describe "when a valid answer is provid...
true
3b58b4cd069700a8a149f16fa2ce0cfebd50ea88
Ruby
MatheusMuriel/RubyHackerRank
/Mini-MaxSum/Mini-MaxSum.rb
UTF-8
342
3.40625
3
[]
no_license
#!/bin/ruby #https://www.hackerrank.com/challenges/mini-max-sum/problem require 'json' require 'stringio' # Complete the miniMaxSum function below. def miniMaxSum(arr) resp = arr.combination(4).minmax_by{|x| x.sum}.map{|x| x.sum} puts resp[0].to_s + " " + resp[1].to_s end arr = gets.rstrip.split(' ').map(&:...
true
a512d2f0f5c5229c79dd116547fa27f668e98309
Ruby
translunar/boolean
/benchmarks.rb
UTF-8
1,876
2.9375
3
[]
no_license
require 'set' require 'benchmark' f = 10_000 ar1 = (1..(10*f)).to_a # 100_000 elements ar2 = ((5*f)..(15*f)).to_a # also 100_000 elements set1 = ar1.to_set set2 = ar2.to_set sset1 = SortedSet.new(ar1) sset2 = SortedSet.new(ar2) n = 10 #20000 Benchmark.bm(10) do |testcase| testcase.report('Array'){ n.times{ ar1 & ar...
true
a1c0108deafa4cb2a966256af7e368a9f8490a21
Ruby
denyago/auithorization-gems-example
/test_heimdallr.rb
UTF-8
436
2.59375
3
[]
no_license
require './common.rb' require './heimdallr.rb' # read puts 'Read: ' + User.restrict(@current_user).pluck(:name).join(', ') # update user = User.restrict(@current_user).find_by_id(42) begin user.update_attributes!(name: '42th User') rescue => e puts "Boom! #{e}" end puts 'Write: ' + user.name puts 'Write again: ' ...
true
9c41c2534257b2104b0afedac05c20528edf7041
Ruby
djtango/oystercard
/lib/journeylog.rb
UTF-8
828
3.046875
3
[]
no_license
require_relative 'journey' class JourneyLog attr_reader :journeys def initialize(journey_klass: Journey) @journey_klass = journey_klass @jr = @journey_klass.new @journeys = [] end def start_journey(station) current_journey outstanding_charges @jr.start(station) end def exit_journey...
true
6893414234cd65820aa5f184941723ac1b659fc1
Ruby
TypicalPolar/Ruby-Training
/ex36.rb
UTF-8
1,680
3.515625
4
[]
no_license
module Game_Functions def self.chance_roller(choice_limit) choice_limit -= 1 rand(0..choice_limit) end def self.set_switch_opt2(switch_value, goto1, goto2) # Would be nice if we could remove indivial set switches end end module Game_Level_1 def self.set_01 puts "You regain consciousness on t...
true
be896c5a5d3debc74fa9854a65cd0fa21ff268ca
Ruby
roniRamon/W3D2
/aa_questions/questions_database.rb
UTF-8
8,125
2.765625
3
[]
no_license
require 'sqlite3' require 'singleton' require 'byebug' class QuestionDatabase < SQLite3::Database include Singleton def initialize super('questions.db') self.type_translation = true self.results_as_hash = true end end class Users attr_accessor :fname, :lname def self.find_by_id(id) user...
true
eba9e0705345bfc388d350ca479f4e2ce5e272d1
Ruby
msrashid/Exercise-sets-for-101-109---Small-Problems
/adv1/ex9.rb
UTF-8
838
3.5625
4
[]
no_license
require "pry" def merge (first_array, second_array) return first_array if second_array.first == nil return second_array if first_array.first == nil merged_array = first_array + second_array returned_merged_array = [] loop do returned_merged_array += [merged_array.min] merged_array.delete_at(merged_...
true
49001c746d4fedaac20e7a2397fceb577ee1a2ef
Ruby
fguerra92/rails_ejercicios
/recta.rb
UTF-8
430
3.390625
3
[]
no_license
#Ejercicio video Asociaciones #se pide crear la clase recta, considerando que una recta está construida a partir de dos puntos require_relative 'punto.rb' class Recta def initialize(p1, p2) @p1 = p1 @p2 = p2 end end puts Recta.new(Punto.new(2, 3), Punto.new(3, 4)) #QUizz # class Casa # attr_accessor :...
true
b43eec5672d033a27730e0eefeb4c0ce52fe6335
Ruby
izcom/sorting_cards
/lib/round.rb
UTF-8
1,077
3.65625
4
[]
no_license
require './lib/card' require './lib/deck' require 'pry' class Round attr_accessor :deck :guesses :number_correct :percent_correct :current_card def initialize(deck) @deck = deck @guesses = [] @number_correct = 0 short = @deck.instanc...
true
05c56b0667f420723fccda954dec593b9620ccbe
Ruby
thoughtbot/factory_bot
/spec/acceptance/attribute_existing_on_object_spec.rb
UTF-8
1,757
3
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
describe "declaring attributes on a Factory that are private methods on Object" do before do define_model("Website", system: :boolean, link: :string, sleep: :integer) FactoryBot.define do factory :website do system { false } link { "http://example.com" } sleep { 15 } end ...
true
232e9f408e2084968ae5e87ee3e3b01963354f1d
Ruby
xarisd/unittesting-with-minitest
/presentation/code/01-poormans-testing/02-separate-files-with-helper/test_helper.rb
UTF-8
371
3.015625
3
[ "MIT" ]
permissive
# encoding: utf-8 ## General assertion methods def assert(condition, message) if condition puts "." else puts "FAIL : #{message}" end end def assert_equal(expected, actual, message) condition = (expected == actual) unless condition message = "#{message} \t expected:\t'#{expected}' \t actual:\t'...
true
bb80dee674bf6374d7ff8db987238152482fdc02
Ruby
GabrielNagy/facter-ng
/lib/framework/core/fact_filter.rb
UTF-8
454
2.5625
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Facter # Filter inside value of a fact. # e.g. os.release.major is the user query, os.release is the fact # and major is the filter criteria inside tha fact class FactFilter def filter_facts!(searched_facts) searched_facts.each do |fact| value = fact.filte...
true
b0238fc3279d07e19c78c7470912dbcfcb745715
Ruby
cyzanfar/PrimeGenerator
/prime.rb
UTF-8
612
3.59375
4
[]
no_license
class Prime attr_accessor :number def initialize(number) self.number = number prime_serie end def is_prime?(num) counter = 2 root_num = Math.sqrt(num).ceil while counter <= root_num if num % counter == 0 && num != counter return false break else counter += 1 end end ...
true
29211ac0b88e0859f37eb3c319693e6b438519a4
Ruby
20000414t/furima-34444
/spec/models/user_spec.rb
UTF-8
4,929
2.578125
3
[]
no_license
require 'rails_helper' RSpec.describe User, type: :model do before do @user = FactoryBot.build(:user) end describe 'ユーザー新規登録' do context '新規登録できる時' do it 'nameとemail、passwordとpassword_confirmation, name_familyとname_first, name_family_kanaとname_first_kanaが存在すれば登録できる' do expect(@user).to...
true
31fda2dde89bc76a6df04adc99d14d8afe36b7f8
Ruby
dsajwan98/article-api
/app/controllers/articles_controller.rb
UTF-8
1,140
2.515625
3
[]
no_license
class ArticlesController<ApplicationController before_action :set_article, only: [:update, :destroy] def create @article=Article.new @article.name=params[:name] @article.description=params[:description] if (@article.save) render json: {message: 'Created succe...
true
473d82ceedc87d0ae55706ee566a3cad85b926c1
Ruby
stefanbarolin/THP2020
/DAY07/exo_11.rb
UTF-8
115
3.203125
3
[]
no_license
puts ("Ecris un chiffre !") print ("> ") number = gets.chomp.to_i number.times do puts ("Salut, ça farte ?") end
true