class Raheui::Store

Base Store class for Aheui. Every child classes should implement push, pop and swap method.

Constants

BASE_METHODS

Public Class Methods

new() click to toggle source

Initialize a Stack.

# File lib/raheui/store.rb, line 18
def initialize
  check_base_methods
  @store = []
end

Private Instance Methods

check_base_methods() click to toggle source

Check whether base methods are implemented.

Returns nothing. Raises NotImplementedError if base methods are not implemented.

# File lib/raheui/store.rb, line 29
def check_base_methods
  errors = []
  BASE_METHODS.each do |method|
    errors << method unless respond_to?(method)
  end
  return if errors.empty?
  fail NotImplementedError, 'base methods are not implemented:' \
                            " #{errors.join(', ')}"
end