class Puppet::Pops::LabelProvider

Provides a label for an object. This simple implementation calls to_s on the given object, and handles articles ‘a/an/the’.

Constants

A
AN
SKIPPED_CHARACTERS
VOWELS

Public Instance Methods

a_an(o) click to toggle source

Produces a label for the given text with indefinite article (a/an)

# File lib/puppet/pops/label_provider.rb, line 17
def a_an o
  text = label(o)
  "#{article(text)} #{text}"
end
a_an_uc(o) click to toggle source

Produces a label for the given text with indefinite article (A/An)

# File lib/puppet/pops/label_provider.rb, line 23
def a_an_uc o
  text = label(o)
  "#{article(text).capitalize} #{text}"
end
label(o) click to toggle source

Provides a label for the given object by calling `to_s` on the object. The intent is for this method to be overridden in concrete label providers.

# File lib/puppet/pops/label_provider.rb, line 12
def label o
  o.to_s
end
plural_s(count, text = '') click to toggle source

Appends ‘s’ to (optional) text if count != 1 else an empty string

# File lib/puppet/pops/label_provider.rb, line 39
def plural_s(count, text = '')
  count == 1 ? text : "#{text}s"
end
the(o) click to toggle source

Produces a label for the given text with *definitie article* (the).

# File lib/puppet/pops/label_provider.rb, line 29
def the o
  "the #{label(o)}"
end
the_uc(o) click to toggle source

Produces a label for the given text with *definitie article* (The).

# File lib/puppet/pops/label_provider.rb, line 34
def the_uc o
  "The #{label(o)}"
end