module SmartName::Predicates

Public Instance Methods

blank?() click to toggle source
   # File lib/smart_name/predicates.rb
 8 def blank?
 9   s.blank?
10 end
Also aliased as: empty?
empty?()
Alias for: blank?
end_with?(postfix)
Alias for: ends_with?
ends_with?(postfix) click to toggle source

@return true if name ends with the same parts as `prefix`

   # File lib/smart_name/predicates.rb
27 def ends_with? postfix
28   end_name = postfix.to_name
29   end_name == self[-end_name.length..-1]
30 end
Also aliased as: end_with?
include?(subname) click to toggle source

@return true if name has a chain of parts that equals `subname`

   # File lib/smart_name/predicates.rb
34 def include? subname
35   subkey = subname.to_name.key
36   key =~ /(^|#{JOINT_RE})#{Regexp.quote subkey}($|#{JOINT_RE})/
37 end
junction?() click to toggle source

@return true if name has more than one part

  # File lib/smart_name/predicates.rb
4 def junction?
5   !simple?
6 end
start_with?(prefix)
Alias for: starts_with?
starts_with?(prefix) click to toggle source

@return true if name starts with the same parts as `prefix`

   # File lib/smart_name/predicates.rb
20 def starts_with? prefix
21   start_name = prefix.to_name
22   start_name == self[0, start_name.length]
23 end
Also aliased as: start_with?
valid?() click to toggle source
   # File lib/smart_name/predicates.rb
13 def valid?
14   !parts.find do |pt|
15     pt.match self.class.banned_re
16   end
17 end