module Ezframe::Ht

Public Class Methods

a(ht_h = {})
Alias for: wrap_tag
br(ht_h = {})
Alias for: single_tag
button(arg) click to toggle source

buttonタグにはデフォルトでtype=button属性を付ける

# File lib/ezframe/ht.rb, line 89
def button(arg)
  arg[:tag] = "button"
  unless arg[:type]
    arg[:type] = "button"
  end
  wrap_tag(arg)
end
checkbox(ht_h = {})
Alias for: wrap_tag
div(ht_h = {})
Alias for: wrap_tag
fieldset(ht_h = {})
Alias for: wrap_tag
form(ht_h = {})
Alias for: wrap_tag
h1(ht_h = {})
Alias for: wrap_tag
h2(ht_h = {})
Alias for: wrap_tag
h3(ht_h = {})
Alias for: wrap_tag
h4(ht_h = {})
Alias for: wrap_tag
h5(ht_h = {})
Alias for: wrap_tag
h6(ht_h = {})
Alias for: wrap_tag
hr(ht_h = {})
Alias for: single_tag
i(ht_h = {})
Alias for: wrap_tag
icon(arg) click to toggle source

materialize用のiconメソッド 引数が文字列だったら、それをname属性とする

# File lib/ezframe/ht.rb, line 78
def icon(arg)
  if arg.is_a?(Hash)
    h = arg.clone
    h[:tag] = "icon"
    return wrap_tag(h)
  elsif arg.is_a?(String)
    return { tag: "icon", wrap: true, name: arg }
  end
end
iframe(ht_h = {})
Alias for: wrap_tag
img(ht_h = {})
Alias for: single_tag
input(ht_h = {})
Alias for: single_tag
label(ht_h = {})
Alias for: wrap_tag
li(ht_h = {})
Alias for: wrap_tag
multi_div(class_a, child) click to toggle source
# File lib/ezframe/ht.rb, line 97
def multi_div(class_a, child)
  class_a.reverse.each do |klass|
    child = Ht.div(class: klass, child: child)
  end
  return child
end
nav(ht_h = {})
Alias for: wrap_tag
ol(ht_h = {})
Alias for: wrap_tag
option(ht_h = {})
Alias for: wrap_tag
p(ht_h = {})
Alias for: wrap_tag
pre(ht_h = {})
Alias for: wrap_tag
radio(ht_h = {})
Alias for: wrap_tag
script(ht_h = {})
Alias for: wrap_tag
select(ht_h = {})
Alias for: wrap_tag
single_tag(ht_h = {}) click to toggle source
# File lib/ezframe/ht.rb, line 26
def single_tag(ht_h = {})
  ht_h[:tag] ||= __callee__.to_s
  raise "no tag" if ht_h[:tag] == "wrap_tag"
  raise "has child: #{ht_h.inspect}" if ht_h[:child]
  return ht_h
end
Also aliased as: br, hr, img, input
small(ht_h = {})
Alias for: wrap_tag
span(ht_h = {})
Alias for: wrap_tag
strong(ht_h = {})
Alias for: wrap_tag
table(ht_h = {})
Alias for: wrap_tag
tbody(ht_h = {})
Alias for: wrap_tag
td(ht_h = {})
Alias for: wrap_tag
textarea(ht_h = {})
Alias for: wrap_tag
th(ht_h = {})
Alias for: wrap_tag
thead(ht_h = {})
Alias for: wrap_tag
tr(ht_h = {})
Alias for: wrap_tag
ul(ht_h = {})
Alias for: wrap_tag
wrap_tag(ht_h = {}) click to toggle source

メソッド名の名前のタグのhthashを生成

# File lib/ezframe/ht.rb, line 6
def wrap_tag(ht_h = {})
  return nil unless ht_h
  if ht_h.is_a?(String) || ht_h.is_a?(Array)
    h = { child: ht_h }
  elsif ht_h.is_a?(Hash)
    if ht_h[:tag] && !__callee__.to_s.index("wrap_tag")
      h = { child: ht_h }
    else
      h = ht_h.dup
    end
  else
    EzLog.info("[WARN] wrap_tag: unknown type: #{ht_h.inspect}")
    return nil
  end
  h[:tag] ||= __callee__.to_s
  h[:wrap] = true
  raise "no tag" if h[:tag] == "wrap_tag"
  return h
end