Class: JsDuck::AppData
- Inherits:
-
Object
- Object
- JsDuck::AppData
- Defined in:
- lib/jsduck/app_data.rb
Overview
Creates big JS file with data for Docs app.
Instance Method Summary collapse
-
#initialize(relations, assets, opts) ⇒ AppData
constructor
A new instance of AppData.
-
#write(filename) ⇒ Object
Writes classes, guides, videos, and search data to one big .js file.
Constructor Details
#initialize(relations, assets, opts) ⇒ AppData
Returns a new instance of AppData.
10 11 12 13 14 |
# File 'lib/jsduck/app_data.rb', line 10 def initialize(relations, assets, opts) @relations = relations @assets = assets @opts = opts end |
Instance Method Details
#write(filename) ⇒ Object
Writes classes, guides, videos, and search data to one big .js file
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/jsduck/app_data.rb', line 17 def write(filename) js = "Docs = " + Util::Json.generate({ :data => { :classes => Icons.new.create(@relations.classes), :guides => @assets.guides.to_array, :videos => @assets.videos.to_array, :examples => @assets.examples.to_array, :search => SearchData.new.create(@relations.classes, @assets, @opts), :guideSearch => @opts.search, :tests => @opts.tests, :signatures => MetaTagRegistry.instance.signatures, :localStorageDb => @opts.local_storage_db, :showPrintButton => @opts.seo, :touchExamplesUi => @opts.touch_examples_ui, :source => @opts.source, :commentsUrl => @opts.comments_url, :commentsDomain => @opts.comments_domain, :message => @opts., } }) + ";\n" File.open(filename, 'w') {|f| f.write(js) } end |