Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/mumuki/domain/extensions/hash.rb,
app/models/concerns/submittable/solvable.rb
Instance Method Summary collapse
- #markdownified(*keys, **options) ⇒ Object
- #markdownified!(*keys, **options) ⇒ Object
- #markdownify!(*keys, **options) ⇒ Object
- #randomize_with(randomizer, seed) ⇒ Object
- #to_mumuki_solution(language) ⇒ Object
Instance Method Details
#markdownified(*keys, **options) ⇒ Object
11 12 13 |
# File 'lib/mumuki/domain/extensions/hash.rb', line 11 def markdownified(*keys, **) map { |k, v| key.in?(keys) ? v.markdownified() : v }.to_h end |
#markdownified!(*keys, **options) ⇒ Object
7 8 9 |
# File 'lib/mumuki/domain/extensions/hash.rb', line 7 def markdownified!(*keys, **) keys.each { |it| self[it] = self[it].markdownified(**) } end |
#markdownify!(*keys, **options) ⇒ Object
2 3 4 5 |
# File 'lib/mumuki/domain/extensions/hash.rb', line 2 def markdownify!(*keys, **) warn "Don't use markdownify. Use markdownified! instead" markdownified! *keys, ** end |
#randomize_with(randomizer, seed) ⇒ Object
15 16 17 |
# File 'lib/mumuki/domain/extensions/hash.rb', line 15 def randomize_with(randomizer, seed) transform_values { |v| v.randomize_with randomizer, seed } end |
#to_mumuki_solution(language) ⇒ Object
32 33 34 35 36 37 |
# File 'app/models/concerns/submittable/solvable.rb', line 32 def to_mumuki_solution(language) language .directives_sections .join(self) .to_mumuki_solution(language) end |