Class: String

Inherits:
Object show all
Defined in:
lib/trellis/utils.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


102
103
104
# File 'lib/trellis/utils.rb', line 102

def blank?
  self !~ /\S/
end

#humanizeObject



121
122
123
# File 'lib/trellis/utils.rb', line 121

def humanize
  gsub(/_id$/, "").gsub(/_/, " ").capitalize
end

#replace_ant_style_properties(properties) ⇒ Object



113
114
115
116
117
118
119
# File 'lib/trellis/utils.rb', line 113

def replace_ant_style_properties(properties)
  text = self
  properties.each_pair do |key,value|
    text = text.replace_ant_style_property(key, value)
  end
  text
end

#replace_ant_style_property(property, value) ⇒ Object



106
107
108
109
110
111
# File 'lib/trellis/utils.rb', line 106

def replace_ant_style_property(property, value)
  result = self.gsub(/\$\{#{property.to_s}\}/) do |match|
    value
  end
  result
end