Module: XDry::StringAdditions

Defined in:
lib/xdry/support/string_additions.rb

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/xdry/support/string_additions.rb', line 6

def blank?
  self =~ /^\s*$/
end

#capitalized_identifierObject



10
11
12
13
14
15
# File 'lib/xdry/support/string_additions.rb', line 10

def capitalized_identifier
  case self
    when 'id', 'uid' then upcase
    else self[0..0].upcase + self[1..-1]
  end
end

#prefixed_as_arg_nameObject



17
18
19
20
21
# File 'lib/xdry/support/string_additions.rb', line 17

def prefixed_as_arg_name
  prefix = case self when /^[aeiou]/ then 'an' else 'a' end

  prefix + self.capitalized_identifier
end