Class: Async::Service::Environment
- Inherits:
-
Object
- Object
- Async::Service::Environment
show all
- Defined in:
- lib/async/service/environment.rb
Defined Under Namespace
Classes: Builder, Evaluator
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(facet = ::Module.new, parent = nil) ⇒ Environment
Returns a new instance of Environment.
59
60
61
62
63
64
65
66
|
# File 'lib/async/service/environment.rb', line 59
def initialize(facet = ::Module.new, parent = nil)
unless facet.class == ::Module
raise ArgumentError, "Facet must be a module!"
end
@facet = facet
@parent = parent
end
|
Instance Attribute Details
#facet ⇒ Object
Returns the value of attribute facet.
69
70
71
|
# File 'lib/async/service/environment.rb', line 69
def facet
@facet
end
|
#parent ⇒ Object
Returns the value of attribute parent.
72
73
74
|
# File 'lib/async/service/environment.rb', line 72
def parent
@parent
end
|
#The parent environment, if any.(parentenvironment) ⇒ Object
72
|
# File 'lib/async/service/environment.rb', line 72
attr :parent
|
Class Method Details
.build ⇒ Object
55
56
57
|
# File 'lib/async/service/environment.rb', line 55
def self.build(...)
Environment.new(Builder.for(...))
end
|
Instance Method Details
#evaluator ⇒ Object
145
146
147
|
# File 'lib/async/service/environment.rb', line 145
def evaluator
return Evaluator.wrap(self)
end
|
#implements?(interface) ⇒ Boolean
83
84
85
|
# File 'lib/async/service/environment.rb', line 83
def implements?(interface)
@facet <= interface
end
|
#included(target) ⇒ Object
74
75
76
77
|
# File 'lib/async/service/environment.rb', line 74
def included(target)
@parent&.included(target)
target.include(@facet)
end
|
#The facet module.=(facet) ⇒ Object
69
|
# File 'lib/async/service/environment.rb', line 69
attr :facet
|
#to_h ⇒ Object
149
150
151
|
# File 'lib/async/service/environment.rb', line 149
def to_h
evaluator.to_h
end
|
#with ⇒ Object
79
80
81
|
# File 'lib/async/service/environment.rb', line 79
def with(...)
return self.class.new(Builder.for(...), self)
end
|