Class: Mxrb::Semantic::InlinePlan
- Inherits:
-
Object
- Object
- Mxrb::Semantic::InlinePlan
- Defined in:
- lib/mxrb/semantic/inliner.rb
Instance Attribute Summary collapse
-
#call_id ⇒ Object
readonly
Returns the value of attribute call_id.
-
#called_name ⇒ Object
readonly
Returns the value of attribute called_name.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #applied? ⇒ Boolean
- #apply! ⇒ Object
- #changes ⇒ Object
-
#initialize(project:, source:, called_name:, call_id:, inner_objects:, inner_flows:, entry_flow:, exit_flow:, source_doc:, source_raw:) ⇒ InlinePlan
constructor
A new instance of InlinePlan.
Constructor Details
#initialize(project:, source:, called_name:, call_id:, inner_objects:, inner_flows:, entry_flow:, exit_flow:, source_doc:, source_raw:) ⇒ InlinePlan
Returns a new instance of InlinePlan.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mxrb/semantic/inliner.rb', line 11 def initialize(project:, source:, called_name:, call_id:, inner_objects:, inner_flows:, entry_flow:, exit_flow:, source_doc:, source_raw:) @project = project @source = source @called_name = called_name @call_id = call_id @inner_objects = inner_objects @inner_flows = inner_flows @entry_flow = entry_flow @exit_flow = exit_flow @source_doc = source_doc @source_raw = source_raw @applied = false end |
Instance Attribute Details
#call_id ⇒ Object (readonly)
Returns the value of attribute call_id.
9 10 11 |
# File 'lib/mxrb/semantic/inliner.rb', line 9 def call_id @call_id end |
#called_name ⇒ Object (readonly)
Returns the value of attribute called_name.
9 10 11 |
# File 'lib/mxrb/semantic/inliner.rb', line 9 def called_name @called_name end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
9 10 11 |
# File 'lib/mxrb/semantic/inliner.rb', line 9 def source @source end |
Instance Method Details
#applied? ⇒ Boolean
28 |
# File 'lib/mxrb/semantic/inliner.rb', line 28 def applied? = @applied |
#apply! ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/mxrb/semantic/inliner.rb', line 39 def apply! raise ArgumentError, "inline plan was already applied" if applied? @project.mpr.transaction { patch_source_microflow! } @project.refresh! @applied = true self end |
#changes ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/mxrb/semantic/inliner.rb', line 30 def changes count = @inner_objects.size suffix = count == 1 ? "y" : "ies" [ "inline #{@called_name} into #{@source.qualified_name}", "replace call_microflow activity with #{count} inlined activit#{suffix}" ] end |