Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/mumuki/domain/extensions/hash.rb,
app/models/concerns/submittable/solvable.rb

Instance Method Summary collapse

Instance Method Details

#markdownified(*keys, **options) ⇒ Object



11
12
13
# File 'lib/mumuki/domain/extensions/hash.rb', line 11

def markdownified(*keys, **options)
  map { |k, v| key.in?(keys) ? v.markdownified(options) : v }.to_h
end

#markdownified!(*keys, **options) ⇒ Object



7
8
9
# File 'lib/mumuki/domain/extensions/hash.rb', line 7

def markdownified!(*keys, **options)
  keys.each { |it| self[it] = self[it].markdownified(**options) }
end

#markdownify!(*keys, **options) ⇒ Object



2
3
4
5
# File 'lib/mumuki/domain/extensions/hash.rb', line 2

def markdownify!(*keys, **options)
  warn "Don't use markdownify. Use markdownified! instead"
  markdownified! *keys, **options
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