Class: Yoti::DynamicSharingService::WantedAttributeBuilder
- Inherits:
-
Object
- Object
- Yoti::DynamicSharingService::WantedAttributeBuilder
- Defined in:
- lib/yoti/dynamic_share_service/policy/wanted_attribute.rb
Overview
Builder for WantedAttribute
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize ⇒ WantedAttributeBuilder
constructor
A new instance of WantedAttributeBuilder.
- #with_accept_self_asserted(accept = true) ⇒ Object
- #with_constraint(constraint) ⇒ Object
- #with_derivation(derivation) ⇒ Object
- #with_name(name) ⇒ Object
Constructor Details
#initialize ⇒ WantedAttributeBuilder
Returns a new instance of WantedAttributeBuilder.
42 43 44 |
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 42 def initialize @attribute = WantedAttribute.new end |
Instance Method Details
#build ⇒ Object
78 79 80 81 82 |
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 78 def build raise 'Attribute name missing' if @attribute.name.nil? || @attribute.name == '' Marshal.load Marshal.dump @attribute end |
#with_accept_self_asserted(accept = true) ⇒ Object
73 74 75 76 |
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 73 def with_accept_self_asserted(accept = true) @attribute.instance_variable_set(:@accept_self_asserted, accept) self end |
#with_constraint(constraint) ⇒ Object
65 66 67 68 |
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 65 def with_constraint(constraint) @attribute.constraints.push(constraint) self end |
#with_derivation(derivation) ⇒ Object
57 58 59 60 |
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 57 def with_derivation(derivation) @attribute.instance_variable_set(:@derivation, derivation) self end |
#with_name(name) ⇒ Object
49 50 51 52 |
# File 'lib/yoti/dynamic_share_service/policy/wanted_attribute.rb', line 49 def with_name(name) @attribute.instance_variable_set(:@name, name) self end |