module Ehon

Constants

VERSION

Public Class Methods

included(base) click to toggle source
# File lib/ehon.rb, line 4
def self.included(base)
  base.extend ClassMethods
  base.contents        = {}
  base.default_options = {}
end
new(id, options = {}) click to toggle source
# File lib/ehon.rb, line 10
def initialize(id, options = {})
  @options = options.merge(id: id)
end

Public Instance Methods

==(other) click to toggle source
# File lib/ehon.rb, line 18
def ==(other)
  (self.class == other.class) && (self.id == other.id)
end
method_missing(symbol, *args) click to toggle source
Calls superclass method
# File lib/ehon.rb, line 26
def method_missing(symbol, *args)
  return read_attribute(symbol) if respond_to?(symbol)
  super
end
options() click to toggle source
# File lib/ehon.rb, line 14
def options
  self.class.default_options.merge(@options)
end
read_attribute(symbol) click to toggle source
# File lib/ehon.rb, line 31
def read_attribute(symbol)
  self.options[symbol]
end
respond_to_missing?(symbol, include_private = false) click to toggle source
# File lib/ehon.rb, line 22
def respond_to_missing?(symbol, include_private = false)
  self.options.has_key?(symbol)
end