Sha256: f62ca59cbf6c319859469baf94ed38453928c50dd89d3b4c2361521af138c25e

Contents?: true

Size: 415 Bytes

Versions: 20

Compression:

Stored size: 415 Bytes

Contents

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

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

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
applix-0.4.14 lib/applix/oattr.rb
applix-0.4.13 lib/applix/oattr.rb
applix-0.4.12 lib/applix/oattr.rb
applix-0.4.11 lib/applix/oattr.rb
applix-0.4.10 lib/applix/oattr.rb
applix-0.4.9 lib/applix/oattr.rb
applix-0.4.8 lib/applix/oattr.rb
applix-0.4.7 lib/applix/oattr.rb
applix-0.4.6 lib/applix/oattr.rb
applix-0.4.5 lib/applix/oattr.rb
applix-0.4.4 lib/applix/oattr.rb
applix-0.4.3 lib/applix/oattr.rb
applix-0.4.2 lib/applix/oattr.rb
applix-0.3.8 lib/applix/oattr.rb
applix-0.3.7 lib/applix/oattr.rb
applix-0.3.6 lib/applix/oattr.rb
applix-0.3.5 lib/applix/oattr.rb
applix-0.3.4 lib/applix/oattr.rb
applix-0.3.0 lib/applix/oattr.rb
applix-0.2.2 lib/applix/oattr.rb