Class: CodeApe::Class
- Inherits:
-
Object
- Object
- CodeApe::Class
- Defined in:
- lib/code_ape/class.rb
Overview
Represent final ape code (all digits + letter)
Instance Attribute Summary collapse
-
#division_key ⇒ Object
readonly
Returns the value of attribute division_key.
-
#group_key ⇒ Object
readonly
Returns the value of attribute group_key.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#section_key ⇒ Object
readonly
Returns the value of attribute section_key.
-
#subsection_key ⇒ Object
readonly
Returns the value of attribute subsection_key.
Instance Method Summary collapse
-
#division ⇒ CodeApe::Division
The division of this ape code.
-
#group ⇒ CodeApe::Group
The group of this ape code.
-
#initialize(key, label, section_key, subsection_key, division_key, group_key) ⇒ Class
constructor
Creates a new Class.
-
#section ⇒ CodeApe::Section
The section of this ape code.
-
#subsection ⇒ CodeApe::Subsection
The subsection of this ape code.
-
#to_h ⇒ Hash
The hash representation of class label.
Constructor Details
#initialize(key, label, section_key, subsection_key, division_key, group_key) ⇒ Class
Creates a new CodeApe::Class
17 18 19 20 21 22 23 24 |
# File 'lib/code_ape/class.rb', line 17 def initialize(key, label, section_key, subsection_key, division_key, group_key) @key = key.to_s @label = label @section_key = section_key.to_s @subsection_key = subsection_key.to_s @division_key = division_key.to_s @group_key = group_key.to_s end |
Instance Attribute Details
#division_key ⇒ Object (readonly)
Returns the value of attribute division_key.
8 9 10 |
# File 'lib/code_ape/class.rb', line 8 def division_key @division_key end |
#group_key ⇒ Object (readonly)
Returns the value of attribute group_key.
8 9 10 |
# File 'lib/code_ape/class.rb', line 8 def group_key @group_key end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
7 8 9 |
# File 'lib/code_ape/class.rb', line 7 def key @key end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
7 8 9 |
# File 'lib/code_ape/class.rb', line 7 def label @label end |
#section_key ⇒ Object (readonly)
Returns the value of attribute section_key.
8 9 10 |
# File 'lib/code_ape/class.rb', line 8 def section_key @section_key end |
#subsection_key ⇒ Object (readonly)
Returns the value of attribute subsection_key.
8 9 10 |
# File 'lib/code_ape/class.rb', line 8 def subsection_key @subsection_key end |
Instance Method Details
#division ⇒ CodeApe::Division
Returns the division of this ape code.
32 33 34 |
# File 'lib/code_ape/class.rb', line 32 def division @division ||= DIVISIONS.find { |e| e.key == @division_key } end |
#group ⇒ CodeApe::Group
Returns the group of this ape code.
27 28 29 |
# File 'lib/code_ape/class.rb', line 27 def group @group ||= GROUPS.find { |e| e.key == @group_key } end |
#section ⇒ CodeApe::Section
Returns the section of this ape code.
42 43 44 |
# File 'lib/code_ape/class.rb', line 42 def section @section ||= SECTIONS.find { |e| e.key == @section_key } end |
#subsection ⇒ CodeApe::Subsection
Returns the subsection of this ape code.
37 38 39 |
# File 'lib/code_ape/class.rb', line 37 def subsection @subsection ||= SUBSECTIONS.find { |e| e.key == @subsection_key } end |
#to_h ⇒ Hash
Returns the hash representation of class label.
47 48 49 |
# File 'lib/code_ape/class.rb', line 47 def to_h {label: @label} end |