Sha256: 98715beaf87b3a6ab2c0c7ba5a6ad4672279ae1574a182c4da1a974f6c3d90ab

Contents?: true

Size: 426 Bytes

Versions: 3

Compression:

Stored size: 426 Bytes

Contents

require 'active_support/core_ext/module/delegation'

class Module

  def delegate_property *properties
    options = {}
    methods = []

    properties.each do |options_or_property|
      if options_or_property.is_a? Hash
        options.merge! options_or_property
      else
        methods << options_or_property
        methods << "#{options_or_property.to_s}="
      end
    end

    delegate *methods, options
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simply_useful-0.2.3 lib/simply_useful/core_ext/module/property_delegation.rb
simply_useful-0.2.2 lib/simply_useful/core_ext/module/property_delegation.rb
simply_useful-0.2.1 lib/simply_useful/core_ext/module/property_delegation.rb