lib/pa/state.rb in pa-1.1.4 vs lib/pa/state.rb in pa-1.2.0
- old
+ new
@@ -1,12 +1,12 @@
class Pa
module State
extend Util::Concern
- module ClassMethods
- # goes to File
- FILE_DELEGATED_METHODS = [ :exists?, :atime, :ctime, :mtime, :stat, :lstat, :size, :zero?, :executable?, :executable_real?, :world_executable?, :readable?, :readable_real?, :world_readalbe?, :writeable?, :writeable_real?, :world_writeable?, :directory?, :file?, :blockdev?, :chardev?, :piple?, :socket?, :symlink?, :owned?, :grpowned?, :setgid?, :setuid?, :stricky?, :identical? ]
+ FILE_DELEGATED_METHODS = [ :exists?, :atime, :ctime, :mtime, :stat, :lstat, :size, :zero?, :executable?, :executable_real?, :world_executable?, :readable?, :readable_real?, :world_readalbe?, :writeable?, :writeable_real?, :world_writeable?, :directory?, :file?, :blockdev?, :chardev?, :piple?, :socket?, :symlink?, :owned?, :grpowned?, :setgid?, :setuid?, :stricky?, :identical? ]
+
+ module ClassMethods
# delegated from File
FILE_DELEGATED_METHODS.each { |name|
module_eval <<-METHOD, __FILE__, __LINE__
def #{name}(*args)
File.#{name}(*args)
@@ -62,11 +62,10 @@
else
t
end
end # def type
-
# is path a mountpoint?
#
# @param[String] path
# @return [Boolean]
def mountpoint?(path)
@@ -80,9 +79,18 @@
end
end
end
module InstanceMethods
+ # delegated from File
+ FILE_DELEGATED_METHODS.each { |name|
+ module_eval <<-METHOD, __FILE__, __LINE__
+ def #{name}(*args)
+ File.#{name}(*args, path)
+ end
+ METHOD
+ }
+
def chmod(mode)
File.chmod(mode, path)
end
def lchmod(mode)