Sha256: 7642959460ddb14e2e7d2ebf61cb518f0e577689583431591b616b120915b084

Contents?: true

Size: 858 Bytes

Versions: 44

Compression:

Stored size: 858 Bytes

Contents

module Brief
  class Briefcase
    module Documentation

      class ModelDoc
        def initialize(path)
          @content = Pathname(path).read rescue ""
        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

44 entries across 44 versions & 1 rubygems

Version Path
brief-1.17.14 lib/brief/briefcase/documentation.rb
brief-1.17.13 lib/brief/briefcase/documentation.rb
brief-1.17.12 lib/brief/briefcase/documentation.rb
brief-1.17.11 lib/brief/briefcase/documentation.rb
brief-1.17.10 lib/brief/briefcase/documentation.rb
brief-1.17.9 lib/brief/briefcase/documentation.rb
brief-1.17.8 lib/brief/briefcase/documentation.rb
brief-1.17.7 lib/brief/briefcase/documentation.rb
brief-1.17.5 lib/brief/briefcase/documentation.rb
brief-1.17.4 lib/brief/briefcase/documentation.rb
brief-1.17.3 lib/brief/briefcase/documentation.rb
brief-1.17.2 lib/brief/briefcase/documentation.rb
brief-1.17.1 lib/brief/briefcase/documentation.rb
brief-1.17.0 lib/brief/briefcase/documentation.rb
brief-1.16.2 lib/brief/briefcase/documentation.rb
brief-1.16.1 lib/brief/briefcase/documentation.rb
brief-1.16.0 lib/brief/briefcase/documentation.rb
brief-1.15.5 lib/brief/briefcase/documentation.rb
brief-1.15.4 lib/brief/briefcase/documentation.rb
brief-1.15.3 lib/brief/briefcase/documentation.rb