Class: TorqueBox::Configuration::FakeConstant

Inherits:
Object
  • Object
show all
Defined in:
lib/torquebox/configuration.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ FakeConstant

Returns a new instance of FakeConstant.



174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/torquebox/configuration.rb', line 174

def initialize(name)
  @name = name.to_s
  s = <<-END
    module ::#{name}
      def self.const_missing(k)
        FakeConstant.new( "#{name}::" + k.to_s ).to_const
      end
    end
  END

  eval s
 
end

Instance Method Details

#to_constObject



188
189
190
# File 'lib/torquebox/configuration.rb', line 188

def to_const
  eval @name
end

#to_sObject



192
193
194
# File 'lib/torquebox/configuration.rb', line 192

def to_s
  @name
end