Class: Array
Direct Known Subclasses
Instance Method Summary collapse
- #/(len) ⇒ Object
- #_clear ⇒ Object
- #_to_s ⇒ Object
- #clear ⇒ Object
- #clear_all ⇒ Object
- #dark? ⇒ Boolean
- #light? ⇒ Boolean
- #to_s ⇒ Object
Instance Method Details
#/(len) ⇒ Object
135 136 137 138 139 140 141 142 |
# File 'lib/shoes/ruby.rb', line 135 def / len a = [] each_with_index do |x, i| a << [] if i % len == 0 a.last << x end a end |
#_clear ⇒ Object
154 |
# File 'lib/shoes/ruby.rb', line 154 alias :_clear :clear |
#_to_s ⇒ Object
164 |
# File 'lib/shoes/ruby.rb', line 164 alias :_to_s :to_s |
#clear ⇒ Object
155 156 157 158 |
# File 'lib/shoes/ruby.rb', line 155 def clear self.each{|e| e.clear if e.class.method_defined? :clear} _clear end |
#clear_all ⇒ Object
160 161 162 |
# File 'lib/shoes/ruby.rb', line 160 def clear_all self.each &:clear_all end |
#dark? ⇒ Boolean
144 145 146 147 |
# File 'lib/shoes/ruby.rb', line 144 def dark? r, g, b = self r + g + b < 0x55 * 3 end |
#light? ⇒ Boolean
149 150 151 152 |
# File 'lib/shoes/ruby.rb', line 149 def light? r, g, b = self r + g + b > 0xAA * 3 end |
#to_s ⇒ Object
165 166 167 |
# File 'lib/shoes/ruby.rb', line 165 def to_s self.map(&:to_s)._to_s end |