Skip to content

Commit

Permalink
Properly configure top level ns visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan committed Nov 19, 2024
1 parent 0229b35 commit cfc639a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
10 changes: 1 addition & 9 deletions lib/datagrid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
require "datagrid/configuration"
require "datagrid/engine"

# @!visibility public
module Datagrid
extend ActiveSupport::Autoload

Expand Down Expand Up @@ -34,15 +35,6 @@ def self.included(base)
end
end

def self.configuration
@configuration ||= Configuration.new
end

# Configure
def self.configure(&block)
block.call(configuration)
end

class ConfigurationError < StandardError; end
class ArgumentError < ::ArgumentError; end
class ColumnUnavailableError < StandardError; end
Expand Down
16 changes: 15 additions & 1 deletion lib/datagrid/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# frozen_string_literal: true

module Datagrid
# @return [Configuration] current Datagrid configuration
def self.configuration
@configuration ||= Configuration.new
end

# @yield block to configure
# @yieldparam [Configuration] configuration
# @yieldreturn [void]
# @return [void] configure datagrid
# @see Datagrid::Configuration
def self.configure(&block)
block.call(configuration)
end

# ## Configuration
#
# Datagrid provides several configuration options.
Expand All @@ -12,7 +26,7 @@ module Datagrid
# # Defines date formats that can be used to parse dates.
# # Note: Multiple formats can be specified. The first format is used to format dates as strings,
# # while other formats are used only for parsing dates from strings (e.g., if your app supports multiple formats).
# config.date_formats = ["%m/%d/%Y", "%Y-%m-%d"]
# config.date_formats = "%m/%d/%Y", "%Y-%m-%d"
#
# # Defines timestamp formats that can be used to parse timestamps.
# # Note: Multiple formats can be specified. The first format is used to format timestamps as strings,
Expand Down
1 change: 0 additions & 1 deletion lib/datagrid/filters/base_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class FilteringError < StandardError
end
end

# @!visibility private
module Datagrid
module Filters
class BaseFilter
Expand Down
2 changes: 1 addition & 1 deletion lib/datagrid/filters/boolean_filter.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require "datagrid/utils"
# @!visibility private

module Datagrid
module Filters
class BooleanFilter < Datagrid::Filters::BaseFilter
Expand Down
1 change: 0 additions & 1 deletion lib/datagrid/filters/extended_boolean_filter.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

# @!visibility private
module Datagrid
module Filters
class ExtendedBooleanFilter < Datagrid::Filters::EnumFilter
Expand Down
2 changes: 1 addition & 1 deletion lib/datagrid/scaffold.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

require "rails/generators"

# @!visibility private
module Datagrid
# @!visibility private
class Scaffold < Rails::Generators::NamedBase
include Rails::Generators::ResourceHelpers

Expand Down

0 comments on commit cfc639a

Please sign in to comment.