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
b03fa9f11567bff9df8ef5266fdff34ed0624dc5
Ruby
earl-stephens/hogwarts-base
/app/facades/student_search_facade.rb
UTF-8
1,195
2.546875
3
[]
no_license
class StudentSearchFacade attr_reader :house def initialize(house) @house = house end def students_count # conn = Faraday.new("http://hogwarts-it.herokuapp.com/api/v1/house/#{@house}?api_key=alohamora") do |f| # f.adapter Faraday.default_adapter # end # response = conn.get # results ...
true
0b4724bd753a6615965d6bb034ac11ba52e7b96c
Ruby
psagan/slackbot-rubydoc
/lib/client/websocket_response_data.rb
UTF-8
1,150
3.03125
3
[]
no_license
# This class is responsible for handling websocket response data - retrieved # from websocket. module Client class WebsocketResponseData # Public: initialize # # Hash - with params which are required: # :data - incoming data from websocket (json string) # :bot_params_class - class f...
true
83fcd647110d69c1d83cc5b48f51a844a9c9a9a2
Ruby
dapi/courier-notifier
/lib/courier/service/base.rb
UTF-8
1,581
2.53125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # Модель класса осуществляющего способ доставки. # * name - уникальное название (littlesms, actionmailer) # * type (класс) # ## Например: # * Courier::Service::SMS::LittleSMS # * Courier::Service::Email::ActionMailer # * Courier::Service::Email::MailChimp # * Courier::Service::Twitter::Grack...
true
790d7eb6e42bf777548c63462f93f4381c0a05ef
Ruby
mikedao/house-salad-1806
/app/services/pro_publica_service.rb
UTF-8
1,003
2.734375
3
[]
no_license
class ProPublicaService def initialize(filter = {}) @filter = filter end def member_search get_json("/congress/v1/members/house/#{@filter[:state]}/current.json") end def district_search get_json("/congress/v1/members/house/#{@filter[:state]}/#{@filter[:district]}/current.json") end pri...
true
1e6842092e5b056373a64f8d534fdef8bc87198a
Ruby
TRex22/random
/Ruby/incomplete_IRCBotBaseCode.rb
UTF-8
7,214
2.515625
3
[ "WTFPL" ]
permissive
require "socket" require "thread" require "time" require "active_record" class EBot attr_accessor :s, :uname, :server, :port, :connected, :lt, :last, :now, :db, :chan_list, :joined, :join_list, :auth_code, :auth_fail, :auth_list, :irc_markup, :pass #give the bot it's inital settings def initialize(_name,...
true
39fe5cb3a08498f3086b1170c636bbbd6405d53b
Ruby
gabrielwillemann/ruby-introduction-course-presentation
/examples/example09/example09.rb
UTF-8
203
3.328125
3
[]
no_license
a = [6,7,2,1,9] a.each do |value| puts value end a.each_with_index do |value, key| puts "#{key} = #{value}" end h = {:a => 1, :b => 2, :c => 3} h.each do |key, value| puts "#{key} = #{value}" end
true
ec607b3aeca351f6c7810cf3c20abaceec0bf750
Ruby
PederSchacht/car_plebes
/spec/models/car_spec.rb
UTF-8
4,859
2.859375
3
[ "MIT" ]
permissive
require_relative '../spec_helper' describe Car do context ".all" do context "with no cars in the database" do it "should return an empty array" do Car.all.should == [] end end context "with multiple cars in the database" do let!(:foo){ Car.create("Foo", 25) } let!(:bar){ C...
true
dbb89c6e8b66a3c1e74a1ba67f96b93e0741b63f
Ruby
Rickylop/Ahorcado
/lib/ahorcado.rb
UTF-8
348
3.125
3
[]
no_license
class Ahorcado def initialize secreto @palabra1b = secreto.split("") # @avance = "_ " * @palabra1b.size end def valido letra index = @palabra1b.index(letra) if index != nil return index #@avance[index*2] = letra else return 100 @avance end end # def ...
true
0522b7de893943be97a28e5adc5742168e451d79
Ruby
katie-bailey/RB100
/Intro_To_Ruby_Programming/Arrays/a07.rb
UTF-8
74
3.078125
3
[]
no_license
arr = [1, 2, 3, 4, 5, 6, 7] arr.each_with_index{|v, i| puts "#{i}: #{v}"}
true
7899517ac96a3663d0f5a3dcd5bf14d741b61913
Ruby
S1azZy/exercism_ruby
/flatten-array/flatten_array.rb
UTF-8
399
3.484375
3
[]
no_license
class FlattenArray class << self # the Ruby way - list.flatten.compact # but my solution more interesting, i think so :) def flatten(list) iter(*list) end def iter(head = nil, *tail) return [] if head.nil? node = case head when Array iter(*head) ...
true
f1fba6b85e2781cbb78bda2246694529fff85384
Ruby
maha2490/IRONHACK
/course/week_2/self_exercises/calculator/lib/calculator.rb
UTF-8
590
3.625
4
[]
no_license
#calculator class class Calculator def initialize @first_number = first_number @second_number = second_number @result = 0 end def add first = result = @first_number + @second_number "#{first_number} + #{second_number} = #{result}" end def subtract result = @first_number - @second_number "#{firs...
true
5be2057e59a4a9fb487de7f3ed08d9c14526b1b9
Ruby
MarcusMellorMIM/OO-Art-Gallery-london-web-career-042219
/tools/console.rb
UTF-8
573
2.90625
3
[]
no_license
require_relative '../config/environment.rb' marcus = Artist.new("Marcus", 52 ) banksy = Artist.new("Banksy", 35 ) tate = Gallery.new("Tate Modern", "London") national = Gallery.new("The national portrait gallery", "London") scribble = Painting.new( marcus, "The scribble", 1000, tate ) crazy = Painting.new( ma...
true
ef46dd8588670669640fe7870c886117ae1d6573
Ruby
OGonzalezNYC/advanced-hashes-hashketball-prework
/hashketball.rb
UTF-8
6,160
3.171875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require "pry" def game_hash { home: {team_name: "Brooklyn Nets", colors: ["Black", "White"], players: {"Alan Anderson" => { number: 0, shoe: 16, points: 22, rebounds: 12, a...
true
41f6af08833df39f1720b881bd16d6ef2e48cf00
Ruby
adlaika/rb_exercises
/SimpleCalculator.rb
UTF-8
469
3.734375
4
[]
no_license
#from RubyMonk exercise: http://rubymonk.com/learning/books/1-ruby-primer/chapters/19-ruby-methods/lessons/69-new-lesson#solution3899 def add(*nums) nums.inject{|sum, n| sum + n} end def subtract(*nums) nums.inject{|diff, n| diff - n} end def calculate(*args) #if last arg is Hash, extract it #else make empty...
true
831d53cc04deeaf78784aabe19b1e5745ba45398
Ruby
mare-imbrium/film-json
/updatedb.rb
UTF-8
4,329
2.75
3
[]
no_license
#!/usr/bin/env ruby -w # ----------------------------------------------------------------------------- # # File: update.rb # Description: reads up json files, updates table. # This is mostly required for new movies which don't have oscar and other award info updated yet. # Sometimes the plot also changes...
true
6226f539a4f66eea41b175a4204f8b68163fdeb7
Ruby
mmbensalah/sorting_cards_project
/test/sorting_cards_test.rb
UTF-8
471
2.890625
3
[]
no_license
require "./lib/sorting_cards" require "minitest/autorun" require "minitest/pride" class CardTest < Minitest::Test def test_for_class card = Card.new("Ace", "Spades") assert_instance_of Card, card end def test_instance_variables card = Card.new("Ace", "Spades") assert_equal "Ace", card.value ...
true
d6c22f534b08f536f0a724143d10c8cd323d9aec
Ruby
lukeledet/majak
/lib/majak/hmc5883l.rb
UTF-8
1,404
3.28125
3
[ "MIT" ]
permissive
require 'i2c' require 'cmath' # @TODO Add methods for configuring the 2 config registers and mode # @TODO Add a method to configure the magnetic declination: http://www.magnetic-declination.com/ # @TODO Add a way to run the self test # @TODO Add support for the DRDY pin # Reference: http://www.adafruit.com/datasheets/...
true
310409c1b1959f7dd5ac30e1980ae71fea9240d3
Ruby
tylertomlinson/hogwarts_again
/app/models/professor.rb
UTF-8
303
2.65625
3
[]
no_license
class Professor <ApplicationRecord has_many :professor_students has_many :students, :through => :professor_students validates_presence_of :name, :age, :specialty def students_average_age (students.sum(:age) / students.count.to_f).round(2) end end
true
1f286522db1f3fedd7190f39224e3b8197968d03
Ruby
heusserm/katas
/martingale/martinCarlo.rb
UTF-8
3,679
3.515625
4
[]
no_license
puts "\n--------------------------------------------------------------------------" puts "martinCarlo.rb" puts "(C) 2021 Matthew Heusser Matt@xndev.com" puts "----------------------------------------------------------------------------" puts "A Monte Carol simulator of the Martingale bettering technique." puts "Using p...
true
1bbc9d356e5d8ee35cdda4560d7d5e98dfbc0c8a
Ruby
ondrejfuhrer/rocket-library
/app/models/time_difference_result.rb
UTF-8
3,172
3.78125
4
[ "MIT" ]
permissive
class TimeDifferenceResult # Creates a time difference result form hash # # === Return # @return [TimeDifferenceResult] # def self.from_hash(hash) return new hash[:years], hash[:months], hash[:weeks], hash[:days], hash[:hours], hash[:minutes], hash[:seconds] end # Returns human readable string rep...
true
3366e409de4b7205212ae62e3c6e51b03040ceae
Ruby
ALRW/Battle
/spec/game_spec.rb
UTF-8
420
2.609375
3
[]
no_license
require 'game' describe Game do let(:player_klass) { double(:player_klass, new: '')} subject(:game){described_class.new(player_klass, :player1, :player2)} let(:player2){double(:player2)} context 'When attacking' do it { is_expected.to respond_to(:attack).with(1).argument} it 'reduces the players healt...
true
9ddbbd76fd8558691aedf159ad1cee1dba2ab5fb
Ruby
oliverswitzer/random_compliments
/lib/compliment.rb
UTF-8
600
3.109375
3
[]
no_license
class Compliment MESSAGE_IMG_HASH = {"You give great massages" => "img/cat_massage.gif", "If you were a telemarketer, I would totally buy your product" => "img/telemarketer_cat.gif", "You're great between the sheets" => "img/cover_cat.gif", "Your derp face is the derpiest ...
true
98943b399c0d72e63dfe45b7b2098d06a83127bc
Ruby
rossta/pursue
/app/helpers/text_helper.rb
UTF-8
172
2.515625
3
[]
no_license
module TextHelper def pluralize_without_count(count, noun, text = nil) return if count.zero? count == 1 ? "#{noun}#{text}" : "#{noun.pluralize}#{text}" end end
true
be1b95ad7700d2aa8ddeae0e13d7201a4f44732b
Ruby
olesgoy/itcluster_homework
/ruby_lab_methods.rb
UTF-8
2,131
4.375
4
[]
no_license
# 1 def calculate_value(x,y) x + y end # 2 def factorial(n) raise "bad point, check another" if n < 1 return 1 if n == 1 n * factorial(n-1) end end factorial(3) # 6 def true_or_false(x) if x==1 return true else false end end true_or_false(2) # 8 def calculate_...
true
52b04776694ca2892ee150c1538ac431c17f0afe
Ruby
Sufl0wer/summer-2019
/3730/2/confirmation/geoposition.rb
UTF-8
515
3.03125
3
[]
no_license
module Geoposition LATITUDE = 53.914260..53.916240 LONGITUDE = 27.565940..27.571310 def correct_geoposition? payload['location'] && correct_latitude? && correct_longitude? end def save_geoposition(dir_path) File.open(dir_path + 'geo.txt', 'wb') do |file| file << payload['location'].inspect ...
true
cb25085e1bf52e8977eb8e7e50eb9bd56d8867ca
Ruby
andymeneely/squib
/lib/squib/sample_helpers.rb
UTF-8
1,007
2.75
3
[ "MIT" ]
permissive
module Squib # Some helper methods specifically for samples # @api private #:nodoc: class Deck # Draw graph paper for samples def draw_graph_paper(width, height) background color: 'white' grid width: 50, height: 50, stroke_color: '#659ae9', stroke_width: 1.5 grid width: 200, height...
true
4662e2c6a452e2bc10dde89d358a6d986e2d7ddf
Ruby
hmiyado/roko
/lib/roko/source/configurable.rb
UTF-8
839
2.796875
3
[]
no_license
# frozen_string_literal: true require 'date' require 'time' module Roko module Source # @!attribute start # @return [Time] start time of this report # @!attribute end # @return [Time] end time of this report module Configurable attr_accessor :start, :end def setup(options) ...
true
ab8609c7acd5fdbedc7326ebe01df5787f3faae1
Ruby
haveanicedavid/Enigma
/lib/shifter.rb
UTF-8
397
3.640625
4
[]
no_license
class Shifter def initialize(shift, character_map = "abcdefghijklmnopqrstuvwxyz0123456789 .,") i = shift % character_map.size @encrypt_map = character_map[i..-1] + character_map[0...i] @decrypt_map = character_map end def encrypt(string) string.tr(@decrypt_map, @encrypt_map) end...
true
20efd797cabbedcb926d5f86bc7b6516f08ebdf8
Ruby
bkutil/exploring_quickcheck
/test/red_black_tree_fm_test.rb
UTF-8
1,788
3.0625
3
[]
no_license
require 'test_helper' require 'finite_machine' require 'test_helper' require_relative '../lib/red_black_tree' class RedBlackTreeFmTest < Minitest::Test def test_rb_tree m = TestMachine.new 1.upto(100) do |n| m.restore! n.times do m.next(rand) end assert_equal m.tree.length, m...
true
b1224d243880a4a268b2c1331ca6b346fdd77728
Ruby
tenforwardconsulting/jefferies_tube
/lib/jefferies_tube/console.rb
UTF-8
863
2.515625
3
[ "MIT" ]
permissive
class JefferiesTube::Console def self.prompt_base rails_env = JefferiesTube.configuration.environment if rails_env color = "\e[0m" #Default to white text on no background current_app = JefferiesTube.configuration.prompt_name if rails_env == "development" elsif rails_env == "dev" ...
true
e54659a707c1d1302c9f8411615a5008e7f9a4de
Ruby
brianmcgue/Red-Black-Tree
/spec/red_black_tree_spec.rb
UTF-8
6,822
3.28125
3
[]
no_license
require 'rspec' require 'red_black_tree' describe RBNode do describe "#initialize" do let(:n1) { RBNode.new(1) } it "sets value" do n1.value.should == 1 end it "sets color to red" do n1.color.should == :red end it "sets parent, left, and right to nil" do n1.parent.s...
true
4669c3cdce6b932ce33e546502d17935a8e1677c
Ruby
KeenanJT/backend_101_ls
/lesson_5/working_with_blocks.rb
UTF-8
7,386
4.5
4
[]
no_license
############################## Work With Blocks # There will be a lot of examples that need to be broken down. ########### Questions to ask when evaluating code # => What is the type of action being performs (method call, block, conditional, etc..)? # => What is the object that action is being performed on? # => What ...
true
3f792ad4822eb925c4bd69ae71b6498c34da9286
Ruby
treeman/madeoftree
/_plugins/generate_games.rb
UTF-8
4,264
2.859375
3
[ "MIT" ]
permissive
require_relative 'custom_page' module Jekyll class Game < Page def initialize(site, base, dir, game) super site, base, dir, game['base_file'] # Find a showcased screenshot if self.data['showcase'] game['screenshots'].each do |s| if s['filename'] == self.data['showcase'] ...
true
cdecfb76af7c9674b77186bf5f5aad2ca6cf6693
Ruby
theotherzach/exercism.io
/assignments/ruby/anagram/example.rb
UTF-8
276
3.546875
4
[]
no_license
class Anagram attr_reader :letters def initialize(subject) @letters = decompose subject end def match(candidates) candidates.select do |candidate| decompose(candidate) == letters end end private def decompose(s) s.chars.sort end end
true
946396d656409382e5c4b39ab2c50bab761aca4c
Ruby
evolbeginner/packages
/SSW/lib/util.rb
UTF-8
1,088
2.53125
3
[]
no_license
#! /usr/bin/env ruby def getSpeciesNameRela(infiles) out2in = Hash.new in2out = Hash.new infiles.each do |infile| in_fh = File.open(infile, 'r') in_fh.each_line do |line| line.chomp! names = line.split("\t") outName, inName = names out2in[outName] = inName in2out[inName] = ...
true
c230331e2a957c7690d44c058e14aecbe346c41f
Ruby
CorbanR/sanctum
/lib/sanctum/vault_transit.rb
UTF-8
2,814
2.6875
3
[ "MIT" ]
permissive
require 'base64' require 'pathname' module Sanctum class VaultTransit extend Colorizer def self.encrypt(vault_client, secrets, transit_key) transit_key = Pathname.new(transit_key) secrets.each do |k, v| v = encode(v.to_json) #TODO: Fix this.... v = vault_client.logical.w...
true
61a9390c10e6c6881dab34a598b59ac7dce4c364
Ruby
adambonsu/one44-cli
/lib/one44-cli/optparse.rb
UTF-8
1,325
2.671875
3
[]
no_license
# frozen_string_literal: true module One44 module CLI module Optparse require 'optparse' class Parser def self.parse(args) options = {} option_parser = OptionParser.new do |opts| opts.on('-r', '--random-sort-questions') do options[:random_sort_qu...
true
71e2354279387e2f441b3b1cabf6d40d4c924043
Ruby
mainangethe/learn-to-code-w-ruby-bp
/section_20/instance_methods_over_instance_variables.rb
UTF-8
1,689
3.859375
4
[]
no_license
# Always refer to instance methods over instance variables # when referrencing variables class BankAccount def initialize @amount = 500000 end def status "Your bank account has a total of KES #{amount}" end private def amount @amount / 100 #pseudo variables - don't actu...
true
3a8fcf68a3b9c6ed147d6d9d8d1e4225d8bea2e0
Ruby
rmagick/rmagick
/spec/rmagick/image/distortion_channel_spec.rb
UTF-8
1,982
2.5625
3
[ "MIT" ]
permissive
RSpec.describe Magick::Image, '#distortion_channel' do it 'works' do image1 = described_class.new(20, 20) metric = image1.distortion_channel(image1, Magick::MeanAbsoluteErrorMetric) expect(metric).to be_instance_of(Float) expect(metric).to eq(0.0) expect { image1.distortion_channel(image1, Magic...
true
6d4c3f61a5d621274355e293d0b1cca6c2f88aa6
Ruby
mono0x/greeting.sucretown.net
/lib/purolandgreeting/difference.rb
UTF-8
697
2.953125
3
[ "MIT" ]
permissive
module PurolandGreeting class Difference def initialize(added, deleted) @added = added @deleted = deleted end def empty? @added.empty? && @deleted.empty? end def added_by_greeting by_greeting @added end def deleted_by_greeting by_greeting @deleted end ...
true
1048c33c1e4f0f987dc8815d2d15512cfe3dab30
Ruby
doc/ruby-dtrace
/lib/dtrace/provider.rb
UTF-8
7,257
2.65625
3
[ "MIT" ]
permissive
# # Ruby-Dtrace # (c) 2008 Chris Andrews <chris@nodnol.org> # require 'dtrace' require 'dtrace/dof' require 'dtrace/probe' require 'dtrace/provider/probedef' require 'dtrace/provider/klass' class Dtrace # A DTrace provider. Allows creation of USDT probes on a running # Ruby program. You can use this with a Ruby ...
true
9ad3c07a4d1155015c6e56558a85ac5fdefa9a83
Ruby
kechako/zip4win-ruby
/lib/zip4win/zip.rb
UTF-8
2,269
2.71875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- require 'zip4win/version' require 'optparse' require 'pathname' require 'unf' require 'zip' module Zip4win class Zip def initialize @options = {} init_zip end def run exit_code = 0 if parse_params exit_code = 2 unless create_zip else ...
true
10ac4eb2eba3b6fc30383b986dbec99d3729ca91
Ruby
enix12enix/rstat.us
/app/decorators/author_decorator.rb
UTF-8
985
2.515625
3
[ "CC0-1.0", "LicenseRef-scancode-public-domain-disclaimer" ]
permissive
class AuthorDecorator < ApplicationDecorator decorates :author # Creates a div with class avatar that contains the image tag linked # to the user's page def avatar h.content_tag "div", :class => "avatar" do h.link_to( h.image_tag(avatar_src, :class => "photo user-image", :alt => "avatar"), ...
true
151ace09207a10ab5530fd84e77359631438b2ee
Ruby
luke-gru/covet
/lib/covet/run_list_printer.rb
UTF-8
2,049
2.78125
3
[]
no_license
require 'json' module Covet # Used to format the printed output of the run list, when printing instead # of executing the run list. class RunListPrinter def initialize(to_run, options = {}) @to_run = to_run # @var Array @must_run_all_test_files = options[:must_run_all_test_files] @print_for...
true
c86a585c49f3ebd8ec0a01b05aae1929ffd7925b
Ruby
SissyWang/BackEnd_101
/exercise_easy/triangle.rb
UTF-8
290
3.4375
3
[]
no_license
SPACE = ' ' STAR = '*' def trangel(n) var = n loop do puts SPACE * (var - 1) + STAR * (n - var + 1) var -= 1 break if var == 0 end end puts trangel(50) #1. figure our the relation between space and stars #2. fugure out how to draw it on to the screen
true
57cc00a075068da92fe9bdeab23f0d2e52555a53
Ruby
Archipo/Ruby
/exo_09.rb
UTF-8
198
3.53125
4
[]
no_license
puts "Bonjour, quel est ton prénom ?" user_name_1 = gets.chomp puts "Pourrais-tu me donner ton nom également ?" user_name_2 = gets.chomp puts "Bonjour, " + user_name_1 + " " + user_name_2 + " !"
true
379badf7519b794054f696615125f88234b6d4ed
Ruby
JY8752/RPP
/back/app/lib/exceptions/api_common_error.rb
UTF-8
429
2.515625
3
[]
no_license
# APIで発生する共通エラー module Exceptions class ApiCommonError < StandardError attr_accessor(:code) attr_accessor(:message) attr_accessor(:details) attr_accessor(:status) def initialize(code, message, details: nil, status: 400) @code = code @message = me...
true
9f27f6be5ca5e2615b72b970327473a10addeb64
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/bob/69b56d6546a84fd680883d607b78b517.rb
UTF-8
1,176
4.03125
4
[]
no_license
class Bob def initialize @checks = [EmptyCheck, ShoutingCheck, QuestionCheck] end def hey(sentence) @check_chain = @checks.reverse.inject(TerminalCheck.new) { |acc, klass| klass.new(acc) } @check_chain.respond_or_pass_on(sentence) end #Adds a check at the end of the chain def <<(check) @ch...
true
45958595e2b063a4311277e9571ed7156cf090dc
Ruby
Bumbledebee/hangman
/lib/word.rb
UTF-8
459
3.96875
4
[]
no_license
require 'pry' class Word attr_reader :word def initialize(wordbank) if wordbank.class != Array raise "Sorry, enter wordbank as array" end wordbank.each do |word| if word.class != String raise "Sorry, strings only" end if word !~ (/\A[a-zA-Z]+\z/) raise "Sorry,...
true
4a06de24eaec14ac95ed09ca4b3327d656588064
Ruby
rubyworks/quarry
/lib/quarry/template/directory.rb
UTF-8
2,036
3
3
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "Ruby" ]
permissive
module Quarry class Template class Directory # IGNORE = [TEMPLATE_DIRECTORY, '.', '..', '.git', '.hg', '.svn', '_darcs'] # def initialize(template, path) @template = template @path = Pathname.new(path) end # # The template object for this directory....
true
9c7e4dc61dfe860b09e52c2025b1863d0890fb5c
Ruby
godiaz/LOOP_BEAUTY
/app/models/basket_product.rb
UTF-8
2,089
2.625
3
[]
no_license
class BasketProduct < ApplicationRecord belongs_to :basket belongs_to :product belongs_to :shade def convert_to_order_product OrderProduct.new( product: product, shade: shade, quantity: quantity, purchase_with_credit: purchase_with_credit ) end def purchase_with_credit? ...
true
41e05c5d3f804008e6615fe8c94a62e03868c8e4
Ruby
abrieff/bang
/db/seeds.rb
UTF-8
1,381
2.671875
3
[]
no_license
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies', 'Movie.create(['{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # ...
true
51a2b3a844645de9e3e45e6fe4b82ad75339f09c
Ruby
bendeloyola/ruby_activity
/lesson_1/iterate_array.rb
UTF-8
66
3.328125
3
[]
no_license
array = [1,2,3,4,5,6,7,8,9,10] array.each do |n| puts n end
true
7aa58edec4cb854b1daffe7ec53cd3c08a1847db
Ruby
gzigzigzeo/ruby-xdr
/lib/xdr/dsl/enum.rb
UTF-8
599
2.703125
3
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
module XDR::DSL::Enum def member(name, value) raise ArgumentError, "#{self} is sealed" if self.sealed raise ArgumentError, "#{value} is not Integer" unless value.is_a?(Integer) raise ArgumentError, "#{value} is already used" unless name = name.to_s.underscore instance = new(name, value) se...
true
939d797e45b50def6f43b4c367c507ab86fe0167
Ruby
IgnesFatuus/Intro_to_Ruby
/Intro_to_Ruby_ls/Exercises/ch4_stuffs/ch4.rb
UTF-8
2,816
4.375
4
[]
no_license
#Exercise 1 =begin 1. (32 * 4) >= 129 => false 2. false != !true => false 3. true == 4 => false 4. false == (847 == '874') => true 5. (!true || (!(100 / 5) == 20) || ((328 / 4) == 82)) || false =>true =end #Exercise 2 =begin def tenplus(string) if string.is_a? String if string.length > 10 return string.upcase ...
true
40a28e4977cd63c22e01691a5154f606bda4447a
Ruby
maheshlakade148/rubyprogram
/rubyclass.rb
UTF-8
990
3.78125
4
[]
no_license
class Rubyclass def initialize(name, rank) @name= name.capitalize @rank= rank end def up @rank += 1 end def to_s "Name of movie #{@name} & rank is #{@rank } \n" end end class Playlist def initialize(name) @name= name @moviearray = [] end ...
true
b038a1ec235225227e130b0ad3e530bb0cf412ca
Ruby
jrmcgarvey/ruby_course
/bubble_sort.rb
UTF-8
383
3.40625
3
[]
no_license
def bubble_sort(a) while true changed=false a.each_index do |i| puts i if i<(a.length)-1 and a[i] > a[i+1] puts a[i].to_s + " is greater than " + a[i+1].to_s val=a.delete_at(i) puts "val is " + val.to_s a.insert(i+1,val) changed=true puts a.to_s ...
true
061b5d6a5154dce2215e6e0b4aeeb96183079c96
Ruby
rsmease/ruby-misc
/sandbox2.rb
UTF-8
290
3.53125
4
[]
no_license
def chain_blocks(start_val, proc1, proc2, &proc3) val1 = proc1.call(start_val) val2 = proc2.call(val1) val3 = proc3.call(val2) val3 end proc_add_1 = Proc.new {|num| num + 1} proc_add_2 = Proc.new {|num| num + 2} puts chain_blocks(1, proc_add_1, proc_add_2) do |num| num + 3 end
true
984fef21ebe7b2d0cdb0241cb052777976a9964f
Ruby
taahachaudhry/mksAlgorithms--Nodes-and-Graphs
/spec/graph_spec.rb
UTF-8
2,097
3.078125
3
[]
no_license
require 'rubygems' require 'rspec' require 'pry-debugger' require_relative '../graph.rb' describe "Graph" do before(:each) do @map = Graph.new # Adding Texas Cities @map.add_node("Dallas") @map.add_node("Austin") @map.add_node("San Antonio") @map.add_node("Houston") @map.add_node("El Pas...
true
082b3a84ab2799360755e0a30974bb9bff0f4df3
Ruby
kjjwhitlock/bookmarks-monday
/lib/bookmark.rb
UTF-8
729
2.703125
3
[]
no_license
require 'pg' class Bookmark def self.all if ENV['ENVIRONMENT'] == 'test' connection = PG.connect :dbname => 'bookmark_manager_test' else connection = PG.connect :dbname => 'bookmark_manager' end result = connection.exec('SELECT * FROM bookmarks') # newarray = [] # result.each do |element| # el...
true
76797a651cc5effa58907353b2a54f8526b3c7fc
Ruby
RJFryman/Ruby_Cal
/test/test_cal_integration.rb
UTF-8
1,999
2.859375
3
[]
no_license
require 'test/unit' require 'zeller' require 'month' def unix_whitespace_eliminator lines output = "" lines.each_line do |line| output.concat(line.rstrip + "\n") end return output end class CalIntergrationTest < Test::Unit::TestCase def test_12a_cal_intergration_month_error shell_output = `./cal 00 ...
true
78e8f55c1c7e4b75f73097e38209306879676d53
Ruby
ohinton/dictionary
/spec/word_spec.rb
UTF-8
1,750
3.1875
3
[ "MIT" ]
permissive
require('rspec') require('word') require('definition') describe(Word) do before() do Word.clear() end describe('#word') do it('returns the user provided word') do test_word = Word.new(:word => 'cat') expect(test_word.word()).to(eq('cat')) end end describe('#id') do it('returns t...
true
d174876069afb8b2fad10bb47a0043bd063f31a9
Ruby
tigershen23/reed
/app/models/domain/genre_repository.rb
UTF-8
853
3.0625
3
[]
no_license
module Domain # Repositories wrap existing data from the database in a domain object class GenreRepository def initialize(genre_class, genre_factory) @genre_class = genre_class @genre_factory = genre_factory end def find_by_id(id) record = @genre_class.where(id: id).includes(:books) ...
true
6a4476ac17ecfca3b33970df37a4368424e1fb76
Ruby
PADDY202/Practical
/main.rb
UTF-8
766
3.15625
3
[]
no_license
require_relative'agency' require_relative'curler' class Main male_curlers = [] female_curlers = [] i = 0 IO.foreach('men_curlers.txt') do |line| male_curlers[i] = line.split# convert strings to integers i = i + 1 end i = 0 IO.foreach('women_curlers.txt') do |line| female_curlers[i] = line.spl...
true
1d72d033ede52805e17cfaae6ee3194459e38d55
Ruby
veerasundaravel/Gravatar-Profile
/lib/gravatar_profile.rb
UTF-8
2,410
2.953125
3
[ "MIT" ]
permissive
require 'digest/md5' require 'net/http' require 'uri' require 'xmlsimple' class GravatarProfile DefaultOptions = { :rating => 'PG', :secure => false, :filetype => :png, :size => 80 } def gravatar_abbreviations { :size => 's', :default => 'd', :rating => 'r' } end ...
true
135171c16c5b973d17f20146f9053df46376fc1c
Ruby
DangerN/badges-and-schedules-denver-web-career-031119
/conference_badges.rb
UTF-8
457
3.84375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Write your code here. badges = [] def badge_maker(name) "Hello, my name is #{name}." end def batch_badge_creator(names) names.collect { |name| badge_maker(name) } end def assign_rooms(speaker) speaker.map.with_index { | x, i | "Hello, #{x}! You'll be assigned to room #{i+1}!"} end def printer(attendees) ...
true
a807b40e2b503c6bf37eafde1cfb886759e3f0b3
Ruby
mooreniemi/z3
/examples/sudoku
UTF-8
1,770
3.28125
3
[]
no_license
#!/usr/bin/env ruby require 'pathname' require_relative '../lib/z3' class SudokuProblem attr_reader :data, :solver, :unary_formulas, :binary_formulas def initialize(path) @data = Pathname(path).read.strip.split("\n").map do |line| line.split.map { |c| c == '_' ? nil : c.to_i } end @solver ...
true
056872dba93b87e4bcbc297f20c2336fa502aa38
Ruby
szpapas/iChad
/bin/mcu2.rb
UTF-8
1,530
2.890625
3
[]
no_license
#!/usr/bin/ruby $:<<'C:/Ruby187/lib/ruby/gems/1.8/gems/digest-crc-0.3.0/lib' require 'socket' require 'digest/crc16_modbus' if ARGV[0].nil? host = "127.0.0.1" else host = ARGV[0] end client = TCPSocket.open "192.168.0.18", 50000 recv_length = 1024 def set_k(cmd) ss, chr = "", "\000" code = cmd.split(" "...
true
b83be83fb5b5b09e071dcc85d95e79c715c9ee27
Ruby
yeenow123/search_index
/intersect_list.rb
UTF-8
2,670
3.109375
3
[]
no_license
require 'benchmark' require 'ostruct' #Passage from 'A Tale of Two Cities' by Charles Dickens documents = ["Its abiding place was in all things fitted to it. A narrow winding street, full of offence and stench, with other narrow winding streets diverging, all peopled by rags and nightcaps, and all smelling of ra...
true
e70e8bef8ccaddecaec2f072c8aec70a6fae4b3c
Ruby
amyaturner/ls_ruby_basics_exercises
/06_user_input/01.rb
UTF-8
303
3.90625
4
[]
no_license
#1 # Q: Write a program that asks the user to type something in, after which your program should simply display what was entered. =begin $ ruby repeater.rb >> Type anything you want: This is what I typed. This is what I typed. =end puts "Enter something..." answer = gets.chomp puts answer # CORRECT
true
3e2a1ea65ddd0f64b0633b0f12fd194f3ee2e356
Ruby
Aram-Anderson/black_thursday
/lib/item_repo.rb
UTF-8
3,519
3.21875
3
[]
no_license
require 'csv' require_relative 'item' require_relative 'std_dev_math' require 'pry' class ItemRepo include StdDevMath attr_reader :items, :sales_engine def initialize(file, sales_engine) @items = [] @sales_engine = sales_engine create_items(file) end def create_items(file) ...
true
3776b144ae606d827e24874f87f88e0065d9587a
Ruby
Leviax7/ruby1-10
/calc.rb
UTF-8
249
3.34375
3
[]
no_license
year_hours = 365*24 puts year_hours.to_s + " hours in a year" decade_minutes = (year_hours * 60) * 10 puts "There are #{decade_minutes} minutes in a decade" myage = ((year_hours*60)*60) * 26 puts "I am #{myage} seconds old" puts "you're swell"
true
7559541a56df7e12d658b2fbb0ca0e8868386e0c
Ruby
jaredfrankel10/ruby-music-library-cli-v-000
/lib/Song.rb
UTF-8
1,383
2.9375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Song attr_accessor :name attr_reader :artist attr_reader :genre @@all = [] def initialize(name, artist = nil, genre = nil) @name = name self.artist = artist unless artist.nil? self.genre = genre unless genre.nil? end def create Song.new(name).tap(&:save) ...
true
d4ebbd98a3de99ebaeee0cd460cf3804748eaf59
Ruby
trikitrok/PaperRockScissorsInRubyUsingNoConditionals
/rock_paper_scissors_tests.rb
UTF-8
2,071
3.0625
3
[]
no_license
require File.join(File.dirname(__FILE__), "rock_paper_scissors") require 'test/unit' class TestRockPaperScissors < Test::Unit::TestCase def setup @game = Game.new @paper = Paper.new @rock = Rock.new @scissors = Scissors.new end def test_paper_against_paper assert_that( GameHand.with(@...
true
69f33ac786ef4cac38f5f84e87ed1e28ed776822
Ruby
docljn/advent2019
/spec/wire_spec.rb
UTF-8
953
3.0625
3
[ "MIT" ]
permissive
# frozen_string_literal: true require './lib/wire' RSpec.describe Wire do it "starts at 0,0" do wire = Wire.new expect(wire.path).to eq([[0,0]]) end it "has many instructions" do wire = Wire.new(['R5', 'L5']) expect(wire.instructions).to eq([Instruction.new('R5'), Instruction.new('L5')]) end...
true
b3768c58e869226915052b7af088cb4826a742f4
Ruby
ZeroOnePro/RubyMarket
/app/models/line_item.rb
UTF-8
349
2.546875
3
[]
no_license
class LineItem < ApplicationRecord belongs_to :item, optional: true # 상품 삭제되도 주문목록에는 남아있어야 belongs_to :order, optional: true # 주문이 삭제되면 주문목록도 같이 삭제 after_destroy :set_order_total def set_order_total self.order.update(total: self.order.line_items.sum("price")) end end
true
9abb8cdb6e8cbd0d64814708696261db5e87dc3b
Ruby
Barak-S/ruby-enumerables-cartoon-collections-lab-nyc-web-102819
/cartoon_collections.rb
UTF-8
681
3.5625
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def roll_call_dwarves(dwarfs)# code an argument here # Your code here #dwarfs = ["Doc", "Dopey", "Bashful", "Grumpy"] dwarfs.each_with_index do | name , index | puts "#{index + 1} #{name}" end end def summon_captain_planet(array_calls) array_calls.collect do |call| call.capitalize + "!" end end de...
true
040f7f53175503dc58ff8498f21b1fb736f6cd35
Ruby
NomadicNibbler/foodtruck_be
/app/poros/truck.rb
UTF-8
2,943
2.875
3
[]
no_license
class Truck attr_reader :lat, :long, :name, :distance, :logo, :payment_methods, :website, :socials, :phone, :description, :display, :id, :description_...
true
9566979c521536fc2ef32e8a30bb26eb763771e5
Ruby
danarmulder/gCamp
/app/controllers/pages_controller.rb
UTF-8
1,148
2.59375
3
[]
no_license
class PagesController < ApplicationController def about end def faq faq1 = Faq.new('What is gCamp?', 'gCamp is an awesome tool that is going to change your life. gCamp is your one stop shop to organize all your tasks and documents. You\'ll also be able to track comments that you and others make. gCamp ma...
true
c32da01c72c80737f9a89eb415c8dd4dfb8a174f
Ruby
SuhasPradhan/SuhasPradhan
/BackEnd/Ruby/excercise_2.rb
UTF-8
267
2.84375
3
[]
no_license
class Myself def my_name puts "My name is Suhas Pradhan" end def my_occupation puts "Trainee @ Qwinix Technologies mysore" end def my_achievement puts "Waiting for user input" end end disp= Myself.new disp.my_name disp.my_occupation disp.my_achievement
true
0ae5beaebdbf165496735b40fe8f657cf04a42b7
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/bob/240ae74879d548f5952b3a5560bd0e62.rb
UTF-8
916
3.546875
4
[]
no_license
class Bob def hey(said) if shouting(said) || asking_forceful_question(said) 'Woah, chill out!' elsif asking_a_question(said) || prattling_on(said) 'Sure.' elsif silence(said) 'Fine. Be that way!' else 'Whatever.' end end def shouting(said) said == said.upcase unle...
true
3c0ddd8b100b164b43cfdea995430795527f845a
Ruby
issamok3/price_is_right
/price_is_right.rb
UTF-8
190
3.21875
3
[]
no_license
computer_number = rand(5) puts "Can you guess?" user_number = gets.chomp.to_i while user_number != computer_number puts "Try again!" user_number = gets.chomp.to_i end puts "you win!"
true
8d6ddca9aaac74a8679cdc6cf3e8f95fe8527409
Ruby
learn-academy-2019-bravo/ruby-assessments-CityMiles
/ruby.rb
UTF-8
3,258
4.875
5
[]
no_license
# Ruby Assessments ##### 1. Use two different Ruby loops to loop over this array, multiplying each element by 2. tempArray = [1, 2, 6, 9, 3, 21] tempArray.each do |el| puts el * 2 end # 2 # 4 # 12 # 18 # 6 # 42 # returns => [2, 4, 12, 18, 6, 42] tempArray.each_with_index() { |element, index| puts element * 2...
true
5c31454aa46b78512e2fced000f98b73308a6ed5
Ruby
konyan/learn-algo-daily
/ruby/cavity_map.rb
UTF-8
982
3.359375
3
[]
no_license
def cavityMap(grid) org_arr = [] result = [] grid.each do |val| arr = val.split("") org_arr << arr end org_arr.each_with_index do |val,index| unless index == 0 || index == org_arr.length-1 val.each_with_index do |child,childIndex| unless childIndex == 0 || childIndex == val.length ...
true
be77e6d8d20b08658903a361b535248f5eda7daf
Ruby
chrisstankus99/museo_2001
/lib/photograph.rb
UTF-8
262
2.75
3
[]
no_license
class Photograph attr_reader :id, :name, :artist_id, :year def initialize(photograph_params) @id = photograph_params[:id] @name = photograph_params[:name] @artist_id = photograph_params[:artist_id] @year = photograph_params[:year] end end
true
13fa68986e47ea810dffa91428390b2e8e9178dd
Ruby
fscarpin/project-management-app
/app/models/plan.rb
UTF-8
236
2.671875
3
[]
no_license
class Plan PLAN_FREE = "free" PLAN_PREMIUM = "premium" PLANS = [PLAN_FREE, PLAN_PREMIUM] def self.get_options options = Array.new PLANS.each { |plan| options << [plan.capitalize, plan] } return options end end
true
70b94128138dbd4fcdd7a21ab9b760b8751aa145
Ruby
jalerson/catawiki
/spec/lib/surface_spec.rb
UTF-8
607
2.8125
3
[]
no_license
RSpec.describe Surface do context 'initialization' do context 'positive x and y' do it 'builds an instance' do surface = Surface.new(5, 2) expect(surface.x).to eq(5) expect(surface.y).to eq(2) end end context 'x is zero' do it 'raises an ArgumentError' do ...
true
910cd3123b13ce9c087baa5e70beccdc4f21da26
Ruby
lizconlan/uk-constituencies
/lib/test.rb
UTF-8
2,394
2.859375
3
[]
no_license
require 'rubygems' require 'rest_client' require 'json' result = RestClient.get("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D'http%3A%2F%2Fwww.leighrayment.com%2Fcommons%2FAcommons3.htm'%20and%20xpath%3D%22%2F%2Ftr%22&format=json&diagnostics=false") values = JSON.parse(result.bo...
true
b5135660a00c60ab6b21d79485a4cc180e74e513
Ruby
maribethpierce/Dictionary-Sorter
/unique_sequence_extractor.rb
UTF-8
1,229
3.65625
4
[]
no_license
require 'pry' long_list = File.open "dictionary" class UniqueSequenceExtractor attr_reader :words def initialize(dictionary_file_path) @dictionary_file_path = dictionary_file_path @words = read_words_from_file end def output_unique_sequences File.open('sequences.txt', 'w') do |f| f.puts sel...
true
d71b1daf8367bd27521a11f618934b6828f18f48
Ruby
priceflex/squeel
/lib/squeel/nodes/key_path.rb
UTF-8
2,939
2.625
3
[ "MIT" ]
permissive
require 'squeel/nodes/operators' require 'squeel/nodes/predicate_operators' module Squeel module Nodes class KeyPath include PredicateOperators include Operators attr_reader :path, :endpoint def initialize(path, endpoint, absolute = false) @path, @endpoint = path, endpoint ...
true
c34677eb16e20ab1e12fc9e7183116094e3a8b30
Ruby
tallkeith/OO-t3
/player.rb
UTF-8
867
3.96875
4
[]
no_license
require "pry" class Player def initilaize end def num_players puts "How many players? Choose 0 - 2" @players = gets.chomp.to_i @players end def name puts "What is your name?" @player_name = gets.chomp @player_name end def choose_piece puts "Would you like to be 'X' or 'O'?" marker = get...
true
822af33efe9de11cc8fb1bcd82b7622887f66420
Ruby
dpalumbo/codeeval
/moderate/point_in_circle.rb
UTF-8
228
3
3
[]
no_license
File.open(ARGV[0]).each_line do |line| center_x, center_y, radius, point_x, point_y = line.gsub(/[A-Za-z]|:|;|,|\(|\)/,"").strip.split.map(&:to_f) puts (point_x - center_x) ** 2 + (point_y - center_y) ** 2 <= radius ** 2 end
true
d3d6b0dc910b0017e9ee5877caf9556de0903207
Ruby
matharotheelf/mega_lotto_trial
/spec/mega_lotto_trial/drawing_spec.rb
UTF-8
806
2.734375
3
[ "MIT" ]
permissive
require "spec_helper" module MegaLottoTrial RSpec.describe Drawing do describe '#draw' do let(:drawing) { Drawing.new.draw } let(:drawing_two) { Drawing.new.draw } it 'returns an Array' do expect(drawing).to be_a(Array) end it 'returns an Array with 5 elements' do ...
true
a98c7c332284e4dc16296dbf988e8b0055c96097
Ruby
Laguna1/ttt-5-move-rb-bootcamp-prep-000
/spec/01_input_to_index_spec.rb
UTF-8
575
3.25
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_relative "../lib/move.rb" describe '#input_to_index' do it 'converts a user_input to an integer'do user_input = "1" converted_input = input_to_index(user_input) expect(converted_input).to be_a(Integer) end it 'subtracts 1 from the user_input' do user_input = "6" converted_input...
true
c2f1ecbe7548eea5a8eec29fb669f7d9254f9f92
Ruby
slockey/rogueby
/screens/game_screen.rb
UTF-8
590
2.8125
3
[]
no_license
class GameScreen def initialize(game, ui, options) @game = game @ui = ui @options = options @messages = Messages[:game] end def render ui.clear ui.message(0, 0, messages[:title]) handle_choice prompt end private attr_reader :ui, :options, :messages def prompt ui.choic...
true
2bb406e9cdca4e1f855faf44ffe7766bf8aea770
Ruby
kylewelt/project-euler-multiples-3-5-web-042417
/lib/multiples.rb
UTF-8
276
3.390625
3
[]
no_license
# Enter your procedural solution here! def collect_multiples(limit) numbers = Array(1..limit-1) final = numbers.collect do |num| if (num%3 == 0 || num%5 == 0) num end end.compact end def sum_multiples(limit) collect_multiples(limit).reduce(0, :+) end
true
deaf29d5ef486db46d9fe63617b42287499864f5
Ruby
urieljuliatti/csv_record
/lib/csv_record/validations.rb
UTF-8
2,047
2.6875
3
[ "MIT" ]
permissive
module CsvRecord module Validations module ClassMethods [:presence, :uniqueness].each do |kind| define_method "fields_to_validate_#{kind}" do eval "@fields_to_validate_#{kind} || []" end define_method "__validates_#{kind}_of__" do |*attr_names| eval "@fields_to_v...
true
5a024cfdef900e8e1ea03bbb02be595279d7b1de
Ruby
danrodz/school-domain-houston-web-071618
/lib/school.rb
UTF-8
363
3.640625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# code here! class School attr_reader :roster def initialize(name) @name = name @roster = {} end def add_student(student, grade) roster.include?(grade) ? roster[grade] << student : roster[grade] = [student] end def grade(grade) roster[grade] end def sort roster.each do |grade,...
true
da4839f6d685d34f7d1cae022ae6ccc4e942fd06
Ruby
hiendinhngoc/TheOdinProject
/the_back_end/01_temperature/temperature.rb
UTF-8
96
3.078125
3
[]
no_license
def ftoc(x) x = (x - 32) * 5.0 / 9.0 end def ctof(x) x = (x * 9.0 / 5.0) + 32 end p ctof(100)
true
a43f5bb0741f66187491eecef3c27677c9df026b
Ruby
estantevirtual/opsworks-cookbooks
/opsworks_commons/libraries/package_info.rb
UTF-8
2,816
2.765625
3
[ "Apache-2.0" ]
permissive
# # Create a common interface for the current package manager module OpsWorks # discover installed packages module PackageDiscovery def installed_packages cmdline = case platform_family when 'rhel' "rpm -qa --queryformat '%{NAME} %{VERSION}\n'" when 'debian' "dpkg-query -W -f=...
true