Class: Util
- Inherits:
-
Object
- Object
- Util
- Defined in:
- lib/canner/util.rb
Class Method Summary collapse
-
.arrayify(roles) ⇒ Object
ensure given roles are in the form of an array.
- .prepare(str) ⇒ Object
-
.symbolize(strings) ⇒ Object
ensures the array elements are symbols.
Class Method Details
.arrayify(roles) ⇒ Object
ensure given roles are in the form of an array
15 16 17 |
# File 'lib/canner/util.rb', line 15 def arrayify(roles) roles.class == Array ? roles : [roles].flatten end |
.prepare(str) ⇒ Object
5 6 7 |
# File 'lib/canner/util.rb', line 5 def prepare(str) symbolize(arrayify(str)) end |
.symbolize(strings) ⇒ Object
ensures the array elements are symbols
10 11 12 |
# File 'lib/canner/util.rb', line 10 def symbolize(strings) strings.map{|s| s.to_sym} end |