module Zelda # Abstract base class to provide common functionality of Zelda importer classes. # including method_missing magic to turn an @attrs hash into getters. class Base def initialize(attrs={}) @attrs = attrs end def attributes @attrs end # Try both string keys and symbol keys in that order. def method_missing(method, *args, &block) if @attrs[method.to_s] return @attrs[method.to_s] elsif @attrs[method] return @attrs[method] else super(method, *args, &block) end end end end