Sha256: f4bad547ebef874227304c755ccd24710c87822d3024facd7898091ab3643708

Contents?: true

Size: 492 Bytes

Versions: 2

Compression:

Stored size: 492 Bytes

Contents

# Enumerable extensions.
module Enumerable
  # Invokes the specified method for each item, along with the supplied
  # arguments.
  def send_each(sym, *args)
    each {|i| i.send(sym, *args)}
  end
end

# Range extensions
class Range
  # Returns the interval between the beginning and end of the range.
  def interval
    last - first
  end
end

# Object extensions
class Object
  def is_one_of?(*classes)
    classes.each {|c| return c if is_a?(c)}
    nil
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sequel_core-1.0.2 lib/sequel_core/core_ext.rb
sequel_core-1.0.3 lib/sequel_core/core_ext.rb