Sha256: 94f7ee0f5c80ce77335944408f4a5c1088e8144dc8eaf27590762610f9192766

Contents?: true

Size: 848 Bytes

Versions: 12

Compression:

Stored size: 848 Bytes

Contents

module Brief
  class Briefcase
    module Documentation

      class ModelDoc
        def initialize(path)
          @content = Pathname(path).read
        end

        def content
          @content
        end

        def rendered
          ::GitHub::Markdown.render_gfm(content)
        end
      end

      def render_documentation(include_all=false)
        list = include_all ? Brief::Model.classes : model_classes

        list.reduce({}.to_mash) do |memo, klass|
          docs = klass.to_documentation rescue {}
          memo[klass.type_alias] = docs unless docs.empty?
          memo
        end
      end

      def schema_map(include_all=false)
        list = include_all ? Brief::Model.classes : model_classes
        list.map(&:to_schema)
          .reduce({}.to_mash) {|m, k| m[k[:type_alias]] = k; m }
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
brief-1.11.5 lib/brief/briefcase/documentation.rb
brief-1.11.4 lib/brief/briefcase/documentation.rb
brief-1.11.3 lib/brief/briefcase/documentation.rb
brief-1.11.2 lib/brief/briefcase/documentation.rb
brief-1.11.1 lib/brief/briefcase/documentation.rb
brief-1.11.0 lib/brief/briefcase/documentation.rb
brief-1.10.1 lib/brief/briefcase/documentation.rb
brief-1.10.0 lib/brief/briefcase/documentation.rb
brief-1.9.14 lib/brief/briefcase/documentation.rb
brief-1.9.13 lib/brief/briefcase/documentation.rb
brief-1.9.12 lib/brief/briefcase/documentation.rb
brief-1.9.11 lib/brief/briefcase/documentation.rb