Sha256: 87ea107ce9583e1c9be96e6d1c7822d83a4eb85ddc24340abbbb9a7ecc937067

Contents?: true

Size: 393 Bytes

Versions: 1

Compression:

Stored size: 393 Bytes

Contents

module Lotu
  module Behavior

    def behave_like something
      class << self
        attr_accessor :behavior_options
      end
      include something

      @behavior_options ||= Hash.new{ |h,k| h[k] = {} }
    end

    def inherited subclass
      subclass.behavior_options =
        behavior_options.inject({}){ |hash, opts| hash[opts[0]] = opts[1].deep_copy; hash }
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lotu-0.1.16 lib/lotu/behavior.rb