Sha256: 5ab4c3ee299ac1765e276b714dc451c6bd3c2d77b9651bb003efb71ef399bf9a

Contents?: true

Size: 721 Bytes

Versions: 2

Compression:

Stored size: 721 Bytes

Contents

module Troles::Common::Macros
  class Configuration  
    class BaseLoader
      attr_reader :strategy, :orm

      include ClassExt
      
      def initialize strategy, orm
        @strategy = strategy
        @orm = orm || Troles::Config.default_orm
      end

      def singularity
        (strategy =~ /_many$/) ? :many : :one
      end
      
      def strategy_class
        strategy.to_s.camelize
      end
      
      def base_class
        "Base#{singularity.to_s.camelize}"
      end

      def namespace
        singularity == :many ? 'Troles' : 'Trole'      
      end

      def orm_namespace
        ns = namespace
        ns << "::#{orm.to_s.camelize}" if orm
        ns
      end      
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
troles-0.6.1 lib/troles/common/macros/configuration/base_loader.rb
troles-0.6.0 lib/troles/common/macros/configuration/base_loader.rb