Sha256: d2aad72965fe484b72fd4b3e9d779d31e4b9d9419d7a0698f31817ff21509202
Contents?: true
Size: 894 Bytes
Versions: 1
Compression:
Stored size: 894 Bytes
Contents
# frozen_string_literal: true require_relative "../format_parser" module SemanticDateTimeTags class Tag class Date < Tag def initialize(obj, options = {}) raise "object must be Date or DateTime" unless [::Date, ::DateTime].any? { |c| obj.instance_of? c } options = options.except(*%i(separator)) 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.html_safe content_tag(tag_name, options.except(*%i(format))) { value }.html_safe end private def scope "date.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/date.rb |