Class: Rails::Schema::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rails/schema/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rails/schema/configuration.rb', line 9

def initialize
  @output_path = "docs/schema.html"
  @exclude_models = []
  @exclude_model_if = nil
  @title = "Database Schema"
  @theme = :auto
  @expand_columns = false
  @schema_format = :auto
  @model_schema_group = nil
  @collapse_groups = true
  @show_through_edges = true
end

Instance Attribute Details

#collapse_groupsObject

Returns the value of attribute collapse_groups.



6
7
8
# File 'lib/rails/schema/configuration.rb', line 6

def collapse_groups
  @collapse_groups
end

#exclude_model_ifObject

Returns the value of attribute exclude_model_if.



6
7
8
# File 'lib/rails/schema/configuration.rb', line 6

def exclude_model_if
  @exclude_model_if
end

#exclude_modelsObject

Returns the value of attribute exclude_models.



6
7
8
# File 'lib/rails/schema/configuration.rb', line 6

def exclude_models
  @exclude_models
end

#expand_columnsObject

Returns the value of attribute expand_columns.



6
7
8
# File 'lib/rails/schema/configuration.rb', line 6

def expand_columns
  @expand_columns
end

#model_schema_groupObject

Returns the value of attribute model_schema_group.



6
7
8
# File 'lib/rails/schema/configuration.rb', line 6

def model_schema_group
  @model_schema_group
end

#output_pathObject

Returns the value of attribute output_path.



6
7
8
# File 'lib/rails/schema/configuration.rb', line 6

def output_path
  @output_path
end

#schema_formatObject

Returns the value of attribute schema_format.



6
7
8
# File 'lib/rails/schema/configuration.rb', line 6

def schema_format
  @schema_format
end

#show_through_edgesObject

Returns the value of attribute show_through_edges.



6
7
8
# File 'lib/rails/schema/configuration.rb', line 6

def show_through_edges
  @show_through_edges
end

#themeObject

Returns the value of attribute theme.



6
7
8
# File 'lib/rails/schema/configuration.rb', line 6

def theme
  @theme
end

#titleObject

Returns the value of attribute title.



6
7
8
# File 'lib/rails/schema/configuration.rb', line 6

def title
  @title
end

Instance Method Details

#resolved_group_procObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/rails/schema/configuration.rb', line 22

def resolved_group_proc
  case @model_schema_group
  when nil then nil
  when :namespaces
    ->(model) { model.name.split("::")[0..-2] }
  when Proc then @model_schema_group
  else
    raise ArgumentError, "model_schema_group must be nil, :namespaces, or a Proc"
  end
end