Class: Himekaminize::Nodes::Header
- Defined in:
- lib/himekaminize/nodes/header.rb
Constant Summary collapse
- PATTERN =
/\#{1,6}/
Instance Attribute Summary collapse
-
#level ⇒ Object
Returns the value of attribute level.
-
#name ⇒ Object
Returns the value of attribute name.
-
#size ⇒ Object
Returns the value of attribute size.
-
#space ⇒ Object
Returns the value of attribute space.
Instance Method Summary collapse
-
#initialize(line) ⇒ Header
constructor
A new instance of Header.
- #to_s ⇒ Object
Constructor Details
#initialize(line) ⇒ Header
Returns a new instance of Header.
8 9 10 11 |
# File 'lib/himekaminize/nodes/header.rb', line 8 def initialize(line) @space, @level, @name = split_name_and_level(line) @size = count_size end |
Instance Attribute Details
#level ⇒ Object
Returns the value of attribute level.
6 7 8 |
# File 'lib/himekaminize/nodes/header.rb', line 6 def level @level end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/himekaminize/nodes/header.rb', line 6 def name @name end |
#size ⇒ Object
Returns the value of attribute size.
6 7 8 |
# File 'lib/himekaminize/nodes/header.rb', line 6 def size @size end |
#space ⇒ Object
Returns the value of attribute space.
6 7 8 |
# File 'lib/himekaminize/nodes/header.rb', line 6 def space @space end |
Instance Method Details
#to_s ⇒ Object
13 14 15 |
# File 'lib/himekaminize/nodes/header.rb', line 13 def to_s sprintf("%s%s%s\n", @space, @level, @name) end |