Class: CanTango::Factory::Permits
- Inherits:
-
Object
- Object
- CanTango::Factory::Permits
- Includes:
- Helpers::Debug
- Defined in:
- lib/cantango/permits_ext/factory/permits.rb
Instance Attribute Summary collapse
-
#ability ⇒ Object
Returns the value of attribute ability.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(ability, type) ⇒ Permits
constructor
creates the factory for the ability note that the ability contains the roles and role groups of the user (or account).
- #permits ⇒ Object
- #permits_builder ⇒ Object
- #permits_builder_class ⇒ Object
Constructor Details
#initialize(ability, type) ⇒ Permits
creates the factory for the ability note that the ability contains the roles and role groups of the user (or account)
12 13 14 |
# File 'lib/cantango/permits_ext/factory/permits.rb', line 12 def initialize ability, type @ability, @type = [ability, type] end |
Instance Attribute Details
#ability ⇒ Object
Returns the value of attribute ability.
6 7 8 |
# File 'lib/cantango/permits_ext/factory/permits.rb', line 6 def ability @ability end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/cantango/permits_ext/factory/permits.rb', line 7 def type @type end |
Instance Method Details
#create ⇒ Object
16 17 18 |
# File 'lib/cantango/permits_ext/factory/permits.rb', line 16 def create permits.build end |
#permits ⇒ Object
20 21 22 |
# File 'lib/cantango/permits_ext/factory/permits.rb', line 20 def permits permits_builder.new ability end |
#permits_builder ⇒ Object
24 25 26 |
# File 'lib/cantango/permits_ext/factory/permits.rb', line 24 def permits_builder permits_builder_class.constantize end |
#permits_builder_class ⇒ Object
28 29 30 31 |
# File 'lib/cantango/permits_ext/factory/permits.rb', line 28 def permits_builder_class return "CanTango::Builder::Permit::Special" if type == :special "CanTango::Builder::Permit::#{type.to_s.camelize}" end |