source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
cldwalker/irbfiles
https://github.com/cldwalker/irbfiles
boson/lib/redirect_follower.rb
Ruby
mit
48
master
1,231
# explained here: http://railstips.org/2009/3/4/following-redirects-with-net-http # original version: http://github.com/jnunemaker/columbus/blob/4f5199e2a778563ffc208e314c8879ee13245e6b/lib/columbus/redirect_follower.rb class RedirectFollower class TooManyRedirects < StandardError; end attr_accessor :url, :redirec...
github
cldwalker/irbfiles
https://github.com/cldwalker/irbfiles
boson/lib/searchable_array.rb
Ruby
mit
48
master
1,574
# Searches array of hashes (anything responding to to_hash) with a hash or string module SearchableArray # attr_accessor :default_search_field def find_by(search_hash) @search_proc = nil @search_mode = :exact results = hash_search(search_hash) results.is_a?(Array) ? results[0] : results end de...
github
cldwalker/irbfiles
https://github.com/cldwalker/irbfiles
boson/lib/rubygems/specification_hack.rb
Ruby
mit
48
master
2,237
# Overriding til github fixes their Marshal index class Gem::Specification def self._load(str) array = Marshal.load str spec = Gem::Specification.new spec.instance_variable_set :@specification_version, array[1] current_version = CURRENT_SPECIFICATION_VERSION begin field_count = if spec.spec...
github
cldwalker/irbfiles
https://github.com/cldwalker/irbfiles
boson/test/test_helper.rb
Ruby
mit
48
master
321
require 'rubygems' require 'test/unit' require 'context' #gem install jeremymcanally-context --source http://gems.github.com require 'matchy' #gem install jeremymcanally-matchy --source http://gems.github.com require 'rr' $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) class Test::Unit::TestCase end
github
cldwalker/irbfiles
https://github.com/cldwalker/irbfiles
boson/test/menu_test.rb
Ruby
mit
48
master
462
require File.join(File.dirname(__FILE__), 'test_helper') require 'commands/exp/plugins/menu' require 'boson' class MenuTest < Test::Unit::TestCase def create_menu(options={}) options = { :items=>[], :env=>{:global_options=>{}} }.merge options Menu.new(options[:items], {}, options[:env]) end def run_menu...
github
cldwalker/irbfiles
https://github.com/cldwalker/irbfiles
boson/test/searchable_array_test.rb
Ruby
mit
48
master
1,629
require File.join(File.dirname(__FILE__), 'test_helper') require 'searchable_array' class SearchableArrayTest < Test::Unit::TestCase before(:all) { @sarray = ([{:name=>'dog', :color=>'red', :num=>1}, {:name=>'cat', :color=>'blue', :num=>1}]).extend SearchableArray } context "search" do test "returns bac...
github
cldwalker/irbfiles
https://github.com/cldwalker/irbfiles
boson/test/boson_test.rb
Ruby
mit
48
master
801
require File.join(File.dirname(__FILE__), 'test_helper') require 'commands/public/boson' # currently broken class BosonTest < Test::Unit::TestCase before(:all) { @higgs = Object.new.extend ::BosonLib # # reset_boson # @higgs = Boson.main_object # ancestors = class <<Boson.main_object; self end.ancest...
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
unicode_math.gemspec
Ruby
mit
48
master
683
# encoding: utf-8 $:.push File.expand_path("../lib", __FILE__) require "unicode_math/version" Gem::Specification.new do |gem| gem.name = 'unicode_math' gem.version = UnicodeMath::VERSION gem.author = 'Collective Idea' gem.email = 'info@collectiveidea.com' gem.description = %(Fun Ruby extension...
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
lib/unicode_math/set.rb
Ruby
mit
48
master
737
# encoding: utf-8 module UnicodeMath module Set def self.included(base) base.class_eval do define_method('∩') do |set| self & set end define_method('∪') do |set| self | set end define_method('⊂') do |set| ((set.∩ self) == self) ...
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
lib/unicode_math/multiplication.rb
Ruby
mit
48
master
280
# encoding: utf-8 module UnicodeMath module Multiplication def self.included(base) base.class_eval do define_method('×') do |multiplier| self * multiplier end end end end end Numeric.send(:include, UnicodeMath::Multiplication)
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
lib/unicode_math/factorial.rb
Ruby
mit
48
master
349
# encoding: utf-8 module UnicodeMath module Factorial def self.included(base) base.class_eval do define_method('!') do fact = 1 (self).downto(1) do |i| fact = fact * i end fact end end end end end Numeric.send(:incl...
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
lib/unicode_math/constants.rb
Ruby
mit
48
master
1,093
# encoding: utf-8 module UnicodeMath module Constants def self.included(base) base.class_eval do %w(π ϖ 𝛑 𝛡 𝜋 𝜛 𝝅 𝝕 𝝿 𝞏 𝞹 𝟉).each do |pi| define_method(pi) do Math::PI end end %w(τ 𝛕 𝜏 𝝉 𝞃 𝞽).each do |tau| define_method(tau) ...
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
lib/unicode_math/roots.rb
Ruby
mit
48
master
417
# encoding: utf-8 module UnicodeMath module Roots def self.included(base) base.class_eval do define_method('√') do |number| Math.sqrt number end define_method('∛') do |number| Math.cbrt number end define_method('∜') do |number| number...
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
lib/unicode_math/fractions.rb
Ruby
mit
48
master
1,180
# encoding: utf-8 module UnicodeMath module Fractions def self.included(base) base.class_eval do # Half define_method '½' do 0.5 end # Thirds define_method '⅓' do 1.0 / 3 end define_method '⅔' do 2.0 / 3 end ...
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
lib/unicode_math/division.rb
Ruby
mit
48
master
344
# encoding: utf-8 module UnicodeMath module Division def self.included(base) base.class_eval do define_method('÷') do |divisor| self / divisor end define_method('⟌') do |dividend| dividend / self end end end end end Numeric.send(:include, Un...
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
lib/unicode_math/trigonometry.rb
Ruby
mit
48
master
271
# encoding: utf-8 module UnicodeMath module Trigonometry def self.included(base) base.class_eval do define_method('∿') do |number| Math.sin number end end end end end Kernel.send :include, UnicodeMath::Trigonometry
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
lib/unicode_math/sigma.rb
Ruby
mit
48
master
331
# encoding: utf-8 module UnicodeMath module Sigma def self.included(base) base.class_eval do define_method('Σ') do |enum| enum.inject(:+) end define_method('Π') do |enum| enum.inject(:*) end end end end end Kernel.send(:include, UnicodeMath:...
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
lib/unicode_math/exponents.rb
Ruby
mit
48
master
956
# encoding: utf-8 module UnicodeMath module Exponents def self.included(base) base.class_eval do define_method('⁰') do 1 end define_method('¹') do self end define_method('²') do self ** 2 end define_method('³') do ...
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
lib/unicode_math/fractional_output.rb
Ruby
mit
48
master
876
# encoding: utf-8 module UnicodeMath module FractionalOutput def self.included(base) base.class_eval do alias_method :old_to_s, :to_s def to_s frac = case self % 1 when ⅛ then '⅛' when ⅙ then '⅙' when ⅕ then '⅕' when ¼ th...
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
spec/unicode_math/constants_spec.rb
Ruby
mit
48
master
527
# encoding: utf-8 require 'spec_helper' describe UnicodeMath::Constants do it 'defines π' do expect(π).to be_within(0.00005).of(3.1416) end it 'defines τ' do expect(τ).to eq(2 * π) end it 'defines 𝑒' do expect(𝑒).to be_within(0.00005).of(2.7183) end it 'defines 𝑖' do expect(𝑖 * 𝑖...
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
spec/unicode_math/factorial_spec.rb
Ruby
mit
48
master
273
# encoding: utf-8 require 'spec_helper' describe UnicodeMath::Factorial do it 'calculates factorial of 0' do expect(0.!).to eq(1) end it 'calculate factorial' do expect(2.!).to eq(2) end it 'calculates factorial' do expect(4.!).to eq(24) end end
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
spec/unicode_math/root_spec.rb
Ruby
mit
48
master
371
# encoding: utf-8 require 'spec_helper' describe UnicodeMath::Roots do it 'defines √ to take square roots' do result = √ 25 expect(result).to eq(5.0) end it 'defines ∛ to take square roots' do result = ∛ 8 expect(result).to eq(2) end it 'defines ∜ to take square roots' do result = ∜ 81...
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
spec/unicode_math/fractional_output_spec.rb
Ruby
mit
48
master
1,555
# encoding: utf-8 require 'spec_helper' describe UnicodeMath::FractionalOutput do it 'displays one half as ½' do expect((1.0/2).to_s).to eq('½') end describe 'thirds' do it 'displays one third as ⅓' do expect((1.0/3).to_s).to eq('⅓') end it 'displays two thirds as ⅔' do expect((2.0...
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
spec/unicode_math/fractions_spec.rb
Ruby
mit
48
master
1,480
# encoding: utf-8 require 'spec_helper' describe UnicodeMath::Fractions do it 'defines ½ to equal 0.5' do expect(½).to eq(0.5) end describe 'thirds' do it 'defines ⅓ to equal one third' do expect(⅓).to be_within(0.00001).of(0.33333) end it 'defines ⅔ to equal two thirds' do expect(...
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
spec/unicode_math/set_spec.rb
Ruby
mit
48
master
1,747
# encoding: utf-8 require 'spec_helper' describe UnicodeMath::Set do before do @primes = [2, 3, 5, 7] @odd_nums = [3, 5, 7, 9] @superset = [1,2,3,4,5] @subset = [3,5] end it 'defines the intersection operator: ∩' do intersection = @primes.∩ @odd_nums expect(intersection).to eq([3, 5...
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
spec/unicode_math/exponents_spec.rb
Ruby
mit
48
master
864
# encoding: utf-8 require 'spec_helper' describe UnicodeMath::Exponents do it 'raises to the zero power' do expect(2.⁰).to eq(1) end it 'raises to the first power' do expect(2.¹).to eq(2) end it 'squares' do expect(2.²).to eq(4) end it 'cubes' do expect(2.³).to eq(8) end it 'rais...
github
collectiveidea/unicode_math
https://github.com/collectiveidea/unicode_math
spec/unicode_math/sigma_spec.rb
Ruby
mit
48
master
531
# encoding: utf-8 require 'spec_helper' describe UnicodeMath::Sigma do it 'defines Σ to sum up elements of array' do result = Σ [1, 2, 3, 4] expect(result).to eq(10) end it 'defines Σ to sum up elements of range' do result = Σ (1..10) expect(result).to eq(55) end it 'defines Π to multiply ...
github
Selleo/business_process
https://github.com/Selleo/business_process
business_process.gemspec
Ruby
mit
48
master
740
# encoding: utf-8 $:.unshift File.expand_path('../lib', __FILE__) require 'business_process/version' Gem::Specification.new do |gem| gem.name = "business_process" gem.version = BusinessProcess::VERSION gem.authors = ["stevo"] gem.email = ["blazejek@gmail.com"] gem.homepage ...
github
Selleo/business_process
https://github.com/Selleo/business_process
spec/business_process/base_spec.rb
Ruby
mit
48
master
3,085
require 'spec_helper' require 'business_process/base' class BusinessProcessSubclassFactory def self.get(*requirements) Class.new(BusinessProcess::Base).tap do |klass| requirements.each { |requirement| klass.needs requirement } klass.send(:define_method, :call, -> { requirements.map { |requirement| se...
github
Selleo/business_process
https://github.com/Selleo/business_process
lib/business_process/base.rb
Ruby
mit
48
master
2,563
module BusinessProcess class Base class_attribute :steps_queue, :requirements attr_accessor :result attr_reader :parameter_object, :error private :result=, :parameter_object def self.call(parameter_object) new(parameter_object).tap do |business_process| business_process.instance_eva...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
rubocop-magic_numbers.gemspec
Ruby
mit
48
main
961
# frozen_string_literal: true $LOAD_PATH << File.expand_path('lib', __dir__) require 'rubocop/magic_numbers/version' Gem::Specification.new do |s| s.name = 'rubocop-magic_numbers' s.version = RuboCop::MagicNumbers::VERSION s.summary = 'rubocop/magic_numbers implements a rubocop cop for detecting the use ' \ ...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
Gemfile
Ruby
mit
48
main
366
# frozen_string_literal: true source 'https://rubygems.org' git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } # Specify your gem's dependencies in rubocop-require_tools.gemspec gemspec # Development dependencies gem 'byebug' gem 'minitest' gem 'minitest-color' gem 'rake' gem 'rubocop-minitest' g...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
Rakefile
Ruby
mit
48
main
287
# frozen_string_literal: true require 'bundler/gem_tasks' require 'rake/testtask' Rake::TestTask.new(:test) do |t| t.libs << 'test' t.libs << 'lib' t.test_files = FileList['test/**/*_test.rb'] end require 'rubocop/rake_task' RuboCop::RakeTask.new task default: %i[test rubocop]
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
lib/rubocop/magic_numbers.rb
Ruby
mit
48
main
303
# frozen_string_literal: true require 'rubocop/magic_numbers/version' require 'rubocop/cop/magic_numbers/base' require 'rubocop/cop/magic_numbers/no_argument' require 'rubocop/cop/magic_numbers/no_assignment' require 'rubocop/cop/magic_numbers/no_default' require 'rubocop/cop/magic_numbers/no_return'
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
lib/rubocop/cop/magic_numbers/no_argument.rb
Ruby
mit
48
main
2,133
# frozen_string_literal: true require_relative 'base' module RuboCop module Cop module MagicNumbers # Adds violations for magic numbers when used as the argument to a method # # BAD: # object.bottles_on_the_wall(100) # # GOOD: # object.bottles_on_the_wall(DEFAULT_BOTTLE...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
lib/rubocop/cop/magic_numbers/no_default.rb
Ruby
mit
48
main
1,437
# frozen_string_literal: true require_relative 'base' module RuboCop module Cop module MagicNumbers # Adds violations for magic numbers, when used as default values for # arguments to methods # # BAD # def on_the_wall(bottles = 100) # # GOOD # def on_the_wall(bott...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
lib/rubocop/cop/magic_numbers/base.rb
Ruby
mit
48
main
2,439
# frozen_string_literal: true require 'rubocop' require 'rubocop/cop/cop' # rubocop:disable Lint/SuppressedException # This is only available in newer versions of the RuboCop gem begin require 'rubocop/cop/base' rescue LoadError end # rubocop:enable Lint/SuppressedException module RuboCop module Cop module Ma...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
lib/rubocop/cop/magic_numbers/no_assignment.rb
Ruby
mit
48
main
3,746
# frozen_string_literal: true require_relative 'base' module RuboCop module Cop module MagicNumbers # Adds violations for magic numbers, aka assignments to variables with # bare numbers, configurable by literal type. Can detect local, instance, # global, and setter assignment, and works on mul...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
lib/rubocop/cop/magic_numbers/no_return.rb
Ruby
mit
48
main
2,423
# frozen_string_literal: true require_relative 'base' module RuboCop module Cop module MagicNumbers # Raises an offense if a method returns with a magic number # Catches both explicit and implicit returns class NoReturn < RuboCop::Cop::MagicNumbers::Base MAGIC_NUMBER_RETURN_PATTERN = <...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/test_helper.rb
Ruby
mit
48
main
3,945
# frozen_string_literal: true require 'minitest/autorun' require 'minitest/color' require 'rubocop' require 'byebug' require 'rubocop/magic_numbers' module TestHelper FLOAT_LITERALS = %w[10.0 1e1 1.0E1].freeze INTEGER_LITERALS = %w[10 1_0].freeze ALL_LITERALS = (FLOAT_LITERALS | INTEGER_LITERALS).freeze def ...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/all_cops_test.rb
Ruby
mit
48
main
6,213
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers # These tests are to ensure that when all cops are enabled, only the # intended cop marks an offense class AllCopsTest < Minitest::Test # rubocop:disable Minites...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/base_test.rb
Ruby
mit
48
main
877
# frozen_string_literal: true require 'test_helper' module RuboCop module Cop module MagicNumbers class BaseTest < ::Minitest::Test def test_config_defaults config = RuboCop::Config.new('MagicNumbers/NoReturn' => { 'Enabled' => true }) cop = RuboCop::Cop::MagicNumbers::NoReturn...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_default/integer/method_arguments_test.rb
Ruby
mit
48
main
1,996
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoDefault module Integer class MethodArgumentsTest < Minitest::Test def test_detects_magic_numbers_used_as_positional_defaults matc...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_default/float/method_arguments_test.rb
Ruby
mit
48
main
2,104
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoDefault module Float class MethodArgumentsTest < Minitest::Test def test_detects_magic_numbers_used_as_positional_defaults matche...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_return/integer/no_return_test.rb
Ruby
mit
48
main
5,261
# frozen_string_literal: true require 'test_helper' require 'rubocop/cop/magic_numbers/no_return' module RuboCop module Cop module MagicNumbers module Integer class NoReturnTest < ::Minitest::Test ARBITRARY_INTEGER_TO_PERMIT = 5 def test_when_a_method_explicitly_returns_an_int...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_return/float/no_return_test.rb
Ruby
mit
48
main
5,213
# frozen_string_literal: true require 'test_helper' require 'rubocop/cop/magic_numbers/no_return' module RuboCop module Cop module MagicNumbers module Float class NoReturnTest < ::Minitest::Test ARBITRARY_FLOAT_TO_PERMIT = 5.0 def test_when_a_method_explicitly_returns_a_float ...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_argument/method_test.rb
Ruby
mit
48
main
2,958
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoArgument class MethodTest < Minitest::Test def test_ignores_methods_in_ignored_methods_config @config = RuboCop::Config.new({ ...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_argument/integer/method_test.rb
Ruby
mit
48
main
5,046
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoArgument module Integer class MethodTest < Minitest::Test ARBITRARY_INTEGER_TO_PERMIT = 5 def test_detects_magic_numbers_used_as_a...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_argument/float/method_test.rb
Ruby
mit
48
main
4,740
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoArgument module Float class MethodTest < Minitest::Test ARBITRARY_FLOAT_TO_PERMIT = 3.14 def test_detects_magic_numbers_used_as_ar...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_assignment/local_variable_test.rb
Ruby
mit
48
main
1,417
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoAssignment class LocalVariableTest < Minitest::Test def test_ignores_magic_numbers_assigned_to_local_vars_outside_of_methods matched_numerics.e...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_assignment/class_variable_test.rb
Ruby
mit
48
main
1,221
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoAssignment class ClassVariableTest < Minitest::Test def test_ignores_magic_numbers_assigned_to_class_variables_in_default_config cop_class = de...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_assignment/instance_variable_test.rb
Ruby
mit
48
main
1,435
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoAssignment class InstanceVariableTest < Minitest::Test def test_ignores_magic_numbers_assigned_to_ivars_outside_of_methods matched_numerics.eac...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_assignment/setter_test.rb
Ruby
mit
48
main
1,739
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoAssignment class SetterTest < Minitest::Test def test_ignores_magic_numbers_assigned_via_setters_outside_of_methods matched_numerics.each do |n...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_assignment/global_variable_test.rb
Ruby
mit
48
main
876
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoAssignment class GlobalVariableTest < Minitest::Test def test_ignores_magic_numbers_assigned_to_global_variables_by_default cop_class = describ...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_assignment/float/class_variable_test.rb
Ruby
mit
48
main
1,203
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoAssignment module Float class ClassVariableTest < Minitest::Test def setup @matched_numerics = TestHelper::FLOAT_LITERALS ...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_assignment/float/local_variable_test.rb
Ruby
mit
48
main
1,435
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoAssignment module Float class LocalVariableTest < Minitest::Test def setup @matched_numerics = TestHelper::FLOAT_LITERALS ...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_assignment/float/instance_variable_test.rb
Ruby
mit
48
main
1,454
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoAssignment module Float class InstanceVariableTest < Minitest::Test def setup @matched_numerics = TestHelper::FLOAT_LITERALS ...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_assignment/float/global_variable_test.rb
Ruby
mit
48
main
1,130
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoAssignment module Float class GlobalVariableTest < Minitest::Test def test_ignores_magic_numbers_assigned_to_global_variables_when_config_false...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_assignment/float/setter_test.rb
Ruby
mit
48
main
1,776
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoAssignment module Float class SetterTest < Minitest::Test def setup @matched_numerics = TestHelper::FLOAT_LITERALS en...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_assignment/integer/local_variable_test.rb
Ruby
mit
48
main
1,441
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoAssignment module Integer class LocalVariableTest < Minitest::Test def setup @matched_numerics = TestHelper::INTEGER_LITERALS ...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_assignment/integer/class_variable_test.rb
Ruby
mit
48
main
1,209
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoAssignment module Integer class ClassVariableTest < Minitest::Test def setup @matched_numerics = TestHelper::INTEGER_LITERALS ...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_assignment/integer/setter_test.rb
Ruby
mit
48
main
1,698
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoAssignment module Integer class SetterTest < Minitest::Test def test_detects_magic_numbers_assigned_via_setters_on_self matched_n...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_assignment/integer/global_variable_test.rb
Ruby
mit
48
main
1,211
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoAssignment module Integer class GlobalVariableTest < Minitest::Test def setup @matched_numerics = TestHelper::INTEGER_LITERALS ...
github
meetcleo/rubocop-magic_numbers
https://github.com/meetcleo/rubocop-magic_numbers
test/rubocop/cop/magic_numbers/no_assignment/integer/instance_variable_test.rb
Ruby
mit
48
main
1,460
# frozen_string_literal: true require 'minitest/autorun' require 'test_helper' module RuboCop module Cop module MagicNumbers class NoAssignment module Integer class InstanceVariableTest < Minitest::Test def setup @matched_numerics = TestHelper::INTEGER_LITERALS ...
github
layervault/ase.rb
https://github.com/layervault/ase.rb
ase.gemspec
Ruby
mit
48
master
1,075
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'ase/version' Gem::Specification.new do |spec| spec.name = "ase" spec.version = ASE::VERSION spec.authors = ["Ryan LeFevre"] spec.email = ["meltingice8917@gmai...
github
layervault/ase.rb
https://github.com/layervault/ase.rb
spec/ase_spec.rb
Ruby
mit
48
master
1,482
require 'spec_helper' describe ASE do before(:each) do @doc = ASE.new end it "is initialized with defaults" do expect(@doc.palettes).to eq({}) expect(@doc.palettes.length).to be 0 end it "can add palettes" do @doc.add_palette ASE::Palette.new('Test') @doc << ASE::Palette.new('Also Test'...
github
layervault/ase.rb
https://github.com/layervault/ase.rb
spec/file_spec.rb
Ruby
mit
48
master
2,859
require 'spec_helper' require 'tempfile' describe 'Files' do describe 'Reading' do it 'throws an error if file is not set' do doc = ASE.new expect { doc.read! }.to raise_error end it 'can read via factory or instantiation' do doc1 = ASE.from_file('spec/files/control.ase'...
github
layervault/ase.rb
https://github.com/layervault/ase.rb
spec/color_spec.rb
Ruby
mit
48
master
2,784
require 'spec_helper' describe ASE::Color do it "has a working factory method" do expect(ASE::Color).to respond_to(:factory) end describe ASE::Color::RGB do it "works with the color factory" do expect(ASE::Color.factory('RGB')).to be_an_instance_of(ASE::Color::RGB) expect(ASE::Color.factory(...
github
layervault/ase.rb
https://github.com/layervault/ase.rb
spec/spec_helper.rb
Ruby
mit
48
master
475
require './lib/ase' RSpec.configure do |config| config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true unless ENV['CIRCLECI'] config.filter_run :focus end # Run specs in random order to surface order dependencies. If you find an # order dependency...
github
layervault/ase.rb
https://github.com/layervault/ase.rb
lib/ase.rb
Ruby
mit
48
master
857
dir_root = File.dirname(File.absolute_path(__FILE__)) require dir_root + "/ase/version" require dir_root + "/ase/color_modes/cmyk" require dir_root + "/ase/color_modes/gray" require dir_root + "/ase/color_modes/rgb" require dir_root + "/ase/file" require dir_root + "/ase/palette" require dir_root + "/ase/reader" req...
github
layervault/ase.rb
https://github.com/layervault/ase.rb
lib/ase/file.rb
Ruby
mit
48
master
1,250
class ASE class File < ::File FORMATS = { ulonglong: { length: 8, code: 'Q>' }, longlong: { length: 8, code: 'q>' }, double: { length: 8, code: 'G' }, float: { length: 4, code: 'F' }, uint: { ...
github
layervault/ase.rb
https://github.com/layervault/ase.rb
lib/ase/reader.rb
Ruby
mit
48
master
1,742
class ASE module Reader def self.included(base) base.send :include, InstanceMethods base.extend ClassMethods end module ClassMethods def from_file(file) doc = ASE.new(file) doc.read! return doc end end module InstanceMethods def from_file(fi...
github
layervault/ase.rb
https://github.com/layervault/ase.rb
lib/ase/palette.rb
Ruby
mit
48
master
648
class ASE class Palette include Enumerable attr_accessor :name, :colors def initialize(name) @name = name @colors = {} end def add(name, color) @colors[name] = color end alias :[]= :add alias :add_color :add def remove(name) @colors.delete(name) end ...
github
layervault/ase.rb
https://github.com/layervault/ase.rb
lib/ase/writer.rb
Ruby
mit
48
master
1,390
class ASE module Writer def to_file(file) @file = file write! end def write! raise "Must specify an output file" if @file.nil? @file = File.new(@file, 'wb') palette_count = @palettes.keys.length color_count = @palettes.values.map{ |p| p.size }.inject { |sum, i| sum + ...
github
layervault/ase.rb
https://github.com/layervault/ase.rb
lib/ase/color_modes/cmyk.rb
Ruby
mit
48
master
843
require_relative '../color' class ASE class Color class CMYK attr_accessor :c, :m, :y, :k def initialize(c=0, m=0, y=0, k=0) @c = c @m = m @y = y @k = k end def read!(file) @c, @m, @y, @k = 4.times.map do file.read(4).unpack('g')[0].roun...
github
layervault/ase.rb
https://github.com/layervault/ase.rb
lib/ase/color_modes/gray.rb
Ruby
mit
48
master
584
require_relative '../color' class ASE class Color class Gray attr_accessor :value def initialize(value=0) @value = value end def read!(file) @value = file.read(4).unpack('g')[0].round(4) end def write!(file) file.write('Gray') to_a.each { |c|...
github
layervault/ase.rb
https://github.com/layervault/ase.rb
lib/ase/color_modes/rgb.rb
Ruby
mit
48
master
1,345
require_relative '../color' class ASE class Color class RGB attr_accessor :r, :g, :b class << self def from_rgba(*args) args = args.first if args.length == 1 self.new *args end alias :from_rgb :from_rgba def from_hex(hex) self.new *hex ...
github
layervault/ase.rb
https://github.com/layervault/ase.rb
examples/simple.rb
Ruby
mit
48
master
323
require 'pp' require './lib/ase' doc = ASE.new palette = ASE::Palette.new("Simple") palette.add 'White', ASE::Color.from_hex('#ffffff') palette.add 'Black', ASE::Color.from_hex('#000000') doc << palette puts "\nTO FILE" pp doc doc.to_file './output.ase' puts "\nFROM FILE" doc2 = ASE.from_file './output.ase' pp d...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/Rakefile
Ruby
apache-2.0
48
master
802
# # Copyright [2011-2012] [Solr.pl, Marek Rogoziński, Rafał Kuć] # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/solr_explanation.gemspec
Ruby
apache-2.0
48
master
1,492
# # Copyright [2011-2012] [Solr.pl, Marek Rogoziński, Rafał Kuć] # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/Gemfile
Ruby
apache-2.0
48
master
732
source "http://rubygems.org" # # Copyright [2011-2012] [Solr.pl, Marek Rogoziński, Rafał Kuć] # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/tools/extract_explains_from_xml.rb
Ruby
apache-2.0
48
master
1,322
#!/usr/bin/ruby -w # # Copyright [2011-2012] [Solr.pl, Marek Rogoziński, Rafał Kuć] # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/test/test_solr_explanation_4_0_snapshot_lmdirichlet_similarity.rb
Ruby
apache-2.0
48
master
796
#!/usr/bin/ruby -w $:.unshift "#{File.expand_path( File.dirname( __FILE__ ) )}/../lib" require 'test/unit' require 'solr_explanation' class SolrExplanation_4_0SnapshotLMDirichletSimilarityTest < Test::Unit::TestCase def get_explain(file) content = File.read(file) lines = content.split(/\r?\n/) puts "C...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/test/test_solr_explanation_3_4.rb
Ruby
apache-2.0
48
master
11,023
#!/usr/bin/ruby -w $:.unshift "#{File.expand_path( File.dirname( __FILE__ ) )}/../lib" require 'test/unit' require 'rubygems' require 'solr_explanation' require 'pp' class SolrExplanation_3_4Test < Test::Unit::TestCase def get_explain(file) content = File.read("#{File.dirname(__FILE__)}/data/3.4/#{file}.txt") ...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/test/test_solr_explanation_3_0.rb
Ruby
apache-2.0
48
master
1,509
#!/usr/bin/ruby -w $:.unshift "#{File.expand_path( File.dirname( __FILE__ ) )}/../lib" require 'test/unit' require 'solr_explanation' class SolrExplanation_3_0Test < Test::Unit::TestCase def get_explain(file) content = File.read("#{File.dirname(__FILE__)}/data/3.0/#{file}.txt") metadata = SolrExplanation::...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/test/test_solr_explanation_4_0_snapshot_default_similarity.rb
Ruby
apache-2.0
48
master
788
#!/usr/bin/ruby -w $:.unshift "#{File.expand_path( File.dirname( __FILE__ ) )}/../lib" require 'test/unit' require 'solr_explanation' class SolrExplanation_4_0SnapshotDefaultSimilarityTest < Test::Unit::TestCase def get_explain(file) content = File.read(file) lines = content.split(/\r?\n/) puts "Check...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/test/test_solr_explanation_other.rb
Ruby
apache-2.0
48
master
8,751
#!/usr/bin/ruby -w $:.unshift "#{File.expand_path( File.dirname( __FILE__ ) )}/../lib" require 'test/unit' require 'solr_explanation' class SolrExplanationOtherTest < Test::Unit::TestCase def get_explain(file) content = File.read("#{File.dirname(__FILE__)}/data/other/#{file}.txt") metadata = SolrExplanatio...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/test/test_solr_explanation_4_0_snapshot_auto.rb
Ruby
apache-2.0
48
master
663
#!/usr/bin/ruby -w $:.unshift "#{File.expand_path( File.dirname( __FILE__ ) )}/../lib" require 'test/unit' require 'solr_explanation' class SolrExplanation_4_0SnapshotAutoTest < Test::Unit::TestCase def get_explain(file) content = File.read(file) metadata = SolrExplanation::Metadata.new(:id => 'P_164345',...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/test/test_solr_explanation_4_0_snapshot_bm25_similarity.rb
Ruby
apache-2.0
48
master
782
#!/usr/bin/ruby -w $:.unshift "#{File.expand_path( File.dirname( __FILE__ ) )}/../lib" require 'test/unit' require 'solr_explanation' class SolrExplanation_4_0SnapshotBm25SimilarityTest < Test::Unit::TestCase def get_explain(file) content = File.read(file) lines = content.split(/\r?\n/) puts "Check: #...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/test/test_solr_explanation_4_0.rb
Ruby
apache-2.0
48
master
1,097
#!/usr/bin/ruby -w $:.unshift "#{File.expand_path( File.dirname( __FILE__ ) )}/../lib" require 'test/unit' require 'solr_explanation' class SolrExplanation_4_0Test < Test::Unit::TestCase def get_explain(file) content = File.read("#{File.dirname(__FILE__)}/data/4.0/#{file}.txt") metadata = SolrExplanation::...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/lib/solr_explanation.rb
Ruby
apache-2.0
48
master
874
# # Copyright [2011-2012] [Solr.pl, Marek Rogoziński, Rafał Kuć] # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/lib/solr_explanation/impact_tool.rb
Ruby
apache-2.0
48
master
1,530
# # Copyright [2011-2012] [Solr.pl, Marek Rogoziński, Rafał Kuć] # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/lib/solr_explanation/explanation.rb
Ruby
apache-2.0
48
master
3,530
# # Copyright [2011-2012] [Solr.pl, Marek Rogoziński, Rafał Kuć] # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/lib/solr_explanation/metadata.rb
Ruby
apache-2.0
48
master
1,291
# # Copyright [2011-2012] [Solr.pl, Marek Rogoziński, Rafał Kuć] # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/lib/solr_explanation/parser.rb
Ruby
apache-2.0
48
master
1,829
# # Copyright [2011-2012] [Solr.pl, Marek Rogoziński, Rafał Kuć] # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/lib/solr_explanation/elements/root_universal.rb
Ruby
apache-2.0
48
master
1,890
# # Copyright [2011-2012] [Solr.pl, Marek Rogoziński, Rafał Kuć] # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/lib/solr_explanation/elements/root3_4.rb
Ruby
apache-2.0
48
master
1,911
# # Copyright [2011-2012] [Solr.pl, Marek Rogoziński, Rafał Kuć] # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/lib/solr_explanation/elements/tree_element.rb
Ruby
apache-2.0
48
master
2,290
# # Copyright [2011-2012] [Solr.pl, Marek Rogoziński, Rafał Kuć] # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/lib/solr_explanation/elements/root.rb
Ruby
apache-2.0
48
master
1,627
# # Copyright [2011-2012] [Solr.pl, Marek Rogoziński, Rafał Kuć] # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
github
solrpl/explain
https://github.com/solrpl/explain
solr_explanation/lib/solr_explanation/elements/root4_0.rb
Ruby
apache-2.0
48
master
1,094
# # Copyright [2011-2012] [Solr.pl, Marek Rogoziński, Rafał Kuć] # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...