Class: RailsConsolePro::SchemaInspectorResult
- Inherits:
-
Object
- Object
- RailsConsolePro::SchemaInspectorResult
- Defined in:
- lib/rails_console_pro/schema_inspector_result.rb
Overview
Value object for schema inspection results
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#export_to_file(file_path, format: nil) ⇒ Object
Export to file.
-
#initialize(model) ⇒ SchemaInspectorResult
constructor
A new instance of SchemaInspectorResult.
-
#to_html(style: :default) ⇒ Object
Export to HTML.
-
#to_json(pretty: true) ⇒ Object
Export to JSON.
-
#to_yaml ⇒ Object
Export to YAML.
Constructor Details
#initialize(model) ⇒ SchemaInspectorResult
Returns a new instance of SchemaInspectorResult.
8 9 10 11 |
# File 'lib/rails_console_pro/schema_inspector_result.rb', line 8 def initialize(model) @model = model validate_model! end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
6 7 8 |
# File 'lib/rails_console_pro/schema_inspector_result.rb', line 6 def model @model end |
Instance Method Details
#==(other) ⇒ Object
13 14 15 |
# File 'lib/rails_console_pro/schema_inspector_result.rb', line 13 def ==(other) other.is_a?(self.class) && other.model == model end |
#export_to_file(file_path, format: nil) ⇒ Object
Export to file
33 34 35 |
# File 'lib/rails_console_pro/schema_inspector_result.rb', line 33 def export_to_file(file_path, format: nil) FormatExporter.export_to_file(self, file_path, format: format) end |
#to_html(style: :default) ⇒ Object
Export to HTML
28 29 30 |
# File 'lib/rails_console_pro/schema_inspector_result.rb', line 28 def to_html(style: :default) FormatExporter.to_html(self, title: "Schema: #{model.name}", style: style) end |
#to_json(pretty: true) ⇒ Object
Export to JSON
18 19 20 |
# File 'lib/rails_console_pro/schema_inspector_result.rb', line 18 def to_json(pretty: true) FormatExporter.to_json(self, pretty: pretty) end |
#to_yaml ⇒ Object
Export to YAML
23 24 25 |
# File 'lib/rails_console_pro/schema_inspector_result.rb', line 23 def to_yaml FormatExporter.to_yaml(self) end |