Class: RailsLens::ERD::Visualizer
- Inherits:
-
Object
- Object
- RailsLens::ERD::Visualizer
- Defined in:
- lib/rails_lens/erd/visualizer.rb
Constant Summary collapse
- RELATIONSHIP_CARDINALITIES =
Cardinality pair (near-side, far-side) for each association macro.
{ belongs_to: %i[ZERO_OR_MORE ONE_ONLY], has_one: %i[ONE_ONLY ZERO_OR_ONE], has_many: %i[ONE_ONLY ZERO_OR_MORE], has_and_belongs_to_many: %i[ZERO_OR_MORE ZERO_OR_MORE] }.freeze
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(options: {}) ⇒ Visualizer
constructor
A new instance of Visualizer.
Constructor Details
#initialize(options: {}) ⇒ Visualizer
Returns a new instance of Visualizer.
16 17 18 19 |
# File 'lib/rails_lens/erd/visualizer.rb', line 16 def initialize(options: {}) @options = @config = RailsLens.config.erd.merge(.compact.transform_keys(&:to_sym)) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
14 15 16 |
# File 'lib/rails_lens/erd/visualizer.rb', line 14 def config @config end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
14 15 16 |
# File 'lib/rails_lens/erd/visualizer.rb', line 14 def @options end |
Instance Method Details
#generate ⇒ Object
21 22 23 24 |
# File 'lib/rails_lens/erd/visualizer.rb', line 21 def generate models = load_models generate_mermaid(models) end |