Class: Array

Inherits:
Object show all
Includes:
ArrayCleanup, ArrayNestedHash, ArrayTags, Doing::ChronifyArray
Defined in:
lib/doing/good.rb,
lib/doing/array/array.rb,
lib/doing/chronify/chronify.rb

Overview

Array helpers

Direct Known Subclasses

Doing::Items, Doing::Note

Instance Method Summary collapse

Methods included from Doing::ChronifyArray

#time_string, #to_abbr, #to_natural, #to_years

Instance Method Details

#good?Boolean

Tests if object is nil or empty

Returns:

  • (Boolean)

    true if object is defined and has content



59
60
61
# File 'lib/doing/good.rb', line 59

def good?
  !nil? && !empty?
end

#utf8Array

Force UTF-8 encoding of strings in array

Returns:

  • (Array)

    Encoded lines



17
18
19
20
21
22
23
24
# File 'lib/doing/array/array.rb', line 17

def utf8
  c = self.class
  if String.method_defined? :force_encoding
    replace c.new(map(&:utf8))
  else
    self
  end
end