class Bricolage::FileResource
Attributes
path[R]
Public Class Methods
new(path, name = nil)
click to toggle source
# File lib/bricolage/resource.rb, line 12 def initialize(path, name = nil) @path = path @name = name end
Public Instance Methods
==(other)
click to toggle source
# File lib/bricolage/resource.rb, line 33 def ==(other) return false unless other.kind_of?(FileResource) @path == other.path end
Also aliased as: eql?
content()
click to toggle source
# File lib/bricolage/resource.rb, line 23 def content @content ||= File.read(@path) rescue SystemCallError => err raise ParameterError, "could not open a file: #{@path}: #{err.message}" end
hash()
click to toggle source
# File lib/bricolage/resource.rb, line 40 def hash @path.hash end
inspect()
click to toggle source
# File lib/bricolage/resource.rb, line 29 def inspect "\#<#{self.class} #{@path}>" end
name()
click to toggle source
# File lib/bricolage/resource.rb, line 19 def name @name || @path end