Sha256: 4155b96b636dd83de18cb5c9d8422c532181e5d158afaa1fa379a99d3f3a9cbc

Contents?: true

Size: 366 Bytes

Versions: 1

Compression:

Stored size: 366 Bytes

Contents

module OAttr
  def self.included(base)
    base.extend ClassMethods
  end

  module ClassMethods
    def oattr *names
      container = "@options"
      if names.last.kind_of? Hash
        container = "@#{(names.pop)[:container]}"
      end
      names.each do |name|
        class_eval "def #{name}; #{container}['#{name}'.to_sym]; end"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
applix-0.2.1 lib/applix/oattr.rb