From 8dcacf9e69214f66be09c120ba474b848047cb53 Mon Sep 17 00:00:00 2001 From: realtradam Date: Sat, 12 Jun 2021 00:57:04 -0400 Subject: unit testing and cleanup --- docs/FelFlame/Helper/ComponentManager.html | 338 ++++++++++++++--------------- 1 file changed, 169 insertions(+), 169 deletions(-) (limited to 'docs/FelFlame/Helper/ComponentManager.html') diff --git a/docs/FelFlame/Helper/ComponentManager.html b/docs/FelFlame/Helper/ComponentManager.html index c1d0452..acb1cf8 100644 --- a/docs/FelFlame/Helper/ComponentManager.html +++ b/docs/FelFlame/Helper/ComponentManager.html @@ -184,7 +184,7 @@
  • - .each ⇒ Enumerator + .each(&block) ⇒ Enumerator @@ -205,10 +205,19 @@
  • + + +

    + Instance Method Summary + collapse +

    + + - -

    - Instance Method Summary - collapse -

    - - +
    +

    Constructor Details

    + +
    +

    + + #initialize(**attrs) ⇒ Component + + + + + +

    +
    + +

    Creates a new component and sets the values of the attributes given to it. If an attritbute is not passed then it will remain as the default.

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + attrs + + + (Keyword: Value) + + + + — +
      +

      You can pass any number of Keyword-Value pairs

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +62
    +63
    +64
    +65
    +66
    +67
    +68
    +69
    +70
    +71
    +72
    +73
    +74
    +75
    +76
    +77
    +78
    +79
    +80
    +
    +
    # File 'component_manager.rb', line 62
    +
    +def initialize(**attrs)
    +  # Prepare the object
    +  # (this is a function created with metaprogramming
    +  # in FelFlame::Components
    +  set_defaults
    +
    +  # Generate ID
    +  new_id = self.class.data.find_index { |i| i.nil? }
    +  new_id = self.class.data.size if new_id.nil?
    +  @id = new_id
    +
    +  # Fill params
    +  attrs.each do |key, value|
    +    send "#{key}=", value
    +  end
    +
    +  # Save Component
    +  self.class.data[new_id] = self
    +end
    +
    +
    + +

    Instance Attribute Details

    @@ -430,12 +529,12 @@
     
     
    -53
    -54
    -55
    +57 +58 +59 -
    # File 'component_manager.rb', line 53
    +      
    # File 'component_manager.rb', line 57
     
     def id
       @id
    @@ -520,12 +619,12 @@
           
     
     
    -69
    -70
    -71
    +96 +97 +98
    -
    # File 'component_manager.rb', line 69
    +      
    # File 'component_manager.rb', line 96
     
     def [](component_id)
       data[component_id]
    @@ -538,7 +637,7 @@
           

    - .eachEnumerator + .each(&block) ⇒ Enumerator @@ -547,7 +646,7 @@

    -

    Iterates over all components within the component manager

    +

    Iterates over all components within the component manager. Special Enumerable methods like map or each_with_index are not implemented

    @@ -574,114 +673,15 @@
     
     
    -95
    -96
    -97
    -98
    -99
    - - -
    # File 'component_manager.rb', line 95
    -
    -def each
    -  data.each do |component|
    -    yield component
    -  end
    -end
    - - - -
    - -
    -

    - - .new(**attrs) ⇒ Component - - - - - -

    -
    - -

    Creates a new component and sets the values of the attributes given to it. If an attritbute is not passed then it will remain as the default.

    - - -
    -
    -
    -

    Parameters:

    -
      - -
    • - - attrs - - - (Keyword: Value) - - - -
    • - -
    - -

    Returns:

    -
      - -
    • - - - (Component) - - - -
    • - -
    - -
    - - @@ -738,14 +738,14 @@
     
     
    -137
    -138
    -139
    -140
    -141
    +143 +144 +145 +146 +147
    -
    -
    -
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    -90
    -91
    +103 +104 +105
    -
    # File 'component_manager.rb', line 76
    -
    -def new(**attrs)
    -  new_component = super
    +      
    # File 'component_manager.rb', line 103
     
    -  # Generate ID
    -  new_id = self.data.find_index { |i| i.nil? }
    -  new_id = self.data.size if new_id.nil?
    -  new_component.id = new_id
    -
    -  # Fill params
    -  attrs.each do |key, value|
    -    new_component.send "#{key}=", value
    -  end
    -
    -  # Save Component
    -  data[new_id] = new_component
    +def each(&block)
    +  data.compact.each(&block)
     end
    -
    # File 'component_manager.rb', line 137
    +      
    # File 'component_manager.rb', line 143
     
     def attrs
       instance_variables.each_with_object({}) do |key, final|
    @@ -801,20 +801,20 @@
           
     
     
    -124
    -125
    -126
    -127
    -128
    -129
     130
     131
     132
     133
    -134
    +134 +135 +136 +137 +138 +139 +140
    -
    # File 'component_manager.rb', line 124
    +      
    # File 'component_manager.rb', line 130
     
     def delete
       entities.each do |entity_id|
    @@ -835,7 +835,7 @@
           

    - #entitiesArray + #entitiesArray<Integer> @@ -844,7 +844,7 @@

    -

    A list of components that are linked to the component

    +

    A list of entity ids that are linked to the component

    @@ -857,7 +857,7 @@
  • - (Array) + (Array<Integer>) @@ -871,12 +871,12 @@
     
     
    -110
    -111
    -112
    +116 +117 +118
  • -
    # File 'component_manager.rb', line 110
    +      
    # File 'component_manager.rb', line 116
     
     def entities
       @entities ||= []
    @@ -925,12 +925,12 @@
           
     
     
    -104
    -105
    -106
    +110 +111 +112
    -
    # File 'component_manager.rb', line 104
    +      
    # File 'component_manager.rb', line 110
     
     def to_i
       id
    @@ -984,12 +984,12 @@
           
     
     
    -146
    -147
    -148
    +152 +153 +154
    -
    # File 'component_manager.rb', line 146
    +      
    # File 'component_manager.rb', line 152
     
     def to_json
       # should return a json or hash of all data in this component
    @@ -1043,14 +1043,14 @@
           
     
     
    -116
    -117
    -118
    -119
    -120
    +122 +123 +124 +125 +126
    -
    # File 'component_manager.rb', line 116
    +      
    # File 'component_manager.rb', line 122
     
     def update_attrs(**opts)
       opts.each do |key, value|
    @@ -1067,7 +1067,7 @@
     
     
           
    -- 
    cgit v1.2.3