Sha256: ec0506e102877b70b68dde7f8c8eb04528a84151457eb937e4bf2bd6d905fd0f

Contents?: true

Size: 802 Bytes

Versions: 4

Compression:

Stored size: 802 Bytes

Contents

module ActionWidget
  class Configuration
    include SmartProperties
    property :prefix
    property :suffix
    property :superclass, required: true, default: -> { ActionWidget::Base }
    property :directory, required: true, converts: :to_s, accepts: ->(string) { !string.empty? }, default: -> { [underscored_prefix, underscored_suffix].compact.join("_") }
    property :minitest_superclass

    attr_reader :pattern

    def initialize(*)
      super

      @pattern = Regexp.new("^%s$" % [
        underscored_prefix,
        "(.*)",
        underscored_suffix
      ].compact.join("_"))
    end

    private

    def underscored_prefix
      return if prefix.nil?
      prefix.underscore
    end

    def underscored_suffix
      return if suffix.nil?
      suffix.underscore
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
action_widget-0.8.0 lib/action_widget/configuration.rb
action_widget-0.7.0 lib/action_widget/configuration.rb
action_widget-0.6.1 lib/action_widget/configuration.rb
action_widget-0.6.0 lib/action_widget/configuration.rb