Sha256: b6b02154e551765a0148f671ea0056c50e6dae63231191b5bc59fae83e005ddf
Contents?: true
Size: 906 Bytes
Versions: 2
Compression:
Stored size: 906 Bytes
Contents
# frozen_string_literal: true require 'hs/preview/element_preview' module HS class Element include ElementPreview attr_reader :children attr_accessor :style, :class_name def initialize(args = {}) args.each do |key, val| instance_variable_set("@#{key}", val) end @children ||= [] end def tag_name 'div' end def params params = {} class_name = element_class_name params[:class] = class_name if class_name params[:style] = style if style params end def preview element_preview(tag_name, params, children) end def preview_raw preview end private def element_class_name return class_name unless respond_to?(:default_class) class_names = [default_class, class_name].uniq.compact class_names.join(' ') unless class_names.empty? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hs-cli-0.3.3 | lib/hs/elements/element.rb |
hs-cli-0.3.2 | lib/hs/elements/element.rb |