Class: EasyTags::Options::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_tags/options/item.rb

Overview

Represents a single option item

Instance Method Summary collapse

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

#callbacksArray<Callback>

Returns:



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

#nameSymbol

Returns:

  • (Symbol)


17
18
19
# File 'lib/easy_tags/options/item.rb', line 17

def name
  @name ||= key.to_sym
end

#valid?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/easy_tags/options/item.rb', line 12

def valid?
  /[@$"]/ !~ name.inspect
end