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.
1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 |
# File 'lib/rumai/wm.rb', line 1116 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.
1114 1115 1116 |
# File 'lib/rumai/wm.rb', line 1114 def side @side end |
Instance Method Details
#colors ⇒ Object
1136 1137 1138 1139 1140 1141 |
# File 'lib/rumai/wm.rb', line 1136 def colors case read when /^colors (.*)$/ then $1 when COLORS_REGEXP then $& end end |
#colors=(colors) ⇒ Object
1160 1161 1162 1163 1164 1165 1166 |
# File 'lib/rumai/wm.rb', line 1160 def colors= colors if SPLIT_FILE_FORMAT write "colors #{colors}" else write "#{colors} #{label}" end end |
#label ⇒ Object
1129 1130 1131 1132 1133 1134 |
# File 'lib/rumai/wm.rb', line 1129 def label case read when /^label (.*)$/ then $1 when /#{COLORS_REGEXP} (.*)$/o then $1 end end |
#label=(label) ⇒ Object
1152 1153 1154 1155 1156 1157 1158 |
# File 'lib/rumai/wm.rb', line 1152 def label= label if SPLIT_FILE_FORMAT write "label #{label}" else write "#{colors} #{label}" end end |