Class: Culpa::CallHolder
- Inherits:
-
Object
- Object
- Culpa::CallHolder
- Defined in:
- lib/culpa/brickchain_helpers.rb
Instance Attribute Summary collapse
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
Instance Method Summary collapse
- #from(action_name) ⇒ Object
- #get_action(name) ⇒ Object
-
#initialize(brickname, envelope, request, session, async = false) ⇒ CallHolder
constructor
A new instance of CallHolder.
- #sub_from(action_name) ⇒ Object
Constructor Details
#initialize(brickname, envelope, request, session, async = false) ⇒ CallHolder
Returns a new instance of CallHolder.
59 60 61 62 63 64 65 |
# File 'lib/culpa/brickchain_helpers.rb', line 59 def initialize(brickname, envelope, request, session, async = false) @brickname = brickname @envelope = envelope @request = request @session = session @async = async end |
Instance Attribute Details
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
57 58 59 |
# File 'lib/culpa/brickchain_helpers.rb', line 57 def thread @thread end |
Instance Method Details
#from(action_name) ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/culpa/brickchain_helpers.rb', line 67 def from(action_name) if @async @thread = Thread.new { sub_from(action_name) } else sub_from(action_name) end end |
#get_action(name) ⇒ Object
81 82 83 84 |
# File 'lib/culpa/brickchain_helpers.rb', line 81 def get_action(name) action_name = name.split('_').map(&:capitalize).join Actions.const_get(action_name).new(@envelope, @request, @session) end |
#sub_from(action_name) ⇒ Object
75 76 77 78 79 |
# File 'lib/culpa/brickchain_helpers.rb', line 75 def sub_from(action_name) action = get_action(action_name.to_s) action.send @brickname false end |