Sha256: 760205a2e5f6312350ea321123625a111827f61671fc9f5f8f87b175dcd5c8b8

Contents?: true

Size: 304 Bytes

Versions: 2

Compression:

Stored size: 304 Bytes

Contents

class Module #:nodoc:
  def dsl_accessor(*symbols)
    symbols.each do |sym|
      class_eval %{
        def #{sym}(*val)
          if val.empty?
            @#{sym}
          else
            @#{sym} = val.size == 1 ? val[0] : val
          end
        end
      }, __FILE__, __LINE__
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jemmyw-sprinkle-0.2.3 lib/sprinkle/extensions/dsl_accessor.rb
jemmyw-sprinkle-0.2.4 lib/sprinkle/extensions/dsl_accessor.rb