Class: UDRS::Components::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/udrs/components/header.rb

Constant Summary collapse

LEVELS =
1..3

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, level = 1) ⇒ Header

Returns a new instance of Header.



8
9
10
11
12
# File 'lib/udrs/components/header.rb', line 8

def initialize(text, level = 1)
	@text = text.to_s
	fail ArgumentError, "Invalid level: #{level}" unless LEVELS.include?(level)
	@level = level
end

Instance Attribute Details

#levelObject (readonly)

Returns the value of attribute level.



4
5
6
# File 'lib/udrs/components/header.rb', line 4

def level
  @level
end

#textObject (readonly)

Returns the value of attribute text.



4
5
6
# File 'lib/udrs/components/header.rb', line 4

def text
  @text
end