Class: Actor::Build
- Inherits:
-
Object
- Object
- Actor::Build
- Defined in:
- lib/actor/build.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#cls ⇒ Object
readonly
Returns the value of attribute cls.
-
#keyword_arguments ⇒ Object
readonly
Returns the value of attribute keyword_arguments.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(cls, arguments, keyword_arguments, &block) ⇒ Build
constructor
A new instance of Build.
Constructor Details
#initialize(cls, arguments, keyword_arguments, &block) ⇒ Build
Returns a new instance of Build.
8 9 10 11 12 13 |
# File 'lib/actor/build.rb', line 8 def initialize(cls, arguments, keyword_arguments, &block) @arguments = arguments @keyword_arguments = keyword_arguments @block = block @cls = cls end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
3 4 5 |
# File 'lib/actor/build.rb', line 3 def arguments @arguments end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
5 6 7 |
# File 'lib/actor/build.rb', line 5 def block @block end |
#cls ⇒ Object (readonly)
Returns the value of attribute cls.
6 7 8 |
# File 'lib/actor/build.rb', line 6 def cls @cls end |
#keyword_arguments ⇒ Object (readonly)
Returns the value of attribute keyword_arguments.
4 5 6 |
# File 'lib/actor/build.rb', line 4 def keyword_arguments @keyword_arguments end |
Class Method Details
.call(cls, *arguments, **keyword_arguments, &block) ⇒ Object
15 16 17 18 |
# File 'lib/actor/build.rb', line 15 def self.call(cls, *arguments, **keyword_arguments, &block) instance = new(cls, arguments, keyword_arguments, &block) instance.() end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/actor/build.rb', line 20 def call if cls.respond_to?(:build) method = cls.method(:build) else method = cls.method(:new) end if block actor = method.(*arguments, **keyword_arguments, &block) else actor = method.(*arguments, **keyword_arguments) end actor.configure actor end |