From a96733c75ce7caff16a1d79a9caa1894ed95d2ca Mon Sep 17 00:00:00 2001 From: realtradam Date: Sat, 3 Jul 2021 00:36:00 -0400 Subject: completed systems functionality --- docs/FelFlame/Helper/ComponentManager.html | 363 ++++++++++++++++++++++------- 1 file changed, 281 insertions(+), 82 deletions(-) (limited to 'docs/FelFlame/Helper/ComponentManager.html') diff --git a/docs/FelFlame/Helper/ComponentManager.html b/docs/FelFlame/Helper/ComponentManager.html index 425d91b..cce8c36 100644 --- a/docs/FelFlame/Helper/ComponentManager.html +++ b/docs/FelFlame/Helper/ComponentManager.html @@ -137,6 +137,31 @@ +
+ + + + +
  • + + + .attr_triggers ⇒ Object + + + + + + + + + + + + + + + +
  • @@ -192,6 +217,31 @@ +
    + + + + +
  • + + + #attr_triggers ⇒ Object + + + + + + + + + + + + + + + +
  • @@ -322,6 +372,30 @@
  • + #attr_changed_trigger_systems(attr) ⇒ Object + + + + + + + + + + + + + +
    +

    Execute systems that have been added to execute on variable change.

    +
    + +
  • + + +
  • + + #attrs ⇒ Hash @@ -541,13 +615,6 @@
     
     
    -74
    -75
    -76
    -77
    -78
    -79
    -80
     81
     82
     83
    @@ -559,10 +626,17 @@
     89
     90
     91
    -92
    +92 +93 +94 +95 +96 +97 +98 +99 -
    # File 'component_manager.rb', line 74
    +      
    # File 'component_manager.rb', line 81
     
     def initialize(**attrs)
       # Prepare the object
    @@ -610,12 +684,12 @@
           
     
     
    -97
    -98
    -99
    +104 +105 +106
    -
    # File 'component_manager.rb', line 97
    +      
    # File 'component_manager.rb', line 104
     
     def addition_triggers
       @addition_triggers ||= []
    @@ -626,6 +700,38 @@
     
         
           
    +      
    +      
    +

    + + .attr_triggersObject + + + + + +

    + + + + +
    +
    +
    +
    +112
    +113
    +114
    +
    +
    # File 'component_manager.rb', line 112
    +
    +def attr_triggers
    +  @attr_triggers ||= {}
    +end
    +
    +
    + +

    @@ -642,12 +748,12 @@
     
     
    -103
    -104
    -105
    +108 +109 +110

    -
    # File 'component_manager.rb', line 103
    +      
    # File 'component_manager.rb', line 108
     
     def removal_triggers
       @removal_triggers ||= []
    @@ -679,12 +785,12 @@
           
     
     
    -61
    -62
    -63
    +66 +67 +68
    -
    # File 'component_manager.rb', line 61
    +      
    # File 'component_manager.rb', line 66
     
     def addition_triggers
       @addition_triggers ||= []
    @@ -695,6 +801,38 @@
     
         
           
    +      
    +      
    +

    + + #attr_triggersObject + + + + + +

    + + + + +
    +
    +
    +
    +74
    +75
    +76
    +
    +
    # File 'component_manager.rb', line 74
    +
    +def attr_triggers
    +  @attr_triggers ||= {}
    +end
    +
    +
    + +

    @@ -735,12 +873,12 @@
     
     
    -57
    -58
    -59
    +62 +63 +64

    -
    # File 'component_manager.rb', line 57
    +      
    # File 'component_manager.rb', line 62
     
     def id
       @id
    @@ -767,12 +905,12 @@
           
     
     
    -67
    -68
    -69
    +70 +71 +72
    -
    # File 'component_manager.rb', line 67
    +      
    # File 'component_manager.rb', line 70
     
     def removal_triggers
       @removal_triggers ||= []
    @@ -857,12 +995,12 @@
           
     
     
    -120
    -121
    -122
    +129 +130 +131
    -
    # File 'component_manager.rb', line 120
    +      
    # File 'component_manager.rb', line 129
     
     def [](component_id)
       data[component_id]
    @@ -911,12 +1049,12 @@
           
     
     
    -127
    -128
    -129
    +136 +137 +138
    -
    # File 'component_manager.rb', line 127
    +      
    # File 'component_manager.rb', line 136
     
     def each(&block)
       data.compact.each(&block)
    @@ -933,7 +1071,64 @@
     
         
           
    -

    +

    + + #attr_changed_trigger_systems(attr) ⇒ Object + + + + + +

    +
    + +

    Execute systems that have been added to execute on variable change

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +162
    +163
    +164
    +165
    +166
    +167
    +168
    +169
    +170
    +171
    +172
    +
    +
    # File 'component_manager.rb', line 162
    +
    +def attr_changed_trigger_systems(attr)
    +  systems_to_execute = self.class.attr_triggers[attr]
    +  systems_to_execute = [] if systems_to_execute.nil?
    +
    +  systems_to_execute |= attr_triggers[attr] unless attr_triggers[attr].nil?
    +
    +  systems_to_execute.sort_by(&:priority).reverse.each(&:call)
    +  #self.attr_triggers.each do |system|
    +  #  systems_to_execute |= [system]
    +  #end
    +end
    +
    +
    + +
    +

    #attrsHash @@ -976,19 +1171,23 @@
     
     
    -173
    -174
    -175
    -176
    -177
    +195 +196 +197 +198 +199 +200 +201

    -
    # File 'component_manager.rb', line 173
    +      
    # File 'component_manager.rb', line 195
     
     def attrs
    -  instance_variables.each_with_object({}) do |key, final|
    +  return_hash = instance_variables.each_with_object({}) do |key, final|
         final[key.to_s.delete_prefix('@').to_sym] = instance_variable_get(key)
       end
    +  return_hash.delete(:attr_triggers)
    +  return_hash
     end
    @@ -1039,26 +1238,26 @@
     
     
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    -161
    -162
    -163
    -164
    -165
    -166
    -167
    -168
    -169
    -170
    +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192
    -
    # File 'component_manager.rb', line 154
    +      
    # File 'component_manager.rb', line 176
     
     def delete
       addition_triggers.each do |system|
    @@ -1121,12 +1320,12 @@
           
     
     
    -140
    -141
    -142
    +149 +150 +151
    -
    # File 'component_manager.rb', line 140
    +      
    # File 'component_manager.rb', line 149
     
     def entities
       @entities ||= []
    @@ -1175,12 +1374,12 @@
           
     
     
    -134
    -135
    -136
    +143 +144 +145
    -
    # File 'component_manager.rb', line 134
    +      
    # File 'component_manager.rb', line 143
     
     def to_i
       id
    @@ -1234,12 +1433,12 @@
           
     
     
    -182
    -183
    -184
    +206 +207 +208
    -
    # File 'component_manager.rb', line 182
    +      
    # File 'component_manager.rb', line 206
     
     def to_json
       # should return a json or hash of all data in this component
    @@ -1293,14 +1492,14 @@
           
     
     
    -146
    -147
    -148
    -149
    -150
    +155 +156 +157 +158 +159
    -
    # File 'component_manager.rb', line 146
    +      
    # File 'component_manager.rb', line 155
     
     def update_attrs(**opts)
       opts.each do |key, value|
    @@ -1317,7 +1516,7 @@
     
     
           
    -- 
    cgit v1.2.3