Class: Stratagem::Model::Application
- Includes:
- Singleton
- Defined in:
- lib/stratagem/model/application.rb
Overview
container for application
Instance Attribute Summary collapse
-
#controllers ⇒ Object
readonly
Returns the value of attribute controllers.
-
#crawler ⇒ Object
Returns the value of attribute crawler.
-
#gems ⇒ Object
readonly
Returns the value of attribute gems.
-
#models ⇒ Object
readonly
Returns the value of attribute models.
-
#plugins ⇒ Object
readonly
Returns the value of attribute plugins.
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
-
#static_files ⇒ Object
readonly
Returns the value of attribute static_files.
-
#views ⇒ Object
readonly
Returns the value of attribute views.
Instance Method Summary collapse
- #export ⇒ Object
-
#initialize ⇒ Application
constructor
A new instance of Application.
- #log(msg) ⇒ Object
- #rails_version ⇒ Object
Constructor Details
#initialize ⇒ Application
Returns a new instance of Application.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/stratagem/model/application.rb', line 17 def initialize log "initializing application model" @models = ComponentContainer.new self @controllers = ComponentContainer.new self @routes = RouteContainer.new self @views = ComponentContainer.new self @static_files = ComponentContainer.new self @gems = GemContainer.new self @plugins = PluginContainer.new self end |
Instance Attribute Details
#controllers ⇒ Object (readonly)
Returns the value of attribute controllers.
15 16 17 |
# File 'lib/stratagem/model/application.rb', line 15 def controllers @controllers end |
#crawler ⇒ Object
Returns the value of attribute crawler.
14 15 16 |
# File 'lib/stratagem/model/application.rb', line 14 def crawler @crawler end |
#gems ⇒ Object (readonly)
Returns the value of attribute gems.
15 16 17 |
# File 'lib/stratagem/model/application.rb', line 15 def gems @gems end |
#models ⇒ Object (readonly)
Returns the value of attribute models.
15 16 17 |
# File 'lib/stratagem/model/application.rb', line 15 def models @models end |
#plugins ⇒ Object (readonly)
Returns the value of attribute plugins.
15 16 17 |
# File 'lib/stratagem/model/application.rb', line 15 def plugins @plugins end |
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
15 16 17 |
# File 'lib/stratagem/model/application.rb', line 15 def routes @routes end |
#static_files ⇒ Object (readonly)
Returns the value of attribute static_files.
15 16 17 |
# File 'lib/stratagem/model/application.rb', line 15 def static_files @static_files end |
#views ⇒ Object (readonly)
Returns the value of attribute views.
15 16 17 |
# File 'lib/stratagem/model/application.rb', line 15 def views @views end |
Instance Method Details
#export ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/stratagem/model/application.rb', line 32 def export puts "exporting site model" references = @controllers.map {|c| c.references }.flatten.map {|r| r.export }.uniq h = { :rails_version => rails_version, :rails_environment => Rails.env, :rails_root => Rails.root, :models => @models.export, :controllers => @controllers.export, :routes => @routes.export, :views => @views.export, :gems => @gems.export, :plugins => @plugins.export, :site_model => crawler ? crawler.export : nil, :references => references } puts h.to_json h end |
#log(msg) ⇒ Object
28 29 30 |
# File 'lib/stratagem/model/application.rb', line 28 def log(msg) Stratagem.logger.debug(msg) end |
#rails_version ⇒ Object
52 53 54 |
# File 'lib/stratagem/model/application.rb', line 52 def rails_version Stratagem.rails_version end |