Sha256: 52a58e5c7b25662a4ec2673221a42d95c1fa9d68652c755f020d19c80f442f29

Contents?: true

Size: 361 Bytes

Versions: 2

Compression:

Stored size: 361 Bytes

Contents

class Star < Array
  def initialize(*elements)
    @current = 0
    super(elements)
  end
  
  def current
    return self.[](@current)
  end
  
  def next
    unless last_word?
      @current += 1
    else
      raise FragmentException.new("Fragment (consider revising)")
    end
  end
  
  private
    def last_word?
      (length - 1) == @current
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
odin-0.0.4 lib/star.rb
odin-0.1.0.alpha.1 lib/star.rb