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
cff32c299177cd468ec8524f4f9a5d35c0526f7a
Ruby
petdud/rspec-temp-iot
/app/models/device.rb
UTF-8
795
2.609375
3
[]
no_license
class Device < ActiveRecord::Base default_scope { order('id DESC') } def name=(value) raise ArgumentError unless value.is_a?(String) raise ArgumentError unless value.size >= 4 && value.size <= 16 super end def address=(value) raise ArgumentError unless value.is_a?(String) raise ArgumentEr...
true
c0e73dbc20be332eca0a61fdfc4eb49c14e34c1e
Ruby
undeadlabs/wukong
/examples/munging/wikipedia/articles/wp2txt_utils.rb
UTF-8
13,882
2.765625
3
[ "Apache-2.0", "MIT" ]
permissive
#!/usr/bin/env ruby # -*- coding: utf-8 -*- # Taken from Yoichiro Yohasebe's [`wp2txt` project](https://github.com/yohasebe/wp2txt) # with liberal modifications for our purposes. # # This software is distributed under the MIT License. Please see the `./wp2txt-LICENSE.txt` file. require 'strscan' require 'fin...
true
d30c5fc62871d874e579cd48b0a01c9239401031
Ruby
sanpak/student-course
/lib/student.rb
UTF-8
747
3.328125
3
[]
no_license
require_relative 'course' class Student attr_accessor :first_name, :last_name def initialize(first_name,last_name) @courses = [] @first_name = first_name @last_name = last_name end def name "#{@first_name} #{@last_name}" end def enroll(new_course) conflicts = @courses.select { |course...
true
c5b1717174f806a44cd10c43b4b1987b6f5ab2f1
Ruby
bhartiRA/regex-lab-v-000
/lib/regex_lab.rb
UTF-8
953
3.09375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def starts_with_a_vowel?(word) if word.match(/^[aeiouAEIOU]/) return true else false end end words_string = "unassuming ambiguous understanding pomp circumstance uninteresting uncompromising grouchy corollary" def words_starting_with_un_and_ending_with_ing(text) puts "The rain in Spain lies mainly in the plain".sc...
true
10892342afe836cbbb766c09f6183f1c14317695
Ruby
pablo-meier/advent-of-code
/day4/part2.rb
UTF-8
1,756
3.9375
4
[]
no_license
CHAR_MAP = { "A" => 1, "B" => 2, "C" => 3, "D" => 4, "E" => 5, "F" => 6, "G" => 7, "H" => 8, "I" => 9, "J" => 10, "K" => 11, "L" => 12, "M" => 13, "N" => 14, "O" => 15, "P" => 16, "Q" => 17, "R" => 18, "S" => 19, "T" => 20, "U" => 21, "V" => 22, "W" => 23, "X" => 24, "Y" => 25, "Z" => 0 } NUM_MAP = { 1 => "A...
true
04bdb6486f200fdf803293be15b76cb17d48699a
Ruby
rengokantai/psrubyfunda
/cp5/operator.rb
UTF-8
651
3.765625
4
[]
no_license
class Operator attr_reader :name attr_reader :speed def initialize(name) @name = name @speed = 0 @c =[] @v = Hash.new{[]} end def [](type) @v[type] end def []=(type,ve) @v[type]=ve end def << (c) @c<<c end def <=> (other) name <=>other.name end def +@ ...
true
3fd2361b9dcdc1f21996885ec4f4d3a9e672b3b8
Ruby
surfacedamage/oprahizer
/app/models/animation.rb
UTF-8
1,305
3
3
[]
no_license
require 'RMagick' class Animation include Magick IMAGES_PATH = 'public/images/oprahs.bees.gif/*' ANNOTATED_FRAMES = [1,2,3,4,5,12,13,14,15,50,51,52,53,54,70,71,72,73] MAX_CHARS = 20 attr_reader :text, :frames def initialize(text) @text = text[0..MAX_CHARS] end def self.load_or_creat...
true
6139f408c8770f4805ee3c28194f9bc5ec19c9f4
Ruby
Himanshujainp/Ruby
/Practice Problems/stringCopy.rb
UTF-8
83
2.78125
3
[]
no_license
n = gets.to_i for i in (0...n) for j in (0...i+1) print "a" end puts end
true
04b0e4f431fa3676b0431637d811dd2b4ac2915d
Ruby
iona-b/ruby-exercises
/area_code_dictionary.rb
UTF-8
1,707
3.65625
4
[]
no_license
dial_book = { "newyork" => "212", "newbrunswick" => "732", "edison" => "908", "plainsboro" => "609", "sanfrancisco" => "301", "miami" => "305", "paloalto" => "650", "evanston" => "847", "orlando" => "407", "lancaster" => "717" } system "clear" # Get city names from the hash def get_city_names(dia...
true
e63525e236c840df5a1a0c664e1b8bc35232377f
Ruby
bernardoamc/labs
/ruby/cryptopals/04_set/29.rb
UTF-8
3,172
3.421875
3
[]
no_license
# During every iteration a bunch of operations are performed for a block # of 512 bits and the end result is composed of five 32 bit unsigned integers. # At the last iteration these final five 32 bit unsigned integers are # packed together and encoded as a 40 byte hexadecimal. # # Visually speaking: # # a, b, c, d, e =...
true
7e084b5c1dd07a73c4e14a53e9927d999a624b07
Ruby
penaj1/regex-lab-online-web-pt-041519
/lib/regex_lab.rb
UTF-8
264
2.953125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def starts_with_a_vowel?(word) word.match(/W[aeiou]rd/) end def words_starting_with_un_and_ending_with_ing(text) end def words_five_letters_long(text) end def first_word_capitalized_and_ends_with_punctuation?(text) end def valid_phone_number?(phone) end
true
13acad7c050e662a8e7aa3cb3dc94f68b3cb5627
Ruby
jenimech/moTodo
/app/models/task.rb
UTF-8
405
2.59375
3
[]
no_license
class Task # PROPERTIES = [:title, :done] # PROPERTIES.each {|prop| attr_accessor prop} # def initialize(hash = {}) # hash.each {|key, value| # if PROPERTIES.member? key.to_sym # self.send((key.to_s + "=").to_s, value) # end # } # end include MotionModel::Model include MotionMo...
true
44201d26c01cf2c49e2acc7ae94c12195e4c4865
Ruby
Guga-1994/POO
/variaveis/instancia1.rb
UTF-8
370
3.78125
4
[]
no_license
class User def add(name) @name = name puts "User adicionado" hello end def hello #quando vai printar o valor de uma variavel usando o puts ou #print tem que usar aspas duplas "", senão dá erro puts "Seja bem vindo, #{@name} " end end user = User.new use...
true
b7bead907d9d0f5d998da640f632b15ffc19a4be
Ruby
zendesk/property_sets
/spec/casting_spec.rb
UTF-8
2,311
2.8125
3
[ "Apache-2.0" ]
permissive
require 'spec_helper' require 'property_sets/casting' describe PropertySets::Casting do describe "#read" do it "return nil when given value nil regardless of type" do expect(PropertySets::Casting.read(:string, nil)).to be_nil expect(PropertySets::Casting.read(:hello, nil)) .to be_nil end it ...
true
367d42dd902c7426e277513301d942f1a96c23eb
Ruby
RoodzFernando/Tic-Tac-Toe-project
/bin/main
UTF-8
3,664
3.609375
4
[ "MIT" ]
permissive
#!/usr/bin/env ruby require File.expand_path('../lib/board', __dir__) require File.expand_path('../lib/player', __dir__) # frozen_string_literal: true def board_show(board) puts '+---+---+---+' puts "| #{board.board_reader(0)} | #{board.board_reader(1)} | #{board.board_reader(2)} |" puts '+---+---+---+' ...
true
f818db6555ea94d0e84ff257469a415012f5aa40
Ruby
Akkicy/Ruby
/factorial.rb
UTF-8
320
3.78125
4
[]
no_license
#!/usr/koeki/bin/ruby # coding: utf-8 def factorial(n) if n <= 1 1 else n * factorial(n-1) end end if ARGV[0] == nil STDERR.puts "階乗を計算したい数を指定して下さい" STDERR.puts "例: ./factorial.rb 5" exit 0 end n=ARGV[0].to_i printf("%dの階乗は%dです\n", n, factorial(n))
true
070683254f0b26e01f2e335ca009f8d525810a99
Ruby
tranhuyhoangbka/effect_ruby
/item11.rb
UTF-8
899
3.65625
4
[]
no_license
# Use the === protocol for matching tasks # Universal "match" protocol in Ruby # Lambdas, regexes, ranges, classes all implement it # a === b asks "is b subsumed by a" # implemented for free on all classes # Allow you to swap the types of objects aginst which matches are performed # For example, lambda for regex p Obje...
true
4b61c72db95506afea225324f24c2504642d67af
Ruby
jefflunt/lg
/lib/row.rb
UTF-8
939
3.5625
4
[]
no_license
module Row # Takes a Range, and returns the (approximate) midpoint, rounding down. # # Combine this with the longest_wall method to get the midpoint index of the # longest wall: # # Row.midpoint(Row.longest_wall(r)) def self.midpoint(range) m = range.min + (range.size / 2) end # Takes a list of...
true
a24e1fc325fd5afc3a9f5b46d3099905982c4e9e
Ruby
alex2702/tdt4242-shop
/app/helpers/product_items_helper.rb
UTF-8
2,497
2.9375
3
[]
no_license
module ProductItemsHelper # calculates the total amount of a collection of product_items (either order_items or cart_items) def calculate_total_amount(product_items) # return elements total_amount = 0 discount_amount = 0 discounts = Array.new # apply deals to each item product_items.each d...
true
f40333b7e099b686a9293211ec2df979e5fb86b5
Ruby
skomer/karaoke_bar
/room.rb
UTF-8
1,010
3.0625
3
[]
no_license
require 'pry-byebug' class Room attr_reader :room_name, :fee_takings def initialize(room_name, playlist, guests, capacity, entry_fee) @room_name = room_name @playlist = playlist @guests = guests @capacity = capacity @entry_fee = entry_fee @fee_takings = 0 end def guests_in_room ...
true
db5351d99a331a5d64fce14cb0c446f8d0d8dff0
Ruby
enogrob/ktapp
/lib/ktapp/base.rb
UTF-8
488
2.75
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# frozen_string_literal: true # Base class for models class Base @@all = [] def initialize super @@all << self end def self.all @@all.select { |x| x.instance_of? self } end def self.count all.count end def self.has_many(name) instance_variable_set("@#{name}", []) define_met...
true
ce006f9748a437834ce330c060fefc8ac18105da
Ruby
machvee/blackjack-strategy-simulator
/markers.rb
UTF-8
1,618
3.125
3
[]
no_license
module Blackjack class Markers attr_reader :table attr_reader :markers def initialize(table) @table = table @markers = [] end def for_player(player) unpaid_markers_for_player(player) end def borrow(player, amount) markers << {player: player, amount: amount, paid:...
true
911802a5413f2c08c1f8ccc5f9637a321eb1eb7b
Ruby
diegopacheco/Diego-Pacheco-Sandbox
/scripts/ruby/basics/regex.rb
UTF-8
205
3.46875
3
[]
no_license
line1 = "Cats are smarter than dogs"; line2 = "Dogs also like meat"; if ( line1 =~ /Cats(.*)/ ) puts "Line1 starts with Cats" end if ( line2 =~ /Cats(.*)/ ) puts "Line2 starts with Dogs" end
true
ee23ed4e283b86c952a57e524d4cb2495a0dfe4c
Ruby
sebastianbrozda/humble-unit
/lib/test/humble_unit/runners/test_method_runner.rb
UTF-8
1,259
2.5625
3
[ "MIT" ]
permissive
module Test module HumbleUnit module Runners module TestMethodRunner private def setup_method @setup_method ||= methods.select { |m| m.to_s == "setup" }.first end def teardown_method @teardown_method ||= methods.select { |m| m.to_s == "teardown" }.first ...
true
43001850841785d270ebdbaf9661856703b084fd
Ruby
alexandrabryan/LS-RB100
/2variables/3.rb
UTF-8
350
4.15625
4
[]
no_license
=begin Add another section onto name.rb that prints the name of the user 10 times. You must do this without explicitly writing the puts method 10 times in a row. Hint: you can use the times method to do something repeatedly. =end puts "Hello, what is your name? " name = gets.chomp puts "Nice to meet you, #{name}!" ...
true
7bc96d3d157acec083871f17d46967878e84d5bd
Ruby
Anveio/save_images
/save_subreddit_images.rb
UTF-8
1,576
2.9375
3
[]
no_license
require 'mechanize' class ImgurSubScraper < Mechanize def save_images(input) @url = format_url(input.dup) page = get(@url) subreddit = subreddit_name(page) puts "Connection Established: Downloading #{subreddit}" directory = "E:\\Users\\Pictures\\#{subreddit}" thumbnails = page.images_with(...
true
14db9baf5959c2628635001ba208e717df9d7be9
Ruby
benji2634/money_cashboard
/models/category.rb
UTF-8
1,411
3.109375
3
[]
no_license
require_relative('../db/sql_runner') class Category attr_reader :id, :type, :description def initialize(options) @id = nil || options['id'].to_i @type = options['type'] @description = options['description'] end def save() sql = "INSERT INTO categories (type, description) VALUES ('#{@typ...
true
9d1375effbb82429c69a988765b62bfb7ebf8db6
Ruby
forthevint/genderize
/lib/genderize/gender.rb
UTF-8
1,311
3.03125
3
[ "MIT" ]
permissive
module Genderize class Gender include I18n attr_reader :abbr def initialize(abbr) unless abbr.blank? or abbr.to_s =~ /\A(male|female)\Z/i @abbr = "invalid" else @abbr = abbr.to_s.downcase end end def name @name ||= translation_for("name") ...
true
0ea07bf33e8b4e9911fcbee59b478fdc4fe1a00d
Ruby
eternalee/intro-ruby-exercises
/flow_control2.rb
UTF-8
304
4.25
4
[]
no_license
puts "Type your message" message = gets.chomp last_character = message[-1] # if the message ends with a y if last_character == "y" puts "DON'T KNOW" # if message ends with a vowel elsif "aeiou".include?(last_character) puts "VOWEL" # if message ends in consonant else puts "CONSONANT!" end
true
cda170423ee389f507f06308d7ca4cba3638da18
Ruby
koshigoe/ftp_multipart_download
/lib/ftp_multipart_download/downloader.rb
UTF-8
1,366
2.546875
3
[]
no_license
# frozen_string_literal: true module FtpMultipartDownload # Use to download a file by concurrent multipart. # # @example # FtpMultipartDownload::Downloader.new('localhost').download(3, '/file') # class Downloader attr_reader :argv # see Net::FTP#initialize # # @param [String] host Host n...
true
0588e58686193933cdc6fd27f0b8a6d4f88d7ae0
Ruby
yushch/assignment_ruby_api_calls
/ghtoken/github.rb
UTF-8
789
2.75
3
[]
no_license
require 'rubygems' require 'github_api' require 'pry' github = Github.new oauth_token: ENV["GHTOKEN"] repohash = {} date = [] github.repos.list {|repo| repohash[repo.pushed_at] = repo.full_name date << repo.pushed_at } date.sort!{|moment1, moment2| Date.parse(moment1) <=> Date.parse(moment2) }.reverse! 0.upt...
true
8ce58949a93dedf5a72cd5bb6a8f2c372c7d1aad
Ruby
kientn123/programming_problems
/HackerRank/Ruby/circle_city.rb
UTF-8
514
3.15625
3
[]
no_license
def is_protected(r, k) radius = Math.sqrt(r).round count = 0 radius.downto(0) do |i| count += 1 if is_square(r - i**2) end #puts 'count: ' + count.to_s if is_square(r) count = count * 4 - 4 else count = count * 4 end if count - k < 1 return 'possible' else 'impossible' end end ...
true
c806d36d85d24730603bf892386e444edd567aec
Ruby
unflores/scheduler
/lib/filters/no_consecutive_chosen.rb
UTF-8
767
3.484375
3
[]
no_license
module Filters # Limit solutions to only those which have not passed a maximum consective limit class NoConsecutiveChosen # This is a little complicated, I want to minimum distance to be 1 away(giving a max consecutive choice of 2) def initialize(max = 2) @max = [max,2].max @index_distance = @m...
true
15b31672b48e50b1fa5ee8e17876c00912422a2b
Ruby
ruby-processing/learning-processing-with-ruby
/chapter_10/06_simple_raindrop.rb
UTF-8
214
2.8125
3
[]
no_license
def setup size 200, 200 background 0 @x, @y = width / 2, 0 smooth no_stroke end def draw background 255 # Show the drop fill 50, 100, 150 ellipse @x, @y, 16, 16 # Move the drop @y += 1 end
true
e18fd8200f24ea5593fd11fa32a6040ace5777f8
Ruby
svcastaneda/sinatra-overflow-challenge
/app/helpers/comment_helpers.rb
UTF-8
184
2.859375
3
[]
no_license
helpers do def score(object) object.votes.pluck('value').sum end def vote_value(type) if type == "upvote" 1 elsif type == "downvote" -1 end end end
true
6b03047e222b3d486f2ba28c0d7bad76c8a80be7
Ruby
sivanpatel/vending_machine
/lib/money/coin.rb
UTF-8
330
3.484375
3
[]
no_license
module Money class Coin def initialize(value:, quantity: 10) @value = value @quantity = quantity end def value @value end def quantity @quantity end def restock(amount) @quantity += amount end def release(amount) @quantity -= amount end ...
true
70e5fb4b3810a600ab410f6990df059f884ddbf1
Ruby
irridescentrambler/ruby-metaprogramming-101
/lib/example5.rb
UTF-8
170
2.9375
3
[]
no_license
YourClass = Class.new class YourClass class << self puts self end end puts YourClass.singleton_class Foo = YourClass class Foo class << self puts self end end
true
49f4c0b254d3989b93e9520b069aba5c0e4ece81
Ruby
tysoncrosbie/usu-fueltracker
/lib/plane_importer.rb
UTF-8
1,090
2.640625
3
[]
no_license
class PlaneImporter class << self def run! limit=nil failures = {} success_count = 0 total_count = 0 begin CSV.foreach(Rails.root.join('db', 'data', 'planes.csv')) do |row| break if limit && total_count >= limit total_count += 1 plane = Plane...
true
5555739aef8aadff73e59e0abdae15e7de65f2ea
Ruby
toyotathon/leetcode_problems
/arrays/contains_duplicate/contains_duplicate.rb
UTF-8
222
3.25
3
[]
no_license
# @param {Integer[]} nums # @return {Boolean} def contains_duplicate(nums) nums_set = Set.new() nums.each { |e| if nums_set.add?(e) == nil return true; end } return false; end
true
f9de2552e8d7188bb5597dd131d9152e8168aab2
Ruby
nori0610/FyaIdea
/vendor/bundle/ruby/2.6.0/gems/refile-0.3.0/lib/refile/image_processing.rb
UTF-8
1,957
2.796875
3
[ "MIT" ]
permissive
require "refile" require "mini_magick" module Refile class ImageProcessor def initialize(method) @method = method end def convert(img, format) img.format(format.to_s.downcase) end def limit(img, width, height) img.resize "#{width}x#{height}>" end def fit(img, width, h...
true
532b90ceffdb478d7000aed10eefb0f7c5c5e62e
Ruby
Qmzp2/cartoon-collections-onl01-seng-ft-032320
/cartoon_collections.rb
UTF-8
639
3.484375
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def roll_call_dwarves(dwarves) new_array = [] dwarves.each.with_index(1) do |dwarf, i| i = "#{i}." new_array << [i, dwarf] end print new_array end def summon_captain_planet(planeteer) planet_caps = [] planeteer.each do |planet| planet_caps << planet.capitalize + "!" end planet_caps end def ...
true
5065a72904bf92b3dadc220cae80232e9dfb96c3
Ruby
tsimica/tapp
/api/app/controllers/api/v1/instructors_controller.rb
UTF-8
4,950
2.53125
3
[]
no_license
# frozen_string_literal: true module Api::V1 # Controller for Instructors class InstructorsController < ApplicationController # GET /instructors def index unless params.include?(:position_id) render_success(Instructor.order(:id)) return en...
true
6ac7e7de4508f653f67462f6cb71624c0db1a0df
Ruby
JosephZhang3/treasure
/src/HelloWorld.rb
UTF-8
250
3.0625
3
[]
no_license
#!/usr/bin/env ruby # print 不换行,puts 自动换行 print "Hello" print " world." puts puts 'You are a good man' puts 'a new line' puts "---- \\" puts "| \\" puts "| /" puts "| __ /" puts "| \\" puts "| \\" puts "| \\"
true
ef24292409f94419fb5ba2e5918166959c89f3ea
Ruby
diegofspaiva/challenges
/coder_byte/free_challenges/9_alphabet_soup/ruby.rb
UTF-8
87
3.15625
3
[]
no_license
def AlphabetSoup(str) str.split('').sort.join('') end puts AlphabetSoup(STDIN.gets)
true
fb193e5f37cd5ba35f02017f68f0a32e6ec6dabb
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/word-count/0c3659f26bca41a684b4313f3fe4605d.rb
UTF-8
249
3.234375
3
[]
no_license
class Phrase attr_reader :phrase def initialize(phrase) @phrase = phrase end def words @phrase.downcase.split(/[^\w']+/) end def word_count words.each_with_object(Hash.new(0)) { |word, total| total[word] += 1 } end end
true
62910f7c6afe82c9f22a5ba47c7f923a944ac45d
Ruby
nnande/reveal.js
/code/happy_path_and_error_handling/4.rb
UTF-8
688
2.6875
3
[ "MIT" ]
permissive
# Task -> Update db with CSV data from external filesystem =begin Import data from external service | | v Parse CSV | | v Update database records | | v success =end ...
true
756ddfe1c1a17b68a85c0c7b4492b75402d248ac
Ruby
madblobfish/lib
/ruby/fuzz.rb
UTF-8
3,063
2.703125
3
[]
no_license
# todo: # implement before command which also may get the inputs as cliargs or stdin. (optionally everything as well?) # implement after command which may gather some additional information # implement after optimize (ruby?) function which may be used to maximize or minimize something that the after command outpu...
true
3052bd0da0b4bb244cdbf5137046c52c7708468a
Ruby
nodonut/learn_ruby
/03_simon_says/simon_says.rb
UTF-8
350
3.78125
4
[]
no_license
#write your code here def echo(text) text end def shout(text) text.upcase end def repeat(text,many = 2) many.times.collect { text }.join(' ') end def start_of_word(text,index) text.slice(0,index) end def first_word(text) splitText = text.split(" ") splitText[0] end def titleize(text) text.split.map(...
true
851f93ad40ec8739ca264bcacf1630fb4025baab
Ruby
Tinend/FantasyKarte
/lib/Grundlagen/TerrainVerwalter.rb
UTF-8
3,787
2.6875
3
[ "MIT" ]
permissive
class TerrainVerwalter def initialize(terrainTyp, hintergrund, mittelgrund, vordergrund, datenBild) @datenBild = datenBild @terrainTyp = terrainTyp @hintergrund = hintergrund @mittelgrund = mittelgrund @vordergrund = vordergrund @besetzt = Array.new(mittelgrund.width) { Array.new(mittelg...
true
38ca3cdd3d8dcf6d127036e87393adb5991d113e
Ruby
RaduEmanuel92/AdventOfCode_2017
/day3/challenge3.rb
UTF-8
3,270
3.421875
3
[]
no_license
#!/usr/bin/env ruby require "matrix" #require "math" #update matrix class class Matrix def []=(i, j, x) @rows[i][j] = x end end class Challenge3 def initialize(value=265149) @value=value end def find_lower_bound_square(value_=@value) search_ = (value_).to_i (1..search_).each { |x| return x-1 if x**...
true
2d1b517a61d4c0b1616511b40895a584b2cd53cf
Ruby
jcbantuelle/euler
/385.rb
UTF-8
446
3.078125
3
[]
no_license
def operate(operation, first, *rest) result = [] first.zip(*rest) do |i| result << i.inject(operation) end result end z1 = [-4.0,-3.0] z2 = [-4.0,3.0] z3 = [8.0,0.0] one_third = [1.0/3.0, 1.0/3.0] g = operate(:*, one_third, operate(:+,z1,z2,z3)) g2 = operate(:*, g, g) puts g2.to_s sum = operate(:+, oper...
true
aeacbad8b91c4af02ff2e98bd6e785c9c59d291e
Ruby
julio/puzzles
/ruby/my_accessor.rb
UTF-8
941
3.5625
4
[]
no_license
# --------------------------------------------------------------------------- # My own accessor # --------------------------------------------------------------------------- module Accessor def self.included(base) base.extend(ClassMethods) end module ClassMethods def class_attribute_accessor(var_name) ...
true
cecff03986da69580af0d99c2345f7d7e8127e73
Ruby
floehopper/little_scheme
/lib/list.rb
UTF-8
239
3.25
3
[]
no_license
class List def initialize(*array) @array = array end def car @array.first end def cdr self.class.new(*@array[1..-1]) end def ==(other) self.array == other.array end protected attr_reader :array end
true
f1d8d98fda9243ca3393c218198fe463e0d39e45
Ruby
kirillstrelkov/my-vocabulary
/app/helpers/words_helper.rb
UTF-8
832
2.828125
3
[]
no_license
# frozen_string_literal: true module WordsHelper def format_word(word, lang_code) lang_codes = [word.lang_code1, word.lang_code2] raise ArgumentError, "Lang code '#{lang_code}' not in #{lang_codes}" unless lang_codes.include?(lang_code) text_key = lang_code == word.lang_code1 ? 'text1' : 'text2' gen...
true
4688d89558ac336b207775137d4f2be8eaaf8394
Ruby
acockell/confidentqa_cucumber
/features/step_definitions/pythagorean_steps.rb
UTF-8
533
3.21875
3
[]
no_license
Given /I have started the calculator/ do # @right_triangle = Pythagorean.new end Given /I have entered (.*) into the calculator first/ do |value| @right_triangle.side_one value end Given /I have entered (.*) into the calculator second/ do |value| @right_triangle.side_two value end When /I request the hypotenus...
true
d13bfb85a2c18c4c36394b18f758a20bdb154230
Ruby
andykingking/http_stub
/spec/lib/http_stub/server/stub/match/rule/headers_spec.rb
UTF-8
2,576
2.65625
3
[ "MIT" ]
permissive
describe HttpStub::Server::Stub::Match::Rule::Headers do let(:stub_headers) { { "stub_key" => "value" } } let(:headers) { described_class.new(stub_headers) } it "is a hash with indifferent and insensitive access" do expect(headers).to be_a(HttpStub::Extensions::Core::Hash::IndifferentAndInsensitiveAccess) ...
true
931850ad04aa1ec9969561c242f8782fce396a97
Ruby
aczid/ruby_patterns
/structural/flyweight.rb
UTF-8
1,775
3.71875
4
[]
no_license
#!/usr/bin/ruby # This example demonstrates the flyweight pattern in the Ruby language. class Flyweight; end class ConcreteCharacterFlyweight < Flyweight attr_accessor :intrinsic_state def to_s self.intrinsic_state[:character] end def initialize(character, font_face, size) @intrinsic_state = { :c...
true
5352a44ae9e37273d21eb6826d1c98019b4cfeb2
Ruby
randycoulman/blogstats
/lib/blogstats/stats.rb
UTF-8
828
3.109375
3
[ "MIT" ]
permissive
require "ostruct" module Blogstats class Stats < OpenStruct def initialize(*) super self.post_count ||= 0 self.word_count ||= 0 self.loc ||= 0 self.images ||= 0 self.videos ||= 0 end def add_post self.post_count += 1 end def add_words(words) self....
true
9d3dcba56ce014d10b544b9c6c18f345088e3d15
Ruby
mattzuzolo/cartoon-collections-prework
/cartoon_collections.rb
UTF-8
620
3.3125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def roll_call_dwarves (arr_names) arr_names.each_with_index do |name, index| puts "#{index + 1}.#{name}" end end def summon_captain_planet (planeteer_calls) planeteer_calls.map do |thing| thing.capitalize << "!" end end def long_planeteer_calls (array_calls) array_calls.any? do |word| word.l...
true
d9aec32f57dca90bbe7ce6c54674b4620d4b8fe3
Ruby
bluffingtuna/prep-step-1
/practice_assessments/practice_assessment_1_solution.rb
UTF-8
951
4.125
4
[]
no_license
# Factorial def factorial(num) product = 1 while num > 0 product *= num num -= 1 end product end # ------------------------------------------------------------------------------ # E-Words def e_words(sentence) words = sentence.split count = 0 words.each do |word| count += 1 if word[-1] =...
true
4ecd8f5819629586ef6790746df6b1ce70a297e0
Ruby
scypher6/blood-oath-relations-dumbo-web-111819
/app/models/cult.rb
UTF-8
951
3.3125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Cult attr_reader :name, :location, :founding_yr, :slogan @@all = [] @@follower_list = [] def initialize(name, location, founding_yr, slogan) @name = name @location = location @founding_yr = founding_yr @slogan = slogan @@all << self end ...
true
80d4a9eaad5aa0562353eea4d85224507f81f060
Ruby
sotek222/intro-to-tdd-rspec-and-learn-nyc-web-career-012819
/how_old_are_you.rb
UTF-8
208
3.546875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_relative "./current_age_for_birth_year.rb" puts "What is your birth year?" birth_year = gets.to_i users_age = current_age_for_birth_year birth_year puts "You are " + users_age.to_s + " years old."
true
abd853706a59931cecf5d02e24b18985ccd69c25
Ruby
kevinydhan/project-euler
/ruby/12_highly_divisible_triangular_number.rb
UTF-8
586
3.515625
4
[]
no_license
def highly_divisible_triangular_number (1..7).each do |num| find_number_of_divisors(memoize(num)) if find_number_of_divisors(memoize(num)).length > 5 end end def find_triangle_number(nth_term) (1..nth_term).to_a.reduce(0, :+) end def find_number_of_divisors(number) (1..number).to_a.select ...
true
c02ae6ddc71eeecf4a53e0a676380d8d3b837852
Ruby
zacharytq/reverse-each-word-online-web-sp-000
/reverse_each_word.rb
UTF-8
194
3.5
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def reverse_each_word(sentence) sentence_array = sentence.split(" ") return_array = [] sentence_array.collect do |word| return_array << word.reverse end return_array.join(" ") end
true
5a2a95f06c9d3906a91257ca83211adb019372d1
Ruby
SarpongAbasimi/CodeWarsRuby
/5kyu/Extract_the_domain(5kyu).rb
UTF-8
521
3.390625
3
[]
no_license
=begin Write a function that when given a URL as a string, parses out just the domain name and returns it as a string. For example: =end #mySolution def domain_name(url) url=url.split(/\.com\/?.*/).to_s.split(/https?:\/\/w{3}?\.?/) return url[1].to_s.sub!(/"\]/,'') end puts domain_name("http://github.com/carbon...
true
1fb36ca99e21c2943d3d258ae61a7a8330d84c6f
Ruby
zRouth/travel-hub-rails
/app/models/trip_account.rb
UTF-8
884
2.578125
3
[]
no_license
class TripAccount < ActiveRecord::Base has_many :posts belongs_to :trip validates :username, :source, :trip, presence: true def self.assign_trip_accounts(trip_accounts_hash, trip) self._create_twitter_accounts(trip_accounts_hash["twitter_accounts"], trip) self._create_instagram_accounts(trip_accounts_...
true
adbcbe9e832f986a56b482557288136852280650
Ruby
feigningfigure/WDI_NYC_Apr14_String
/w01/d02/Declan_Van_Welie/calculator/calc.rb
UTF-8
836
4.15625
4
[]
no_license
def get_user_choice(choice, num1, num2) if choice == "a" answer = num1 + num2 "#{answer}" elsif choice == "s" answer = num1 - num2 #returns answer elsif choice == "multiply" answer = num1 * num2 returns answer elsif choice == "d" answer = num1 % num2 returns answer else choice...
true
8b42f8e58573a48f344f35b97a77d229002ca2c3
Ruby
nvnogomes/peuler
/004.rb
UTF-8
571
3.796875
4
[]
no_license
# Find the largest palindrome made from the product of two 3-digit numbers. # 906609 class Euler4 @limit def initialize(max=999) @limit = max end def solve max = 0 1.upto(@limit) do |first| 1.upto(@limit) do |second| current = first * second max = current if( is_palindrome?(current.to_s) &...
true
cb695784e4fa4f843520f52670dc734f56e8b194
Ruby
abeland/rubylab
/lib/euler/problem4.rb
UTF-8
582
3.546875
4
[]
no_license
module Problem4 def problem4 max_palindromic_num = nil (100..999).each do |i| (100..999).each do |j| product = i*j if (max_palindromic_num.nil? || product > max_palindromic_num) && is_palindromic_num(product) max_palindromic_num = product end end en...
true
cb0295442f353bee15da0b016a59afea7e0ed52d
Ruby
jonathanparrish/number_guessing
/game.rb
UTF-8
1,253
4.375
4
[]
no_license
def max_number return 100 end def greeting puts "Guess the random number." puts "It's between 1 and #{max_number}." puts "You get 5 tries" puts "Go!" end def get_number_from_user gets.chomp.to_i end def remaining_guesses(count) if 5-count == 1 puts "You have 1 guess remaining." else puts "You...
true
5fbcf5b5390a267c0c58e9b6b6e520d086c7921e
Ruby
tadpol/jiraMule
/lib/JiraMule/commands/assign.rb
UTF-8
831
2.59375
3
[ "MIT" ]
permissive
require 'JiraMule/jiraUtils' command :assign do |c| c.syntax = 'jm assign [options] <to user> <keys...> ' c.summary = 'Assign keys to another user' c.action do |args, options| jira = JiraMule::JiraUtils.new(args, options) muser = args.shift if muser == '-1' or muser =~ /^:de/ then # assign t...
true
1def2f10ebdddcf2dbfc724f1f043b6d4713bf91
Ruby
ThoughtGang/BGO
/lib/bgo/application/commands/project-edit.rb
UTF-8
2,280
2.53125
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env ruby # :title: Bgo::Commands::ProjectEdit =begin rdoc BGO command to modify project contents Copyright 2013 Thoughtgang <http://www.thoughtgang.org> =end require 'bgo/application/command' require 'bgo/application/commands/shared/data_model_options' require 'bgo/application/commands/shared/pipeline' req...
true
99bee889a526efa04f301055cd69cb56f2c4225a
Ruby
Naomi-Dennis/cli-data-gem-assessment-v-000
/lib/reddit_thread.rb
UTF-8
966
2.921875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
######################################################################################################## #PURPOSE: To organize the Reddit_Thread objects into a list where each object can be #easily found. # # Despite being called Reddit_Thread, it actually shows the attributes of a subreddit, not a thread. ############...
true
b324a568e1ddebecf91d86c0b16f86ff3c0b1a63
Ruby
TaniaWhiting/anagram-detector-v-000
/lib/anagram.rb
UTF-8
299
3.671875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Your code goes here! class Anagram attr_accessor :word def initialize(word) @word = word end def match(array_words) matches = [] array = @word.split("").sort array_words.each do |word| if array == word.split("").sort matches << word end end matches end end
true
861cd8c710e7fbd6143a49a25c619b8f3e75d3de
Ruby
shoyan/design-pattern-ruby
/05-singleton.rb
UTF-8
200
2.578125
3
[ "MIT" ]
permissive
require 'singleton' class Settings include Singleton end a = Settings.instance b = Settings.instance p [a.object_id,b.object_id] # a and b are same object Settings.new # error (`new' is private)
true
2135f1393c38185e1c76471c9a7c2cf8541b98b7
Ruby
sitaraemilys/airport_challenge
/spec/feature_spec.rb
UTF-8
2,150
2.8125
3
[]
no_license
require_relative '../lib/airport' describe 'Feature tests' do easyjet = Plane.new ryanair = Plane.new heathrow = Airport.new gatwick = Airport.new(1) context 'when conditions are not stormy' do before { allow(gatwick).to receive(:stormy?).and_return false } it 'mutiple planes taking off and landing' do ...
true
55a58d90865ff5270b41142737fad80df93015f7
Ruby
LU850481135/research-study
/backend/ruby/hello.rb
UTF-8
3,888
4.40625
4
[]
no_license
# encoding: UTF-8 print("你好呀, Ruby.\n") puts "Hello, \nRuby." p "Hello, \n\tRuby." x = 10 y = 20 z = 30 area = (x*y + y*z + z*x) * 2 volume = x * y * z print "表面积=", area, "\n" print "体积=", volume, "\n" def h(name) puts "Hello #{name}!" end h('liulu') def h(name = "World") puts "Hello #{name.capitalize}!" end ...
true
6867e0970430bf12a901fa07aa7eb219127d607c
Ruby
vincentcarbonaro/Personal-Study-Guide
/1-Questions/00-fib.rb
UTF-8
661
4.125
4
[]
no_license
# Return the n'th Fibonacci Number iteratively and recursively def fib_it(n) end def fib_rec(n) end puts puts 'Iterative Fibonacci' puts "0th fib: #{0 == fib_it(0)}" puts "1st fib: #{1 == fib_it(1)}" puts "2nd fib: #{1 == fib_it(2)}" puts "3rd fib: #{2 == fib_it(3)}" puts "4th fib: #{3 == fib_it(4)}" puts "5th fib: ...
true
8ed31286fa1e2e1567c8559db1063a545807e9c9
Ruby
mpedersen2054/learn2program
/fullnamegreeting.rb
UTF-8
194
3.59375
4
[]
no_license
puts "What is your first name?" first = gets.chomp puts "Middle name?" middle = gets.chomp puts "Last name?" last = gets.chomp puts "Pleasure to meet you " + first + ' ' + middle + ' ' + last
true
1015383c5e7678639012546980786f29dccfb8b8
Ruby
ajosepha/todos
/activities/nyc-pigeon-organizerV2.rb
UTF-8
3,477
3.578125
4
[]
no_license
#Color, Gender and lives are the top line keys pigeon_data = { :color => { :purple => ["Theo", "Peter Jr.", "Lucky"], :grey => ["Theo", "Peter Jr.", "Ms .K"], :white => ["Queenie", "Andrew", "Ms .K", "Alex"], :brown => ["Queenie", "Alex"] }, :gender => { :male => ["Alex", "Theo", "Peter Jr.",...
true
aad7f56e439fc38c669ece337352d11159378841
Ruby
OregonDigital/oregondigital
/lib/oregon_digital/date_sorting.rb
UTF-8
3,089
2.65625
3
[ "Apache-2.0" ]
permissive
module OregonDigital module DateSorting extend ActiveSupport::Concern def to_solr(solr_doc={}) solr_doc = super solr_doc = solr_doc.merge({"sort_date_desc_dtsi" => sort_date_desc, "sort_date_asc_dtsi" => sort_date_asc}) solr_doc = solr_doc.merge({"date_decades_ssim" => decades}) solr_d...
true
c9524cbc40dbb2bf61055a5e13b6ec7295740596
Ruby
amufleh1/ruby
/example4.rb
UTF-8
86
3
3
[]
no_license
a = [1975, 2001, 20013, 2202, 1002] puts a[0] puts a[1] puts a[2] puts a[3] puts a[4]
true
fcc2aa27f8abde62a6e3012c7b5149df42d5db0e
Ruby
sheikhn/docker-utilities
/env-var-helper/rm_file.rb
UTF-8
988
2.640625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'json' container_destination = ARGV[0] env_file = "/files/#{ARGV[1]}" if !File.exist?(env_file) || File.readlines(env_file).find {|line| line =~ /^ENV_VAR_HELPER=/ }.nil? raise "Env var file #{File.basename env_file} not found" else # file exists, with ENV_VAR_HELPER present serialized_env_var_helper_data...
true
253cbc7081bd0ceb4d8a5b0d2699bc6f25094082
Ruby
bskillings/Odin-Ruby-Recursion
/palindrome.rb
UTF-8
636
4.09375
4
[]
no_license
def palindrome_non_recursive(test_string) test_string.gsub!(" ", "") reverse_string = test_string.reverse test_string.downcase == reverse_string.downcase end #I have no idea how to make this recursive. I would just strip the spaces, reverse the string, and compare #copied from codequizzes.com def palindrome (stri...
true
f74f0dce3390242f5ab3b72d507905637c067586
Ruby
folajimia/launchSchoolBasics
/lesson_1/flow_control/number_sort.rb
UTF-8
414
4.5
4
[]
no_license
def number_selector (number) case when number < 0 puts "number is less than 0" when (number > 0) && (number <= 50) puts "number is between 0 and 50" when (number > 50) && (number <= 100) puts "number is between 50 and 100" else puts "number is greater than 100" end e...
true
adb4efd1ccca13953041387c06d6801dcb8f3c1d
Ruby
parmarg/asset_manager
/app/helpers/field_helper.rb
UTF-8
196
2.546875
3
[]
no_license
module FieldHelper def get_field_types() fieldTypes = FieldType.all types = Array.new fieldTypes.each do |type| types[] = type.type_name end return types end end
true
2517561daa52daee22625275c6b65bb1af3357cb
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/word-count/4e9159196a034967bd484f64f3228b45.rb
UTF-8
274
3.296875
3
[]
no_license
class Phrase attr_reader :content def initialize(content) @content = content.downcase end def words @words ||= content.scan(/[\w|\d]+/) end def word_count words.each_with_object({}) {|word, word_map| word_map[word] = words.count(word) } end end
true
5d8958ef0f9e989042724a355a0536c332e0406d
Ruby
maksimpanarin/ruby_homework
/homework_1/Module3_integers.rb
UTF-8
270
3.03125
3
[]
no_license
# 9. Create big integer variable bigInteger = 12345678901234567890 # 10. Create integer variable in binary system binaryInteger = 0b1010 # 11. Creat integer in hexadecimal system hexadecimalInteger = 0xA # 12. Create integer in octal system octalInteger = 012 # DONE
true
08da568d9db8e8bf35d6993fe8831b77c76be492
Ruby
emilioriosvz/miniquipu
/app/models/dashboard.rb
UTF-8
450
2.890625
3
[]
no_license
class Dashboard def initialize @expenses ||= Article.expenses @incomes ||= Article.income end def expenses @amount = 0 @expenses.each do |expense| @amount += expense.price end @amount end def income @amount = 0 @incomes.each do |income| @amount += income.price e...
true
33802ce4a6ce28eb8e97a9811da6ee618e5aa499
Ruby
EricRicketts/IntroductionToProgramming
/RubyBasics/Loops2/exercise_2_test.rb
UTF-8
343
3.03125
3
[]
no_license
require 'minitest/autorun' require 'minitest/pride' # capture random numbers > 10 class CatchTheNumberExercise < Minitest::Test def test_catch_the_number ary = [] loop do number = rand(100) ary.push(number) break if number.between?(0, 10) end assert ary.select { |n| n.between?(0, 10)...
true
84c47b1a6dc046e0ca58779a0ce7191ced42918c
Ruby
Cloudef/RPG-Maker-Translator
/3rdParty/rmxp_translator/tran_util.rb
UTF-8
6,722
3.34375
3
[ "MIT" ]
permissive
# Represents a translatable string. class TranslatableString def initialize(orig, tran = "") @original = orig.force_encoding('UTF-8') @translation = tran.force_encoding('UTF-8') end attr_accessor :original attr_accessor :translation def to_json(*a) { 'json_class' => self.class.name, ...
true
cada6f74344dbcd201cc2b3e5c0938d11f1adf60
Ruby
sergso/ruby
/urok4 (копия)/main.rb
UTF-8
1,566
2.953125
3
[]
no_license
PASS = "pass" CARGO = "cargo" require_relative('train.rb') require_relative('station.rb') require_relative('route.rb') require_relative('vagon.rb') def input_key @input = '' until (@input == "x") do puts "Выберите операцию, нажав соответствующую клавишу или нажмите (x) - для выхода" puts "1) Создать новую с...
true
1831917ef126548d88536197848f93a0406db1d3
Ruby
dixiqi/Ruby
/04/dog.rb
UTF-8
282
3.359375
3
[]
no_license
class Dog puts "这是一条哈巴狗" end class Dog puts "这条哈巴狗的颜色是黄色" class Tail puts "奇怪的是这条狗有一条白色的尾巴" end end dog=Dog.new class<<dog def show puts "冬天了,主人给它穿了一件小皮衣" end end dog.show
true
43651f0671d552cbe10fa8a84f871ed31be0c1b1
Ruby
serenahathi/weLoveKatas
/ruby/7kyu/sum_of_numbers.rb
UTF-8
196
3.375
3
[]
no_license
# https://www.codewars.com/kata/55f2b110f61eb01779000053 def get_sum(a,b) return a if a == b sorted_array = [a, b].sort (sorted_array[0]..sorted_array[1]).sum end end get_sum(5, -1)
true
b49779bc709a3563464015486f58a967dd2d84f2
Ruby
cifarquhar/hogwarts
/console.rb
UTF-8
1,367
2.984375
3
[]
no_license
require_relative('models/student.rb') require_relative('models/house.rb') require('pry') Student.delete_all() House.delete_all() house1 = House.new({'name' => "Gryffindor", 'logo_url' => "http://vignette1.wikia.nocookie.net/harrypotter/images/8/8e/0.31_Gryffindor_Crest_Transparent.png"}) house2 = House.new({'name' =>...
true
19f7c58134319b195aa05207db25d2dec0ffa7f8
Ruby
jlindley/title_case
/lib/titlecase.rb
UTF-8
2,524
3.453125
3
[ "MIT" ]
permissive
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) # A port of John Gruber's title casing script to Ruby. # 2008-05-21 Jim Lindley http://jimlindley.com # # --- Original Copyright Notice --- # # This filter changes all word...
true
5cbedf35ffbd17ebc8992c4bb1c6f9149bab8cbf
Ruby
zackseuberling/danger
/lib/danger/commands/local_helpers/http_cache.rb
UTF-8
865
2.875
3
[ "MIT" ]
permissive
require "pstore" module Danger class HTTPCache attr_reader :expires_in def initialize(cache_file = nil, options = {}) File.delete(cache_file) if options[:clear_cache] @store = PStore.new(cache_file) @expires_in = options[:expires_in] || 300 # 5 minutes end def read(key) @sto...
true
80262863a34fe3b1f343dd040e001a70cbbbd8f1
Ruby
IRONHACKJOAQUIN/copyafile
/exercise.rb
UTF-8
788
3.765625
4
[]
no_license
#Exercise Copy a file #consiste en leer el texto de un archivo y escribirlo en otro el usuario introducira los nombre de los archivos origen y destino puts "What is the source file? - ¿Cual es su archivo de Origen" archivo_origen = gets.chomp puts "Ha selecionado como origen #{archivo_origen}" puts "What is the des...
true
55888685d6a288659043b3d44877b7391225fdbf
Ruby
stager94/poker-holdem
/combination_checker/three_of_kind.rb
UTF-8
558
2.953125
3
[]
no_license
module CombinationChecker class ThreeOfKind < CombinationChecker::Base TYPE = 'Three of a Kind' COMBINATION_WEIGHT = 3 class <<self def valid?(cards) groups = cards_faces_groups_count(cards) return groups[0][1] == 3 && groups[1][1] == 1 end def calculate_weight(cards) groups = cards_fa...
true
8811075f5e02330def67278916067e515bed8486
Ruby
waka/musako
/lib/musako/renderer.rb
UTF-8
575
2.578125
3
[ "MIT" ]
permissive
module Musako class Renderer def initialize(file) @original_file = file end # write file def render raise NoImplementationError end def file_name File.basename(@original_file) .gsub(File.extname(@original_file), self.file_extname) end def file_extname ...
true