Module: VCSToolkit::Utils::HashableObject::ClassMethods

Defined in:
lib/vcs_toolkit/utils/hashable_object.rb

Instance Method Summary collapse

Instance Method Details

#hash_on(*attributes) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/vcs_toolkit/utils/hashable_object.rb', line 6

def hash_on(*attributes)
  if attributes.size == 1
    define_method :hash_objects do
      public_send attributes.first
    end
  else
    define_method :hash_objects do
      attributes.map { |attribute| public_send attribute }.to_a.inspect
    end
  end
end