Sha256: 653d68a5130d5508ce66682785ce05051d327984691dc8e4f06ea7aa0cd5e963

Contents?: true

Size: 796 Bytes

Versions: 1

Compression:

Stored size: 796 Bytes

Contents

class Range {
  ruby_alias: 'to_a
  ruby_alias: '==
  ruby_alias: '===
  ruby_alias: 'first
  ruby_alias: 'last

  def initialize: @start to: @end {
    """
    @start Start element of Range.
    @end End element of Range.

    Initializes a new Range starting at @start and ending at @end.
    """

    initialize(@start, @end)
  }

  def each: block {
    """
    @block @Block@ to be called with every value in @self.
    @return @self.

    Calls @block on each value in @self. Used for iterating over a @Range@.
    """

    try {
      val = nil
      each() |x| {
        try {
          val = block call: [x]
        } catch (Fancy NextIteration) => ex {
          val = ex result
        }
      }
      return self
    } catch (Fancy BreakIteration) => ex {
      ex result
    }
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fancy-0.4.0 lib/rbx/range.fy