Sha256: 07d3dd2c1d3789e581ee3b84343ea2f85b546ce680085e25f601dfb27d3d687c
Contents?: true
Size: 793 Bytes
Versions: 1
Compression:
Stored size: 793 Bytes
Contents
# frozen_string_literal: true require_relative "../format_parser" module SemanticDateTimeTags class Tag class Time < Tag def initialize(obj, options = {}) raise "object must be Time" unless obj.instance_of?(::Time) super(obj, options) end def to_html if tag_name == :time datetime = obj.acts_like?(:time) ? obj.xmlschema : obj.iso8601 options[:datetime] = datetime end options[:class] = dom_classes options[:data] = dom_data value = SemanticDateTimeTags::FormatParser.new(format_string, localized_obj).to_html content_tag(tag_name, options.except(*%i(format))) { value }.html_safe end private def scope "time.formats" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
semantic_date_time_tags-0.2.0 | lib/semantic_date_time_tags/tag/time.rb |