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_implement(*methods) ⇒ Object
- #must_implement_one_of(*methods) ⇒ Object
Constructor Details
#initialize(definition, name) ⇒ ComponentProxy
Returns a new instance of ComponentProxy.
66 67 68 69 |
# File 'lib/archspec/dsl.rb', line 66 def initialize(definition, name) @definition = definition @name = name.to_sym end |
Instance Attribute Details
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
64 65 66 |
# File 'lib/archspec/dsl.rb', line 64 def definition @definition end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
64 65 66 |
# File 'lib/archspec/dsl.rb', line 64 def name @name end |
Instance Method Details
#can_use(*targets) ⇒ Object Also known as: only_depend_on, must_only_depend_on
71 72 73 74 |
# File 'lib/archspec/dsl.rb', line 71 def can_use(*targets) add_rule(Rules::AllowDependenciesRule.new(name, targets)) self end |
#cannot_call(*methods) ⇒ Object
84 85 86 87 |
# File 'lib/archspec/dsl.rb', line 84 def cannot_call(*methods) add_rule(Rules::CannotCallRule.new(name, methods)) self end |
#cannot_define(*methods) ⇒ Object
89 90 91 92 |
# File 'lib/archspec/dsl.rb', line 89 def cannot_define(*methods) add_rule(Rules::CannotDefineMethodRule.new(name, methods)) self end |
#cannot_instantiate_and_invoke ⇒ Object
94 95 96 97 |
# File 'lib/archspec/dsl.rb', line 94 def cannot_instantiate_and_invoke add_rule(Rules::CannotInstantiateAndInvokeRule.new(name)) self end |
#cannot_reference_constants(*constants) ⇒ Object
99 100 101 102 |
# File 'lib/archspec/dsl.rb', line 99 def cannot_reference_constants(*constants) add_rule(Rules::CannotReferenceConstantsRule.new(name, constants)) self end |
#cannot_use(*targets) ⇒ Object
79 80 81 82 |
# File 'lib/archspec/dsl.rb', line 79 def cannot_use(*targets) add_rule(Rules::ForbidDependenciesRule.new(name, targets)) self end |
#must_implement(*methods) ⇒ Object
104 105 106 107 108 109 |
# File 'lib/archspec/dsl.rb', line 104 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
111 112 113 114 |
# File 'lib/archspec/dsl.rb', line 111 def must_implement_one_of(*methods) add_rule(Rules::MustImplementOneOfRule.new(name, methods)) self end |