Class: ArchSpec::DSL::ComponentProxy
- Inherits:
-
Object
- Object
- ArchSpec::DSL::ComponentProxy
- Defined in:
- lib/archspec/dsl.rb
Instance Attribute Summary collapse
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #can_use(*targets) ⇒ Object (also: #only_depend_on, #must_only_depend_on)
- #cannot_call(*methods) ⇒ Object
- #cannot_define(*methods) ⇒ Object
- #cannot_instantiate_and_invoke ⇒ Object
- #cannot_reference_constants(*constants) ⇒ Object
- #cannot_use(*targets) ⇒ Object
-
#initialize(definition, name) ⇒ ComponentProxy
constructor
A new instance of ComponentProxy.
- #must_be_empty(because: nil) ⇒ Object
- #must_implement(*methods) ⇒ Object
- #must_implement_one_of(*methods) ⇒ Object
Constructor Details
#initialize(definition, name) ⇒ ComponentProxy
Returns a new instance of ComponentProxy.
64 65 66 67 |
# File 'lib/archspec/dsl.rb', line 64 def initialize(definition, name) @definition = definition @name = name.to_sym end |
Instance Attribute Details
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
62 63 64 |
# File 'lib/archspec/dsl.rb', line 62 def definition @definition end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
62 63 64 |
# File 'lib/archspec/dsl.rb', line 62 def name @name end |
Instance Method Details
#can_use(*targets) ⇒ Object Also known as: only_depend_on, must_only_depend_on
69 70 71 72 |
# File 'lib/archspec/dsl.rb', line 69 def can_use(*targets) add_rule(Rules::AllowDependenciesRule.new(name, targets)) self end |
#cannot_call(*methods) ⇒ Object
82 83 84 85 |
# File 'lib/archspec/dsl.rb', line 82 def cannot_call(*methods) add_rule(Rules::CannotCallRule.new(name, methods)) self end |
#cannot_define(*methods) ⇒ Object
87 88 89 90 |
# File 'lib/archspec/dsl.rb', line 87 def cannot_define(*methods) add_rule(Rules::CannotDefineMethodRule.new(name, methods)) self end |
#cannot_instantiate_and_invoke ⇒ Object
92 93 94 95 |
# File 'lib/archspec/dsl.rb', line 92 def cannot_instantiate_and_invoke add_rule(Rules::CannotInstantiateAndInvokeRule.new(name)) self end |
#cannot_reference_constants(*constants) ⇒ Object
97 98 99 100 |
# File 'lib/archspec/dsl.rb', line 97 def cannot_reference_constants(*constants) add_rule(Rules::CannotReferenceConstantsRule.new(name, constants)) self end |
#cannot_use(*targets) ⇒ Object
77 78 79 80 |
# File 'lib/archspec/dsl.rb', line 77 def cannot_use(*targets) add_rule(Rules::ForbidDependenciesRule.new(name, targets)) self end |
#must_be_empty(because: nil) ⇒ Object
102 103 104 105 |
# File 'lib/archspec/dsl.rb', line 102 def must_be_empty(because: nil) add_rule(Rules::MustBeEmptyRule.new(name, because: because)) self end |
#must_implement(*methods) ⇒ Object
107 108 109 110 111 112 |
# File 'lib/archspec/dsl.rb', line 107 def must_implement(*methods) methods.each do |method_name| add_rule(Rules::MustImplementRule.new(name, method_name)) end self end |
#must_implement_one_of(*methods) ⇒ Object
114 115 116 117 |
# File 'lib/archspec/dsl.rb', line 114 def must_implement_one_of(*methods) add_rule(Rules::MustImplementOneOfRule.new(name, methods)) self end |