Sha256: a84071cb40cf92ab630eae186225fb5ee2e8d253bbed6795314ec3feb0a418fe

Contents?: true

Size: 569 Bytes

Versions: 3

Compression:

Stored size: 569 Bytes

Contents

module WrapIt
  #
  # Provides methods related to HTML `data` attribute
  #
  # @author Alexey Ovchinnikov <alexiss@cybernetlab.ru>
  #
  module HTMLData
    def self.included(base)
      base == Base || fail(
        TypeError,
        "#{self.class.name} can be included only into WrapIt::Base"
      )
    end

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wrap_it-0.2.0 lib/wrap_it/html_data.rb
wrap_it-0.1.5 lib/wrap_it/html_data.rb
wrap_it-0.1.4 lib/wrap_it/html_data.rb