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