Skip to content
/ every Public

Symbol#to_proc's hot cousin. Simple and elegant alternative to using &:method with enumerables.

License

Notifications You must be signed in to change notification settings

mynyml/every

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Symbol#to_proc's hot cousin. Simple and elegant alternative to using &:method with enumerables.

compare:

  enum = [1.4, 2.4 ,3.4]
  enum.map {|i| i.floor } #=> [1, 2, 3]
  enum.map(&:floor)       #=> [1, 2, 3]
  enum.every.floor        #=> [1, 2, 3]

arguments? sure:

  %w( axb dxf ).every.gsub(/x/,'y')     #=> ['ayb', 'dyf']
  %w( axb dxf ).every.gsub(/x/) { 'y' } #=> ['ayb', 'dyf']

About

Symbol#to_proc's hot cousin. Simple and elegant alternative to using &:method with enumerables.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages