Sha256: 9c7e657d6c941d3b58980da11c1dcacc9bac301ee629b161d8732cc5a8b2ecf9
Contents?: true
Size: 837 Bytes
Versions: 6
Compression:
Stored size: 837 Bytes
Contents
require 'jsduck/json_duck' require 'jsduck/null_object' module JsDuck # Reads in examples JSON file class Examples # Creates Examples object from filename. def self.create(filename) if filename Examples.new(filename) else NullObject.new(:to_array => []) end end # Parses examples config file def initialize(filename) @examples = JsonDuck.read(filename) end # Writes examples JSON file to dir def write(dir) 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+"/examples.json", @examples) end # Returns all examples as array def to_array @examples end end end
Version data entries
6 entries across 6 versions & 1 rubygems