lib/aixm/r.rb in aixm-1.1.0 vs lib/aixm/r.rb in aixm-1.2.0

- old
+ new

@@ -6,17 +6,29 @@ # # @examples # AIXM.r(AIXM.d(25, :m), AIXM.d(20, :m)) # rectangle # AIXM.r(AIXM.d(25, :m)) # square class R + include AIXM::Concerns::HashEquality - # @return [AIXM::D] rectangle length + # Rectangle length + # + # @overload length + # @return [AIXM::D] + # @overload length=(value) + # @param value [AIXM::D] attr_reader :length - # @return [AIXM::D] rectangle width + # Rectangle width + # + # @overload width + # @return [AIXM::D] + # @overload width=(value) + # @param value [AIXM::D] attr_reader :width + # See the {overview}[AIXM::R] for examples. def initialize(length, width=nil) self.length, self.width = length, (width || length) end # @return [String] @@ -35,28 +47,19 @@ instance_variable_set(:"@#{dimension}", value) @length, @width = @width, @length if @length && @width && @length < @width end end - # Calculate the surface in square meters + # Calculate the surface in square meters. # # @return [Float] def surface length.to_m.dim * width.to_m.dim end # @see Object#== - # @return [Boolean] def ==(other) self.class === other && length == other.length && width == other.width end - alias_method :eql?, :== - # @see Object#hash - # @return [Integer] - def hash - to_s.hash - end - end - end