Class: ArchSpec::DSL::ComponentProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/archspec/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#definitionObject (readonly)

Returns the value of attribute definition.



64
65
66
# File 'lib/archspec/dsl.rb', line 64

def definition
  @definition
end

#nameObject (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_invokeObject



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