commit 9b5aeb8a4dc98a510d366fa2dcfee5f49dd94728
parent 9df5e88d8563c897f5cb1c66e49f920064f30943
Author: Suraj N. Kurapati <sunaku@gmail.com>
Date: Mon, 11 Sep 2006 09:18:58 -0700
[project @ 32d837fe53d886de3277e147f6220a2b54bd2fdc]
[project @ 65]
refac IxpNode -> IxpFs::Node, Wmii::Container -> Wmii::Node
Diffstat:
fs.rb | | | 124 | ++++++++++++++++++++++++++++++++++++++++---------------------------------------- |
wm.rb | | | 16 | ++++++++-------- |
wmiirc | | | 2 | +- |
3 files changed, 71 insertions(+), 71 deletions(-)
diff --git a/fs.rb b/fs.rb
@@ -99,84 +99,84 @@ module IxpFs
end
end
end
-end
-# Encapsulates access to an entry (node) in the IXP file system.
-class IxpNode
- attr_reader :path
+ # An entry in the IXP file system.
+ class Node
+ attr_reader :path
- # Obtains the IXP node at the given path. If aCreateIt is asserted, then the given path is created unless it already exists.
- def initialize aPath, aCreateIt = false
- @path = aPath.squeeze('/')
- create! if aCreateIt && !exist?
- end
+ # Obtains the IXP node at the given path. If aCreateIt is asserted, then the given path is created unless it already exists.
+ def initialize aPath, aCreateIt = false
+ @path = aPath.squeeze('/')
+ create! if aCreateIt && !exist?
+ end
- # Creates this node.
- def create!
- IxpFs.create @path
- end
+ # Creates this node.
+ def create!
+ IxpFs.create @path
+ end
- # Deletes this node.
- def remove!
- IxpFs.remove @path
- end
+ # Deletes this node.
+ def remove!
+ IxpFs.remove @path
+ end
- # Writes the given content to this node.
- def write! aContent
- IxpFs.write @path, aContent
- end
+ # Writes the given content to this node.
+ def write! aContent
+ IxpFs.write @path, aContent
+ end
- # Returns the contents of this node or the names of all sub-nodes if this is a directory.
- def read
- IxpFs.read @path
- end
+ # Returns the contents of this node or the names of all sub-nodes if this is a directory.
+ def read
+ IxpFs.read @path
+ end
- # Returns true if this node is a file.
- def file?
- IxpFs.file? @path
- end
+ # Returns true if this node is a file.
+ def file?
+ IxpFs.file? @path
+ end
- # Returns true if this node is a directory.
- def directory?
- IxpFs.directory? @path
- end
+ # Returns true if this node is a directory.
+ def directory?
+ IxpFs.directory? @path
+ end
- # Returns true if this node exists in the file system.
- def exist?
- IxpFs.exist? @path
- end
+ # Returns true if this node exists in the file system.
+ def exist?
+ IxpFs.exist? @path
+ end
- def basename
- File.basename @path
- end
+ def basename
+ File.basename @path
+ end
- def dirname
- File.dirname @path
- end
+ def dirname
+ File.dirname @path
+ end
- # Accesses the given sub-path. The contents of the sub-path are returned if it is a file. Otherwise, its node is returned if it is a directory.
- def [] aSubPath
- child = IxpNode.new("#{@path}/#{aSubPath}")
+ # Accesses the given sub-path. The contents of the sub-path are returned if it is a file. Otherwise, its node is returned if it is a directory.
+ def [] aSubPath
+ child = IxpFs::Node.new("#{@path}/#{aSubPath}")
- if child.file?
- child.read
- else
- child
+ if child.file?
+ child.read
+ else
+ child
+ end
end
- end
- # Writes to the given sub-path.
- def []= aSubPath, aContent
- child = IxpNode.new("#{@path}/#{aSubPath}")
- child.write! aContent if child.file?
- end
+ # Writes to the given sub-path.
+ def []= aSubPath, aContent
+ child = IxpFs::Node.new("#{@path}/#{aSubPath}")
+ child.write! aContent if child.file?
+ end
- # Provides easy access to sub-nodes.
- def method_missing aMeth, *aArgs
- if aMeth.to_s =~ /=$/
- self[$`] = *aArgs
- else
- self[aMeth]
+ # Provides easy access to sub-nodes.
+ def method_missing aMeth, *aArgs
+ if aMeth.to_s =~ /=$/
+ self[$`] = *aArgs
+ else
+ self[aMeth]
+ end
end
end
end
diff --git a/wm.rb b/wm.rb
@@ -144,7 +144,7 @@ module Wmii
end
# Represents the window manager at root of the file system.
- class Root < IxpNode
+ class Root < IxpFs::Node
include State
def initialize
@@ -152,8 +152,8 @@ module Wmii
end
end
- # Encapsulates a graphical region in the window manager.
- class Container < IxpNode
+ # A graphical region in the window manager.
+ class Node < IxpFs::Node
include Wmii
def initialize aParentClass, aChildClass, *aArgs
@@ -231,9 +231,9 @@ module Wmii
end
end
- class Client < Container
+ class Client < Node
def initialize *aArgs
- super Area, IxpNode, *aArgs
+ super Area, IxpFs::Node, *aArgs
end
undef index
@@ -284,7 +284,7 @@ module Wmii
end
end
- class Area < Container
+ class Area < Node
def initialize *aArgs
super View, Client, *aArgs
end
@@ -362,9 +362,9 @@ module Wmii
end
end
- class View < Container
+ class View < Node
def initialize *aArgs
- super IxpNode, Area, *aArgs
+ super IxpFs::Node, Area, *aArgs
end
alias areas children
diff --git a/wmiirc b/wmiirc
@@ -380,7 +380,7 @@ WM.def.keys = SHORTCUTS.keys.join("\n")
## STATUS BAR
Thread.new do
- status = IxpNode.new("/bar/status", true)
+ status = IxpFs::Node.new("/bar/status", true)
status.colors = ENV['WMII_NORMCOLORS']
loop do