Class: AdequateExposure::Exposure
- Inherits:
-
Object
- Object
- AdequateExposure::Exposure
- Defined in:
- lib/adequate_exposure/exposure.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #expose! ⇒ Object
-
#initialize(controller, name, fetch_block = nil, **options, &block) ⇒ Exposure
constructor
A new instance of Exposure.
Constructor Details
#initialize(controller, name, fetch_block = nil, **options, &block) ⇒ Exposure
Returns a new instance of Exposure.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/adequate_exposure/exposure.rb', line 9 def initialize(controller, name, fetch_block=nil, **, &block) @controller = controller @options = .with_indifferent_access.merge(name: name) merge_lambda_option :fetch, fetch_block if fetch_block merge_lambda_option :fetch, block if block_given? assert_singleton_option :fetch assert_singleton_option :from :parent, :model :parent, :scope :find_by, :find end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
3 4 5 |
# File 'lib/adequate_exposure/exposure.rb', line 3 def controller @controller end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/adequate_exposure/exposure.rb', line 3 def @options end |
Class Method Details
.expose!(*args, &block) ⇒ Object
5 6 7 |
# File 'lib/adequate_exposure/exposure.rb', line 5 def self.expose!(*args, &block) new(*args, &block).expose! end |
Instance Method Details
#expose! ⇒ Object
25 26 27 28 |
# File 'lib/adequate_exposure/exposure.rb', line 25 def expose! expose_attribute! expose_helper_methods! end |