Class: CrudComponents::Admin::Dependents::Item
- Inherits:
-
Struct
- Object
- Struct
- CrudComponents::Admin::Dependents::Item
- Defined in:
- lib/crud_components/admin/dependents.rb
Instance Attribute Summary collapse
-
#behavior ⇒ Object
Returns the value of attribute behavior.
-
#cascades ⇒ Object
Returns the value of attribute cascades.
-
#count ⇒ Object
Returns the value of attribute count.
-
#model ⇒ Object
Returns the value of attribute model.
-
#name ⇒ Object
Returns the value of attribute name.
-
#records ⇒ Object
Returns the value of attribute records.
Instance Method Summary collapse
- #blocks? ⇒ Boolean
- #destroys? ⇒ Boolean
- #human_name ⇒ Object
- #nullifies? ⇒ Boolean
-
#unnamed ⇒ Object
What is left over once the named ones are shown.
Instance Attribute Details
#behavior ⇒ Object
Returns the value of attribute behavior
12 13 14 |
# File 'lib/crud_components/admin/dependents.rb', line 12 def behavior @behavior end |
#cascades ⇒ Object
Returns the value of attribute cascades
12 13 14 |
# File 'lib/crud_components/admin/dependents.rb', line 12 def cascades @cascades end |
#count ⇒ Object
Returns the value of attribute count
12 13 14 |
# File 'lib/crud_components/admin/dependents.rb', line 12 def count @count end |
#model ⇒ Object
Returns the value of attribute model
12 13 14 |
# File 'lib/crud_components/admin/dependents.rb', line 12 def model @model end |
#name ⇒ Object
Returns the value of attribute name
12 13 14 |
# File 'lib/crud_components/admin/dependents.rb', line 12 def name @name end |
#records ⇒ Object
Returns the value of attribute records
12 13 14 |
# File 'lib/crud_components/admin/dependents.rb', line 12 def records @records end |
Instance Method Details
#blocks? ⇒ Boolean
18 |
# File 'lib/crud_components/admin/dependents.rb', line 18 def blocks? = BLOCKING.include?(behavior) && count.positive? |
#destroys? ⇒ Boolean
13 |
# File 'lib/crud_components/admin/dependents.rb', line 13 def destroys? = DESTROYING.include?(behavior) |
#human_name ⇒ Object
22 23 24 25 |
# File 'lib/crud_components/admin/dependents.rb', line 22 def human_name human = model ? model.model_name.human(count: count) : name.to_s.humanize count == 1 ? human : human.pluralize(I18n.locale) end |
#nullifies? ⇒ Boolean
20 |
# File 'lib/crud_components/admin/dependents.rb', line 20 def nullifies? = behavior == :nullify |
#unnamed ⇒ Object
What is left over once the named ones are shown.
16 |
# File 'lib/crud_components/admin/dependents.rb', line 16 def unnamed = count - Array(records).size |