Class: Toni::Builder::PermissionBuilder
- Inherits:
-
Object
- Object
- Toni::Builder::PermissionBuilder
- Defined in:
- lib/toni/builder.rb
Instance Attribute Summary collapse
-
#permission ⇒ Object
readonly
Returns the value of attribute permission.
Instance Method Summary collapse
-
#expect_attribute(method_name, &block) ⇒ Object
Attribute should always be a column in the database on the resource.
-
#expect_method(method_name, is_attr = false, &block) ⇒ Object
Methods should be defined on the resource.
-
#initialize(resource_name, options = {}, &block) ⇒ PermissionBuilder
constructor
A new instance of PermissionBuilder.
Constructor Details
#initialize(resource_name, options = {}, &block) ⇒ PermissionBuilder
Returns a new instance of PermissionBuilder.
48 49 50 51 52 53 54 |
# File 'lib/toni/builder.rb', line 48 def initialize(resource_name, ={}, &block) [:to] ||= [:manage] = Permission.new(resource_name, [:to]) if block_given? instance_eval &block end end |
Instance Attribute Details
#permission ⇒ Object (readonly)
Returns the value of attribute permission.
46 47 48 |
# File 'lib/toni/builder.rb', line 46 def end |
Instance Method Details
#expect_attribute(method_name, &block) ⇒ Object
Attribute should always be a column in the database on the resource
57 58 59 |
# File 'lib/toni/builder.rb', line 57 def expect_attribute(method_name, &block) expect_method(method_name, true, &block) end |
#expect_method(method_name, is_attr = false, &block) ⇒ Object
Methods should be defined on the resource
62 63 64 65 |
# File 'lib/toni/builder.rb', line 62 def expect_method(method_name, is_attr = false, &block) builder = ExpectationBuilder.new(&block) .add_matcher(method_name, builder, is_attr) end |