Class: Abst::IntegerIdeal
- Inherits:
-
Object
- Object
- Abst::IntegerIdeal
- Defined in:
- lib/include/integer.rb
Instance Attribute Summary collapse
-
#n ⇒ Object
readonly
Returns the value of attribute n.
Instance Method Summary collapse
- #&(other) ⇒ Object
- #*(other) ⇒ Object
- #+(other) ⇒ Object
-
#initialize(n) ⇒ IntegerIdeal
constructor
A new instance of IntegerIdeal.
- #to_s ⇒ Object (also: #inspect)
- #to_tex ⇒ Object
Constructor Details
#initialize(n) ⇒ IntegerIdeal
Returns a new instance of IntegerIdeal.
260 261 262 |
# File 'lib/include/integer.rb', line 260 def initialize(n) @n = n end |
Instance Attribute Details
#n ⇒ Object (readonly)
Returns the value of attribute n.
258 259 260 |
# File 'lib/include/integer.rb', line 258 def n @n end |
Instance Method Details
#&(other) ⇒ Object
272 273 274 |
# File 'lib/include/integer.rb', line 272 def &(other) self.class.new(Abst.lcm(@mod, other.mod)) end |
#*(other) ⇒ Object
268 269 270 |
# File 'lib/include/integer.rb', line 268 def *(other) self.class.new(@mod * other.mod) end |
#+(other) ⇒ Object
264 265 266 |
# File 'lib/include/integer.rb', line 264 def +(other) self.class.new(Abst.gcd(@mod, other.mod)) end |
#to_s ⇒ Object Also known as: inspect
276 277 278 |
# File 'lib/include/integer.rb', line 276 def to_s return "IntegerIdeal #{@n}Z" end |
#to_tex ⇒ Object
281 282 283 |
# File 'lib/include/integer.rb', line 281 def to_tex return "#{@n}#{Z.to_tex}" end |