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


5
6
7
# File 'lib/easy_tags/options/item.rb', line 5

def initialize(option)
  @option = option
end

Instance Method Details

#callbacksArray<Callback>

Returns:


20
21
22
23
24
25
26
# File 'lib/easy_tags/options/item.rb', line 20

def callbacks
  return [] unless callbacks?

  @option.values.first.map do |type, callback|
    Callback.new(callback: callback, type: type)
  end
end

#nameSymbol

Returns:

  • (Symbol)

15
16
17
# File 'lib/easy_tags/options/item.rb', line 15

def name
  @name ||= key.to_sym
end

#valid?Boolean

Returns:

  • (Boolean)

10
11
12
# File 'lib/easy_tags/options/item.rb', line 10

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