Class: EasyTags::Options::Item
- Inherits:
-
Object
- Object
- EasyTags::Options::Item
- Defined in:
- lib/easy_tags/options/item.rb
Overview
Represents a single option item
Instance Method Summary collapse
- #callbacks ⇒ Array<Callback>
-
#initialize(option) ⇒ Item
constructor
A new instance of Item.
- #name ⇒ Symbol
- #valid? ⇒ Boolean
Constructor Details
#initialize(option) ⇒ Item
Returns a new instance of Item.
7 8 9 |
# File 'lib/easy_tags/options/item.rb', line 7 def initialize(option) @option = option end |
Instance Method Details
#callbacks ⇒ Array<Callback>
22 23 24 25 26 27 28 |
# File 'lib/easy_tags/options/item.rb', line 22 def callbacks return [] unless callbacks? @option.values.first.map do |type, callback| Callback.new(callback: callback, type: type) end end |
#name ⇒ Symbol
17 18 19 |
# File 'lib/easy_tags/options/item.rb', line 17 def name @name ||= key.to_sym end |
#valid? ⇒ Boolean
12 13 14 |
# File 'lib/easy_tags/options/item.rb', line 12 def valid? /[@$"]/ !~ name.inspect end |