Module: DataMapper::Is::ClassMethods

Defined in:
lib/dm-is-sluggable/is/class_methods.rb

Instance Method Summary collapse

Instance Method Details

#get(slug) ⇒ Object

_with_slug slug



26
27
28
# File 'lib/dm-is-sluggable/is/class_methods.rb', line 26

def get slug #_with_slug slug
  first(slug_property_name => slug)
end

#slug_max_lengthObject



22
23
24
# File 'lib/dm-is-sluggable/is/class_methods.rb', line 22

def slug_max_length
  slug_options[:max_length]
end

#slug_permanent?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/dm-is-sluggable/is/class_methods.rb', line 18

def slug_permanent?
  slug_options[:permanent?]
end

#slug_propertyObject



5
6
7
8
# File 'lib/dm-is-sluggable/is/class_methods.rb', line 5

def slug_property
  sp = properties[slug_property_name]
  sp && (sp.type == String ? sp : nil)
end

#slug_property_nameObject



10
11
12
# File 'lib/dm-is-sluggable/is/class_methods.rb', line 10

def slug_property_name
  slug_options[:property_name]
end

#slug_sourceObject



14
15
16
# File 'lib/dm-is-sluggable/is/class_methods.rb', line 14

def slug_source
  slug_options[:source]
end