Sha256: 90baca82b43820101600bb181d7e027836db5454f77945a6a44b3ce75983435c
Contents?: true
Size: 866 Bytes
Versions: 11
Compression:
Stored size: 866 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] tt.accepts_option :style, default: :line tt.accepts_option :spin, default: false 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
11 entries across 11 versions & 1 rubygems