Skip to content

Commit

Permalink
Merge pull request #3 from ermaker/symbol-args
Browse files Browse the repository at this point in the history
Add Symbol#args
  • Loading branch information
ermaker committed Aug 10, 2016
2 parents 38268ca + befd0e7 commit a827119
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/cext/symbol_args.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Symbol#args
class Symbol
def args(*args_)
->(item) { item.send(self, *args_) }
end
end
1 change: 1 addition & 0 deletions lib/cool.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'cool/version'
require 'cext/symbol_args'

# The list of classes in Cool module
module Cool
Expand Down
7 changes: 7 additions & 0 deletions spec/lib/cext/symbol_args_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
RSpec.describe Symbol do
subject { :+ }
it { is_expected.to be_a(described_class) }
specify do
expect((0..10).map(&subject.args(1))).to eq((1..11).to_a)
end
end
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,5 @@
# as the one that triggered the failure.
Kernel.srand config.seed
end

require 'cool'

0 comments on commit a827119

Please sign in to comment.