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
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/lexer/lang.rb
Ruby
mit
48
main
576
# frozen_string_literal: true module Wordlist class Lexer # # Detects the system's default language. # # @api semipublic # # @since 1.0.0 # module Lang # # The default language. # # @return [Symbol] # def self.default if (lang = ENV['LANG'])...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/modifiers/capitalize.rb
Ruby
mit
48
main
1,024
# frozen_string_literal: true require_relative 'modifier' module Wordlist module Modifiers # # Lazily calls `String#capitalize` on every word in the wordlist. # # @since 1.0.0 # class Capitalize < Modifier # # Enumerates over every capitalized word in the wordlist. # ...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/modifiers/mutate.rb
Ruby
mit
48
main
3,182
# frozen_string_literal: true require_relative 'sub' module Wordlist module Modifiers # # Lazily enumerates through every combination of a string substitution # on every word in the wordlist. # # @since 1.0.0 # class Mutate < Sub # # Enumerates over every mutation of every wo...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/modifiers/gsub.rb
Ruby
mit
48
main
1,154
# frozen_string_literal: true require_relative 'sub' module Wordlist module Modifiers # # Lazily calls `String#gsub` on every word in the wordlist. # # @since 1.0.0 # class Gsub < Sub # # Enumerates over every `gsub`ed word in the wordlist. # # @yield [word] # ...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/modifiers/tr.rb
Ruby
mit
48
main
1,623
# frozen_string_literal: true require_relative 'modifier' module Wordlist module Modifiers # # Lazily calls `String#tr` on every word in the wordlist. # # @since 1.0.0 # class Tr < Modifier # The characters or character range to translate. # # @return [String] attr_re...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/modifiers/mutate_case.rb
Ruby
mit
48
main
530
# frozen_string_literal: true require_relative 'mutate' module Wordlist module Modifiers # # Lazily enumerates through every possible upper/lower-case variation of # each word in the wordlist. # # @since 1.0.0 # class MutateCase < Mutate # # Initializes the case mutator. ...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/modifiers/modifier.rb
Ruby
mit
48
main
805
module Wordlist module Modifiers # # Modifier base class. # # @since 1.0.0 # class Modifier include Enumerable # The wordlist to modify. # # @return [Enumerable] attr_reader :wordlist # # Initializes the modifier. # # @param [Enumerable]...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/modifiers/downcase.rb
Ruby
mit
48
main
998
# frozen_string_literal: true require_relative 'modifier' module Wordlist module Modifiers # # Lazily calls `String#downcase` on every word in the wordlist. # # @since 1.0.0 # class Downcase < Modifier # # Enumerates over every `downcase`d word in the wordlist. # # @y...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/modifiers/upcase.rb
Ruby
mit
48
main
984
# frozen_string_literal: true require_relative 'modifier' module Wordlist module Modifiers # # Lazily calls `String#upcase` on every word in the wordlist. # # @since 1.0.0 # class Upcase < Modifier # # Enumerates over every `upcase`d word in the wordlist. # # @yield [...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/modifiers/sub.rb
Ruby
mit
48
main
2,463
# frozen_string_literal: true require_relative 'modifier' module Wordlist module Modifiers # # Lazily calls `String#sub` on every word in the wordlist. # # @since 1.0.0 # class Sub < Modifier # The pattern to substitute. # # @return [Regexp, String] attr_reader :patte...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/operators/binary_operator.rb
Ruby
mit
48
main
684
# frozen_string_literal: true require_relative 'operator' module Wordlist module Operators # # Binary operator base class. # # @since 1.0.0 # class BinaryOperator < Operator # The left operand. # # @return [Enumerable] attr_reader :left # The right operand. ...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/operators/subtract.rb
Ruby
mit
48
main
1,388
# frozen_string_literal: true require_relative 'binary_operator' require_relative '../unique_filter' module Wordlist module Operators # # Lazily enumerates over every word in the first wordlist, that is not in # the second wordlist. # # @since 1.0.0 # class Subtract < BinaryOperator ...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/operators/product.rb
Ruby
mit
48
main
1,231
# frozen_string_literal: true require_relative 'binary_operator' module Wordlist module Operators # # Lazily enumerates over the combination of the words from two wordlists. # # @since 1.0.0 # class Product < BinaryOperator # # Enumerates over every combination of the words from ...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/operators/union.rb
Ruby
mit
48
main
1,440
# frozen_string_literal: true require_relative 'binary_operator' require_relative '../unique_filter' module Wordlist module Operators # # Lazily enumerates over words from both wordlists, filtering out any # duplicates. # # @since 1.0.0 # class Union < BinaryOperator # # Enum...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/operators/power.rb
Ruby
mit
48
main
1,631
# frozen_string_literal: true require_relative 'binary_operator' require_relative 'product' module Wordlist module Operators # # Lazily enumerates over every combination of words in the wordlist. # # @since 1.0.0 # class Power < BinaryOperator # The product of the wordlist with itself....
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/operators/operator.rb
Ruby
mit
48
main
453
module Wordlist module Operators # # Operator base class. # # @since 1.0.0 # class Operator include Enumerable # # Place-holder method. # # @yield [word] # # @yieldparam [String] word # # @return [Enumerator] # # @abstract ...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/operators/unique.rb
Ruby
mit
48
main
1,213
# frozen_string_literal: true require_relative 'unary_operator' require_relative '../unique_filter' module Wordlist module Operators # # Lazily enumerates over only the unique words in the wordlist, filtering # out duplicates. # # @since 1.0.0 # class Unique < UnaryOperator # ...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/operators/unary_operator.rb
Ruby
mit
48
main
516
# frozen_string_literal: true require_relative 'operator' module Wordlist module Operators # # Unary operator base class. # # @since 1.0.0 # class UnaryOperator < Operator # The wordlist to operate on. # # @return [Enumerable] attr_reader :wordlist # # In...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/operators/concat.rb
Ruby
mit
48
main
1,090
# frozen_string_literal: true require_relative 'binary_operator' module Wordlist module Operators # # Lazily enumerates over the first wordlist, then the second. # # @since 1.0.0 # class Concat < BinaryOperator # # Enumerates over each word in both wordlists. # # @yie...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/operators/intersect.rb
Ruby
mit
48
main
1,345
# frozen_string_literal: true require_relative 'binary_operator' require_relative '../unique_filter' module Wordlist module Operators # # Lazily enumerates over every word that belongs to both wordlists. # # @since 1.0.0 # class Intersect < BinaryOperator # # Enumerates over the ...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/compression/reader.rb
Ruby
mit
48
main
1,982
require_relative '../exceptions' require 'shellwords' module Wordlist module Compression # # Handles reading compressed files. # # @since 1.0.0 # module Reader # # Returns the command to read the compressed wordlist. # # @param [String] path # The path to the ...
github
postmodern/wordlist.rb
https://github.com/postmodern/wordlist.rb
lib/wordlist/compression/writer.rb
Ruby
mit
48
main
2,716
require_relative '../exceptions' require 'shellwords' module Wordlist module Compression # # Handles writing compressed files. # # @since 1.0.0 # module Writer # # Returns the command to write to the compressed wordlist. # # @param [String] path # The path to ...
github
jamesarosen/constellation
https://github.com/jamesarosen/constellation
constellation.gemspec
Ruby
mit
48
master
800
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = "constellation" s.version = '0.1.1' s.authors = ["James A. Rosen"] s.email = ["james.a.rosen@gmail.com"] s.homepage = "http://github.com/jamesarosen/constellation" s.summary = %q{Load configuration settings} s.de...
github
jamesarosen/constellation
https://github.com/jamesarosen/constellation
spec/constellation_spec.rb
Ruby
mit
48
master
4,458
# encoding: utf-8 require "spec_helper" describe Constellation do let(:load_from_gems) { false } let(:path) { 'config/chomper.yml' } let(:home) { ENV['HOME'] } let(:config_class) do Class.new.tap do |c| Constellation.enhance c c.env_params = { foo: 'MY_FOO', bar: 'MY_BAR' } c.config_fi...
github
jamesarosen/constellation
https://github.com/jamesarosen/constellation
lib/constellation.rb
Ruby
mit
48
master
2,925
module Constellation class ParseError < StandardError def initialize(file) super("Could not parse #{file}. Try overriding #parse_config_file") end end def self.enhance(klass) klass.extend Constellation::ClassMethods klass.env_params = {} klass.send :include, Constellation::InstanceMeth...
github
leschenko/elasticsearch_autocomplete
https://github.com/leschenko/elasticsearch_autocomplete
elasticsearch_autocomplete.gemspec
Ruby
mit
48
master
1,090
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'elasticsearch_autocomplete/version' Gem::Specification.new do |gem| gem.name = 'elasticsearch_autocomplete' gem.version = ElasticsearchAutocomplete::VERSION gem.aut...
github
leschenko/elasticsearch_autocomplete
https://github.com/leschenko/elasticsearch_autocomplete
lib/elasticsearch_autocomplete.rb
Ruby
mit
48
master
1,397
require 'tire' require 'elasticsearch_autocomplete/version' require 'elasticsearch_autocomplete/analyzers' require 'elasticsearch_autocomplete/model_addition' require 'elasticsearch_autocomplete/railtie' if Object.const_defined?(:Rails) module ElasticsearchAutocomplete mattr_accessor :defaults mattr_accessor :enab...
github
leschenko/elasticsearch_autocomplete
https://github.com/leschenko/elasticsearch_autocomplete
lib/elasticsearch_autocomplete/railtie.rb
Ruby
mit
48
master
420
module ElasticsearchAutocomplete class Railtie < Rails::Railtie initializer 'elasticsearch_autocomplete.model_additions' do ActiveSupport.on_load :mongoid do const_get(:ClassMethods).send :include, ElasticsearchAutocomplete::ModelAddition::SingletonMethods end ActiveSupport.on_load :ac...
github
leschenko/elasticsearch_autocomplete
https://github.com/leschenko/elasticsearch_autocomplete
lib/elasticsearch_autocomplete/model_addition.rb
Ruby
mit
48
master
4,855
module ElasticsearchAutocomplete module ModelAddition def self.included(base) base.send :extend, SingletonMethods end module SingletonMethods def ac_setup_tire include InstanceMethods include Tire::Model::Search after_save :ac_update_index after_destroy :ac_up...
github
leschenko/elasticsearch_autocomplete
https://github.com/leschenko/elasticsearch_autocomplete
lib/elasticsearch_autocomplete/analyzers.rb
Ruby
mit
48
master
1,325
module ElasticsearchAutocomplete module Analyzers AC_TOKENIZERS = { ac_edge_ngram: { type: 'edgeNGram', min_gram: 1, max_gram: 50, side: 'front' }, ac_edge_ngram_full: { type: 'nGram', min_gram: 1, max_gra...
github
leschenko/elasticsearch_autocomplete
https://github.com/leschenko/elasticsearch_autocomplete
spec/spec_helper.rb
Ruby
mit
48
master
1,556
require 'active_model' require 'tire' require 'active_support/core_ext' require 'elasticsearch_autocomplete' Tire.configure do # logger 'tmp/elasticsearch.log' # Commented out logger line here so that it doesn't break specs when tmp directory doesn't exist. url "http://localhost:#{ENV['ES_PORT'] || 9200}" prett...
github
leschenko/elasticsearch_autocomplete
https://github.com/leschenko/elasticsearch_autocomplete
spec/elasticsearch_autocomplete/word_mode_spec.rb
Ruby
mit
48
master
750
require 'spec_helper' class ActiveModelUserWord < StubModelBase ac_field :full_name, mode: :word end describe ':word mode autocomplete' do before :all do @model = ActiveModelUserWord @model.setup_index end it 'have :word mode' do expect(@model.ac_opts[:mode]).to eq :word end it_behaves_like ...
github
leschenko/elasticsearch_autocomplete
https://github.com/leschenko/elasticsearch_autocomplete
spec/elasticsearch_autocomplete/phrase_mode_spec.rb
Ruby
mit
48
master
654
require 'spec_helper' class ActiveModelUserPhrase < StubModelBase ac_field :full_name, mode: :phrase end describe ':phrase mode autocomplete' do let(:model) { ActiveModelUserPhrase } before :all do @model = ActiveModelUserPhrase @model.setup_index end it 'have :phrase mode' do expect(@model.ac_...
github
leschenko/elasticsearch_autocomplete
https://github.com/leschenko/elasticsearch_autocomplete
spec/elasticsearch_autocomplete/base_spec.rb
Ruby
mit
48
master
3,706
require 'spec_helper' class ActiveModelUser < StubModelBase ac_field :full_name def self.test_data ['Test User', 'Test User2'] end def self.populate test_data.each_with_index do |name, id| u = new(full_name: name) u.id = id u.save end end # Stub for find, which takes in arr...
github
leschenko/elasticsearch_autocomplete
https://github.com/leschenko/elasticsearch_autocomplete
spec/elasticsearch_autocomplete/localized_spec.rb
Ruby
mit
48
master
787
require 'spec_helper' class ActiveModelProductLocalized < StubModelBase ac_field :name, localized: true def self.test_data [ {name_ru: 'name_ru first', name_en: 'name_en first'}, {name_ru: 'name_ru second', name_en: 'name_en second'} ] end def self.populate test_data.each_with_ind...
github
leschenko/elasticsearch_autocomplete
https://github.com/leschenko/elasticsearch_autocomplete
spec/elasticsearch_autocomplete/full_mode_spec.rb
Ruby
mit
48
master
1,069
require 'spec_helper' class ActiveModelProductFull < StubModelBase ac_field :sku, mode: :full def self.test_data ['SAMARA', 'A.3103', 'b A.3611', 'kac12 dk/sm'] end def self.populate test_data.each_with_index do |name, id| u = new(sku: name) u.id = id u.save end end end descr...
github
leschenko/elasticsearch_autocomplete
https://github.com/leschenko/elasticsearch_autocomplete
spec/elasticsearch_autocomplete/search_filters_spec.rb
Ruby
mit
48
master
2,142
require 'spec_helper' class ActiveModelUserFilter < StubModelBase ac_field :full_name def self.test_data [ {full_name: 'Laura Nelson', interest_ids: [1, 2]}, {full_name: 'Laura Flores', interest_ids: [2, 3]}, {full_name: 'Laura Larson', interest_ids: [3, 4]} ] end def self.pop...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
Rakefile
Ruby
mit
48
master
912
$:.unshift('.') # 1.9.2 require 'rubygems' require 'rake' require 'rake/clean' # # clean CLEAN.include('pkg') # # test / spec task :test do exec 'bundle exec ruby test/test.rb' end task :default => [ :spec ] task :spec => [ :test ] # # gem GEMSPEC_FILE = Dir['*.gemspec'].first GEMSPEC = eval(File.read(GE...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
rufus-decision.gemspec
Ruby
mit
48
master
846
Gem::Specification.new do |s| s.name = 'rufus-decision' s.version = File.read( File.expand_path('../lib/rufus/decision/version.rb', __FILE__) ).match(/ VERSION *= *['"]([^'"]+)/)[1] s.platform = Gem::Platform::RUBY s.authors = [ 'John Mettraux' ] s.email = [ 'jmettraux@gmail.com' ] s.homepage = 'ht...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
demo/start.rb
Ruby
mit
48
master
1,850
# # just a tiny Ruby Rack application for serving the stuff under demo/ # # start with # # ruby start.rb # # (don't forget to # # sudo gem install rack mongrel # # if necessary) # $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'rubygems' require 'json' require 'sinatra' require 'rufus/decision...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
test/dt_1_vertical.rb
Ruby
mit
48
master
2,040
# # testing rufus-deciision # # Sun Oct 29 15:41:44 JST 2006 # require File.expand_path('../base.rb', __FILE__) class Dt1Test < Test::Unit::TestCase include DecisionTestMixin CSV1 = %{ ,, in:fx,in:fy,out:fz ,, a,${fx},0 c,d,${fx} e,f,${r:3+4} g,h,${r:'${fx}' + '${fy}'} } def tes...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
test/dt_3_bounded.rb
Ruby
mit
48
master
932
# # testing rufus-decision # # Mon Sep 7 13:42:09 JST 2009 # require File.expand_path('../base.rb', __FILE__) class Dt3Test < Test::Unit::TestCase include DecisionTestMixin CSV14 = %{ in:fstate,out:result apple,1 orange,2 } def test_bounded_match dt = Rufus::DecisionTable.new(CSV14) ...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
test/dt_4_eval.rb
Ruby
mit
48
master
363
# # testing rufus-decision # # Mon Oct 9 22:19:44 JST 2006 # require File.expand_path('../base.rb', __FILE__) class Dt4Test < Test::Unit::TestCase def test_0 eh = Rufus::Decision::EvalHashFilter.new({}) eh['a'] = :a eh['b'] = 'r:5 * 5' assert_equal :a, eh['a'] assert_equal 25, eh['b'] ...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
test/matcher_string_test.rb
Ruby
mit
48
master
944
require File.expand_path('../base.rb', __FILE__) class StringMatcherTest < Test::Unit::TestCase def test_substitution_true m = Rufus::Decision::Matchers::String.new m.options = {} assert m.cell_substitution? end def test_does_match m = Rufus::Decision::Matchers::String.new m.options = {...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
test/test.rb
Ruby
mit
48
master
240
# # testing rufus-decision # # 2007 something # $:.unshift(File.dirname(File.dirname(__FILE__))) Dir["#{File.dirname(__FILE__)}/dt_*.rb"].each { |path| load(path) } Dir["#{File.dirname(__FILE__)}/*_test.rb"].each { |path| load(path) }
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
test/base.rb
Ruby
mit
48
master
798
# # testing rufus-decision # # 2007 something # require 'test/unit' require 'rufus/decision' def trim_table(s) s.split("\n").collect(&:lstrip).join("\n").strip end module DecisionTestMixin protected def do_test(table_data, h, expected_result, verbose=false) table = if table_data.is_a?(Rufus::De...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
test/matcher_range_test.rb
Ruby
mit
48
master
956
require File.expand_path('../base.rb', __FILE__) class RangeMatcherTest < Test::Unit::TestCase def test_substitution_true m = Rufus::Decision::Matchers::Range.new assert m.cell_substitution? end def test_does_match m = Rufus::Decision::Matchers::Range.new %Q{ 1..4 | 2 3..10 ...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
test/dt_0_basic.rb
Ruby
mit
48
master
7,631
# # testing rufus-decision # # Sun Oct 29 15:41:44 JST 2006 # require File.expand_path('../base.rb', __FILE__) class Dt0Test < Test::Unit::TestCase include DecisionTestMixin CSV0 = %{ ,, in:fx,in:fy,out:fz ,, a,b,0 c,d,1 e,f,2 } def test_0 wi = { "fx" => "c", "fy" =...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
test/short_circuit_matcher_test.rb
Ruby
mit
48
master
2,151
require File.expand_path('../base.rb', __FILE__) class ShortCircuitMatcherTest < Test::Unit::TestCase include DecisionTestMixin class Matcher1 < Rufus::Decision::Matcher def matches?(cell, value) value.include?("aaa") end end class Matcher2 < Rufus::Decision::Matcher def matches?(cell, v...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
test/pluggable_test.rb
Ruby
mit
48
master
412
require File.expand_path('../base.rb', __FILE__) class PluggableTest < Test::Unit::TestCase def test_default_matchers table = Rufus::Decision::Table.new("\n") assert table.matchers[0].is_a?( Rufus::Decision::Matchers::Numeric) assert table.matchers[1].is_a?( Rufus::Decision::Matchers::Rang...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
test/dt_2_google.rb
Ruby
mit
48
master
816
# # testing rufus-decision # # Sun Oct 29 15:41:44 JST 2006 # require File.expand_path('../base.rb', __FILE__) class Dt2Test < Test::Unit::TestCase include DecisionTestMixin CSV3D = 'https://spreadsheets.google.com/pub?key=pCkopoeZwCNsMWOVeDjR1TQ&output=csv&gid=0' def test_3d return if ENV['SKIP_RUFUS_S...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
test/dt_5_transpose.rb
Ruby
mit
48
master
1,067
# # testing rufus-decision # # Thu Apr 23 15:18:15 JST 2009 # require File.expand_path('../base.rb', __FILE__) class Dt5Test < Test::Unit::TestCase def test_transpose_empty_array assert_equal([], Rufus::Decision.transpose([])) end def test_transpose_a_to_h assert_equal( [ { 'age' => 3...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
test/matcher_test.rb
Ruby
mit
48
master
280
require File.expand_path('../base.rb', __FILE__) class MatcherTest < Test::Unit::TestCase def test_base_class empty_matcher = Rufus::Decision::Matcher.new assert ! empty_matcher.matches?(Object.new, Object.new) assert empty_matcher.cell_substitution? end end
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
test/matcher_numeric_test.rb
Ruby
mit
48
master
993
require File.expand_path('../base.rb', __FILE__) class NumericMatcherTest < Test::Unit::TestCase def test_substitution_true m = Rufus::Decision::Matchers::Numeric.new assert m.cell_substitution? end def test_does_match m = Rufus::Decision::Matchers::Numeric.new %Q{ >0 | 1 <...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
test/ruote/rt_0_basic.rb
Ruby
mit
48
master
982
# # testing rufus-decision (ruote participant) # # Tue Feb 16 14:54:55 JST 2010 # require File.join(File.dirname(__FILE__), 'base') require 'rufus/decision/participant' class Rt0Test < Test::Unit::TestCase include RuoteBase def test_basic @engine.register_participant( :decision, Rufus::Decision...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
test/ruote/base.rb
Ruby
mit
48
master
643
# # testing rufus-decision (ruote participant) # # Tue Feb 16 14:37:13 JST 2010 # $:.unshift( File.expand_path(File.join(File.dirname(__FILE__), %w[ .. .. lib ]))) $:.unshift( File.expand_path(File.join(File.dirname(__FILE__), %w[ .. .. .. .. ruote lib ]))) require 'test/unit' require 'rubygems' require 'ruote' r...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
lib/rufus/decision/participant.rb
Ruby
mit
48
master
3,887
#-- # Copyright (c) 2007-2013, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
lib/rufus/decision/hashes.rb
Ruby
mit
48
master
5,055
#-- # Copyright (c) 2008-2013, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
lib/rufus/decision/table.rb
Ruby
mit
48
master
16,136
#-- # Copyright (c) 2007-2013, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
lib/rufus/decision/matcher.rb
Ruby
mit
48
master
1,692
#-- # Copyright (c) 2007-2013, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
lib/rufus/decision/version.rb
Ruby
mit
48
master
1,207
#-- # Copyright (c) 2008-2013, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
lib/rufus/decision/matchers/range.rb
Ruby
mit
48
master
2,597
#-- # Copyright (c) 2007-2013, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
lib/rufus/decision/matchers/numeric.rb
Ruby
mit
48
master
1,874
#-- # Copyright (c) 2007-2013, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
lib/rufus/decision/matchers/string.rb
Ruby
mit
48
master
1,544
#-- # Copyright (c) 2007-2013, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
examples/journalists.rb
Ruby
mit
48
master
1,050
require 'rubygems' require 'rufus/decision' # sudo gem install rufus-decision table = %{ in:topic,in:region,out:team_member sports,europe,Alice sports,,Bob finance,america,Charly finance,europe,Donald finance,,Ernest politics,asia,Fujio politics,america,Gilbert politics,,Henry ,,Zach } #Rufus::Dec...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
examples/readme_example.rb
Ruby
mit
48
master
849
require 'rubygems' require 'rufus/decision' TABLE = Rufus::Decision::Table.new(%{ in:age,in:trait,out:salesperson 18..35,,adeslky 25..35,,bronco 36..50,,espadas 51..78,,thorsten 44..120,,ojiisan 25..35,rich,kerfelden ,cheerful,swanson ,maniac,korolev }) # Given a customer (a Hash instance directly, for # convenienc...
github
jmettraux/rufus-decision
https://github.com/jmettraux/rufus-decision
examples/reimbursement.rb
Ruby
mit
48
master
3,358
# # ruote + rufus-decision example # # featured in # # http://jmettraux.wordpress.com/2010/02/17/ruote-and-decision-tables/ # require 'rubygems' # # preparing the workflow engine require 'ruote' engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new())) # for this example we use a transient, in-me...
github
quartzmo/mocha_rails
https://github.com/quartzmo/mocha_rails
Rakefile
Ruby
mit
48
master
705
#!/usr/bin/env rake begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end begin require 'rdoc/task' rescue LoadError require 'rdoc/rdoc' require 'rake/rdoctask' RDoc::Task = Rake::RDocTask end RDoc::Task.new(:rdoc) do |rdoc| rdoc.r...
github
quartzmo/mocha_rails
https://github.com/quartzmo/mocha_rails
mocha_rails.gemspec
Ruby
mit
48
master
794
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "mocha_rails/version" Gem::Specification.new do |s| s.name = "mocha_rails" s.version = MochaRails::VERSION s.authors = ["Chris smith"] s.email = ["quartzmo@gmail.com"] s.homepage = "https://github.com...
github
quartzmo/mocha_rails
https://github.com/quartzmo/mocha_rails
Gemfile
Ruby
mit
48
master
633
source "http://rubygems.org" # Declare your gem's dependencies in mocha_rails.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec # jquery-rails is used by the dummy application gem "jquery-rails" # Decl...
github
quartzmo/mocha_rails
https://github.com/quartzmo/mocha_rails
test/dummy/config/application.rb
Ruby
mit
48
master
2,673
require File.expand_path('../boot', __FILE__) # Pick the frameworks you want: # require "active_record/railtie" require "action_controller/railtie" require "action_mailer/railtie" require "active_resource/railtie" require "sprockets/railtie" require "rails/test_unit/railtie" Bundler.require require "mocha_rails" mod...
github
quartzmo/mocha_rails
https://github.com/quartzmo/mocha_rails
test/dummy/config/environments/development.rb
Ruby
mit
48
master
1,070
Dummy::Application.configure do # Settings specified here will take precedence over those in config/application.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web serv...
github
quartzmo/mocha_rails
https://github.com/quartzmo/mocha_rails
test/dummy/config/environments/production.rb
Ruby
mit
48
master
2,283
Dummy::Application.configure do # Settings specified here will take precedence over those in config/application.rb # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false config.action_c...
github
quartzmo/mocha_rails
https://github.com/quartzmo/mocha_rails
test/dummy/config/initializers/secret_token.rb
Ruby
mit
48
master
496
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attac...
github
quartzmo/mocha_rails
https://github.com/quartzmo/mocha_rails
lib/generators/mocha_rails/install_generator.rb
Ruby
mit
48
master
593
module MochaRails class InstallGenerator < Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) class_option :mount, :aliases => '-m', :type => :string, :default => 'mocha', :desc => 'mounts engine at specified MOUNT route' desc 'installs mocha_rails into your application' ...
github
quartzmo/mocha_rails
https://github.com/quartzmo/mocha_rails
config/initializers/mocha_rails.rb
Ruby
mit
48
master
276
spec_path = File.join(Rails.root, "spec", "javascripts") test_path = File.join(Rails.root, "test", "javascripts") Rails.application.config.assets.paths << spec_path if FileTest.exists? spec_path Rails.application.config.assets.paths << test_path if FileTest.exists? test_path
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
Rakefile
Ruby
mit
48
main
752
begin require "rake/testtask" require "standard/rake" Rake::TestTask.new(:test) do |t| t.libs << "test" t.libs << "lib" t.test_files = FileList["test/**/*_test.rb"] end task default: [:test, "standard:fix"] namespace :benchmark do desc "Run simple comparison benchmark" task :simple do...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
rqrcode_core.gemspec
Ruby
mit
48
main
1,618
lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "rqrcode_core/version" Gem::Specification.new do |spec| spec.name = "rqrcode_core" spec.version = RQRCodeCore::VERSION spec.platform = Gem::Platform::RUBY spec.authors = ["Duncan Robertson"] spec.email = ["...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
test/benchmark_simple.rb
Ruby
mit
48
main
2,548
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path("../lib", __dir__) require "rqrcode_core" require "benchmark" puts "=" * 80 puts "RQRCode Core - Simple Benchmark" puts "=" * 80 puts "Ruby: #{RUBY_VERSION} (#{RUBY_PLATFORM})" puts "ARCH_BITS: #{RQRCodeCore::QRUtil::ARCH_BITS}" puts "=" * 80 puts # Q...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
test/profile_stackprof.rb
Ruby
mit
48
main
3,804
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path("../lib", __dir__) require "rqrcode_core" require "stackprof" require "fileutils" puts "=" * 80 puts "RQRCode Core - StackProf Performance Profiling" puts "=" * 80 puts "Ruby: #{RUBY_VERSION} (#{RUBY_PLATFORM})" puts "ARCH_BITS: #{RQRCodeCore::QRUtil::...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
test/benchmark_memory.rb
Ruby
mit
48
main
2,468
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path("../lib", __dir__) require "rqrcode_core" require "memory_profiler" puts "=" * 80 puts "RQRCode Core - Memory Profiling Benchmark" puts "=" * 80 puts "Ruby: #{RUBY_VERSION} (#{RUBY_PLATFORM})" puts "ARCH_BITS: #{RQRCodeCore::QRUtil::ARCH_BITS}" puts "=...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
test/benchmark_performance.rb
Ruby
mit
48
main
2,791
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path("../lib", __dir__) require "rqrcode_core" require "benchmark/ips" puts "=" * 80 puts "RQRCode Core - Detailed Performance Benchmark (benchmark-ips)" puts "=" * 80 puts "Ruby: #{RUBY_VERSION} (#{RUBY_PLATFORM})" puts "ARCH_BITS: #{RQRCodeCore::QRUtil::A...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
test/rqrcode_core/boundary_test.rb
Ruby
mit
48
main
10,671
require "test_helper" # Tests for boundary conditions, edge cases, and maximum capacity scenarios class BoundaryTest < Minitest::Test def test_empty_string # Empty string should work at all error correction levels %i[l m q h].each do |level| qr = RQRCodeCore::QRCode.new("", level: level) assert q...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
test/rqrcode_core/qr_segment_test.rb
Ruby
mit
48
main
750
# frozen_string_literal: true require "test_helper" class RQRCodeCore::QRSegmentTest < Minitest::Test PAYLOAD = [{data: "byteencoded", mode: :byte_8bit}, {data: "A1" * 107, mode: :alphanumeric}, {data: "1" * 498, mode: :number}] def test_multi_payloads RQRCodeCore::QRCode.new(PAYLOAD, level: :l) RQRCodeC...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
test/rqrcode_core/regresions_test.rb
Ruby
mit
48
main
226
require "test_helper" class RegresionTests < Minitest::Test # Rs block information was incomplete. def test_code_length_overflow_bug RQRCodeCore::QRCode.new("s" * 220) RQRCodeCore::QRCode.new("s" * 195) end end
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
test/rqrcode_core/multi_segment_encoding_test.rb
Ruby
mit
48
main
7,358
require "test_helper" # Tests for multi-segment encoding with various combinations and edge cases class MultiSegmentEncodingTest < Minitest::Test # Happy path: basic multi-segment functionality def test_creates_valid_qr_code_with_multiple_segments segments = [ {data: "123456789", mode: :number}, {d...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
test/rqrcode_core/rqrcode_test.rb
Ruby
mit
48
main
7,599
require "test_helper" class RQRCodeCore::BaseTest < Minitest::Test require_relative "data" def test_qrcode_argument_error error = assert_raises(RQRCodeCore::QRCodeArgumentError) do RQRCodeCore::QRCode.new(size: 1, level: :h) end assert_equal "data must be a String, QRSegment, or an Array", error...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
test/rqrcode_core/character_encoding_test.rb
Ruby
mit
48
main
3,181
require "test_helper" # Tests for character encoding handling in QR codes class CharacterEncodingTest < Minitest::Test def test_printable_ascii_uses_byte_mode ascii_string = (32..126).map(&:chr).join qr = RQRCodeCore::QRCode.new(ascii_string) assert_equal :mode_8bit_byte, qr.mode end def test_contr...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
test/rqrcode_core/data.rb
Ruby
mit
48
main
80,220
MATRIX_1_H = [[true, true, true, true, true, true, true, false, true, true, false, true, false, false, true, true, true, true, true, true, true], [true, false, false, false, false, false, true, false, false, true, false, false, true, false, true, false, false, false, false, false, true], [true, false, true, true, true,...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
test/rqrcode_core/qr_util_test.rb
Ruby
mit
48
main
3,732
require "test_helper" module RQRCodeCore class QRUtilTest < Minitest::Test def test_demerit_points_4_dark_ratio # Test with all white modules (ratio = 0) # Expected: (100 * 0 - 50).abs / 5 * 10 = 10 * 10 = 100 modules = Array.new(4) { Array.new(4, false) } assert_equal 100, QRUtil.demerit...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
test/rqrcode_core/output_verification_test.rb
Ruby
mit
48
main
10,788
require "test_helper" # High-level tests that verify QR code output correctness across various scenarios # These tests focus on structural integrity and consistency rather than internal implementation class OutputVerificationTest < Minitest::Test def test_module_count_matches_version_formula # QR Code size formu...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
lib/rqrcode_core/qrcode.rb
Ruby
mit
48
main
485
# frozen_string_literal: true require "rqrcode_core/qrcode/qr_8bit_byte" require "rqrcode_core/qrcode/qr_alphanumeric" require "rqrcode_core/qrcode/qr_bit_buffer" require "rqrcode_core/qrcode/qr_code" require "rqrcode_core/qrcode/qr_math" require "rqrcode_core/qrcode/qr_multi" require "rqrcode_core/qrcode/qr_numeric" ...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
lib/rqrcode_core/qrcode/qr_numeric.rb
Ruby
mit
48
main
847
# frozen_string_literal: true module RQRCodeCore NUMERIC = %w[0 1 2 3 4 5 6 7 8 9].freeze class QRNumeric def initialize(data) raise QRCodeArgumentError, "Not a numeric string `#{data}`" unless QRNumeric.valid_data?(data) @data = data end def self.valid_data?(data) (data.chars - NU...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
lib/rqrcode_core/qrcode/qr_polynomial.rb
Ruby
mit
48
main
1,309
# frozen_string_literal: true module RQRCodeCore class QRPolynomial def initialize(num, shift) raise QRCodeRunTimeError, "#{num.size}/#{shift}" if num.empty? offset = 0 while offset < num.size && num[offset] == 0 offset += 1 end @num = Array.new(num.size - offset + shift) ...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
lib/rqrcode_core/qrcode/qr_segment.rb
Ruby
mit
48
main
1,390
# frozen_string_literal: true module RQRCodeCore class QRSegment attr_reader :data, :mode def initialize(data:, mode: nil) @data = data @mode = QRMODE_NAME.dig(mode&.to_sym) # If mode is not explicitly found choose mode according to data type @mode ||= if RQRCodeCore::QRNumeric.vali...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
lib/rqrcode_core/qrcode/qr_alphanumeric.rb
Ruby
mit
48
main
1,054
# frozen_string_literal: true module RQRCodeCore ALPHANUMERIC = [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", " ", "$", "%", "*", "+", "-", ".", "/", ":" ].freeze c...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
lib/rqrcode_core/qrcode/qr_rs_block.rb
Ruby
mit
48
main
6,641
# frozen_string_literal: true module RQRCodeCore class QRRSBlock attr_reader :data_count, :total_count def initialize(total_count, data_count) @total_count = total_count @data_count = data_count end # http://www.thonky.com/qr-code-tutorial/error-correction-table/ RS_BLOCK_TABLE = [ ...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
lib/rqrcode_core/qrcode/qr_bit_buffer.rb
Ruby
mit
48
main
1,705
# frozen_string_literal: true module RQRCodeCore class QRBitBuffer attr_reader :buffer PAD0 = 0xEC PAD1 = 0x11 def initialize(version) @version = version @buffer = [] @length = 0 end def get(index) buf_index = (index / 8).floor (QRUtil.rszf(@buffer[buf_index],...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
lib/rqrcode_core/qrcode/qr_code.rb
Ruby
mit
48
main
16,103
# frozen_string_literal: true module RQRCodeCore QRMODE = { mode_number: 1 << 0, # 1 (binary: 0001) mode_alpha_numk: 1 << 1, # 2 (binary: 0010) mode_8bit_byte: 1 << 2 # 4 (binary: 0100) }.freeze QRMODE_NAME = { number: :mode_number, alphanumeric: :mode_alpha_numk, byte_8bit: :mod...
github
whomwah/rqrcode_core
https://github.com/whomwah/rqrcode_core
lib/rqrcode_core/qrcode/qr_8bit_byte.rb
Ruby
mit
48
main
276
# frozen_string_literal: true module RQRCodeCore class QR8bitByte def initialize(data) @data = data end def write(buffer) buffer.byte_encoding_start(@data.bytesize) @data.each_byte do |b| buffer.put(b, 8) end end end end