Class: Array

Inherits:
Object show all
Defined in:
lib/webbynode.rb,
lib/webbynode/attribute_accessors.rb

Instance Method Summary collapse

Instance Method Details

#extract_options!Object



64
65
66
# File 'lib/webbynode/attribute_accessors.rb', line 64

def extract_options!
  last.is_a?(::Hash) ? pop : {}
end

#to_phrase(last_join = "and") ⇒ Object



84
85
86
87
88
89
90
91
92
93
# File 'lib/webbynode.rb', line 84

def to_phrase(last_join="and")
  return "" if empty?

  array = self.clone
  last = array.pop

  return last if array.empty?

  "#{array.join(", ")} #{last_join} #{last}"
end