Sha256: bb5925a3ee2ba259a10493091ad1d13f9b97de4623c052f768ed7e1e54598506

Contents?: true

Size: 613 Bytes

Versions: 3

Compression:

Stored size: 613 Bytes

Contents

Loquor::Representations.each do |name, path|
  klass = Class.new(Object) do
    extend Loquor::Representation::ClassMethods
    include Loquor::Representation::InstanceMethods

    instance_eval <<-EOS
      def path
        "#{path}"
      end
    EOS
  end

  # Split off the Group and Discussion parts
  name_parts = name.split("::")
  klass_name = name_parts.pop

  # Create base modules
  const = Loquor
  name_parts.each do |name_part|
    const.const_set name_part, Module unless const.const_defined?(name_part)
  end

  # Define the actual klass at the right point
  const.const_set klass_name, klass
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
loquor-0.1.1 lib/loquor/representations.rb
loquor-0.1.0 lib/loquor/representations.rb
loquor-0.0.2 lib/loquor/representations.rb