Class: Ezframe::Ht::List

Inherits:
Array show all
Defined in:
lib/ezframe/ht.rb

Overview

配列を<UL><OL>要素に変換するためのクラス

Direct Known Subclasses

Ol, Ul

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Array

#symbolize_keys

Instance Attribute Details

#tagObject

Returns the value of attribute tag.



120
121
122
# File 'lib/ezframe/ht.rb', line 120

def tag
  @tag
end

Instance Method Details

#to_h(opts = {}) ⇒ Object



121
122
123
124
125
126
127
128
129
# File 'lib/ezframe/ht.rb', line 121

def to_h(opts = {})
  return nil if self.empty?
  child = self.map do |elem|
    { tag: "li", child: elem }
  end
  h = { tag: @tag, child: child }
  h.update(opts)
  return h
end