Module: DataMapper::Is::Slug::InstanceMethods
- Defined in:
- lib/dm-is-slug/is/slug.rb
Overview
ClassMethods
Instance Method Summary collapse
- #slug_mutable? ⇒ Boolean
- #slug_property ⇒ Object
- #slug_source ⇒ Object
- #slug_source_property ⇒ Object
- #slug_source_value ⇒ Object
-
#stale_slug? ⇒ Boolean
The slug is not stale if 1.
- #to_param ⇒ Object
Instance Method Details
#slug_mutable? ⇒ Boolean
138 139 140 |
# File 'lib/dm-is-slug/is/slug.rb', line 138 def slug_mutable? self.class.slug_mutable? end |
#slug_property ⇒ Object
150 151 152 |
# File 'lib/dm-is-slug/is/slug.rb', line 150 def slug_property self.class.slug_property end |
#slug_source ⇒ Object
142 143 144 |
# File 'lib/dm-is-slug/is/slug.rb', line 142 def slug_source self.class.slug_source end |
#slug_source_property ⇒ Object
146 147 148 |
# File 'lib/dm-is-slug/is/slug.rb', line 146 def slug_source_property self.class.slug_source_property end |
#slug_source_value ⇒ Object
154 155 156 |
# File 'lib/dm-is-slug/is/slug.rb', line 154 def slug_source_value self.send(slug_source) end |
#stale_slug? ⇒ Boolean
The slug is not stale if
-
the slug is permanent, and slug column has something valid in it
-
the slug source value is nil or empty
161 162 163 |
# File 'lib/dm-is-slug/is/slug.rb', line 161 def stale_slug? !((!slug_mutable? && slug && !slug.empty?) || (slug_source_value.nil? || slug_source_value.empty?)) end |
#to_param ⇒ Object
134 135 136 |
# File 'lib/dm-is-slug/is/slug.rb', line 134 def to_param [slug] end |