class Aws::Templates::Utils::Lazy
Lazy
module wrapper
Allows to traverse non-existent modules up to the point when constant can be auto-discovered.
Public Class Methods
fail_on_method(method_name)
click to toggle source
# File lib/aws/templates/utils/autoload.rb, line 124 def self.fail_on_method(method_name) define_method(method_name) { |*params, &blk| raise_error(method_name, params, blk) } end
new(parent, short_name = nil)
click to toggle source
# File lib/aws/templates/utils/autoload.rb, line 206 def initialize(parent, short_name = nil) raise ScriptError.new("#{parent} is not a module") unless parent.is_a?(Module) @parent = parent @short_name = short_name end
Public Instance Methods
const_missing(const_name)
click to toggle source
# File lib/aws/templates/utils/autoload.rb, line 169 def const_missing(const_name) Lazy.new(self, const_name) end
inspect()
click to toggle source
# File lib/aws/templates/utils/autoload.rb, line 184 def inspect "#{name}(Lazy)" end
lazy()
click to toggle source
# File lib/aws/templates/utils/autoload.rb, line 188 def lazy self end
method_missing(method_name, *params, &blk)
click to toggle source
Calls superclass method
# File lib/aws/templates/utils/autoload.rb, line 160 def method_missing(method_name, *params, &blk) raise_error(method_name, params, blk) super end
name()
click to toggle source
# File lib/aws/templates/utils/autoload.rb, line 192 def name return @parent.name if @short_name.nil? if @parent.root_namespace? @short_name.to_s else "#{@parent.name}::#{@short_name}" end end
raise_error(method_name, params, blk)
click to toggle source
# File lib/aws/templates/utils/autoload.rb, line 128 def raise_error(method_name, params, blk) raise NoMethodError.new( "Lazy namespace #{self} doesn't support #{method_name}\n" \ " Parameters: #{params}\n" \ " Block: #{blk}" ) end
reduce(is_loaded = false)
click to toggle source
# File lib/aws/templates/utils/autoload.rb, line 173 def reduce(is_loaded = false) return @parent.reduce if @short_name.nil? @parent.reduce(is_loaded || Autoload.const_is_loaded?(@parent, @short_name)) .const_get(@short_name) end
respond_to_missing?(*)
click to toggle source
Calls superclass method
# File lib/aws/templates/utils/autoload.rb, line 165 def respond_to_missing?(*) super end
root_namespace?()
click to toggle source
# File lib/aws/templates/utils/autoload.rb, line 202 def root_namespace? @parent.root_namespace? && @short_name.nil? end
to_s()
click to toggle source
# File lib/aws/templates/utils/autoload.rb, line 180 def to_s name end