Sha256: 2828dbcaf8186b9c95f2f0d68349879d9d5b395e802397859e4188a89ee91f37

Contents?: true

Size: 668 Bytes

Versions: 1

Compression:

Stored size: 668 Bytes

Contents

module Variation
class Change
  attr_reader :length, :end_value

  # Pass :length and :end_value by hash. Length must be > 0.
  def initialize hashed_args
    raise HashedArgMissingError unless hashed_args.has_key?(:length)
    raise HashedArgMissingError unless hashed_args.has_key?(:end_value)

    self.length = hashed_args[:length]
    self.end_value = hashed_args[:end_value]
  end

  def length= length
    raise NegativeLengthError if length < 0
    @length = length
  end

  def end_value= end_value
    @end_value = end_value
  end

  def ==(other)
    length == other.length &&
    end_value == other.end_value &&
    self.class == other.class
  end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
variation-0.2.1 lib/variation/change.rb