Sha256: b6c852e84dcccd170ae35e52accd3a191e36c778f8f7db9bf3c0e3a3882daa41

Contents?: true

Size: 423 Bytes

Versions: 4

Compression:

Stored size: 423 Bytes

Contents

# frozen_string_literal: true

module ViewComponentContrib
  module StyleVariants
    module ClassMethods
      # Returns the name of the default style set based on the class name:
      #  MyComponent::Component => my_component
      #  Namespaced::MyComponent => my_component
      def default_style_name
        @default_style_name ||= name.split("::")[-2].underscore.presence || "component"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.67 app/lib/view_component_contrib/style_variants.rb
ariadne_view_components-0.0.66 app/lib/view_components_contrib/style_variants.rb
ariadne_view_components-0.0.65 app/lib/view_components_contrib/style_variants.rb
ariadne_view_components-0.0.64 app/lib/view_components_contrib/style_variants.rb