Class: Daigaku::Solution
- Inherits:
-
Object
- Object
- Daigaku::Solution
- Defined in:
- lib/daigaku/solution.rb
Constant Summary collapse
- FILE_SUFFIX =
'_solution.rb'.freeze
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(unit_path) ⇒ Solution
constructor
A new instance of Solution.
- #store_key ⇒ Object
- #verified? ⇒ Boolean
- #verify! ⇒ Object
Constructor Details
#initialize(unit_path) ⇒ Solution
Returns a new instance of Solution.
7 8 9 10 11 12 |
# File 'lib/daigaku/solution.rb', line 7 def initialize(unit_path) @unit_path = unit_path @path = solution_path(unit_path) @code = load_code(@path) @verified = store_state end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
5 6 7 |
# File 'lib/daigaku/solution.rb', line 5 def code @code end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
5 6 7 |
# File 'lib/daigaku/solution.rb', line 5 def errors @errors end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/daigaku/solution.rb', line 5 def path @path end |
Instance Method Details
#store_key ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/daigaku/solution.rb', line 25 def store_key unless @store_key part_path = path.split('/')[-3..-1].join('/').gsub(FILE_SUFFIX, '') @store_key = Storeable.key(part_path, prefix: 'verified') end @store_key end |
#verified? ⇒ Boolean
21 22 23 |
# File 'lib/daigaku/solution.rb', line 21 def verified? !!@verified end |