Sha256: 8a5321a3a46da8f04ed2054144d8ecde06850acee092a61bc850a32365d077c6

Contents?: true

Size: 558 Bytes

Versions: 2

Compression:

Stored size: 558 Bytes

Contents

require "pathname"

Dir[File.expand_path("../components/*.rb", __FILE__)].each do |component|
  require component
end

module Docks::Themes
  class API < Base
    module Components
      def self.component_for(name)
        const = name.to_s.split(/[^a-z]/i).map(&:capitalize).join("").to_sym
        const_defined?(const) ? const_get(const) : Base
      end

      def self.template_path(name)
        name = name.to_s.split(":")
        API.instance.assets.path_for(File.join("components", name.first, "#{name.join("_")}.erb"))
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
docks_theme_api-1.0.3 lib/docks_theme_api/components.rb
docks_theme_api-1.0.2 lib/docks_theme_api/components.rb