class Prune::FileContext

A thin wrapper around files for holding attributes that might be precalculated and then used by a number of categories.

Attributes

name[RW]

Public Class Methods

new( path, filename, preprocessor ) click to toggle source
# File lib/prune/retention.rb, line 109
def initialize( path, filename, preprocessor )
  @name = File.join( path, filename )
  @attributes = Hash.new
  instance_eval &preprocessor unless preprocessor.nil?
end

Public Instance Methods

method_missing( symbol, *arguments ) click to toggle source

def responds_to?( symbol )

symbol.to_s.end_with? '=' || @attributes.has_key? symbol

end

Calls superclass method
# File lib/prune/retention.rb, line 119
def method_missing( symbol, *arguments )
  if symbol.to_s =~ /(.+)=/ && arguments.size == 1 then
    @attributes[ $1.to_sym ] = arguments.first
  elsif @attributes.has_key?( symbol ) && arguments.empty? then
    @attributes[ symbol ]
  else
    super symbol, arguments
  end
end