Sha256: 546759dde968529ea9d661505cbf90beff44d167d103bb8a89c70bcfbaa148db

Contents?: true

Size: 744 Bytes

Versions: 4

Compression:

Stored size: 744 Bytes

Contents

class Module
  # TODO2 Cache it and next one
  def resource_exist? resource_name    
    self_ancestors_and_namespaces do |klass|
      return true if VResource.resource_exist? klass, resource_name          
    end
    return false
  end  
  cache_method_with_params :resource_exist?
  
  def [] resource_name
    self_ancestors_and_namespaces do |klass|
      if VResource.resource_exist? klass, resource_name
        return VResource.resource_get(klass, resource_name)
      end  
    end
    raise VResource::NotExist, "Resource '#{resource_name}' for Class '#{self.name}' doesn't exist!", caller
  end
  cache_method_with_params :[]
  
  def []= resource_name, value
    VResource.resource_set self.name, resource_name, value
  end    
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-ext-0.4.3 lib/vresource/module.rb
ruby-ext-0.4.2 lib/vresource/module.rb
ruby-ext-0.4.1 lib/vresource/module.rb
ruby-ext-0.4.0 lib/vresource/module.rb