Sha256: 38e410042d57d03c9cfbdc8b8cddc8bc0affda47453566d3cc357bc2833eefec

Contents?: true

Size: 407 Bytes

Versions: 4

Compression:

Stored size: 407 Bytes

Contents

module Mobility
  module Sequel
=begin

Internal class used to initialize column value(s) by default to a hash.

=end
    class HashInitializer < Module
      def initialize(*columns)
        class_eval <<-EOM, __FILE__, __LINE__ + 1
          def initialize_set(values)
            #{columns.map { |c| "self[:#{c}] = {}" }.join(';')}
            super
          end
        EOM
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mobility-0.4.3 lib/mobility/sequel/hash_initializer.rb
mobility-0.4.2 lib/mobility/sequel/hash_initializer.rb
mobility-0.4.1 lib/mobility/sequel/hash_initializer.rb
mobility-0.4.0 lib/mobility/sequel/hash_initializer.rb