class Construct

Public Instance Methods

[](key) click to toggle source
# File lib/rake/config.rb, line 149
def [](key)
  Thread.current[:confStack].calling(self, key, :key_lookup);
  orig_key_lookup(key)
end
Also aliased as: orig_key_lookup
[]=(key, value) click to toggle source
# File lib/rake/config.rb, line 155
def []=(key, value)
  value = Hash.new() if value.nil?;

  if @data.include?(key) && @data[key].is_a?(Construct) && (value.is_a?(Hash) || value.is_a?(Construct)) then
    value = @data[key].merge(value);
  end
  orig_key_value_assignment(key, value);
end
Also aliased as: orig_key_value_assignment
cloneData() click to toggle source
# File lib/rake/config.rb, line 117
def cloneData()
  @data = @data.clone;
end
each_key(*args, &block) click to toggle source
# File lib/rake/config.rb, line 133
def each_key(*args, &block)
  @data.each_key(*args, &block)
end
each_pair(*args, &block) click to toggle source
# File lib/rake/config.rb, line 129
def each_pair(*args, &block)
  @data.each_pair(*args, &block)
end
empty?() click to toggle source
# File lib/rake/config.rb, line 121
def empty?()
  @data.empty?();
end
has_key?(key) click to toggle source
# File lib/rake/config.rb, line 125
def has_key?(key)
  @data.has_key?(key);
end
merge(valueToMerge) click to toggle source
# File lib/rake/config.rb, line 164
def merge(valueToMerge)
  if valueToMerge.is_a?(Hash) || valueToMerge.is_a?(Construct) then
    valueToMerge.each do | key, value |
      key = key.to_sym;
      if value.is_a?(Hash) || value.is_a?(Construct) then
        self[key] = Construct.new() unless self.has_key?(key);
        if !self[key].is_a?(Construct) then
          raise ArgumentError, "attempting to merge a Hash/Construct into an existing non Hash/Construct key [#{key}]";
        end
        self[key].merge(value);
      elsif value.is_a?(Array) then
        self[key] = Array.new() unless self.has_key?(key);
        if !self[key].is_a?(Array) then
          raise ArgumentError, "attempting to merge an Array into an existing non Array key [#{key}]";
        end
        value.each do | item |
          self[key].push(item);
        end
      else
        self[key] = value;
      end
    end
  end
  if valueToMerge.is_a?(Construct) then
    @schema.merge(valueToMerge.schema);
  end
  return self;
end
method_missing(meth, *args) click to toggle source
# File lib/rake/config.rb, line 138
def method_missing(meth, *args)
  Thread.current[:confStack].calling(self, meth, :method_missing, args);
  begin
    resultObject = orig_method_missing(meth, *args);
  rescue NoMethodError => errorObject
    Thread.current[:confStack].reportNoMethodError(errorObject);
  end
  resultObject
end
Also aliased as: orig_method_missing
orig_key_lookup(key)
Alias for: []
orig_key_value_assignment(key, value)
Alias for: []=
orig_method_missing(meth, *args)
Alias for: method_missing
prettyPrint(result, prefix) click to toggle source
# File lib/rake/config.rb, line 204
def prettyPrint(result, prefix)
  if empty? then
    result.puts(prefix+'=emptyConstruct');
  else
    data.keys.sort{ |x,y| x.to_s <=> y.to_s }.each do | aKey |
      aValue = data[aKey];
      if aValue.respond_to?(:prettyPrint) then
        aValue.prettyPrint(result, prefix+'.'+aKey.to_s);
      else
        result.puts(prefix+'.'+aKey.to_s+"="+aValue.to_s);
      end
    end
  end
end
to_stringHash() click to toggle source
# File lib/rake/config.rb, line 193
def to_stringHash() 
  result = Hash.new();
  data.each_pair do | aKey, aValue |
    if aValue.is_a?(Construct) then
      aValue = aValue.to_stringHash();
    end
    result[aKey.to_s] = aValue;
  end
  return result;
end