Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
Simplify #to_h
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Jun 15, 2015
1 parent 6437cb7 commit 9f3d657
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
8 changes: 1 addition & 7 deletions lib/family.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def initialize(proof, comparison: :===, values: [])
:rassoc, :delete, :delete_at, :empty?, :fetch, :first, :last, :take, :tail,
:flatten, :include?, :index, :to_s, :length, :size, :pack,
:pop, :product, :reverse_each, :rindex, :sample,
:slice, :slice!, :transpose, :zip, :bsearch
:slice, :slice!, :transpose, :zip, :to_h, :bsearch

def_enums :@values, :each, :each_index, :cycle, :combination,
:repeated_combination, :permutation, :repeated_permutation
Expand Down Expand Up @@ -321,12 +321,6 @@ def values_at(*selectors)
self.class.__new__ @proof, @comparison, @values.values_at(*selectors)
end

# @return [Hash]
# This definition is adjusting the arity number with Array#to_h.
def to_h
@values.to_h
end

protected

def _values
Expand Down
4 changes: 0 additions & 4 deletions test/basic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,6 @@
The list.to_h do
is [[1, 2], [10, 20]].to_h
end

The Family.instance_method(:to_h).arity do
is Array.instance_method(:to_h).arity
end
end

The Family.define{AND(String, /\d/)} do |list|
Expand Down

0 comments on commit 9f3d657

Please sign in to comment.