Sha256: d655d80e6a9a843430624483d809f4957ceec6f76fefddb00ca3228c505f5568
Contents?: true
Size: 826 Bytes
Versions: 1
Compression:
Stored size: 826 Bytes
Contents
# frozen_string_literal: true module Phlex class Tag SPACE = " " NAMESPACE_DELINEATOR = "::" class << self attr_accessor :abstract def value name.split(NAMESPACE_DELINEATOR).last.downcase end end def call raise NoMethodError end def initialize(**attributes) @attributes = attributes .transform_values { _1.split(SPACE) if _1.is_a?(String) } end # def method_missing(name, *args, **kwargs, &block) # @attributes[:class] ||= [] # @attributes[:class] << name # self # end private def meta_data ([self.class.value] + build_attributes).join(SPACE) end def build_attributes @attributes .transform_values { _1.join(SPACE) } .map { |k, v| "#{k}=\"#{v}\"" } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
phlex-0.1.0 | lib/phlex/tag.rb |