Class: Bparity::Boundary::Subject
- Inherits:
-
Struct
- Object
- Struct
- Bparity::Boundary::Subject
- Defined in:
- lib/bparity/boundary.rb
Instance Attribute Summary collapse
-
#excluded ⇒ Object
Returns the value of attribute excluded.
-
#method_names ⇒ Object
Returns the value of attribute method_names.
-
#name ⇒ Object
Returns the value of attribute name.
-
#return_projections ⇒ Object
Returns the value of attribute return_projections.
-
#state_projection ⇒ Object
Returns the value of attribute state_projection.
Instance Method Summary collapse
- #exclude(*names) ⇒ Object
-
#initialize(name:) ⇒ Subject
constructor
A new instance of Subject.
- #methods(*names) ⇒ Object
- #observed_methods(target) ⇒ Object
- #project_return(class_name, &block) ⇒ Object
- #state(&block) ⇒ Object
Constructor Details
#initialize(name:) ⇒ Subject
Returns a new instance of Subject.
6 7 8 |
# File 'lib/bparity/boundary.rb', line 6 def initialize(name:, **) super(name:, method_names: [], excluded: [], return_projections: {}) end |
Instance Attribute Details
#excluded ⇒ Object
Returns the value of attribute excluded
5 6 7 |
# File 'lib/bparity/boundary.rb', line 5 def excluded @excluded end |
#method_names ⇒ Object
Returns the value of attribute method_names
5 6 7 |
# File 'lib/bparity/boundary.rb', line 5 def method_names @method_names end |
#name ⇒ Object
Returns the value of attribute name
5 6 7 |
# File 'lib/bparity/boundary.rb', line 5 def name @name end |
#return_projections ⇒ Object
Returns the value of attribute return_projections
5 6 7 |
# File 'lib/bparity/boundary.rb', line 5 def return_projections @return_projections end |
#state_projection ⇒ Object
Returns the value of attribute state_projection
5 6 7 |
# File 'lib/bparity/boundary.rb', line 5 def state_projection @state_projection end |
Instance Method Details
#exclude(*names) ⇒ Object
14 15 16 |
# File 'lib/bparity/boundary.rb', line 14 def exclude(*names) self.excluded |= names.map(&:to_sym) end |
#methods(*names) ⇒ Object
10 11 12 |
# File 'lib/bparity/boundary.rb', line 10 def methods(*names) self.method_names = names.map(&:to_sym) end |
#observed_methods(target) ⇒ Object
26 27 28 |
# File 'lib/bparity/boundary.rb', line 26 def observed_methods(target) (method_names.empty? ? target.public_instance_methods(false) : method_names) - excluded end |
#project_return(class_name, &block) ⇒ Object
22 23 24 |
# File 'lib/bparity/boundary.rb', line 22 def project_return(class_name, &block) return_projections[class_name] = block end |
#state(&block) ⇒ Object
18 19 20 |
# File 'lib/bparity/boundary.rb', line 18 def state(&block) self.state_projection = block end |