Sha256: f21653201d4f87ec6430c414fb67cd5d4b5a040e9f483082898e1c22843f3b12

Contents?: true

Size: 284 Bytes

Versions: 64

Compression:

Stored size: 284 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
      }
    end
  end
end

Version data entries

64 entries across 64 versions & 12 rubygems

Version Path
sprinkle-0.1.8 lib/sprinkle/extensions/dsl_accessor.rb
sprinkle-0.2.1 lib/sprinkle/extensions/dsl_accessor.rb
sprinkle-0.2.2 lib/sprinkle/extensions/dsl_accessor.rb
sprinkle-0.1.9 lib/sprinkle/extensions/dsl_accessor.rb