Module: WrapIt::HTMLData

Included in:
Base
Defined in:
lib/wrap_it/html_data.rb

Overview

Provides methods related to HTML ‘data` attribute

Author:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
13
# File 'lib/wrap_it/html_data.rb', line 8

def self.included(base)
  base == Base || fail(
    TypeError,
    "#{self.class.name} can be included only into WrapIt::Base"
  )
end

Instance Method Details

#remove_html_data(name) ⇒ Object



20
21
22
23
# File 'lib/wrap_it/html_data.rb', line 20

def remove_html_data(name)
  return unless @options[:data].is_a?(Hash)
  @options[:data].delete(name.to_sym)
end

#set_html_data(name, value) ⇒ Object



15
16
17
18
# File 'lib/wrap_it/html_data.rb', line 15

def set_html_data(name, value)
  @options[:data] ||= {}
  @options[:data][name.to_sym] = value
end