equalizer-0.0.11/0000755000004100000410000000000012545527303013630 5ustar www-datawww-dataequalizer-0.0.11/.yardstick.yml0000644000004100000410000000002312545527303016421 0ustar www-datawww-data--- threshold: 100 equalizer-0.0.11/Rakefile0000644000004100000410000000014012545527303015270 0ustar www-datawww-datarequire 'bundler' require 'devtools' Bundler::GemHelper.install_tasks Devtools.init_rake_tasks equalizer-0.0.11/Gemfile0000644000004100000410000000024512545527303015124 0ustar www-datawww-data# encoding: utf-8 source 'https://rubygems.org' group :development, :test do gem 'devtools', '= 0.0.2', git: 'https://github.com/mbj/devtools.git' end gemspec equalizer-0.0.11/.rspec0000644000004100000410000000011212545527303014737 0ustar www-datawww-data--backtrace --color --format progress --order random --profile --warnings equalizer-0.0.11/.ruby-version0000644000004100000410000000001312545527303016267 0ustar www-datawww-dataruby-2.2.1 equalizer-0.0.11/spec/0000755000004100000410000000000012545527303014562 5ustar www-datawww-dataequalizer-0.0.11/spec/spec_helper.rb0000644000004100000410000000103212545527303017374 0ustar www-datawww-data# encoding: utf-8 if ENV['COVERAGE'] == 'true' require 'simplecov' require 'coveralls' SimpleCov.formatters = [ SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter ] SimpleCov.start do command_name 'spec:unit' add_filter 'config' add_filter 'spec' add_filter 'vendor' minimum_coverage 100 end end require 'equalizer' RSpec.configure do |config| config.raise_errors_for_deprecations! config.expect_with :rspec do |expect_with| expect_with.syntax = :expect end end equalizer-0.0.11/spec/unit/0000755000004100000410000000000012545527303015541 5ustar www-datawww-dataequalizer-0.0.11/spec/unit/equalizer/0000755000004100000410000000000012545527303017542 5ustar www-datawww-dataequalizer-0.0.11/spec/unit/equalizer/included_spec.rb0000644000004100000410000000312212545527303022666 0ustar www-datawww-data# encoding: utf-8 require 'spec_helper' describe Equalizer, '#included' do subject { descendant.instance_exec(object) { |mod| include mod } } let(:object) { described_class.new } let(:descendant) { Class.new } let(:superclass) { described_class.superclass } before do # Prevent Module.included from being called through inheritance allow(described_class::Methods).to receive(:included) end around do |example| # Restore included method after each example superclass.class_eval do alias_method :original_included, :included example.call undef_method :included alias_method :included, :original_included end end it 'delegates to the superclass #included method' do # This is the most succinct approach I could think of to test whether the # superclass#included method is called. All of the built-in rspec helpers # did not seem to work for this. included = false superclass.class_eval do define_method(:included) do |_| # Only set the flag when an Equalizer instance is included. # Otherwise, other module includes (which get triggered internally # in RSpec when `change` is used for the first time, since it uses # autoloading for its matchers) will wrongly set this flag. included = true if self.kind_of?(Equalizer) end end expect { subject }.to change { included }.from(false).to(true) end it 'includes methods into the descendant' do subject expect(descendant.included_modules).to include(described_class::Methods) end end equalizer-0.0.11/spec/unit/equalizer/universal_spec.rb0000644000004100000410000000750512545527303023120 0ustar www-datawww-data# encoding: utf-8 require 'spec_helper' describe Equalizer, '.new' do let(:object) { described_class } let(:name) { 'User' } let(:klass) { ::Class.new } context 'with no keys' do subject { object.new } before do # specify the class #name method allow(klass).to receive(:name).and_return(name) klass.send(:include, subject) end let(:instance) { klass.new } it { should be_instance_of(object) } it { should be_frozen } it 'defines #hash and #inspect methods dynamically' do expect(subject.public_instance_methods(false).map(&:to_s).sort) .to eql(%w[hash inspect]) end describe '#eql?' do context 'when the objects are similar' do let(:other) { instance.dup } it { expect(instance.eql?(other)).to be(true) } end context 'when the objects are different' do let(:other) { double('other') } it { expect(instance.eql?(other)).to be(false) } end end describe '#==' do context 'when the objects are similar' do let(:other) { instance.dup } it { expect(instance == other).to be(true) } end context 'when the objects are different' do let(:other) { double('other') } it { expect(instance == other).to be(false) } end end describe '#hash' do it 'has the expected arity' do expect(klass.instance_method(:hash).arity).to be(0) end it { expect(instance.hash).to eql([klass].hash) } end describe '#inspect' do it 'has the expected arity' do expect(klass.instance_method(:inspect).arity).to be(0) end it { expect(instance.inspect).to eql('#') } end end context 'with keys' do subject { object.new(*keys) } let(:keys) { %i[firstname lastname].freeze } let(:firstname) { 'John' } let(:lastname) { 'Doe' } let(:instance) { klass.new(firstname, lastname) } let(:klass) do ::Class.new do attr_reader :firstname, :lastname private :firstname, :lastname def initialize(firstname, lastname) @firstname, @lastname = firstname, lastname end end end before do # specify the class #inspect method allow(klass).to receive_messages(name: nil, inspect: name) klass.send(:include, subject) end it { should be_instance_of(object) } it { should be_frozen } it 'defines #hash and #inspect methods dynamically' do expect(subject.public_instance_methods(false).map(&:to_s).sort) .to eql(%w[hash inspect]) end describe '#eql?' do context 'when the objects are similar' do let(:other) { instance.dup } it { expect(instance.eql?(other)).to be(true) } end context 'when the objects are different' do let(:other) { double('other') } it { expect(instance.eql?(other)).to be(false) } end end describe '#==' do context 'when the objects are similar' do let(:other) { instance.dup } it { expect(instance == other).to be(true) } end context 'when the objects are different type' do let(:other) { klass.new('Foo', 'Bar') } it { expect(instance == other).to be(false) } end context 'when the objects are from different type' do let(:other) { double('other') } it { expect(instance == other).to be(false) } end end describe '#hash' do it 'returns the expected hash' do expect(instance.hash) .to eql([firstname, lastname, klass].hash) end end describe '#inspect' do it 'returns the expected string' do expect(instance.inspect) .to eql('#') end end end end equalizer-0.0.11/spec/unit/equalizer/methods/0000755000004100000410000000000012545527303021205 5ustar www-datawww-dataequalizer-0.0.11/spec/unit/equalizer/methods/equality_operator_spec.rb0000644000004100000410000000516012545527303026316 0ustar www-datawww-data# encoding: utf-8 require 'spec_helper' describe Equalizer::Methods, '#==' do subject { object == other } let(:object) { described_class.new(true) } let(:described_class) { Class.new(super_class) } let(:super_class) do Class.new do include Equalizer::Methods attr_reader :boolean def initialize(boolean) @boolean = boolean end def cmp?(comparator, other) boolean.send(comparator, other.boolean) end end end context 'with the same object' do let(:other) { object } it { should be(true) } it 'is symmetric' do should eql(other == object) end end context 'with an equivalent object' do let(:other) { object.dup } it { should be(true) } it 'is symmetric' do should eql(other == object) end end context 'with a subclass instance having equivalent obervable state' do let(:other) { Class.new(described_class).new(true) } it { should be(true) } it 'is not symmetric' do # the subclass instance should maintain substitutability with the object # (in the LSP sense) the reverse is not true. should_not eql(other == object) end end context 'with a superclass instance having equivalent observable state' do let(:other) { super_class.new(true) } it { should be(false) } it 'is not symmetric' do should_not eql(other == object) end end context 'with an object of another class' do let(:other) { Class.new.new } it { should be(false) } it 'is symmetric' do should eql(other == object) end end context 'with an equivalent object after coercion' do let(:other) { Object.new } before do # declare a private #coerce method described_class.class_eval do def coerce(other) [self.class.new(![nil, false].include?(other)), self] end private :coerce end end it { should be(true) } it 'is not symmetric' do should_not eql(other == object) end end context 'with a different object after coercion' do let(:other) { nil } before do # declare a private #coerce method described_class.class_eval do def coerce(other) [self.class.new(![nil, false].include?(other)), self] end private :coerce end end it { should be(false) } it 'is symmetric' do should eql(other == object) end end context 'with a different object' do let(:other) { described_class.new(false) } it { should be(false) } it 'is symmetric' do should eql(other == object) end end end equalizer-0.0.11/spec/unit/equalizer/methods/eql_predicate_spec.rb0000644000004100000410000000226512545527303025352 0ustar www-datawww-data# encoding: utf-8 require 'spec_helper' describe Equalizer::Methods, '#eql?' do subject { object.eql?(other) } let(:object) { described_class.new(true) } let(:described_class) do Class.new do include Equalizer::Methods attr_reader :boolean def initialize(boolean) @boolean = boolean end def cmp?(comparator, other) boolean.send(comparator, other.boolean) end end end context 'with the same object' do let(:other) { object } it { should be(true) } it 'is symmetric' do should eql(other.eql?(object)) end end context 'with an equivalent object' do let(:other) { object.dup } it { should be(true) } it 'is symmetric' do should eql(other.eql?(object)) end end context 'with an equivalent object of a subclass' do let(:other) { Class.new(described_class).new(true) } it { should be(false) } it 'is symmetric' do should eql(other.eql?(object)) end end context 'with a different object' do let(:other) { described_class.new(false) } it { should be(false) } it 'is symmetric' do should eql(other.eql?(object)) end end end equalizer-0.0.11/spec/support/0000755000004100000410000000000012545527303016276 5ustar www-datawww-dataequalizer-0.0.11/spec/support/config_alias.rb0000644000004100000410000000012512545527303021237 0ustar www-datawww-data# encoding: utf-8 require 'rbconfig' ::Config = RbConfig unless defined?(::Config) equalizer-0.0.11/.travis.yml0000644000004100000410000000067412545527303015750 0ustar www-datawww-datalanguage: ruby bundler_args: --without yard guard benchmarks script: "bundle exec rake ci" cache: bundler sudo: false rvm: - 2.0 - 2.1 - 2.2 - ruby-head - rbx-2 matrix: include: - rvm: jruby env: JRUBY_OPTS="$JRUBY_OPTS --debug --2.0" # for simplecov - rvm: jruby-head env: JRUBY_OPTS="$JRUBY_OPTS --debug --2.0" # for simplecov allow_failures: - rvm: ruby-head - rvm: jruby-head fast_finish: true equalizer-0.0.11/lib/0000755000004100000410000000000012545527303014376 5ustar www-datawww-dataequalizer-0.0.11/lib/equalizer.rb0000644000004100000410000000517512545527303016734 0ustar www-datawww-data# encoding: utf-8 # Define equality, equivalence and inspection methods class Equalizer < Module # Initialize an Equalizer with the given keys # # Will use the keys with which it is initialized to define #cmp?, # #hash, and #inspect # # @param [Array] keys # # @return [undefined] # # @api private def initialize(*keys) @keys = keys define_methods freeze end private # Hook called when module is included # # @param [Module] descendant # the module or class including Equalizer # # @return [self] # # @api private def included(descendant) super descendant.module_eval { include Methods } end # Define the equalizer methods based on #keys # # @return [undefined] # # @api private def define_methods define_cmp_method define_hash_method define_inspect_method end # Define an #cmp? method based on the instance's values identified by #keys # # @return [undefined] # # @api private def define_cmp_method keys = @keys define_method(:cmp?) do |comparator, other| keys.all? do |key| __send__(key).public_send(comparator, other.__send__(key)) end end private :cmp? end # Define a #hash method based on the instance's values identified by #keys # # @return [undefined] # # @api private def define_hash_method keys = @keys define_method(:hash) do | | keys.map(&method(:send)).push(self.class).hash end end # Define an inspect method that reports the values of the instance's keys # # @return [undefined] # # @api private def define_inspect_method keys = @keys define_method(:inspect) do | | klass = self.class name = klass.name || klass.inspect "#<#{name}#{keys.map { |key| " #{key}=#{__send__(key).inspect}" }.join}>" end end # The comparison methods module Methods # Compare the object with other object for equality # # @example # object.eql?(other) # => true or false # # @param [Object] other # the other object to compare with # # @return [Boolean] # # @api public def eql?(other) instance_of?(other.class) && cmp?(__method__, other) end # Compare the object with other object for equivalency # # @example # object == other # => true or false # # @param [Object] other # the other object to compare with # # @return [Boolean] # # @api public def ==(other) other = coerce(other).first if respond_to?(:coerce, true) other.kind_of?(self.class) && cmp?(__method__, other) end end # module Methods end # class Equalizer equalizer-0.0.11/lib/equalizer/0000755000004100000410000000000012545527303016377 5ustar www-datawww-dataequalizer-0.0.11/lib/equalizer/version.rb0000644000004100000410000000015612545527303020413 0ustar www-datawww-data# encoding: utf-8 class Equalizer < Module # Gem version VERSION = '0.0.11'.freeze end # class Equalizer equalizer-0.0.11/.rubocop.yml0000644000004100000410000000000012545527303016070 0ustar www-datawww-dataequalizer-0.0.11/equalizer.gemspec0000644000004100000410000000151612545527303017201 0ustar www-datawww-data# encoding: utf-8 require File.expand_path('../lib/equalizer/version', __FILE__) Gem::Specification.new do |gem| gem.name = 'equalizer' gem.version = Equalizer::VERSION.dup gem.authors = ['Dan Kubb', 'Markus Schirp'] gem.email = %w[dan.kubb@gmail.com mbj@schirp-dso.com] gem.description = 'Module to define equality, equivalence and inspection methods' gem.summary = gem.description gem.homepage = 'https://github.com/dkubb/equalizer' gem.licenses = 'MIT' gem.require_paths = %w[lib] gem.files = `git ls-files`.split("\n") gem.test_files = `git ls-files -- spec/{unit,integration}`.split("\n") gem.extra_rdoc_files = %w[LICENSE README.md CONTRIBUTING.md] gem.required_ruby_version = '>= 1.8.7' gem.add_development_dependency('bundler', '~> 1.3', '>= 1.3.5') end equalizer-0.0.11/metadata.yml0000644000004100000410000000451012545527303016133 0ustar www-datawww-data--- !ruby/object:Gem::Specification name: equalizer version: !ruby/object:Gem::Version version: 0.0.11 platform: ruby authors: - Dan Kubb - Markus Schirp autorequire: bindir: bin cert_chain: [] date: 2015-03-23 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: bundler requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '1.3' - - ">=" - !ruby/object:Gem::Version version: 1.3.5 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '1.3' - - ">=" - !ruby/object:Gem::Version version: 1.3.5 description: Module to define equality, equivalence and inspection methods email: - dan.kubb@gmail.com - mbj@schirp-dso.com executables: [] extensions: [] extra_rdoc_files: - LICENSE - README.md - CONTRIBUTING.md files: - ".gitignore" - ".rspec" - ".rubocop.yml" - ".ruby-gemset" - ".ruby-version" - ".travis.yml" - ".yardstick.yml" - CONTRIBUTING.md - Gemfile - LICENSE - README.md - Rakefile - config/devtools.yml - config/flay.yml - config/flog.yml - config/mutant.yml - config/reek.yml - config/rubocop.yml - config/yardstick.yml - equalizer.gemspec - lib/equalizer.rb - lib/equalizer/version.rb - spec/spec_helper.rb - spec/support/config_alias.rb - spec/unit/equalizer/included_spec.rb - spec/unit/equalizer/methods/eql_predicate_spec.rb - spec/unit/equalizer/methods/equality_operator_spec.rb - spec/unit/equalizer/universal_spec.rb homepage: https://github.com/dkubb/equalizer licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 1.8.7 required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: rubygems_version: 2.4.5 signing_key: specification_version: 4 summary: Module to define equality, equivalence and inspection methods test_files: - spec/unit/equalizer/included_spec.rb - spec/unit/equalizer/methods/eql_predicate_spec.rb - spec/unit/equalizer/methods/equality_operator_spec.rb - spec/unit/equalizer/universal_spec.rb has_rdoc: equalizer-0.0.11/.gitignore0000644000004100000410000000042212545527303015616 0ustar www-datawww-data## MAC OS .DS_Store ## TEXTMATE *.tmproj tmtags ## EMACS *~ \#* .\#* ## VIM *.swp ## Rubinius *.rbc .rbx ## PROJECT::GENERAL *.gem coverage profiling turbulence rdoc pkg tmp doc log .yardoc measurements ## BUNDLER .bundle Gemfile.lock bin bundle ## PROJECT::SPECIFIC equalizer-0.0.11/config/0000755000004100000410000000000012545527303015075 5ustar www-datawww-dataequalizer-0.0.11/config/flay.yml0000644000004100000410000000005512545527303016553 0ustar www-datawww-data--- threshold: 0 total_score: 0 lib_dirs: [] equalizer-0.0.11/config/reek.yml0000644000004100000410000000346712545527303016560 0ustar www-datawww-data--- Attribute: enabled: false exclude: [] BooleanParameter: enabled: true exclude: [] ClassVariable: enabled: true exclude: [] ControlParameter: enabled: true exclude: [] DataClump: enabled: true exclude: [] max_copies: 2 min_clump_size: 2 DuplicateMethodCall: enabled: true exclude: [] max_calls: 1 allow_calls: [] FeatureEnvy: enabled: true exclude: [] IrresponsibleModule: enabled: true exclude: [] LongParameterList: enabled: true exclude: [] max_params: 2 overrides: initialize: max_params: 3 LongYieldList: enabled: true exclude: [] max_params: 2 NestedIterators: enabled: true exclude: - Equalizer#define_cmp_method - Equalizer#define_inspect_method max_allowed_nesting: 1 ignore_iterators: [] NilCheck: enabled: true exclude: [] RepeatedConditional: enabled: true exclude: [] max_ifs: 1 TooManyInstanceVariables: enabled: true exclude: [] max_instance_variables: 3 TooManyMethods: enabled: true exclude: [] max_methods: 6 TooManyStatements: enabled: true exclude: - Equalizer#define_inspect_method max_statements: 5 UncommunicativeMethodName: enabled: true exclude: [] reject: - !ruby/regexp /^[a-z]$/ - !ruby/regexp /[0-9]$/ - !ruby/regexp /[A-Z]/ accept: [] UncommunicativeModuleName: enabled: true exclude: [] reject: - !ruby/regexp /^.$/ - !ruby/regexp /[0-9]$/ accept: [] UncommunicativeParameterName: enabled: true exclude: [] reject: - !ruby/regexp /^.$/ - !ruby/regexp /[0-9]$/ - !ruby/regexp /[A-Z]/ accept: [] UncommunicativeVariableName: enabled: true exclude: [] reject: - !ruby/regexp /^.$/ - !ruby/regexp /[0-9]$/ - !ruby/regexp /[A-Z]/ accept: [] UnusedParameters: enabled: true exclude: [] UtilityFunction: enabled: true exclude: [] max_helper_calls: 0 equalizer-0.0.11/config/devtools.yml0000644000004100000410000000003112545527303017451 0ustar www-datawww-data--- unit_test_timeout: 1 equalizer-0.0.11/config/yardstick.yml0000644000004100000410000000111712545527303017615 0ustar www-datawww-data--- path: 'lib/**/*.rb' threshold: 100 rules: ApiTag::Presence: enabled: true exclude: [] ApiTag::Inclusion: enabled: true exclude: [] ApiTag::ProtectedMethod: enabled: true exclude: [] ApiTag::PrivateMethod: enabled: true exclude: [] ExampleTag: enabled: true exclude: [] ReturnTag: enabled: true exclude: [] Summary::Presence: enabled: true exclude: [] Summary::Length: enabled: true exclude: [] Summary::Delimiter: enabled: true exclude: [] Summary::SingleLine: enabled: true exclude: [] equalizer-0.0.11/config/rubocop.yml0000644000004100000410000000516312545527303017276 0ustar www-datawww-data# Avoid parameter lists longer than five parameters. ParameterLists: Max: 3 CountKeywordArgs: true # Avoid more than `Max` levels of nesting. BlockNesting: Max: 3 # Align with the style guide. CollectionMethods: PreferredMethods: collect: 'map' inject: 'reduce' find: 'detect' find_all: 'select' # Do not force public/protected/private keyword to be indented at the same # level as the def keyword. My personal preference is to outdent these keywords # because I think when scanning code it makes it easier to identify the # sections of code and visually separate them. When the keyword is at the same # level I think it sort of blends in with the def keywords and makes it harder # to scan the code and see where the sections are. AccessModifierIndentation: Enabled: false # Limit line length LineLength: Max: 106 # Disable documentation checking until a class needs to be documented once Documentation: Enabled: false # Do not always use &&/|| instead of and/or. AndOr: Enabled: false # Do not favor modifier if/unless usage when you have a single-line body IfUnlessModifier: Enabled: false # Allow case equality operator (in limited use within the specs) CaseEquality: Enabled: false # Constants do not always have to use SCREAMING_SNAKE_CASE ConstantName: Enabled: false # Not all trivial readers/writers can be defined with attr_* methods TrivialAccessors: Enabled: false # Allow empty lines around class body EmptyLinesAroundClassBody: Enabled: false # Allow empty lines around module body EmptyLinesAroundModuleBody: Enabled: false # Allow empty lines around block body EmptyLinesAroundBlockBody: Enabled: false # Allow multiple line operations to not require indentation MultilineOperationIndentation: Enabled: false # Prefer String#% over Kernel#sprintf FormatString: Enabled: false # Use square brackets for literal Array objects PercentLiteralDelimiters: PreferredDelimiters: '%': '{}' '%i': '[]' '%q': () '%Q': () '%r': '{}' '%s': () '%w': '[]' '%W': '[]' '%x': () # Use %i[...] for arrays of symbols SymbolArray: Enabled: true # Align if/else blocks with the variable assignment EndAlignment: AlignWith: variable # Do not always align parameters when it is easier to read AlignParameters: Exclude: - spec/**/*_spec.rb # Prefer #kind_of? over #is_a? ClassCheck: EnforcedStyle: kind_of? # Do not prefer double quotes to be used when %q or %Q is more appropriate UnneededPercentQ: Enabled: false # Allow a maximum ABC score Metrics/AbcSize: Max: 8.6 # Do not prefer lambda.call(...) over lambda.(...) LambdaCall: Enabled: false equalizer-0.0.11/config/flog.yml0000644000004100000410000000004612545527303016547 0ustar www-datawww-data--- threshold: 15.6 lib_dirs: ['lib'] equalizer-0.0.11/config/mutant.yml0000644000004100000410000000004512545527303017127 0ustar www-datawww-dataname: equalizer namespace: Equalizer equalizer-0.0.11/CONTRIBUTING.md0000644000004100000410000000202412545527303016057 0ustar www-datawww-dataContributing ------------ * If you want your code merged into the mainline, please discuss the proposed changes with me before doing any work on it. This library is still in early development, and the direction it is going may not always be clear. Some features may not be appropriate yet, may need to be deferred until later when the foundation for them is laid, or may be more applicable in a plugin. * Fork the project. * Make your feature addition or bug fix. * Follow this [style guide](https://github.com/dkubb/styleguide). * Add specs for it. This is important so I don't break it in a future version unintentionally. Tests must cover all branches within the code, and code must be fully covered. * Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) * Run "rake ci". This must pass and not show any regressions in the metrics for the code to be merged. * Send me a pull request. Bonus points for topic branches. equalizer-0.0.11/LICENSE0000644000004100000410000000211612545527303014635 0ustar www-datawww-dataCopyright (c) 2009-2013 Dan Kubb Copyright (c) 2012 Markus Schirp (packaging) 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, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. equalizer-0.0.11/.ruby-gemset0000644000004100000410000000001212545527303016065 0ustar www-datawww-dataequalizer equalizer-0.0.11/README.md0000644000004100000410000000554512545527303015120 0ustar www-datawww-dataequalizer ========= Module to define equality, equivalence and inspection methods [![Gem Version](http://img.shields.io/gem/v/equalizer.svg)][gem] [![Build Status](http://img.shields.io/travis/dkubb/equalizer.svg)][travis] [![Dependency Status](http://img.shields.io/gemnasium/dkubb/equalizer.svg)][gemnasium] [![Code Climate](http://img.shields.io/codeclimate/github/dkubb/equalizer.svg)][codeclimate] [![Coverage Status](http://img.shields.io/coveralls/dkubb/equalizer.svg)][coveralls] [gem]: https://rubygems.org/gems/equalizer [travis]: https://travis-ci.org/dkubb/equalizer [gemnasium]: https://gemnasium.com/dkubb/equalizer [codeclimate]: https://codeclimate.com/github/dkubb/equalizer [coveralls]: https://coveralls.io/r/dkubb/equalizer Examples -------- ``` ruby class GeoLocation include Equalizer.new(:latitude, :longitude) attr_reader :latitude, :longitude def initialize(latitude, longitude) @latitude, @longitude = latitude, longitude end end point_a = GeoLocation.new(1, 2) point_b = GeoLocation.new(1, 2) point_c = GeoLocation.new(2, 2) point_a.inspect # => "#" point_a == point_b # => true point_a.hash == point_b.hash # => true point_a.eql?(point_b) # => true point_a.equal?(point_b) # => false point_a == point_c # => false point_a.hash == point_c.hash # => false point_a.eql?(point_c) # => false point_a.equal?(point_c) # => false ``` Supported Ruby Versions ----------------------- This library aims to support and is [tested against][travis] the following Ruby implementations: * Ruby 1.8.7 * Ruby 1.9.3 * Ruby 2.0.0 * Ruby 2.1 * Ruby 2.2 * [JRuby][] * [Rubinius][] * [Ruby Enterprise Edition][ree] [jruby]: http://jruby.org/ [rubinius]: http://rubini.us/ [ree]: http://www.rubyenterpriseedition.com/ If something doesn't work on one of these versions, it's a bug. This library may inadvertently work (or seem to work) on other Ruby versions or implementations, however support will only be provided for the implementations listed above. If you would like this library to support another Ruby version or implementation, you may volunteer to be a maintainer. Being a maintainer entails making sure all tests run and pass on that implementation. When something breaks on your implementation, you will be responsible for providing patches in a timely fashion. If critical issues for a particular implementation exist at the time of a major release, support for that Ruby version may be dropped. Credits ------- * Dan Kubb ([dkubb](https://github.com/dkubb)) * Piotr Solnica ([solnic](https://github.com/solnic)) * Markus Schirp ([mbj](https://github.com/mbj)) * Erik Michaels-Ober ([sferik](https://github.com/sferik)) Contributing ------------- See [CONTRIBUTING.md](CONTRIBUTING.md) for details. Copyright --------- Copyright © 2009-2013 Dan Kubb. See LICENSE for details.