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
phillbaker/capybara-mechanize
https://github.com/phillbaker/capybara-mechanize
lib/capybara/mechanize/browser.rb
Ruby
mit
212
master
4,999
# frozen_string_literal: true require 'ostruct' require 'capybara/rack_test/driver' require 'mechanize' require 'capybara/mechanize/node' require 'capybara/mechanize/form' class Capybara::Mechanize::Browser < Capybara::RackTest::Browser extend Forwardable def_delegator :agent, :scheme_handlers def_delegator :a...
github
phillbaker/capybara-mechanize
https://github.com/phillbaker/capybara-mechanize
lib/capybara/mechanize/node.rb
Ruby
mit
212
master
793
# frozen_string_literal: true class Capybara::Mechanize::Node < Capybara::RackTest::Node def click(keys = [], **options) options.delete(:offset) raise ArgumentError, 'The mechanize driver does not support click options' unless keys.empty? && options.empty? submits = respond_to?(:submits?) ? submits? : ...
github
phillbaker/capybara-mechanize
https://github.com/phillbaker/capybara-mechanize
lib/capybara/mechanize/driver.rb
Ruby
mit
212
master
532
# frozen_string_literal: true require 'capybara/mechanize/browser' class Capybara::Mechanize::Driver < Capybara::RackTest::Driver def initialize(app, **options) raise ArgumentError, 'mechanize requires a rack application, but none was given' unless app super end def remote?(url) browser.remote?(ur...
github
phillbaker/capybara-mechanize
https://github.com/phillbaker/capybara-mechanize
lib/capybara/mechanize/form.rb
Ruby
mit
212
master
1,466
# frozen_string_literal: true class Capybara::Mechanize::Form < Capybara::RackTest::Form def params(button) return super unless use_mechanize? node = {} # Create a fake form class << node def search(*_args); []; end end node['method'] = button && button['formmethod'] node['method...
github
phillbaker/capybara-mechanize
https://github.com/phillbaker/capybara-mechanize
spec/spec_helper.rb
Ruby
mit
212
master
864
# frozen_string_literal: true require 'capybara/spec/spec_helper' require 'capybara/mechanize' require 'capybara/spec/extended_test_app' PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')).freeze $LOAD_PATH << File.join(PROJECT_ROOT, 'lib') Dir[File.join(PROJECT_ROOT, 'spec', 'support', '**', '...
github
phillbaker/capybara-mechanize
https://github.com/phillbaker/capybara-mechanize
spec/support/extended_test_app_setup.rb
Ruby
mit
212
master
861
# frozen_string_literal: true # This class works around some weirdness with Capybara's test suite and sinatra's behavior. # We need to make sure that sinatra uses TestApp for at least one request before the Capybara session # specs run. Without this we get errors from sinatra trying to handle requests with TestApp.cl...
github
phillbaker/capybara-mechanize
https://github.com/phillbaker/capybara-mechanize
spec/support/disable_external_tests.rb
Ruby
mit
212
master
587
# frozen_string_literal: true class DisableExternalTests attr_accessor :tests_to_disable def disable(top_level_example_group) tests_to_disable.each do |to_disable| example_group = top_level_example_group example_description = to_disable.pop to_disable.each do |description| example_...
github
phillbaker/capybara-mechanize
https://github.com/phillbaker/capybara-mechanize
spec/driver/mechanize_driver_spec.rb
Ruby
mit
212
master
7,532
# frozen_string_literal: true require 'spec_helper' describe Capybara::Mechanize::Driver, 'local' do let(:driver) { Capybara::Mechanize::Driver.new(ExtendedTestApp) } describe '#configure' do it 'allows extended configuration of the agent' do expect_any_instance_of(::Mechanize).to receive(:foo=).with('...
github
phillbaker/capybara-mechanize
https://github.com/phillbaker/capybara-mechanize
spec/driver/remote_mechanize_driver_spec.rb
Ruby
mit
212
master
1,421
# frozen_string_literal: true require 'spec_helper' describe Capybara::Mechanize::Driver, 'remote' do before do Capybara.app_host = remote_test_url end after do Capybara.app_host = nil end let(:driver) { Capybara::Mechanize::Driver.new(ExtendedTestApp) } context 'in remote mode' do it 'shou...
github
phillbaker/capybara-mechanize
https://github.com/phillbaker/capybara-mechanize
spec/session/remote_mechanize_spec.rb
Ruby
mit
212
master
3,118
# frozen_string_literal: true require 'spec_helper' module TestSessions RemoteMechanize = Capybara::Session.new(:mechanize, TestApp) end shared_context 'remote tests' do before do Capybara.app_host = remote_test_url end after do Capybara.app_host = nil end end skipped_tests = %i[ about_scheme ...
github
phillbaker/capybara-mechanize
https://github.com/phillbaker/capybara-mechanize
spec/session/mechanize_spec.rb
Ruby
mit
212
master
4,076
# frozen_string_literal: true require 'spec_helper' module TestSessions Mechanize = Capybara::Session.new(:mechanize, TestApp) end skipped_tests = %i[ about_scheme active_element css download frames hover html_validation js modals screenshot scroll send_keys server shadow_dom spatial ...
github
pocke/mry
https://github.com/pocke/mry
mry.gemspec
Ruby
apache-2.0
212
master
1,521
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'mry/version' Gem::Specification.new do |spec| spec.name = "mry" spec.version = Mry::VERSION spec.authors = ["Masataka Kuwabara"] spec.email = ["kuwabara@pocke...
github
pocke/mry
https://github.com/pocke/mry
bin/renamed_cop.rb
Ruby
apache-2.0
212
master
279
require 'yaml' log = YAML.load_file('/tmp/mry_check_rubocop_update_log.yaml') log[:renamed].each do |before:, after:| raise 'before is not one' if before.size != 1 raise 'after is not one' if after.size != 1 puts "define_rule ['#{before.first}' => '#{after.first}']" end
github
pocke/mry
https://github.com/pocke/mry
test/yaml_rewriter/test_rule.rb
Ruby
apache-2.0
212
master
817
require 'test_helper' class TestRule < Minitest::Test def test_rule_match rule = YAMLRewriter::Rule.new(['foo', 'bar' => 'baz']) assert { rule.match?(['foo', 'bar'], reverse: false) } assert { not rule.match?(['foo', 'baz'], reverse: false) } end def test_rule_match_with_reverse rule = YAMLRewri...
github
pocke/mry
https://github.com/pocke/mry
test/yaml_rewriter/test_rewriter.rb
Ruby
apache-2.0
212
master
3,184
require 'test_helper' class TestRewriter < Minitest::Test def test_rewriter [ [ [['foo' => 'hello']], <<~END, foo: bar: hoge baz: fuga END <<~END, hello: bar: hoge b...
github
pocke/mry
https://github.com/pocke/mry
test/mry/test_runner.rb
Ruby
apache-2.0
212
master
7,834
require 'test_helper' class TestRunner < Minitest::Test def test_run_with_master prev = <<~END # master Style/VariableName: Enabled: true # 0.49.0 Style/Tab: Enabled: true # 0.47.0 Lint/Eval: Enabled: true # 0.46.0 Performance/SortWithBlo...
github
pocke/mry
https://github.com/pocke/mry
test/mry/test_added_cops.rb
Ruby
apache-2.0
212
master
3,643
require 'test_helper' require 'yaml' class TestAddedCops < Minitest::Test def test_added_cops cops = Mry::AddedCops.added_cops( from: Gem::Version.new('0.50.0'), to: Gem::Version.new('0.51.0') ) assert_equal %w[ Rails/UnknownEnv Style/StderrPuts Lint/UnneededRequireStatemen...
github
pocke/mry
https://github.com/pocke/mry
lib/yaml_rewriter.rb
Ruby
apache-2.0
212
master
212
require 'psych' require 'yaml_rewriter/rule' require 'yaml_rewriter/scalar_with_mark' require 'yaml_rewriter/mark_handler' require 'yaml_rewriter/parser' require 'yaml_rewriter/rewriter' module YAMLRewriter end
github
pocke/mry
https://github.com/pocke/mry
lib/mry.rb
Ruby
apache-2.0
212
master
206
require 'yaml_rewriter' require 'optparse' require 'tmpdir' require 'pathname' require "mry/version" require 'mry/rewriters' require 'mry/runner' require 'mry/cli' require 'mry/added_cops' module Mry end
github
pocke/mry
https://github.com/pocke/mry
lib/mry/added_cops.rb
Ruby
apache-2.0
212
master
9,945
module Mry # TODO: Replace this list with VersionAdded module AddedCops Cops = { Gem::Version.new('0.78.0') => %w[ Lint/NonDeterministicRequireOrder ], Gem::Version.new('0.77.0') => %w[], Gem::Version.new('0.76.0') => %w[], Gem::Version.new('0.75.0') => %w[ Migratio...
github
pocke/mry
https://github.com/pocke/mry
lib/mry/runner.rb
Ruby
apache-2.0
212
master
996
module Mry module Runner class << self def run(files, to: , from:) rewriters, reverse_rewriters = *Rewriters.rewriters(to) files.each do |file| yaml = File.read(file) reverse_rewriters.each do |r| yaml = r.new(yaml, reverse: true).rewrite end ...
github
pocke/mry
https://github.com/pocke/mry
lib/mry/cli.rb
Ruby
apache-2.0
212
master
925
module Mry module CLI class << self # @param argv [Array<String>] # @return [Integer] exit code def run(argv) parse_option(argv) if argv.empty? puts option.help return 1 end Runner.run(argv, to: @target, from: @from) return 0 end ...
github
pocke/mry
https://github.com/pocke/mry
lib/mry/rewriters.rb
Ruby
apache-2.0
212
master
12,017
module Mry module Rewriters class Rewriter_Master < YAMLRewriter::Rewriter end class Rewriter_0_78_0 < YAMLRewriter::Rewriter define_rule ['Metrics/LineLength' => 'Layout/LineLength'] end class Rewriter_0_77_0 < YAMLRewriter::Rewriter define_rule ['Naming/UncommunicativeMethodParamNa...
github
pocke/mry
https://github.com/pocke/mry
lib/yaml_rewriter/rule.rb
Ruby
apache-2.0
212
master
411
module YAMLRewriter class Rule def initialize(rule) @rule = rule end def match?(path, reverse:) rule_path = @rule[0..-2] + (reverse ? [@rule.last.values.first] : [@rule.last.keys.first]) rule_path == (path[(path.size-@rule.size)..-1]) end def replacement(key, reverse:) ...
github
pocke/mry
https://github.com/pocke/mry
lib/yaml_rewriter/rewriter.rb
Ruby
apache-2.0
212
master
1,741
module YAMLRewriter # Usage: # class MyRewriter < YAMLRewriter::Rewriter # define_rule ['foo' => 'bar'] # define_rule ['one', 'two', 'threeee' => 'three'] # end # # MyRewriter.new('foo: baz').rewrite # => 'bar: baz' # # rewriter = MyRewriter.new(<<-END) # one: # two: # ...
github
pocke/mry
https://github.com/pocke/mry
lib/yaml_rewriter/mark_handler.rb
Ruby
apache-2.0
212
master
330
module YAMLRewriter class MarkHandler < ::Psych::TreeBuilder using ScalarWithMark def initialize(parser) @parser = parser super() end def scalar(value, anchor, tag, plain, quoted, style) mark = @parser.mark super.tap do |scalar| scalar.mark = mark end end ...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
Rakefile
Ruby
mit
212
master
2,054
require 'rake' require 'rake/testtask' desc 'Default: run all tests.' task :default => :test desc 'Run all tests.' Rake::TestTask.new(:test) do |t| t.libs << 'test' t.libs << 'lib' t.test_files = FileList['test/integration/*_test.rb', 'test/unit/*_test.rb'] t.verbose = true end desc 'Run unit tests.' Rake::T...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
acts_as_indexed.gemspec
Ruby
mit
212
master
2,539
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- # stub: acts_as_indexed 0.9.0 ruby lib Gem::Specification.new do |s| s.name = "acts_as_indexed".freeze s.version = "0.9.1" s.required_rubygems_version = Gem::Requi...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
Gemfile
Ruby
mit
212
master
238
source "http://rubygems.org" group :test do gem "sdoc" gem "rake" gem "minitest" gem "mocha"#, "~> 0.9.11" gem "sqlite3"#, "~> 1.3.5" gem "activerecord"#, "~> 3.2.9" gem "will_paginate"#, "~> 4.0" gem "activesupport" end
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
lib/acts_as_indexed.rb
Ruby
mit
212
master
1,598
require 'active_record' path = File.expand_path(File.dirname(__FILE__)) $:.unshift path unless $:.include?(path) require 'acts_as_indexed/class_methods' require 'acts_as_indexed/instance_methods' require 'acts_as_indexed/singleton_methods' require 'acts_as_indexed/configuration' require 'acts_as_indexed/search_index' ...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
lib/will_paginate_search.rb
Ruby
mit
212
master
800
module ActsAsIndexed module WillPaginate module Search def paginate_search(query, options) page = options.fetch(:page) { raise ArgumentError, ":page parameter required" } per_page = options.delete(:per_page) || self.per_page total_entries = options.delete(:total_entries) ...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
lib/acts_as_indexed/configuration.rb
Ruby
mit
212
master
2,620
module ActsAsIndexed # Used to set up and modify settings for acts_as_indexed. class Configuration # Sets the location for the index. Specify as an array. The default, for # example, would be set as [Rails.root,'tmp','index]. #attr_accessor :index_file # Tuning value for the index partitioning. La...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
lib/acts_as_indexed/token_normalizer.rb
Ruby
mit
212
master
525
module ActsAsIndexed class TokenNormalizer # Takes an array of tokens. # - Downcases the tokens when :normalize_case option is passed. # - Removes tokens of :min_token_length when option is passed. # Returns the resulting array of tokens. def self.process(arr, options={}) if options[:normal...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
lib/acts_as_indexed/class_methods.rb
Ruby
mit
212
master
6,829
module ActsAsIndexed module ClassMethods # Declares a class as searchable. # # ====options: # fields:: Names of fields to include in the index. Symbols pointing to # instance methods of your model may also be given here. # index_file_depth:: Tuning value for the index partitioning. ...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
lib/acts_as_indexed/singleton_methods.rb
Ruby
mit
212
master
343
module ActsAsIndexed # Adds model class singleton methods. module SingletonMethods # Finds instances matching the terms passed in +query+. # # See ActsAsIndexed::ClassMethods#search_index. def find_with_index(query='', find_options = {}, options = {}) search_index(query, find_options, option...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
lib/acts_as_indexed/search_index.rb
Ruby
mit
212
master
9,087
module ActsAsIndexed #:nodoc: class SearchIndex # fields:: Fields or instance methods of ActiveRecord model to be indexed. # config:: ActsAsIndexed::Configuration instance. def initialize(fields, config) @storage = Storage.new(config) @fields = fields @atoms = ActiveSupport::OrderedHash...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
lib/acts_as_indexed/search_atom.rb
Ruby
mit
212
master
3,946
module ActsAsIndexed #:nodoc: class SearchAtom # Contains a hash of records. # { 'record_id' => [pos1, pos2, pos] } #-- # Weighting: # http://www.perlmonks.com/index.pl?node_id=27509 # W(T, D) = tf(T, D) * log ( DN / df(T)) # weighting = frequency_in_this_record * log (total_number_of_rec...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
lib/acts_as_indexed/storage.rb
Ruby
mit
212
master
5,215
require 'thread' module ActsAsIndexed #:nodoc: class Storage class OldIndexVersion < Exception;end INDEX_FILE_EXTENSION = '.ind' TEMP_FILE_EXTENSION = '.tmp' def initialize(config) @path = Pathname.new(config.index_file.to_s) @size_path = @path.join('size') @prefix_size = config...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
lib/acts_as_indexed/instance_methods.rb
Ruby
mit
212
master
677
module ActsAsIndexed # Adds model class instance methods. # Methods are called automatically by ActiveRecord on +save+, +destroy+, # and +update+ of model instances. module InstanceMethods # Adds the current model instance to index. # Called by ActiveRecord on +save+. def add_to_index self.c...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
test/unit_test_helper.rb
Ruby
mit
212
master
536
require 'minitest/autorun' require 'fileutils' # require 'bundler/setup' # require 'mocha' # require 'mocha/integration/test_unit' require 'mocha/minitest' require 'active_support/test_case' # Mock out the required environment variables. # Do this before requiring AAI. class Rails def self.root Pathname.new(Dir...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
test/integration_test_helper.rb
Ruby
mit
212
master
1,513
require 'minitest/autorun' require 'fileutils' require 'bundler/setup' require 'active_record' require 'active_record/fixtures' require 'mocha' puts "ActiveRecord version is #{ActiveRecord::VERSION::STRING}" # Mock out the required environment variables. # Do this before requiring AAI. class Rails def self.root ...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
test/integration/will_paginate_search_test.rb
Ruby
mit
212
master
621
require 'integration_test_helper' class WillPaginateSearchTest < ActiveSupport::TestCase fixtures :posts def teardown # need to do this to work with the :if Proc tests. Post.acts_as_indexed :fields => [:title, :body] destroy_index end def test_paginate_search assert_equal [5, 2, 1, 3, 6, 4], ...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
test/integration/acts_as_indexed_test.rb
Ruby
mit
212
master
12,499
require 'integration_test_helper.rb' class ActsAsIndexedTest < ActiveSupport::TestCase fixtures :posts def teardown # need to do this to work with the :if Proc tests. Post.acts_as_indexed :fields => [:title, :body] destroy_index end def test_adds_to_index original_post_count = Post.count ...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
test/unit/search_index_test.rb
Ruby
mit
212
master
394
require 'unit_test_helper.rb' include ActsAsIndexed class SearchIndexTest < ActiveSupport::TestCase def teardown destroy_index end # Write new tests for this since most of the existing tests were concerned # with the storage routines which have now been moved elsewhere. private def build_sear...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
test/unit/configuration_test.rb
Ruby
mit
212
master
1,877
require 'unit_test_helper' include ActsAsIndexed class ConfigurationTest < ActiveSupport::TestCase def test_default_index_file_should_be_set assert_equal Rails.root.join('tmp', 'index'), config.index_file end def test_default_index_file_depth_should_be_set assert_equal 3, config.index_file_depth end ...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
test/unit/tokenizer_test.rb
Ruby
mit
212
master
387
require 'unit_test_helper.rb' include ActsAsIndexed class TokenizerTest < ActiveSupport::TestCase def test_splits_tokens_to_array assert_equal ["Chocolate", "Chip", "Cookies"], Tokenizer.process("Chocolate Chip Cookies ") end def test_deals_with_multiple_spaces assert_equal ["Chocolate", "Chip", "Cooki...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
test/unit/token_normalizer_test.rb
Ruby
mit
212
master
1,042
require 'unit_test_helper.rb' include ActsAsIndexed class TokenNormalizerTest < ActiveSupport::TestCase def test_leaves_case_of_tokens_untouched assert_equal ["Chocolate", "Chip", "Cookies"], TokenNormalizer.process(["Chocolate", "Chip", "Cookies"]) end def test_downcases_tokens assert_equal ["chocolat...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
test/unit/search_atom_test.rb
Ruby
mit
212
master
3,167
require 'unit_test_helper.rb' include ActsAsIndexed class SearchAtomTest < ActiveSupport::TestCase def test_should_create_a_new_instance assert SearchAtom.new end def test_include_record_should_return_false assert ! SearchAtom.new.include_record?(123) end def test_include_record_should_retur...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
test/unit/pre_tokenizer_test.rb
Ruby
mit
212
master
349
require 'unit_test_helper.rb' include ActsAsIndexed class PreTokenizerTest < ActiveSupport::TestCase def test_strips_non_word_characters assert_equal "Chocolate Chip Cookies ", PreTokenizer.process("Chocolate-Chip Cookies!") end def test_strips_underscores assert_equal "Test try it", PreTokenizer.proce...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
test/db/schema.rb
Ruby
mit
212
master
329
ActiveRecord::Schema.define :version => 0 do create_table :posts, :force => true do |t| t.column :title, :string t.column :body, :text t.column :visible, :boolean end create_table :sources, :force => true do |t| t.column :name, :string t.column :url, :string t.column :description, :text ...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
test/performance/record_removal_performance_test.rb
Ruby
mit
212
master
521
require 'integration_test_helper.rb' require 'benchmark' class RecordRemovalPerformanceTest < ActiveSupport::TestCase fixtures :posts def teardown # need to do this to work with the :if Proc tests. Post.acts_as_indexed :fields => [:title, :body] destroy_index end def test_removal iterations =...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
test/performance/record_addition_performance_test.rb
Ruby
mit
212
master
501
require 'integration_test_helper.rb' require 'benchmark' class RecordAdditionPerformanceTest < ActiveSupport::TestCase fixtures :posts def teardown # need to do this to work with the :if Proc tests. Post.acts_as_indexed :fields => [:title, :body] destroy_index end def test_addition iterations...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
test/performance/record_update_performance_test.rb
Ruby
mit
212
master
1,132
require 'integration_test_helper.rb' require 'benchmark' class RecordUpdatePerformanceTest < ActiveSupport::TestCase fixtures :posts def teardown # need to do this to work with the :if Proc tests. Post.acts_as_indexed :fields => [:title, :body] destroy_index end def test_unchanged iterations ...
github
dougal/acts_as_indexed
https://github.com/dougal/acts_as_indexed
test/performance/query_performance_test.rb
Ruby
mit
212
master
1,119
require 'integration_test_helper.rb' require 'benchmark' class RecordUpdatePerformanceTest < ActiveSupport::TestCase fixtures :posts QUERIES = [ ['crane', 10_000], ['foo', 10_000], ['-foo', 10_000], ['-foo crane', 10_000], ['foo "crane ship', 10_000], ['crane -"crane ship"', 10_000], [...
github
G5/storext
https://github.com/G5/storext
Rakefile
Ruby
mit
212
master
573
begin require 'bundler/setup' rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end require 'rdoc/task' RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' rdoc.title = 'Storext' rdoc.options << '--line-numbers' rdoc.rdoc_files.include('README.rdoc') rdo...
github
G5/storext
https://github.com/G5/storext
storext.gemspec
Ruby
mit
212
master
965
$:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "storext/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "storext" s.version = Storext::VERSION s.authors = ["G5", "Ramon Tayag", "Marc Rendl Ignacio"] s.email ...
github
G5/storext
https://github.com/G5/storext
Gemfile
Ruby
mit
212
master
523
source "https://rubygems.org" # Declare your gem's dependencies in storext.gemspec. # Bundler will treat runtime dependencies like base dependencies, and # development dependencies will be added by default to the :development group. gemspec # Declare any dependencies that are still in development here instead of in #...
github
G5/storext
https://github.com/G5/storext
Appraisals
Ruby
mit
212
master
452
appraise "rails_4.2.10" do gem "rails", "4.2.10" gem "pg", "~> 0.12" end appraise "rails_5.0.7" do gem "rails", "5.0.7" gem "pg", "~> 0.12" end appraise "rails_5.1.6" do gem "rails", "5.1.6" gem "pg", "~> 1.0" end appraise "rails_5.2.1" do gem "rails", "5.2.1" gem "pg", "~> 1.0" end appraise "rails_...
github
G5/storext
https://github.com/G5/storext
spec/storext_spec.rb
Ruby
mit
212
master
9,716
require 'spec_helper' describe Storext do it "can set default value for the serialized column" do coffee = Coffee.new expect(coffee.data).to eq({}) end describe ".store_attributes" do it "allows definition of multiple attributes" do book = Book.create book.author = "A. Clarke" boo...
github
G5/storext
https://github.com/G5/storext
spec/spec_helper.rb
Ruby
mit
212
master
661
# Configure Rails Environment ENV["RAILS_ENV"] = "test" require "bundler/setup" Bundler.require(:development, :test) require "storext" require File.expand_path("../dummy/config/environment.rb", __FILE__) require "rails/test_help" Rails.backtrace_cleaner.remove_silencers! # Load support files Dir["#{File.dirname(__F...
github
G5/storext
https://github.com/G5/storext
spec/dummy/config/application.rb
Ruby
mit
212
master
881
require File.expand_path('../boot', __FILE__) require 'rails/all' Bundler.require(*Rails.groups) require "storext" module Dummy class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/in...
github
G5/storext
https://github.com/G5/storext
spec/dummy/config/environments/test.rb
Ruby
mit
212
master
1,705
Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suit...
github
G5/storext
https://github.com/G5/storext
spec/dummy/app/models/book.rb
Ruby
mit
212
master
658
class Book < ActiveRecord::Base include Storext.model store_attributes :data do author String title String, default: "Great Voyage" available Boolean, default: true copies Integer, default: 0 preface String, default: :default_preface isbn(String, { default: lambda do |book, attribute|...
github
G5/storext
https://github.com/G5/storext
spec/dummy/db/schema.rb
Ruby
mit
212
master
1,381
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
G5/storext
https://github.com/G5/storext
lib/storext.rb
Ruby
mit
212
master
1,181
require "active_support/concern" require "active_support/core_ext/module/attribute_accessors" require "virtus" require "storext/attribute_proxy" require "storext/class_methods" require "storext/instance_methods" module Storext mattr_accessor :proxy_classes self.proxy_classes ||= {} def self.model(options={}) ...
github
G5/storext
https://github.com/G5/storext
lib/storext/instance_methods.rb
Ruby
mit
212
master
1,632
module Storext module InstanceMethods def destroy_key(column, attr) new_value = send(column) if Rails.gem_version < Gem::Version.new("4.2.0") new_value = send(column).dup end new_value.delete(attr.to_s) storext_cast_proxy.reset_attribute(attr) send("#{column}=", new_v...
github
G5/storext
https://github.com/G5/storext
lib/storext/class_methods.rb
Ruby
mit
212
master
3,466
module Storext module ClassMethods def storext_define_writer(column, attr) define_method "#{attr}=" do |value| coerced_value = storext_cast_proxy.send("#{attr}=", value) send("#{column}=", send(column) || {}) write_store_attribute column, attr, coerced_value send(column)[at...
github
G5/storext
https://github.com/G5/storext
lib/storext/attribute_proxy.rb
Ruby
mit
212
master
378
module Storext class AttributeProxy def initialize(source_class, column, &block) @source_class = source_class @column = column @block = block end def define_store_attribute instance_eval &@block end def method_missing(method_name, *args, &block) @source_class.store...
github
chocoby/jp_prefecture
https://github.com/chocoby/jp_prefecture
Rakefile
Ruby
mit
211
main
1,679
#!/usr/bin/env rake # frozen_string_literal: true require 'bundler/gem_tasks' desc '郵便番号のデータを作成/更新する' task :create_zip_code_data do require 'csv' require 'jp_prefecture' file_name = 'ken_all_utf8.csv' # download files `curl -O https://www.post.japanpost.jp/zipcode/dl/kogaki/zip/ken_all.zip` `unzip ken_a...
github
chocoby/jp_prefecture
https://github.com/chocoby/jp_prefecture
Gemfile
Ruby
mit
211
main
384
# frozen_string_literal: true source 'https://rubygems.org' gemspec gem 'csv' gem 'rake' group :development, :test do gem 'rubocop', require: false gem 'rubocop-performance', require: false gem 'rubocop-rake', require: false gem 'rubocop-rspec', require: false end group :test do gem 'rspec' gem 'simple...
github
chocoby/jp_prefecture
https://github.com/chocoby/jp_prefecture
jp_prefecture.gemspec
Ruby
mit
211
main
856
# frozen_string_literal: true require File.expand_path('lib/jp_prefecture/version', __dir__) Gem::Specification.new do |gem| gem.name = 'jp_prefecture' gem.version = JpPrefecture::VERSION gem.authors = ['chocoby'] gem.email = ['chocoby@himajin.dev'] gem.summary = 'Convert...
github
chocoby/jp_prefecture
https://github.com/chocoby/jp_prefecture
lib/jp_prefecture.rb
Ruby
mit
211
main
353
# frozen_string_literal: true require 'jp_prefecture/base' require 'jp_prefecture/config' require 'jp_prefecture/prefecture' require 'jp_prefecture/version' module JpPrefecture @config = Config.new def self.included(model_class) model_class.extend Base end def self.setup yield @config end def s...
github
chocoby/jp_prefecture
https://github.com/chocoby/jp_prefecture
lib/jp_prefecture/mapping.rb
Ruby
mit
211
main
331
# frozen_string_literal: true require 'yaml' module JpPrefecture # コードと都道府県のマッピング module Mapping filepath = File.join(File.dirname(__FILE__), '../../data/prefecture.yml') @data = YAML.load_file(filepath) def self.data JpPrefecture.config.mapping_data || @data end end end
github
chocoby/jp_prefecture
https://github.com/chocoby/jp_prefecture
lib/jp_prefecture/prefecture.rb
Ruby
mit
211
main
4,102
# frozen_string_literal: true require 'jp_prefecture/prefecture/finder' require 'jp_prefecture/mapping' require 'jp_prefecture/zip_mapping' module JpPrefecture # 都道府県のコードと名前を扱うクラス class Prefecture attr_accessor :code, :name, :name_e, :name_r, :name_h, :name_k, :zips, :area, :type # 都道府県コードから都道府県インスタンスを作成...
github
chocoby/jp_prefecture
https://github.com/chocoby/jp_prefecture
lib/jp_prefecture/base.rb
Ruby
mit
211
main
1,357
# frozen_string_literal: true module JpPrefecture module Base # モデル内で使用するための設定を行う # # 変換対象のカラムを指定する: # # class Place < ActiveRecord::Base # include JpPrefecture # jp_prefecture :prefecture_code # end # # p = Place.new # p.prefecture_code = 1 # p.prefe...
github
chocoby/jp_prefecture
https://github.com/chocoby/jp_prefecture
lib/jp_prefecture/zip_mapping.rb
Ruby
mit
211
main
608
# frozen_string_literal: true require 'yaml' module JpPrefecture # コードと郵便番号のマッピング module ZipMapping filepath = File.join(File.dirname(__FILE__), '../../data/zip.yml') @data = YAML.load_file(filepath) @data = Hash[*@data.collect { |code, arr| [code, arr.collect { |zip_from, zip_to| zip_from..zip_to }] ...
github
chocoby/jp_prefecture
https://github.com/chocoby/jp_prefecture
lib/jp_prefecture/prefecture/finder.rb
Ruby
mit
211
main
2,053
# frozen_string_literal: true require 'jp_prefecture/mapping' require 'jp_prefecture/zip_mapping' module JpPrefecture class Prefecture # 都道府県の検索を行うクラス class Finder def initialize @mapping = Mapping.data end # 指定した項目を検索 # # @param field [Symbol] 検索する項目。nil の場合は都道府県コードとし...
github
chocoby/jp_prefecture
https://github.com/chocoby/jp_prefecture
spec/base_spec.rb
Ruby
mit
211
main
2,581
# frozen_string_literal: true require 'spec_helper' describe JpPrefecture::Base do describe '#jp_prefecture' do describe 'カラム名の指定について' do context 'prefecture_code を指定した場合' do let(:model_class) do klass = Class.new(ActiveRecord::Base) do self.table_name = :places i...
github
chocoby/jp_prefecture
https://github.com/chocoby/jp_prefecture
spec/mapping_spec.rb
Ruby
mit
211
main
229
# frozen_string_literal: true require 'spec_helper' describe JpPrefecture::Mapping do describe '.data' do it '都道府県の数が47であること' do expect(described_class.data.count).to eq 47 end end end
github
chocoby/jp_prefecture
https://github.com/chocoby/jp_prefecture
spec/zip_mapping_spec.rb
Ruby
mit
211
main
232
# frozen_string_literal: true require 'spec_helper' describe JpPrefecture::ZipMapping do describe '.data' do it '都道府県の数が47であること' do expect(described_class.data.count).to eq 47 end end end
github
chocoby/jp_prefecture
https://github.com/chocoby/jp_prefecture
spec/spec_helper.rb
Ruby
mit
211
main
903
# frozen_string_literal: true if ENV['CI'] require 'simplecov' require 'simplecov-lcov' SimpleCov::Formatter::LcovFormatter.config do |c| c.report_with_single_file = true c.single_report_path = 'coverage/lcov.info' end SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter SimpleCov.start end r...
github
chocoby/jp_prefecture
https://github.com/chocoby/jp_prefecture
spec/jp_prefecture_spec.rb
Ruby
mit
211
main
819
# frozen_string_literal: true require 'spec_helper' describe JpPrefecture do describe '.included' do subject do Class.new(ActiveRecord::Base) do include JpPrefecture end end it { is_expected.to respond_to(:jp_prefecture) } end describe 'include されていない' do subject { Class.ne...
github
chocoby/jp_prefecture
https://github.com/chocoby/jp_prefecture
spec/prefecture_spec.rb
Ruby
mit
211
main
3,124
# frozen_string_literal: true require 'spec_helper' describe JpPrefecture::Prefecture do describe '.build_by_code' do context '都道府県が見つかる' do let(:pref) { JpPrefecture::Prefecture.build_by_code(1) } it { expect(pref).to be_an_instance_of(JpPrefecture::Prefecture) } it { expect(pref.code).to eq(...
github
chocoby/jp_prefecture
https://github.com/chocoby/jp_prefecture
spec/config_spec.rb
Ruby
mit
211
main
533
# frozen_string_literal: true require 'spec_helper' describe JpPrefecture::Config do describe '#mapping_data' do context 'カスタマイズされたprefecture.ymlを使うとき' do before do filepath = File.join(File.dirname(__FILE__), 'fixtures/prefecture.yml') @config = described_class.new @config.mapping...
github
chocoby/jp_prefecture
https://github.com/chocoby/jp_prefecture
spec/prefecture/finder_spec.rb
Ruby
mit
211
main
4,058
# frozen_string_literal: true require 'spec_helper' describe JpPrefecture::Prefecture::Finder do describe '#find' do shared_examples '都道府県が見つかる' do |field, value, expected_result| let(:result) { JpPrefecture::Prefecture::Finder.new.find(field: field, value: value) } it { expect(result.name).to eq(ex...
github
stripe/subprocess
https://github.com/stripe/subprocess
Rakefile
Ruby
mit
211
master
2,657
# frozen_string_literal: true require 'bundler/gem_tasks' require 'bundler/setup' require 'rake/testtask' require 'tempfile' task :default do sh 'rake -T' end Rake::TestTask.new do |t| t.libs.push "lib" t.test_files = FileList['test/test_*.rb'] t.verbose = true end task :sord do rbi_file = 'rbi/subprocess...
github
stripe/subprocess
https://github.com/stripe/subprocess
subprocess.gemspec
Ruby
mit
211
master
926
# -*- encoding: utf-8 -*- # frozen_string_literal: true lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'subprocess/version' Gem::Specification.new do |s| s.name = "subprocess" s.version = Subprocess::VERSION s.authors = ["Carl Jackson", "...
github
stripe/subprocess
https://github.com/stripe/subprocess
lib/subprocess.rb
Ruby
mit
211
master
25,276
# frozen_string_literal: true require 'thread' require 'set' require 'subprocess/version' # A Ruby clone of Python's subprocess module. # # @see http://docs.python.org/2/library/subprocess.html module Subprocess # An opaque constant that indicates that a pipe should be opened. PIPE = -1 # An opaque constant th...
github
stripe/subprocess
https://github.com/stripe/subprocess
test/test_subprocess.rb
Ruby
mit
211
master
14,349
# coding: utf-8 # frozen_string_literal: true require 'rubygems' gem 'minitest' require 'minitest/autorun' require 'subprocess' require 'timeout' require 'pathname' require 'tempfile' # Because we're testing spawning processes, these tests assume you have a basic # set of useful UNIX-y programs on your PATH. Efforts ...
github
stripe/subprocess
https://github.com/stripe/subprocess
test/test_empty_stdin.rb
Ruby
mit
211
master
1,983
# frozen_string_literal: true require 'rubygems' gem 'minitest' require 'minitest/autorun' require 'subprocess' describe Subprocess do describe "communicate with empty string input" do # Bug report: subprocess.communicate("") doesn't properly handle stdin, # causing it to close incorrectly and result in a br...
github
tsechingho/ckeditor-rails
https://github.com/tsechingho/ckeditor-rails
Rakefile
Ruby
mit
211
master
346
#!/usr/bin/env rake require 'bundler/gem_tasks' require File.expand_path('../lib/ckeditor-rails/source_file', __FILE__) desc 'Update CKEditor Library, VERSION is required.' task 'update_ckeditor' do files = SourceFile.new files.fetch ENV['VERSION'] files.destination_root = 'vendor/assets' files.move files.fi...
github
tsechingho/ckeditor-rails
https://github.com/tsechingho/ckeditor-rails
ckeditor-rails.gemspec
Ruby
mit
211
master
1,099
# -*- encoding: utf-8 -*- require File.expand_path('../lib/ckeditor-rails/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ['Tse-Ching Ho'] gem.email = ['tsechingho@gmail.com'] gem.description = %q{CKEditor is a javascript library of the WYSIWYG rich-text editor. This gem integra...
github
tsechingho/ckeditor-rails
https://github.com/tsechingho/ckeditor-rails
test/rails6/Gemfile
Ruby
mit
211
master
2,028
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '3.0.2' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main' gem 'rails', '~> 6.1.4', '>= 6.1.4.1' # Use sqlite3 as the database for Active Record gem 'sqlite3', '~> 1.4' # Use Puma as the app...
github
tsechingho/ckeditor-rails
https://github.com/tsechingho/ckeditor-rails
test/rails6/config/application.rb
Ruby
mit
211
master
1,190
require_relative "boot" require "rails" # Pick the frameworks you want: require "active_model/railtie" require "active_job/railtie" require "active_record/railtie" require "active_storage/engine" require "action_controller/railtie" require "action_mailer/railtie" require "action_mailbox/engine" require "action_text/en...
github
tsechingho/ckeditor-rails
https://github.com/tsechingho/ckeditor-rails
test/rails6/config/initializers/assets.rb
Ruby
mit
211
master
724
# Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path # Add Yarn node_modules ...
github
tsechingho/ckeditor-rails
https://github.com/tsechingho/ckeditor-rails
test/rails6/config/environments/production.rb
Ruby
mit
211
master
5,333
require "active_support/core_ext/integer/time" Rails.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 # Eager load code on boot. This eager loads most of Rails and # your applica...
github
tsechingho/ckeditor-rails
https://github.com/tsechingho/ckeditor-rails
test/rails5/Gemfile
Ruby
mit
211
master
2,009
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.7.4' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.2.6' # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use Puma as the app server gem "puma", ">= 4.3.12" # Use SC...
github
tsechingho/ckeditor-rails
https://github.com/tsechingho/ckeditor-rails
test/rails5/config/puma.rb
Ruby
mit
211
master
1,499
# Puma can serve each request in a thread from an internal thread pool. # The `threads` method setting takes two numbers: a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum # and maximum; this matches...
github
tsechingho/ckeditor-rails
https://github.com/tsechingho/ckeditor-rails
test/rails5/config/application.rb
Ruby
mit
211
master
1,083
require_relative 'boot' require "rails" # Pick the frameworks you want: require "active_model/railtie" require "active_job/railtie" require "active_record/railtie" require "active_storage/engine" require "action_controller/railtie" require "action_mailer/railtie" require "action_view/railtie" require "action_cable/eng...
github
tsechingho/ckeditor-rails
https://github.com/tsechingho/ckeditor-rails
test/rails5/config/environments/production.rb
Ruby
mit
211
master
3,936
Rails.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 # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web serve...