Sha256: 8df3db8a92090c100b0fefbe2208bfc5faeb41bd598e83a22157b5af78a64f4c
Contents?: true
Size: 585 Bytes
Versions: 3
Compression:
Stored size: 585 Bytes
Contents
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
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
bartzon-zelda-0.0.5 | lib/zelda/base.rb |
zelda-1.0.0 | lib/zelda/base.rb |
zelda-0.1.0 | lib/zelda/base.rb |