Class: Consent::View
- Inherits:
-
Object
- Object
- Consent::View
- Defined in:
- lib/consent/view.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Instance Method Summary collapse
- #conditions(*args) ⇒ Object
-
#initialize(key, label, instance = nil, collection = nil) ⇒ View
constructor
A new instance of View.
- #object_conditions(*args) ⇒ Object
Constructor Details
#initialize(key, label, instance = nil, collection = nil) ⇒ View
Returns a new instance of View.
7 8 9 10 11 12 |
# File 'lib/consent/view.rb', line 7 def initialize(key, label, instance = nil, collection = nil) @key = key @label = label @instance = instance @collection = collection end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
5 6 7 |
# File 'lib/consent/view.rb', line 5 def key @key end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
5 6 7 |
# File 'lib/consent/view.rb', line 5 def label @label end |
Instance Method Details
#conditions(*args) ⇒ Object
14 15 16 17 18 |
# File 'lib/consent/view.rb', line 14 def conditions(*args) return @collection unless @collection.respond_to?(:call) @collection.call(*args) end |
#object_conditions(*args) ⇒ Object
20 21 22 23 24 |
# File 'lib/consent/view.rb', line 20 def object_conditions(*args) return @instance unless @instance.respond_to?(:curry) @instance.curry[*args] end |