Sha256: d886a8255785553074897a72e75dcddb2ca368704050620f6904de422d7b7dcd

Contents?: true

Size: 575 Bytes

Versions: 4

Compression:

Stored size: 575 Bytes

Contents

module Kuhsaft
  module PagePart

    def self.all
      descendants = []
      ObjectSpace.each_object(Class) do |k|
        descendants.unshift k if k < self
      end
      descendants.uniq!
      descendants.map { |d| d.to_s.underscore.to_sym }
    end

    class Base

      #
      # TODO: behave like ActiveModel for validations etc
      # http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/
      #
      def initialize hash
        hash.each_pair do |k,v|
          self.send "#{k}=", v
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kuhsaft-0.0.6 app/models/kuhsaft/page_parts/base.rb
kuhsaft-0.0.5 app/models/kuhsaft/page_parts/base.rb
kuhsaft-0.0.4 app/models/kuhsaft/page_parts/base.rb
kuhsaft-0.0.3 app/models/kuhsaft/page_parts/base.rb