Sha256: 1ec2eda58b794daa894dc4d512a3e42dab79c7881cbbd6daa61eae69268b6520

Contents?: true

Size: 645 Bytes

Versions: 27

Compression:

Stored size: 645 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.new) unless const.const_defined?(name_part)
    const = const.const_get(name_part)
  end

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

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
loquor-0.5.4 lib/loquor/interactors.rb
loquor-0.5.3 lib/loquor/interactors.rb
loquor-0.5.2 lib/loquor/interactors.rb
loquor-0.5.1 lib/loquor/interactors.rb
loquor-0.5.0 lib/loquor/interactors.rb
loquor-0.4.0 lib/loquor/interactors.rb
loquor-0.3.0 lib/loquor/interactors.rb