Sha256: 04135bef22561049868f8152b3735cde31820e99c59a319db176d01db6f7acea

Contents?: true

Size: 601 Bytes

Versions: 2

Compression:

Stored size: 601 Bytes

Contents

Loquor::Interactors.each do |name, path|
  klass = Class.new(Object) do
    extend Loquor::Interactor::ClassMethods
    include Loquor::Interactor::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

2 entries across 2 versions & 1 rubygems

Version Path
loquor-0.2.0 lib/loquor/interactors.rb
loquor-0.1.2 lib/loquor/interactors.rb