Sha256: 3293afc4146f92b07267e91e2e972406acb476dd29e79933dc78d35cff27f7fc

Contents?: true

Size: 572 Bytes

Versions: 25

Compression:

Stored size: 572 Bytes

Contents

require 'mumukit/directives'

class Mumukit::Directives::Sections < Mumukit::Directives::Directive
  def build(section, content)
    "#{comment_type.comment "<#{section}#"}#{content}#{comment_type.comment "##{section}>"}"
  end

  def join(sections)
    file_declarations, file_references = sections.map do |section, content|
      [build(section, content), interpolate(section)]
    end.transpose
    "#{file_declarations.join "\n"}\n#{build 'content', file_references.join("\n")}"
  end

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

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
mumuki-laboratory-5.7.0 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.6.3 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.6.2 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.6.1 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.6.0 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.5.0 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.4.0 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.3.0 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.2.1 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.2.0 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.1.1 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.1.0 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.0.12 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.0.11 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.0.10 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.0.9 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.0.8 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.0.7 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.0.6 lib/mumuki/laboratory/mumukit/directives.rb
mumuki-laboratory-5.0.5 lib/mumuki/laboratory/mumukit/directives.rb