Sha256: fba3bff158a154487d266bdb91e8a91d24711609970935599315b43baf28dba6

Contents?: true

Size: 605 Bytes

Versions: 3

Compression:

Stored size: 605 Bytes

Contents

module BBLib
  # Requires Simple init to be loaded first. This sets up a very basic
  # init foundation by adding a method called type and setting the init
  # foundation method to it.
  module TypeInit

    def self.included(base)
      base.extend(ClassMethods)
      base.send(:bridge_method, :type)
      base.send(:serialize_method, :type, always: true)
      base.send(:setup_init_foundation, :type) { |a, b| a && b && a.to_s.to_sym == b.to_s.to_sym }
    end

    module ClassMethods
      def type
        to_s.split('::').last.method_case.to_sym
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bblib-2.0.1 lib/bblib/core/mixins/type_init.rb
bblib-2.0.0 lib/bblib/core/mixins/type_init.rb
bblib-1.0.2 lib/mixins/type_init.rb