class Brainclusterfuck::Opcodes::ModifyingBase

Attributes

modify_by[R]

Public Class Methods

new(modify_by, cycles) click to toggle source
# File lib/brainclusterfuck/opcodes/modifying_base.rb, line 7
def initialize(modify_by, cycles)
  @modify_by = modify_by.to_i
  @cycles = cycles.to_i
end

Public Instance Methods

==(other) click to toggle source
# File lib/brainclusterfuck/opcodes/modifying_base.rb, line 12
def ==(other)
  other.class == self.class &&
    other.modify_by == modify_by &&
    other.cycles == cycles
end
can_squeeze_with?(other) click to toggle source
# File lib/brainclusterfuck/opcodes/modifying_base.rb, line 18
def can_squeeze_with?(other)
  other.class == self.class
end
squeeze_with(other) click to toggle source
# File lib/brainclusterfuck/opcodes/modifying_base.rb, line 22
def squeeze_with(other)
  raise "Cannot squeeze: #{self}, #{other}" unless can_squeeze_with?(other)
  self.class.new(modify_by + other.modify_by, cycles + other.cycles)
end