Class: PartializerConfig::PartialFunctions
- Defined in:
- lib/ceedling/partials/partializer_config.rb
Overview
Holds function-level extraction config for tests or mocks within a Partial. type -- :public, :private, or :accumulate (additions-driven); nil if unset additions -- function names to explicitly include subtractions -- function names to explicitly exclude (illegal with ACCUMULATE)
Instance Attribute Summary collapse
-
#additions ⇒ Object
Returns the value of attribute additions.
-
#subtractions ⇒ Object
Returns the value of attribute subtractions.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type: nil, additions: [], subtractions: []) ⇒ PartialFunctions
constructor
A new instance of PartialFunctions.
-
#present? ⇒ Boolean
Returns true if this PartialFunctions entry has enough configuration to be processed.
Constructor Details
#initialize(type: nil, additions: [], subtractions: []) ⇒ PartialFunctions
Returns a new instance of PartialFunctions.
40 41 42 |
# File 'lib/ceedling/partials/partializer_config.rb', line 40 def initialize(type: nil, additions: [], subtractions: []) super end |
Instance Attribute Details
#additions ⇒ Object
Returns the value of attribute additions
39 40 41 |
# File 'lib/ceedling/partials/partializer_config.rb', line 39 def additions @additions end |
#subtractions ⇒ Object
Returns the value of attribute subtractions
39 40 41 |
# File 'lib/ceedling/partials/partializer_config.rb', line 39 def subtractions @subtractions end |
#type ⇒ Object
Returns the value of attribute type
39 40 41 |
# File 'lib/ceedling/partials/partializer_config.rb', line 39 def type @type end |
Instance Method Details
#present? ⇒ Boolean
Returns true if this PartialFunctions entry has enough configuration to be processed. Used to gate downstream work: a nil type means the feature is disabled; an ACCUMULATE type with no additions has no functions to include; all other cases are meaningful.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/ceedling/partials/partializer_config.rb', line 47 def present? # Feature is disabled for this test/mock side of the module return false if type.nil? # ACCUMULATE starts empty and relies entirely on explicit additions; without any, # there is nothing to include, so the config has no effect return false if type == ACCUMULATE && additions.empty? # PUBLIC, PRIVATE: always have a base set of functions to filter # DEDUCT: starts with all functions; zero subtractions is valid ("include everything") return true end |