Sha256: 3fd4477b87913ebbd38eed1fa1828194e3661645d1c339adcf14d80f082d9b81
Contents?: true
Size: 765 Bytes
Versions: 13
Compression:
Stored size: 765 Bytes
Contents
module Coco module Concerns module WithIcon extend ActiveSupport::Concern include AcceptsOptions included do accepts_option :icon, shorthand: :name do |tt| tt.accepts_option :name, private: true tt.accepts_option :position, from: ["start", "end", :start, :end] end renders_one :icon, ->(icon_name = nil, position: nil, **kwargs) do set_option_value(:icon, :position, position) unless position.nil? Coco::Icon.new(name: icon_name, **kwargs) end before_render do unless icon? icon_opts = get_option_group(:icon).values with_icon(**icon_opts) if icon_opts[:name] end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems