class Nagoriyuki::Generators::Base

Attributes

options[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/nagoriyuki/generators/base.rb, line 12
def initialize(options = {})
  if (missing = missing_required_options(options)) && !missing.empty?
    raise ArgumentError, "Missing Required options: #{missing.join(', ')}"
  end
  @options = options
end

Public Instance Methods

biggest(timestamp) click to toggle source
# File lib/nagoriyuki/generators/base.rb, line 39
def biggest(timestamp)
  raise NotImplemented, "Please Override"
end
current() click to toggle source
# File lib/nagoriyuki/generators/base.rb, line 31
def current
  raise NotImplemented, "Please Override"
end
generate() click to toggle source
# File lib/nagoriyuki/generators/base.rb, line 27
def generate
  raise NotImplemented, "Please Override"
end
length() click to toggle source
# File lib/nagoriyuki/generators/base.rb, line 23
def length
  options["length"]
end
name() click to toggle source
# File lib/nagoriyuki/generators/base.rb, line 19
def name
  options["name"]
end
smallest(timestamp) click to toggle source
# File lib/nagoriyuki/generators/base.rb, line 35
def smallest(timestamp)
  raise NotImplemented, "Please Override"
end

Private Instance Methods

bit_fill() click to toggle source
# File lib/nagoriyuki/generators/base.rb, line 45
def bit_fill
  (2 ** length - 1)
end
missing_required_options(given_options) click to toggle source
# File lib/nagoriyuki/generators/base.rb, line 49
def missing_required_options(given_options)
  required_options.reject { |k| given_options.has_key?(k) }
end