Sha256: e6e49c39d1a8a3dfd46942fd87d02b7abb9cbc54e6171611adbe21ffb26b7fa9

Contents?: true

Size: 395 Bytes

Versions: 5

Compression:

Stored size: 395 Bytes

Contents

class Util

  # ensures whatever is passed in comes out an array of symbols
  class << self
    def prepare(str)
      symbolize(arrayify(str))
    end

    # ensures the array elements are symbols
    def symbolize(strings)
      strings.map{|s| s.to_sym}
    end

    # ensure given roles are in the form of an array
    def arrayify(roles)
      Array.wrap(roles).flatten
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
canner-0.3.0 lib/canner/util.rb
canner-0.2.2 lib/canner/util.rb
canner-0.2.1 lib/canner/util.rb
canner-0.2.0 lib/canner/util.rb
canner-0.1.0 lib/canner/util.rb