Class: Array

Inherits:
Object show all
Defined in:
lib/shoes/ruby.rb

Instance Method Summary collapse

Instance Method Details

#/(len) ⇒ Object



62
63
64
65
66
67
68
69
# File 'lib/shoes/ruby.rb', line 62

def / len
  a = []
  each_with_index do |x, i|
    a << [] if i % len == 0
    a.last << x
  end
  a
end

#dark?Boolean

Returns:

  • (Boolean)


71
72
73
74
# File 'lib/shoes/ruby.rb', line 71

def dark?
  r, g, b = self
  r + g + b < 0x55 * 3
end

#light?Boolean

Returns:

  • (Boolean)


76
77
78
79
# File 'lib/shoes/ruby.rb', line 76

def light?
  r, g, b = self
  r + g + b > 0xAA * 3
end