Sha256: f9346d12b3fb1ac0e92ea88c23f96e9fbf9bf28f860a7ab93c771875099f0372

Contents?: true

Size: 275 Bytes

Versions: 20

Compression:

Stored size: 275 Bytes

Contents

class Module
  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

20 entries across 20 versions & 4 rubygems

Version Path
auser-sprinkle-0.1.5 lib/sprinkle/extensions/dsl_accessor.rb
crafterm-sprinkle-0.1.0 lib/sprinkle/extensions/dsl_accessor.rb
crafterm-sprinkle-0.1.1 lib/sprinkle/extensions/dsl_accessor.rb
crafterm-sprinkle-0.1.2 lib/sprinkle/extensions/dsl_accessor.rb
crafterm-sprinkle-0.1.4 lib/sprinkle/extensions/dsl_accessor.rb
crafterm-sprinkle-0.1.5 lib/sprinkle/extensions/dsl_accessor.rb
orthorings-0.4.2 lib/core_ext/dsl_accessor.rb
orthorings-0.4.1 lib/core_ext/dsl_accessor.rb
orthorings-0.4.0 lib/core_ext/dsl_accessor.rb
orthorings-0.3.1 lib/core_ext/dsl_accessor.rb
orthorings-0.3.0 lib/core_ext/dsl_accessor.rb
orthorings-0.2.0 lib/core_ext/dsl_accessor.rb
orthorings-0.1.5 lib/core_ext/dsl_accessor.rb
orthorings-0.1.4 lib/core_ext/dsl_accessor.rb
orthorings-0.1.3 lib/core_ext/dsl_accessor.rb
orthorings-0.1.2 lib/core_ext/dsl_accessor.rb
orthorings-0.1.1 lib/core_ext/dsl_accessor.rb
orthorings-0.1.0 lib/core_ext/dsl_accessor.rb
sprinkle-0.1.5 lib/sprinkle/extensions/dsl_accessor.rb
sprinkle-0.1.4 lib/sprinkle/extensions/dsl_accessor.rb