lib/rails_erd.rb in rails-erd-1.1.0 vs lib/rails_erd.rb in rails-erd-1.2.0
- old
+ new
@@ -1,7 +1,8 @@
require "active_support/ordered_options"
require "rails_erd/railtie" if defined? Rails
+require "rails_erd/config"
# Welcome to the API documentation of Rails ERD. If you wish to extend or
# customise the output that is generated by Rails ERD, you have come to the
# right place.
#
@@ -30,10 +31,29 @@
module RailsERD
class << self
# Access to default options. Any instance of RailsERD::Domain and
# RailsERD::Diagram will use these options unless overridden.
attr_accessor :options
+
+ def default_options
+ ActiveSupport::OrderedOptions[
+ :attributes, :content,
+ :disconnected, true,
+ :filename, "erd",
+ :filetype, :pdf,
+ :indirect, true,
+ :inheritance, false,
+ :markup, true,
+ :notation, :simple,
+ :orientation, :horizontal,
+ :polymorphism, false,
+ :warn, true,
+ :title, true,
+ :exclude, nil,
+ :only, nil
+ ]
+ end
end
module Inspectable # @private :nodoc:
def inspection_attributes(*attributes)
attribute_inspection = attributes.collect { |attribute|
@@ -45,22 +65,7 @@
end
RUBY
end
end
- self.options = ActiveSupport::OrderedOptions[
- :attributes, :content,
- :disconnected, true,
- :filename, "erd",
- :filetype, :pdf,
- :indirect, true,
- :inheritance, false,
- :markup, true,
- :notation, :simple,
- :orientation, :horizontal,
- :polymorphism, false,
- :warn, true,
- :title, true,
- :exclude, nil,
- :only, nil
- ]
+ self.options = default_options.merge(Config.load)
end