Class: HS::Element
- Inherits:
-
Object
- Object
- HS::Element
- Includes:
- ElementPreview
- Defined in:
- lib/hs/elements/element.rb
Direct Known Subclasses
Br, Code, Dd, Dl, Dt, Emphasize, Header, Image, InitialCode, Intro, Li, Link, LiveCode, Note, Ol, Original, Paragraph, Solution, Strong, Table, Tbody, Td, Th, Thead, Tr, Ul
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#class_name ⇒ Object
Returns the value of attribute class_name.
-
#style ⇒ Object
Returns the value of attribute style.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Element
constructor
A new instance of Element.
- #params ⇒ Object
- #preview ⇒ Object
- #tag_name ⇒ Object
Methods included from ElementPreview
#element_preview, #text_preview
Constructor Details
#initialize(args = {}) ⇒ Element
Returns a new instance of Element.
12 13 14 15 16 17 18 |
# File 'lib/hs/elements/element.rb', line 12 def initialize(args = {}) args.each do |key, val| instance_variable_set("@#{key}", val) end @children ||= [] end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
9 10 11 |
# File 'lib/hs/elements/element.rb', line 9 def children @children end |
#class_name ⇒ Object
Returns the value of attribute class_name.
10 11 12 |
# File 'lib/hs/elements/element.rb', line 10 def class_name @class_name end |
#style ⇒ Object
Returns the value of attribute style.
10 11 12 |
# File 'lib/hs/elements/element.rb', line 10 def style @style end |
Instance Method Details
#params ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/hs/elements/element.rb', line 24 def params params = {} class_name = element_class_name params[:class] = class_name if class_name params[:style] = style if style params end |
#preview ⇒ Object
33 34 35 |
# File 'lib/hs/elements/element.rb', line 33 def preview element_preview(tag_name, params, children) end |
#tag_name ⇒ Object
20 21 22 |
# File 'lib/hs/elements/element.rb', line 20 def tag_name 'div' end |