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
18a1cd8d28da6f24f8b172bc31feaaf6c1c90ae3
Ruby
hanniedong/DBC_Overflow
/dbc_overflow/app/helpers/sessions_helper.rb
UTF-8
287
2.546875
3
[ "MIT" ]
permissive
def current_user @current_user ||= User.find(session[:user_id]) if session[:user_id] end def logged_in? !!current_user end def logout session[:user_id] = nil end def login(user) @user.authenticate(params[:user][:email], params[:user][:password]) session[:user_id] = @user.id end
true
0d13c24b9ea47e614ef20ed6d15f9fab0581fcb5
Ruby
RayNovarina/planning-poker-03-15-17
/spec/models/team_spec.rb
UTF-8
1,250
2.703125
3
[ "Apache-2.0" ]
permissive
require 'rails_helper' describe Team do before :each do @daltons = Team.create(name: "Daltons") @joe = @daltons.team_members.create(name: "Joe") @avrell = @daltons.team_members.create(name: "Avrell") end it "has members" do expect(Team.find_by(name: "Daltons").team_members.size).to eq(2) end ...
true
99e97ba679df76612e6bc728da6ce27560156533
Ruby
ksukhorukov/CodeEval
/TryToSolveIt/try_to_solve_it.rb
UTF-8
586
3.03125
3
[]
no_license
#!/usr/bin/env ruby code = {} code2 = {} code['A'] = 'U' code['B'] = 'V' code['C'] = 'W' code['D'] = 'X' code['E'] = 'Y' code['F'] = 'Z' code['G'] = 'N' code['H'] = 'O' code['I'] = 'P' code['J'] = 'Q' code['K'] = 'R' code['L'] = 'S' code['M'] = 'T' code.each_key { |key| code2[code[key]] = key } File.open(ARGV[0]).e...
true
4685c7ec66eb75b4cca3f80f388d39f574f2f02f
Ruby
quinn/music_pigeon
/song_scrape.rb
UTF-8
1,904
2.78125
3
[]
no_license
require 'lib/general' require 'hpricot' require 'open-uri' class String # Transforms this string into an escaped POSIX shell argument. def shell_escape inspect.gsub(/\\(\d{3})/) {$1.to_i(8).chr} end end def recursive_mkdir dirs base= '' dirs.split('/').each do |dir| base+= dir+'/' ...
true
b45815bf0d443ef17fde09317d76787ef238e37a
Ruby
WeilerWebServices/textmagic
/textmagic-rest-ruby/lib/textmagic-ruby/rest/unsubscribers.rb
UTF-8
1,939
2.6875
3
[ "MIT" ]
permissive
module Textmagic module REST class Unsubscribers < ListResource ## # Get unsubscriber by ID. # Returns Unsubscriber object. # # uid:: Unsubscriber ID. Required. # # Example: # # @unsubscriber = client.unsubscribers.get 987 # def get(uid) ...
true
638676cd78582500b2e951e23493353d4766a29b
Ruby
joshpied/f1-cli
/f1.rb
UTF-8
5,353
2.609375
3
[]
no_license
#!/usr/bin/env ruby require 'optparse' require 'net/http' require 'json' require 'time' require './colourize' # API available at https://ergast.com/mrd/ def get_JSON(url) uri = URI(url) response = Net::HTTP.get(uri) return JSON.parse(response) end OptionParser.new do |parser| parser.on("-l", "--logo") do ...
true
8e494d374dea6cfbb36719604ec9e549dff42dbb
Ruby
aquariumbio/protocol-base
/standard_libs/libraries/priority_queue/source.rb
UTF-8
2,253
3.828125
4
[ "MIT" ]
permissive
class PriorityQueue def initialize @heap = Heap.new() @priority_map = Hash.new() end def empty? @heap.empty? end def has_key?(key) @priority_map.has_key?(key) end def push(key, priority) node = PriorityNode.new(value: key, priority: priority) @priority_map[key] = priority @...
true
a1da374b5d72a480b6a6d88879f4903c95db616c
Ruby
MrJons/bank_tech_test
/lib/account.rb
UTF-8
996
3.609375
4
[]
no_license
# Responsible for enacting requests on the history made by the ATM class class Account def initialize(balance=0) @balance = balance @history = [] end attr_reader :balance, :history def add_funds(amount, date=Time.now.strftime("%d/%m/%Y")) @balance += amount record_history("deposit", amount, ...
true
f047fb2af8b889d6c8f3f253c611dc4662e3eaf6
Ruby
h4hany/leetcode
/python_solutions/1030.matrix-cells-in-distance-order.rb
UTF-8
1,964
3.75
4
[]
no_license
# # @lc app=leetcode id=1030 lang=ruby # # [1030] Matrix Cells in Distance Order # # https://leetcode.com/problems/matrix-cells-in-distance-order/description/ # # algorithms # Easy (68.11%) # Total Accepted: 3.8K # Total Submissions: 5.5K # Testcase Example: '1\n2\n0\n0' # # We are given a matrix with R rows and C ...
true
6f967068c3078367d0424cb66e56b50ec97f8da2
Ruby
philiplambok/cpractice
/leetcode/goat.rb
UTF-8
600
3.9375
4
[]
no_license
# @param {String} s # @return {String} def to_goat_latin(s) consonant = %w[a i u e o] a_counter = 1 s_arr = s.split(' ') s_arr.each_with_index do |word, index| if consonant.include?(word[0].downcase) a_word = 'a' * a_counter s_arr[index] = "#{word}ma#{a_word}" else first_char = word[0]...
true
aac59a4270bb0af685fe6ff7dc90fa9b6649b4fb
Ruby
gmalkas/timetablesonrails
/app/presenters/course_presenter.rb
UTF-8
489
2.859375
3
[]
no_license
## # # = CoursePresenter # # Decorates Course to encapsulate the knowledge associated # with course rendering. # class CoursePresenter attr_accessor :course def initialize(course) @course = course end ## # # Renders a course partial according to the course's state # (assigned to a manager or not). ...
true
5ca1db6889f50db90a596b3f752cb4efcfa4b9dd
Ruby
diniscoelho/Ruby-FCT
/casewhen.rb
UTF-8
200
3.625
4
[]
no_license
print 'Insira a sua idade: ' idade = gets.to_i case idade when 0..12 puts "vocΓͺ Γ© uma crianΓ§a" when 13..17 puts "vocΓͺ Γ© um adolescente" else puts "vocΓͺ Γ© um adulto" end
true
281f352246771ef39e4c6a0b07e07cbca065e02b
Ruby
nicolai86/url_plumber
/lib/url_plumber/plumber.rb
UTF-8
1,634
2.90625
3
[ "MIT" ]
permissive
require "active_support/hash_with_indifferent_access" module UrlPlumber class Plumber attr_accessor :params def initialize params @params = dup(params) end def extract key_path keys = key_path.to_s.split('.').map(&:to_sym) key = keys[-1] scope = params keys[0..-2].eac...
true
bfe994e916af5a4c824e07d21d381b9c3c6f9d57
Ruby
drewwebs/DrivingHistoryReporter
/spec/trip_spec.rb
UTF-8
785
2.984375
3
[]
no_license
require "trip" describe Trip do let(:valid_trip) { Trip.new("00:00", "01:00", 60) } let(:invalid_trip) { Trip.new("00:00", "01:00", 150) } describe "#initialize" do it "should set up instance variables" do [:distance, :duration_in_hours].each do |attribute| expect(v...
true
1018608ca3d92f72b061877d0b02aa8156a3dd35
Ruby
krzyzak/road_runner
/lib/road_runner/reporters/classic.rb
UTF-8
1,472
2.859375
3
[ "MIT" ]
permissive
module RoadRunner module Reporters class Classic attr_reader :exceptions, :failures, :monitor def initialize(monitor: monitor) @monitor = monitor @failures = [] @exceptions = [] @tests = 0 end def report_seed_value(random) puts "Initialized with #{...
true
55df18450b932cfa0dc7f7f586292d26717c9a00
Ruby
harisr92/twitspam
/twitter_spam.rb
UTF-8
1,175
3.265625
3
[]
no_license
require 'twitter_classifier' require 'optiflag' module Args extend OptiFlagSet optional_flag "kf" do long_form "knowledge_file" default "twitter_spam.kf" description "knowledge file -- used for storing classification data" end flag "u" do long_form "user" description "the user to classify" ...
true
620af1bc86be913ebff2ae3155ae04f77d3a8b32
Ruby
kaji-hiro/AtCoder_beginner_contest
/ABC184/C-Super_Ryuma.rb
UTF-8
359
3.078125
3
[]
no_license
r1, c1 = gets.split.map(&:to_i) r2, c2 = gets.split.map(&:to_i) if r1 == r2 && c1 == c2 puts 0 elsif (r1 - r2).abs + (c1 - c2).abs <= 3 || ((r1 - r2).abs - (c1 - c2).abs).zero? puts 1 elsif (r1 + c1) % 2 == (r2 + c2) % 2 puts 2 elsif ((r1 - r2).abs - (c1 - c2).abs).abs <= 3 puts 2 elsif (r1 - r2).abs + (c1 - c...
true
dc43986089335caa81af6099473184c82080c714
Ruby
idhallie/sorting-string-manipulation
/lib/sort_by_length.rb
UTF-8
1,765
4.53125
5
[]
no_license
# A method which will return an array of the words in the string # sorted by the length of the word. # Time complexity: O(n^2); Turning a string into an array is O(n) because the program has to traverse each character of the string # in order to parse it into an array. Then, sorting the array w/Bubble sort is O(n^2) ...
true
ec88ab4a41853bf8e7e7158e04913d0f3dd93799
Ruby
bitprophet/nanoc
/lib/nanoc3/helpers/html_escape.rb
UTF-8
1,562
3.375
3
[ "MIT" ]
permissive
# encoding: utf-8 module Nanoc3::Helpers # Contains functionality for HTML-escaping strings. module HTMLEscape require 'nanoc3/helpers/capturing' include Nanoc3::Helpers::Capturing # Returns the HTML-escaped representation of the given string or the given # block. Only `&`, `<`, `>` and `"` are ...
true
02a69d2ae2a92454fa83425a6fb97e9ed0d2e951
Ruby
standardgalactic/euler
/solutions/problem96.rb
UTF-8
3,167
3.171875
3
[]
no_license
require 'colored' def constraints(puzzle, index) r = row(puzzle, index) c = col(puzzle, index) b = block(puzzle, index) (1..9).select do |i| not r.include? i and not c.include? i and not b.include? i end end def parse_puzzle(str) str.chars.map { |i| i.to_i } end def row(puzzle, index...
true
e4e8a6761bb09a5bf149a3a9dc6dd71ae693987a
Ruby
prisara/object_oriented_programming1
/mars_rover/mars_rover.rb
UTF-8
2,347
4.5
4
[]
no_license
# create Rover class class Rover attr_accessor :name, :x_coordinate, :y_coordinate, :direction # initialize location and direction properties def initialize(name, x_coordinate, y_coordinate, direction) @name = name @x_coordinate = x_coordinate @y_coordinate = y_coordinate @direction = d...
true
23940e3a48d638caa27db7d7305daef9e05a6c47
Ruby
sunnyrajrathod/sample-code-ruby
/REST/WebHooks/create-webhook.rb
UTF-8
1,654
2.671875
3
[ "MIT" ]
permissive
require 'authorizenet_rest' require 'json' require '../config.rb' def createAWebhook() # object creation for WebhooksApi class api_instance = AuthorizeNetRest::WebhooksApi.new # object creation for external config class commonObj = AuthorizeNetRestConfiguration::Common.new authorisation = commonO...
true
723877817b80af99b530ab2ae22f3e43f1a2f5f5
Ruby
dharmjeetkr/Api_app
/app/models/todo.rb
UTF-8
1,039
2.609375
3
[]
no_license
class Todo < ApplicationRecord has_many :items, dependent: :destroy validates_presence_of :title, :created_by Results1="Results" #def self.params() # "hello worlds, india, america" #end def self.ody(title) #logger.info "#{title[:title].inspect}----------------" od1 = Ody...
true
64cae3bfc291cec6cdbe0f7117177655843a994f
Ruby
mobius-network/mobius-tipbot-ruby
/tip_bot/tipped_message.rb
UTF-8
1,827
2.71875
3
[]
no_license
# Saves stats for tipped message class TipBot::TippedMessage extend Dry::Initializer # @!method initialize # @param message [Telegram::Bot::Types::Message] Telegram message object # @!scope instance param :message # Returns overall tips sum in currency for the message # @return [Float] tips sum def ba...
true
54b8236c4fdb0829e0c6e005f1bf74cf1cf8821c
Ruby
pbc/poker-test
/lib/poker_game/game_engine.rb
UTF-8
655
3.078125
3
[]
no_license
module PokerGame class GameEngine def sort_hands_by_rank(poker_hands) collections = collection_factory.split_into_collections(poker_hands) collections.each do |collection| collection.sort! end collections.sort do |collection_x,collection_y| collection_x <=> collection_y ...
true
190a4392698a3f6de812e35ab7535333e4c120b2
Ruby
ramikhalaf/Ruby
/song-list.rb
UTF-8
1,004
3.953125
4
[]
no_license
class SongList def initialize @songs = Array.new end def append(aSong) @songs.push(aSong) self end def deleteFirst @songs.shift end def deleteLast @songs.pop end def [](key) return @songs[key] if key.kind_of?(Integer) return @songs.find { |aSong| aSong.name == key } end end class Song d...
true
86c994448c62d5f6654acdc6bc8a412909447a69
Ruby
barrywilso/Project-Gameshop
/models/customer.rb
UTF-8
1,298
3.296875
3
[]
no_license
require_relative("../db/sql_runner") class Customer attr_reader :id attr_accessor :first_name, :last_name def initialize(customer) @id = customer['id'].to_i() if customer['id'] @first_name = customer['first_name'] @last_name = customer['last_name'] end def save() sql = "INSERT INTO custom...
true
10018a7cfc73679c74a6e51b9242c67913ff0da6
Ruby
Njunu-sk/Ruby
/Test/obj.rb
UTF-8
96
3.40625
3
[]
no_license
obj = Object.new def obj.talk puts "Iam an object" puts "Simon is my name" end obj.talk
true
e7516f2bcf1b04ffa722d69e6c7fa2be15a1f154
Ruby
IceDragon200/mruby-nanovg
/docstub/paint.rb
UTF-8
766
2.796875
3
[]
no_license
module Nanovg # A pattern or painting object class Paint # @!attribute xform # @return [Transform] attr_accessor :xform # @!attribute extent # @return [Array<Float>] 2 floats defining the extent attr_accessor :extent # @!attribute radius # @return [Float] attr_accessor :r...
true
23fd794969055d077268710882aa6aef72a27215
Ruby
adinsley/Festival_project
/app/models/performance.rb
UTF-8
2,166
2.75
3
[]
no_license
class Performance < ActiveRecord::Base has_many :users, through: :bookings has_many :bookings, dependent: :destroy belongs_to :genre belongs_to :show belongs_to :venue scope :venue_check, -> (v_id){where("venue_id == ?", v_id)} scope :finish_after, -> (start){where("finish > ?", start)} scope :start_b...
true
9e03f37892a0b994d7c10c5452e8849c9b81bb4f
Ruby
chess1424/Programming_contests
/Hacker_rank/Strings/anagram.rb
UTF-8
409
3.359375
3
[]
no_license
t = gets.chomp.to_i t.times do hash = Array.new(26,0); ans = 0; str = gets.chomp if str.length.odd? puts "-1" else for i in str.length / 2 .. str.length-1 hash[str[i].ord - 'a'.ord] += 1 end for i in 0 .. str.length/2 - 1 if hash[str[i].ord - 'a'.ord] == 0 ans += 1 ...
true
6efd030bd05117f710b665464ab440d0f5fd72d2
Ruby
scottdensmore/WoWUpdater
/Addon.rb
UTF-8
964
2.78125
3
[]
no_license
require 'pathname' class Addon attr_accessor :name, :remote_version, :url, :dependencies @local_version = nil @@addons_folder = nil VER_FILE_NAME = "current.ver" def initialize @dependencies = Array.new end def Addon.addons_folder=(value) @@addons_folder = value end def Addon.ad...
true
48fa10635c38e6983554c42106d522f113241ab7
Ruby
yamiacat/matt-n-charlie-WIZARDS
/models/house.rb
UTF-8
874
3.3125
3
[]
no_license
require_relative("../db/sql_runner.rb") class House attr_reader :id, :house_name, :logo def initialize(params) @id = params['id'].to_i @house_name = params['house_name'] @logo = params['logo'] end def save() sql = "INSERT INTO houses (house_name, logo) VALUES ('#{@house_name}', '#{@logo}' )...
true
ef1ee87751c2a3895dafc9da7abbee4cad4aae9e
Ruby
JoseyKinnaman/leetspeak
/spec/leetspeak_spec.rb
UTF-8
826
3.34375
3
[ "MIT" ]
permissive
require ('rspec') require ('leetspeak') describe ('String#leetspeak') do it('replaces every "e" or "E" in a string with a "3"') do expect('beE'.leetspeak).to(eq('b33')) end it('replaces every "o" or "O" in a string with a "0"') do expect('Oops'.leetspeak).to(eq('00pz')) end it('replaces every "I" in...
true
db135fbd911d7f812356c95bd895c9b4cd2cba9d
Ruby
gitkseniya/garage_2102
/test/owner_test.rb
UTF-8
1,116
3.296875
3
[]
no_license
require_relative 'test_helper' class OwnerTest < Minitest::Test def setup @owner_1 = Owner.new('Regina George', 'Heiress') @car_1 = Car.new({description: 'Green Ford Mustang', year: '1967'}) @car_2 = Car.new({description: 'Silver BMW 3-Series', year: 2001}) @car_3 = Car.new({description: 'Red Chevr...
true
96b3257937d2ae6677d9a37229a070f110e15cfc
Ruby
Salaizrm/prime-ruby-onl01-seng-pt-012220
/prime.rb
UTF-8
118
3.375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def prime?(num) if num > 1 (2..num-1).none? {|prime| num % prime == 0} else false end end
true
70d7337517294ae8b9f77dd123943f322fba09ad
Ruby
taurusismysign/iotmicroservices
/app/sync/sync_data.rb
UTF-8
549
2.546875
3
[]
no_license
require 'httparty' class SyncData def self.follow @experts = Expert.limit(10) t = TwitterSync.new t.Follow(@experts) end def self.process #DEVELOPER NOTE: #Get all the tweets. Later on we could horizontally split it #to scale by pulling experts based on certain filter criteria #...
true
20a14b9f4735d6c862d834df9d3f33bc14a1c391
Ruby
NiranjanSarade/ruby_gunner_client
/player_state.rb
UTF-8
561
3.09375
3
[]
no_license
require File.expand_path('../orientation', __FILE__) class PlayerState attr_accessor :name, :x, :y, :orientation, :weaponOrientation, :energy def initialize(name="", x=0.0, y=0.0, orientation=0.0, weaponOrientation=0.0, energy=0.0) @name = name @x = x @y = y @orientation = Orien...
true
df37cfb30b956902e7bc1e6920316612b26c8e56
Ruby
beachio/hammer-gem
/test/hammer/unit/cacher_test.rb
UTF-8
2,752
2.6875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require '../test_helper' unless defined?(Hammer) require 'rake' require 'tmpdir' require 'hammer' require 'hammer/cacher' # A cacher object for a Hammer project. # Takes project-wide dependencies, and wildcard dependnecies # Dependencies: # {'index.html' => ['about.html']} # Wildcard Dependencie...
true
21c910b2606ad95de252477f1306a2be0311fcb4
Ruby
Lightspeed-Systems/clever-ruby
/lib/clever-ruby/api_operations/list.rb
UTF-8
4,988
3.0625
3
[ "Apache-2.0", "MIT" ]
permissive
module Clever # API Operations module APIOperations # A list of API resource instances module List # Class methods for those that include List # @api public module ClassMethods # Get all elements of a resource # @api public # @deprecated This can be costly since it ...
true
64f663cb5993c034fba2a9012ee376e81c4ad4c7
Ruby
KeenanJones1/Lectio-Victoria-v1
/test/models/user_test.rb
UTF-8
858
2.53125
3
[]
no_license
require 'test_helper' class UserTest < ActiveSupport::TestCase def setup @user = users(:valid) end test 'valid user' do assert @user.valid?, "Please check user requirements" end test 'invalid without name' do @user.name = nil # refute - Fails if test is a true value refute @user.valid...
true
df46ab76d692e7e2a92d9feb40f5fda626131ba1
Ruby
RubyCamp/rc2012w_g1
/scenes/stages/characters/simplemove.rb
SHIFT_JIS
1,020
3.0625
3
[]
no_license
require_relative "character" require "dxruby" require "dxrubyex" module SimpleMove #def self.included(base); puts "#{base}.included #{self}" end def move #puts "move" super if @mvstt == :hide && rand < 0.01 #Μ’lς邱ƂŏoΟ‚ @mvstt = :out @mvtimes = @speed end if @mvstt == :out @mv ...
true
dca79aa4abdc075eb69995aa6bcabe1996ca6064
Ruby
fuchsto/aurita
/lib/aurita/base/bits/time_ago.rb
UTF-8
1,971
3.421875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# options # :start_date, sets the time to measure against, defaults to now # :later, changes the adjective and measures time forward # :round, sets the unit of measure 1 = seconds, 2 = minutes, 3 hours, 4 days, 5 weeks, 6 months, 7 years (yuck!) # :max_seconds, sets the maximimum practical number of seconds before just...
true
98787ac07c1a21487fd1a95647910725cd02b6f4
Ruby
Tonyjlum/nyc-pigeon-organizer-nyc-web-111918
/nyc_pigeon_organizer.rb
UTF-8
381
2.90625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def nyc_pigeon_organizer(data) # write your code here! pigeon_list = {} data.each do |key1, value1| value1.each do |key2, names| names.each do |name| pigeon_list[name] = {} if pigeon_list[name].nil? pigeon_list[name][key1] = [] if pigeon_list[name][key1].nil? pigeon_list[name][ke...
true
3621cb541fc522d6e2b55f2c76c82eb42e7499a3
Ruby
miriamtocino/miritosar
/app/models/company.rb
UTF-8
626
2.578125
3
[]
no_license
class Company < ActiveRecord::Base validates :name, :founded_in, :website, presence: true validates :description, length: { minimum: 25 } validates :staff, numericality: { greater_than: 0 } validates :logo, allow_blank: true, format: { with: /\w+.(gif|jpg|png)\z/i, message: "must reference a GIF, JPG...
true
3575a050628aa715704b774b24122b8ba086d2eb
Ruby
paultag/ocd-division-ids
/scripts/country-ca/ca_census_divisions.rb
UTF-8
1,473
2.71875
3
[]
no_license
#!/usr/bin/env ruby # coding: utf-8 require File.expand_path(File.join("..", "utils.rb"), __FILE__) # Scrapes census division codes and names from statcan.gc.ca class CensusDivisions < Runner def names type_names = census_division_type_names # @see http://www12.statcan.gc.ca/census-recensement/2011/dp-pd/...
true
0db882d19b45ca09cd38f35ce891077d344e0a9d
Ruby
gabrielalewandowska/functions-paired-lab
/ruby_functions_practice.rb
UTF-8
962
3.84375
4
[]
no_license
def return_10() return 10 end def add(number1, number2) return number1 + number2 end def subtract(num1, num2) return num1 - num2 end def multiply(num1, num2) return num1 * num2 end def divide(num1, num2) return num1 / num2 end def length_of_string(string) return string.length end def join_string (str...
true
20d131ff099718eb8608f3db43432497399508d5
Ruby
toshiemon18/tnct_classchange_line_bot
/lib/helper.rb
UTF-8
1,030
2.640625
3
[]
no_license
module TmNCTClassChangeLINEBOT class Helper CLASS_NAME_LIST = { "1εΉ΄1η΅„" => ["1-1"], "1εΉ΄2η΅„" => ["1-2"], "1εΉ΄3η΅„" => ["1-3"], "1εΉ΄4η΅„" => ["1-4"], "1εΉ΄5η΅„" => ["1-5"] } def initialize @yaml = YAML.load_file("./config/app.yml") end def line_client client = TmNCTClassChangeLINEBOT::...
true
fd9b607beb6c41f3532c950b0a86aafaea276bc9
Ruby
brianpattison/ingredients
/app/models/recipe.rb
UTF-8
398
2.90625
3
[]
no_license
class Recipe < ActiveRecord::Base has_many :used_ingredients has_many :ingredients, :through => :used_ingredients validates_presence_of :name, :yield validates_numericality_of :yield def cost cost = 0 self.used_ingredients.each do |used_ingredient| cost += used_ingredient.cost end ...
true
2b03972e2078fde14ae179e867675c4438f9d808
Ruby
mglazner/Homework
/HW8.rb
UTF-8
622
3.96875
4
[]
no_license
# Update this program to keep a running tally of the same stats we were # puts'ing in babylibrary v1. # # > A string here # > Another string here # > exit # A # string # here # Another # string # here # # EXTRA CREDIT! Rather than tallying up the strings, instead process each # string and hold onto another ...
true
22d1c417e5d57447ba65c561b0877b0fbe4d0e52
Ruby
asdFletcher/data-structures-and-algorithms
/src/code-challenges/leetcode/easy/range-sum-bst.rb
UTF-8
1,324
4.21875
4
[ "MIT" ]
permissive
# Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive). # The binary search tree is guaranteed to have unique values. # Input: root = [10,5,15,3,7,null,18], L = 7, R = 15 # Output: 32 # Input: root = [10,5,15,3,7,13,18,1,null,6], L = 6, R = 10 # Out...
true
025167b2ae268f1466e6e38501f9c266d5cf1fc9
Ruby
AJDot/Launch_School_Files
/Exercises/Small_Problems_101-109/easy_3/palindromic_strings_part_2.rb
UTF-8
1,914
4.46875
4
[]
no_license
# palindromic_string_part_2.rb #Understand the problem # - same as part 1 but now case-insensitive and ignore all non-alphanumeric # - characters. May call palindrome? from part 1 # - Input: string # - Output: boolean based on real_palindrome # #Examples / Test Cases # real_palindrome?('madam') == true # real_pa...
true
f1e4379d43b648f69b923d97c40d7089b8414d7f
Ruby
jamiemonserrate/sales_tax
/lib/sales_tax.rb
UTF-8
595
3.171875
3
[]
no_license
require 'yaml' class SalesTax SALES_TAX_RATE = 0.1 def initialize(product) @product = product end def amount return 0 if is_exempt? round @product.price_before_tax * SALES_TAX_RATE end private def is_exempt? exempt_products.any? {|exempt_product| @product.name.include?(exempt_product)}...
true
5d39fa571bd4c6983cbd9cce2170a49ad227ebc6
Ruby
yuan-xy/smally
/c-sky/inst32-16/test2.rb
UTF-8
415
2.71875
3
[]
no_license
lines = [] File.open("16.txt").each_line do |line| lines << line end (1..100).each {|x| lines << "" } puts lines.size count=0 File.open("32.txt").each_line do |line| puts "#{count}: #{line.split[0]} ~ #{lines[count].split[0]}" lines.insert(count," \r\n") if line.split[0] != lines[count].split[0] count...
true
60cecf5cd2c7fb41a8e819431d7613c72f223f56
Ruby
chetna1726/vinsol_campus_hiring
/app/models/response.rb
UTF-8
1,567
2.578125
3
[]
no_license
class Response < ActiveRecord::Base auto_strip_attributes :answer, squish: true belongs_to :user belongs_to :quiz belongs_to :question belongs_to :option validates :user_id, uniqueness: { :scope => [:quiz_id, :question_id], message: "cannot take quiz more than once"} validates :question_id, uniqueness:...
true
96e4a309426894c7a4f480f8ef0fd40b2ec404b6
Ruby
rubyworks/realms
/work/reference/environment.rb
UTF-8
15,731
2.625
3
[ "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
permissive
require 'time' require 'roll/core_ext/rbconfig' require 'roll/core_ext/hash' require 'roll/xdg' class Library # An ... represents a set of libraries to be served by Rolls. # class Environment include Enumerable # Instantiate environment given +name+ or file. def initialize(file=nil) @file = ...
true
a83b8d74f8be4accc045f276f189075093e831e6
Ruby
legoabram/OpenSplitTime
/app/services/interactors/errors.rb
UTF-8
1,761
2.53125
3
[ "MIT" ]
permissive
module Interactors module Errors def resource_error_object(record) {title: "#{record.class} #{record} could not be saved", detail: {attributes: record.attributes.compact, messages: record.errors.full_messages}} end def active_record_error(exception) {title: 'An ActiveRecord exception o...
true
dcbf1d8f1a3bda9ce44d41190c4c2e86381c1d71
Ruby
seannam/codecademy
/movies.rb
UTF-8
1,349
3.265625
3
[]
no_license
movies = { avatar: 4, inception: 4, horeee: 1 } done = false while (!done) puts "What would you like to do?" choice = gets.chomp case choice when "add" puts "What movie do you want to add?" title = gets.chomp title = title.to_sym if movies[title.to_sym] == nil pu...
true
555da56e710be80e7bd9b76236579e58c4d3b065
Ruby
itggot-elias-stenhede/yardoc-sinatra-guide
/app.rb
UTF-8
3,086
2.609375
3
[]
no_license
require_relative 'model/model.rb' require 'sinatra' require 'slim' enable :sessions include Model # Wat dis? # Display Landing Page # get('/') do slim(:index) end # Displays search result based on search parameters # # @param [String] query_string, The search parameters delimited by spaces get('/articles/search...
true
b9c299daae65732b95af7ff7a30bd81912d643f5
Ruby
theowright2017/Sinatra-web-app-rock-paper-scissors-homework
/specs/game_spec.rb
UTF-8
705
3.015625
3
[]
no_license
require 'minitest/autorun' require_relative '../models/game.rb' class TestGame < Minitest::Test def setup() @game = Game.new("rock", "scissors") @game1 = Game.new("paper", "scissors") @game2 = Game.new("paper", "paper") end # def test_hand1_wins() assert_equal("Hand 1 wins with rock", @game.w...
true
b65adf24e4492ccb0bd69d50040b62e7fd5902c8
Ruby
natalieweesh/ice-cream-finder
/ice_cream_finder.rb
UTF-8
2,552
3.203125
3
[]
no_license
require 'rest-client' require 'json' require 'addressable/uri' require 'addressable/template' require 'nokogiri' require 'sanitize' class QueryProcessor def self.validate(name, value) return !!(value =~ /^[\w ]+$/) if name == "query" return true end def self.transform(name, value) return value.gsub(...
true
8d602550ee7b37e45c14870177300df47abaab0a
Ruby
seanjams/AAhomework
/w1d3/lib/recursion_project.rb
UTF-8
2,557
3.609375
4
[]
no_license
require 'byebug' def merge_sort(arr) return [arr[0]] if arr.length == 1 idx = arr.length/2 halves = [arr[0...idx], arr[idx..-1]] result = [] halves.each do |half| result << merge_sort(half) end merge(result) end def merge(pair) result = [] if pair.all? { |arr| arr == arr.flatten } until pair...
true
f6e41a9cd5a6d46db303b3394798b3cd5c5b6bf3
Ruby
aleknak/guesser
/lib/guesser/player.rb
UTF-8
142
2.8125
3
[ "Beerware" ]
permissive
module Guesser class Player attr_accessor :player_name def initialize(name = 'John Doe') @player_name = name end end end
true
dfe728daac84eae8a22549c258d5abd6683de0b6
Ruby
sh0kunin/find-like
/lib/find_like/utils/util.rb
UTF-8
965
2.765625
3
[ "MIT" ]
permissive
# frozen_string_literal: true module FindLike # Util class for any utilities in FindLike class Util class << self # Maps `arguments` in parallel and performs a block on each. # @param arguments [Array<Argument>] A list of arguments # @yieldparam argument [Argument] Argument from `arguments` p...
true
7cf141668224a303ca1577acc12caf491308fc76
Ruby
Samkttn/ruby-thp
/exo_13.rb
UTF-8
147
3.15625
3
[]
no_license
puts "Ton annΓ©e de naissance ? :" number = gets.to_i nombre = number number = 2018 - nombre number.times do nombre += 1 puts nombre.to_s end
true
26889cc9c7e71db22e4f27eee0f73330a07c213d
Ruby
aungaungNMK/ruby_learning_for_gold
/chapter 9 Ruby Platform/enumerators_and_iterators.rb
UTF-8
713
3.015625
3
[]
no_license
#Enumerable::Enumerator, print e = [1..10].to_enum print e = "test".enum_for(:each_byte) print e = "test".each_byte puts #IF repeated application are possible, you can start and external iterator before StorIteration has been raised bu calling rewind print "Ruby".each_char.max puts iter = "Ruby".each_char #...
true
45ac2436c12d0ea806d7b36e954e698523f5769d
Ruby
ashleyjbland/knitting_patterns
/lib/knitting_patterns/category.rb
UTF-8
437
2.640625
3
[ "MIT" ]
permissive
class KnittingPatterns::Category attr_accessor :title, :patterns @@all = [] def initialize @patterns = [] end def self.all @@all end def save @@all << self end #def patterns # KnittingPatterns::Pattern.all.keep_if {|pattern| pattern.category == self} #end def self.pattern_count...
true
104bf4203198e3bd8daf175b5f9fb083b44af1e7
Ruby
logaan/clojure-workshop
/ruby-examples/multiples.rb
UTF-8
889
4.375
4
[ "MIT" ]
permissive
# Multiples of 3 and 5 # # If we list all the natural numbers below 10 that are multiples of 3 or 5, we # get 3, 5, 6 and 9. The sum of these multiples is 23. # # Find the sum of all the multiples of 3 or 5 below 1000. # # ANSWER: 233168 counter = 1 sum = 0 while counter < 10 if counter % 3 == 0 || counter % 5 == 0...
true
66eaa6897f20e47e6256992f8b523bcbb4d521a0
Ruby
jessemcready/OO-Auto-Shop-nyc-web-080618
/app/models/mechanic.rb
UTF-8
785
3.4375
3
[]
no_license
class Mechanic attr_reader :name, :specialty @@all = [] def initialize(name, specialty) @name = name @specialty = specialty @@all << self end # initialize def self.all @@all end # self.all def self.car_owners(mechanic) cars = Car.all.select do |car| car.mechanic == mechanic ...
true
a5735a7b9102946be0af4f9b6127118dda30b6bc
Ruby
chaione/hue-jenkins
/hue.rb
UTF-8
1,300
2.5625
3
[ "MIT" ]
permissive
require 'rubygems' require 'bundler/setup' Bundler.require require 'open-uri' require 'json' if ENV['JENKINS_URL'].nil? raise "This script requires the JENKINS_URL env var to be defined." end light_index = ENV['HUE_LIGHT_INDEX'].nil? ? 0 : ENV['HUE_LIGHT_INDEX'].to_i jenkins_url = ENV['JENKINS_URL'] + "/api/json" p...
true
967264571b9f66b01519a7586fffa4670434be9d
Ruby
alexeybokov/binary_tree
/index.rb
UTF-8
1,297
3.953125
4
[]
no_license
require_relative 'navigation' require_relative 'node' require_relative 'binary_tree' @current_tree = BinaryTree.new(0) loop do puts '___________________________________________________' puts 'Allowed commands:' puts ' 1 - Create binary-tree' puts ' 2 - Add new item' puts ' 3 - Remove item ( its del...
true
412ce63da56fd608ae209cd178012cd609ad774c
Ruby
patrickwhardy/enigma
/lib/rotation.rb
UTF-8
1,286
3.296875
3
[]
no_license
require 'pry' require 'Date' class Rotation attr_reader :a, :b, :c, :d, :a_offset, :b_offset, :c_offset, :d_offset attr_accessor :offset_array, :key, :today def initialize(key='') @key = key #'12345' - use when hard-coding for test @today = '' end def setup # generate_key # date_format k...
true
1f35c53d3599b552d02f15ca039c449ecbc89092
Ruby
srwatlanta/algorithms
/exercises/cutthesticks.rb
UTF-8
130
3.140625
3
[]
no_license
def cutTheSticks(arr) lengths = [] while arr.length > 0 lengths << arr.length arr.delete(arr.min) end lengths end
true
49f33b4c2af235322e67c5fba1d25e11276e5c1c
Ruby
s-dney/sid-arthur-module1
/functions/view_list.rb
UTF-8
1,290
3.109375
3
[ "MIT" ]
permissive
require_relative '../config/environment' require 'pry' def view_list(selected, sortstring) system("clear") sleep(0.2) display_table(selected, sortstring) # $prompt.ask('') $prompt.select("What do you want to do?") do |menu| menu.choice "Sort list", -> {choose_sort(selected)} ...
true
40aaea6658d262929d425667f5a0fa065b7306b4
Ruby
dnnp2011/tdd-rspec-bootcamp
/current_age_for_birth_year.rb
UTF-8
93
2.890625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def current_age_for_birth_year(birth_year) return Time.now.year.to_i - birth_year.to_i; end
true
dde7cc8c814887a649dea836daa8f090984363b1
Ruby
danie16arrido/week03_day05_homework
/db/console.rb
UTF-8
1,847
3.03125
3
[]
no_license
require('pry-byebug') require_relative('../models/film.rb') require_relative('../models/customer.rb') require_relative('../models/ticket.rb') require_relative('../models/screening.rb') require_relative('../db/sql_runner.rb') customer1 = Customer.new({"name" => "Daniel", 'funds' => 100.2}) customer2 = Customer.new({"n...
true
50df5a1e8fdc952696ebaf443ce583d6d53d921c
Ruby
reneenordholm/ruby-music-library-cli-online-web-pt-041519
/lib/artist.rb
UTF-8
773
3.203125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Artist extend Concerns::Findable attr_accessor :name @@all = [] def initialize(name) @name = name @songs = [] end def self.all @@all end def self.destroy_all @@all.clear end def save @@all << self end def self.create(artist) created_artist = Artist.new(artist...
true
c5bc25fd39971c92ab2a983720f7bd7bd35c622e
Ruby
macbury/detox
/app/services/extract/image_details.rb
UTF-8
816
2.546875
3
[]
no_license
module Extract # Fetch size details from image url class ImageDetails < Service def initialize(image_url) @image_url = image_url end def call return unless image_url PosterMetaData.new( url: image_url, width: size[0], height: size[1], resolution: size[...
true
35672e1ebca99ccde22021808a9b06902e18cc17
Ruby
AdamClemons/sql-table-relations-crowdfunding-join-table-lab
/lib/sql_queries.rb
UTF-8
1,143
3.203125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Write your sql queries in this file in the appropriate method like the example below: # # def select_category_from_projects # "SELECT category FROM projects;" # end # Make sure each ruby method returns a string containing a valid SQL statement. def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabe...
true
42a2d727bbe9471b32fa313cd514dd059faeb7d4
Ruby
taiyoslime/procon
/atcoder/031_A.rb
UTF-8
56
2.859375
3
[]
no_license
a,b = gets.split.map(&:to_i) puts (a>b)?a*(b+1):(a+1)*b
true
a217bfcdae4acba2a90a587c5c14d018651e2ad0
Ruby
mkeshita/scratchpad
/lib/scratchpad/common/hash_tree_cache_driver.rb
UTF-8
6,678
3.015625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require 'set' # :nodoc: namespace module Scratchpad # Manages a HashTreeCache. class HashTreeCacheDriver # Creates a new cache driver. # # Args: # hash_tree:: the hash tree being cached # cache_capacity:: the number of lines in the cache def initialize(hash_tree, cache_capacity) @tree = hash_tree ...
true
edcaddfc80c4efd5c0d0afd7dfb56600e214f067
Ruby
Pandenok/ruby_rspec_TOP
/spec/14_find_number_spec.rb
UTF-8
8,518
3.703125
4
[]
no_license
# frozen_string_literal: true require_relative '../lib/14_find_number' # The file order to complete this lesson: # 1. Familarize yourself with the initialize method in lib/14_find_number.rb # 2. Start reading spec/14_find_number_spec.rb, which will also include # instructions to add methods to lib/14_find_number.r...
true
92643b267deaf4467f4333d466aee07f0251027f
Ruby
nrser/yard-link_stdlib
/lib/yard/cli/link_stdlib/search.rb
UTF-8
3,632
2.828125
3
[ "BSD-3-Clause", "MIT" ]
permissive
# encoding: UTF-8 # frozen_string_literal: true # Requirements # ======================================================================= ### Stdlib ### require 'optparse' ### Deps ### # We need {YARD::CLI::Command} require 'yard' ### Project / Package ### require_relative './command_helper' # Namespace # =====...
true
b1955df75169d504956b3f6e87972291ed4946bc
Ruby
eliellds/nivelamento-aluno
/14-exercicio.rb
UTF-8
3,065
3.890625
4
[]
no_license
def exibe_array(array) for n in (0..array.size-1) print array[n] if n < array.size-1 print "," end end puts end def existe_no_array(array, elemento) for conferir in (0..array.size-1) if array[conferir] == elemento return true end end ...
true
2e5d8f3c7c1c57df8201c10d7786be700e1fd0a9
Ruby
climber2002/dcstore
/spec/models/csv_importer_spec.rb
UTF-8
2,012
2.578125
3
[]
no_license
require 'spec_helper' describe CsvImporter do context "import" do it "should be able to import categories from a local file" do category_names = ['Cameras', 'WhiteGoods', 'Audio', 'Computers and Tablets'] category_names.each do |category_name| expect(Category.find_by(name: category_name)).to...
true
dcc9a3c456e5a76458ee909d552d2c7c12090038
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/filtered-submissions/7aaef901a1de4a74a5b132f53c94cb72.rb
UTF-8
244
3.203125
3
[]
no_license
def compute(s1, s2) hamming_count = 0 s1_a = s1.split(//) s2_a = s2.split(//) s1_a.each_with_index do |item, index| if item != s2_a[index] hamming_count = hamming_count+1 end end hamming_count end
true
ad5ab501e85a69aaf1b1b950999713d136ff8cb1
Ruby
ryanduchin/Various-Projects
/SQL-Projects/w3d2_QuestionsDatabase/QuestionLike.rb
UTF-8
2,481
2.65625
3
[]
no_license
class QuestionLike attr_accessor :id, :liked, :user_id, :question_id def initialize(options = {}) @id = options['id'] @liked = options['liked'] @user_id = options['user_id'] @question_id = options['question_id'] end def self.all results = QuestionsDatabase.instance.execute('SELECT * FROM ...
true
51d4605d3d540e2765776bbf6cd831c7f81d063e
Ruby
curquiza/gegene
/src/gegene.rb
UTF-8
2,486
2.921875
3
[]
no_license
# frozen_string_literal: true require_relative 'current_config' class Gegene def initialize(filename) @filename = filename @current_config = nil @comment_prefix = comment_prefix_value end def fetch_code_samples_in_test_file code_samples = {} File.foreach(@filename) do |line| if gegene...
true
7874a0f30161e393d1a7a6582260b6a7c28cc385
Ruby
richardrice/bookstore_prj
/memcached.rb
UTF-8
735
2.890625
3
[]
no_license
require 'dalli' require_relative './book_in_stock' # options = { :namespace => "app_v1", :compress => true } dc = Dalli::Client.new('localhost:11211') isbn = '1234' book = nil version = dc.get "v_#{isbn}" # Is book 1234 in the cache? if version serial = dc.get "#{version}_#{isbn}" book = BookInStock.from...
true
bbb54b703ae4ef23fb2f1ec5390c3aa5a181e838
Ruby
asaloff/tealeaf-intro-to-programming
/variables/name.rb
UTF-8
275
3.9375
4
[]
no_license
# name.rb # greet user: puts 'What is your first name?' first_name = gets.chomp puts 'What is your last name?' last_name = gets.chomp puts 'Hello ' + first_name + ' ' + last_name + '.' # prints users name 10 times: 10.times do puts first_name + ' ' + last_name end
true
282597f61b8646fbac755d261ea8077223bee6f4
Ruby
antcliffoc/boris_bikes-1
/spec/docking_station_spec.rb
UTF-8
1,565
2.953125
3
[]
no_license
require 'docking_station' describe DockingStation do let (:ds) { DockingStation.new(10, 10) } it { should respond_to(:release_bike)} it { should respond_to(:dock)} it { should respond_to(:bikes)} it "accepts a capacity argument" do expect(ds.capacity).to eq(10) end it "defaults to a capacity of 2...
true
9014b273a6f0a93fb65163f32009e2dd1e067a7f
Ruby
chewieee/the-odin-project
/ruby/cp_chap4.rb
UTF-8
659
4.21875
4
[]
no_license
# Chris Pine Chapter 2 Things to Try # Program that asks for First, Middle, Last name and greets user # If statement to handle no middle name puts "Hi, what's your first name?" first = gets.chomp puts "Do you have a middle name?" middle = gets.chomp puts "And finally, your last name?" last = gets.chomp if ["no", ...
true
1951aa91727f8235abafa64ba19f047a4d373a4c
Ruby
beniutek/online_voting
/administrator/test.rb
UTF-8
2,571
2.921875
3
[]
no_license
def foo message = "hello world!" vkey = OpenSSL::PKey::RSA.new(512) akey = OpenSSL::PKey::RSA.new(512) rsa = OnlineVoting::RSABlindSigner.new # msg = OpenSSL::Digest::SHA224.hexdigest(message) cipher = OpenSSL::Cipher::AES256.new :CBC cipher.encrypt iv = cipher.random_iv key = SecureRandom.hex(16) ...
true
fffaf2a4e0adcfa0f85348f61923e49aaa883ec7
Ruby
tensins/uw_sfinder
/app/helpers/rooms_helper.rb
UTF-8
2,505
3.390625
3
[]
no_license
module RoomsHelper # gets all buildings # returns the building def get_buildings() # gets all the buildings used for classes / tutorials building_names = Room.select("building").distinct.order("building ASC") return building_names end # gets rooms for building # returns the room names as well as a bool a...
true
0de18be36365a3dc7b17846162ca1c95050d3646
Ruby
hookbil/ruby_learning
/lesson_1/right_triangle.rb
UTF-8
535
3.640625
4
[]
no_license
print "Π’Π²Π΅Π΄ΠΈΡ‚Π΅ a: " a = gets.chomp.to_f print "Π’Π²Π΅Π΄ΠΈΡ‚Π΅ b: " b = gets.chomp.to_f print "Π’Π²Π΅Π΄ΠΈΡ‚Π΅ c: " c = gets.chomp.to_f teorema = a**2 + b**2 == c**2 if teorema == true puts "Π’Ρ€Π΅ΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊ ΠΏΡ€ΡΠΌΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½Ρ‹ΠΉ" else puts "Π’Ρ€Π΅ΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊ Π½Π΅ ΠΏΡ€ΡΠΌΠΎΡƒΠ³ΠΎΠ»ΡŒΠ½Ρ‹ΠΉ" end if a == b && b == c puts "Π’Ρ€Π΅ΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊ равносторонний ΠΈ Ρ€Π°Π²Π½ΠΎΠ±Π΅Π΄Ρ€...
true
2f1098e53cda026696e8ce25cc1057b2cbf07461
Ruby
dynomatix/errbit-client-ios
/app/host_settings_store.rb
UTF-8
2,121
2.578125
3
[]
no_license
class HostSettingsStore def self.shared # Our store is a singleton object. @shared ||= HostSettingsStore.new end def hosts @hosts ||= begin # Fetch all hosts from the model, sorting by the creation date. request = NSFetchRequest.alloc.init request.entity = NSEntityDescription.entity...
true
79851f6f8e1b76c68bdd0485724a42e89944e43a
Ruby
Sigurami97/knight_travails
/lib/vertices.rb
UTF-8
134
2.625
3
[]
no_license
Vertices = Struct.new(:x, :y, :parent) do attr_accessor :coordinates def coordinates @coordinates = [self.x, self.y] end end
true
f6f08c2d85d7b1ac301e1edeab68db776a276f72
Ruby
djberg96/net-tnsping
/examples/example_tnsping.rb
UTF-8
661
2.546875
3
[ "LicenseRef-scancode-warranty-disclaimer", "Artistic-2.0" ]
permissive
####################################################################### # example_tnsping.rb # # Simple test script. Not required for installation. Modify as you see # fit. You can run this program via the 'example' rake task. ####################################################################### require "net/tnsping"...
true
96e236dd0b0a5237e4bfd56b790c249551ef56ac
Ruby
372groupproject/milestones-team14-makaylaworden-jcollins1
/code/p4_small_program.ruby
UTF-8
1,688
3.96875
4
[]
no_license
# Jensen Collins, Makyala Worden # jcollins1, makaylaworden # CSC372, Collberg # p4_small_program.ruby # This file is the small snippet of code for Milestone 4 that shows # off some of the uniqueness with Ruby and dividing code within a # file. This short program computes and shows the average grades # amound s...
true
baaacffe937b5feada3c6da6d8a8e6775ad76654
Ruby
Dcrame31/ruby-music-library-cli-onl01-seng-ft-032320
/lib/001_song_basics.rb
UTF-8
1,290
3.03125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Song attr_accessor :name, :artist, :genre @@all=[] def initialize(name, artist= nil, genre= nil) @name= name self.artist = artist if artist self.genre = genre if genre end def self.all @@all end def self.destroy_all self.all.clear end def save @@all << self ...
true