Sha256: 8e27204d1041e8cb8cf96d2965e4c5a3ce27dc3f2eaa3f9fe5d4079bdd2f02ee

Contents?: true

Size: 891 Bytes

Versions: 4

Compression:

Stored size: 891 Bytes

Contents

module SmartMonth
  # Responsible for all math related functionality.
  module Math
    # adds a number to the month value and returns a Fixnum.
    def +(int)
      self.to_i + int
    end

    # subtracts a number to the month value and returns a Fixnum.
    def -(int)
      self.to_i - int
    end
    
    # multiplies a number to the month value and returns a Fixnum.
    def *(int)
      self.to_i * int
    end

    # divides a number to the month value and returns a Fixnum.
    def /(int)
      self.to_i / int
    end
    
    # exponents a number to the month value and returns a Fixnum.
    def **(int)
      self.to_i ** int
    end
    
    # modulos a number to the month value and returns a Fixnum.
    def %(int)
      self.to_i % int
    end
    
    # compares the current month to another month.
    def ==(month)
      self.inspect! == month.inspect! 
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rmoriz-smartmonth-1.0.2 lib/smart_month/math.rb
rmoriz-smartmonth-1.0 lib/smart_month/math.rb
rmoriz-smartmonth-1.01 lib/smart_month/math.rb
rmoriz-smartmonth-1.1.1 lib/smart_month/math.rb