Sha256: d656f14c99d9d4a2b68dc8f7a067e6916109e9785bbf559cc7a6877876c7e7c6

Contents?: true

Size: 677 Bytes

Versions: 5

Compression:

Stored size: 677 Bytes

Contents

require 'jsduck/json_duck'

module JsDuck

  # Reads in videos JSON file
  class Videos
    def initialize
      @videos = []
    end

    # Parses videos config file
    def parse(filename)
      @videos = JsonDuck.read(filename)
    end

    # Writes videos JSON file to a dir
    def write(dir)
      return if @videos.length == 0

      FileUtils.mkdir(dir) unless File.exists?(dir)
      # Write the JSON to output dir, so it's available in released
      # version of docs and people can use it with JSDuck by themselves.
      JsonDuck.write_json(dir+"/videos.json", @videos)
    end

    # Returns all videos as array
    def to_array
      @videos
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jsduck-3.0.1 lib/jsduck/videos.rb
jsduck-3.0 lib/jsduck/videos.rb
jsduck-3.0.pre3 lib/jsduck/videos.rb
jsduck-3.0.pre2 lib/jsduck/videos.rb
jsduck-3.0.pre lib/jsduck/videos.rb