Class: Ea::Svg::EaEmitter::Element::Filter
- Inherits:
-
Object
- Object
- Ea::Svg::EaEmitter::Element::Filter
- Defined in:
- lib/ea/svg/ea_emitter/element/filter.rb
Overview
Predicate: should this element be rendered, or is it a diagram-frame placeholder that EA skips?
Instance Attribute Summary collapse
-
#model_index ⇒ Object
readonly
Returns the value of attribute model_index.
Instance Method Summary collapse
-
#initialize(model_index:) ⇒ Filter
constructor
A new instance of Filter.
-
#skip?(element) ⇒ Boolean
Returns true if the element should be SKIPPED.
Constructor Details
#initialize(model_index:) ⇒ Filter
Returns a new instance of Filter.
12 13 14 |
# File 'lib/ea/svg/ea_emitter/element/filter.rb', line 12 def initialize(model_index:) @model_index = model_index end |
Instance Attribute Details
#model_index ⇒ Object (readonly)
Returns the value of attribute model_index.
10 11 12 |
# File 'lib/ea/svg/ea_emitter/element/filter.rb', line 10 def model_index @model_index end |
Instance Method Details
#skip?(element) ⇒ Boolean
Returns true if the element should be SKIPPED. EA emits a "diagram frame placeholder" Classifier with no name and no properties on some diagrams — those get dropped. Packages and named Classifiers are always kept.
20 21 22 23 24 25 26 27 |
# File 'lib/ea/svg/ea_emitter/element/filter.rb', line 20 def skip?(element) return false unless element.background_color == -1 classifier = classifier_for(element) return false unless classifier classifier.name.to_s.strip.empty? && (classifier.properties.nil? || classifier.properties.empty?) end |