Class: Rumai::Barlet
Overview
Subdivision of the bar—the thing that spans the width of the screen—useful for displaying information and system controls.
Constant Summary collapse
- COLORS_REGEXP =
/^\S+ \S+ \S+/
Instance Attribute Summary collapse
-
#side ⇒ Object
readonly
Returns the value of attribute side.
Attributes inherited from Node
Instance Method Summary collapse
- #colors ⇒ Object
- #colors=(colors) ⇒ Object
-
#initialize(file_name, side) ⇒ Barlet
constructor
A new instance of Barlet.
- #label ⇒ Object
- #label=(label) ⇒ Object
Methods inherited from Node
#[], #children, #clear, #create, #directory?, #each, #each_line, #entries, #exist?, #method_missing, #open, #parent, #read, #remove, #stat, #write
Methods included from ExportInstanceMethods
Constructor Details
#initialize(file_name, side) ⇒ Barlet
Returns a new instance of Barlet.
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 |
# File 'lib/rumai/wm.rb', line 1105 def initialize file_name, side prefix = case @side = side when :left then '/lbar' when :right then '/rbar' else raise ArgumentError, side end super "#{prefix}/#{file_name}" end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Rumai::Node
Instance Attribute Details
#side ⇒ Object (readonly)
Returns the value of attribute side.
1103 1104 1105 |
# File 'lib/rumai/wm.rb', line 1103 def side @side end |
Instance Method Details
#colors ⇒ Object
1125 1126 1127 1128 1129 1130 |
# File 'lib/rumai/wm.rb', line 1125 def colors case read when /^colors (.*)$/ then $1 when COLORS_REGEXP then $& end end |
#colors=(colors) ⇒ Object
1149 1150 1151 1152 1153 1154 1155 |
# File 'lib/rumai/wm.rb', line 1149 def colors= colors if SPLIT_FILE_FORMAT write "colors #{colors}" else write "#{colors} #{label}" end end |
#label ⇒ Object
1118 1119 1120 1121 1122 1123 |
# File 'lib/rumai/wm.rb', line 1118 def label case read when /^label (.*)$/ then $1 when /#{COLORS_REGEXP} (.*)$/o then $1 end end |
#label=(label) ⇒ Object
1141 1142 1143 1144 1145 1146 1147 |
# File 'lib/rumai/wm.rb', line 1141 def label= label if SPLIT_FILE_FORMAT write "label #{label}" else write "#{colors} #{label}" end end |