Sha256: be02d7159eecb1dc5ac891100acdccb14af7409c6493f1814a24b7c10a10875c

Contents?: true

Size: 743 Bytes

Versions: 1

Compression:

Stored size: 743 Bytes

Contents

class Range {
  ruby_aliases: [ '==, '===, 'first, '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.10.0 lib/rbx/range.fy