Sha256: 04f392e9f71394d7e85fc6ffffe458d5642ee8c5021c155c3138de2298e20466

Contents?: true

Size: 556 Bytes

Versions: 2

Compression:

Stored size: 556 Bytes

Contents

require 'mumukit/directives'

class Mumukit::Directives::Sections < Mumukit::Directives::Directive
  # TODO Move this behaviour to gem
  def join(sections)
    file_declarations, file_references = sections.map do |section, content|
      [build(section, content), interpolate(section)]
    end.transpose

    file_declarations.join "\n"
  end

  def build(section, content)
    "#{comment_type.comment "<#{section}#"}#{content}#{comment_type.comment "##{section}>"}"
  end

  def interpolate(section)
    comment_type.comment("...#{section}...")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mumuki-laboratory-5.9.1 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.9.0 lib/mumuki/laboratory/mumukit/directives.rb