Class: Himekaminize::Nodes::Header

Inherits:
BaseNode
  • Object
show all
Defined in:
lib/himekaminize/nodes/header.rb

Constant Summary collapse

PATTERN =
/\#{1,6}/

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#levelObject

Returns the value of attribute level.



6
7
8
# File 'lib/himekaminize/nodes/header.rb', line 6

def level
  @level
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/himekaminize/nodes/header.rb', line 6

def name
  @name
end

#sizeObject

Returns the value of attribute size.



6
7
8
# File 'lib/himekaminize/nodes/header.rb', line 6

def size
  @size
end

#spaceObject

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_sObject



13
14
15
# File 'lib/himekaminize/nodes/header.rb', line 13

def to_s
  sprintf("%s%s%s\n", @space, @level, @name)
end