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 = Stratagem::Model::Containers::Base.new self @controllers = Stratagem::Model::Containers::Base.new self @routes = Stratagem::Model::Containers::Route.new self @views = Stratagem::Model::Containers::Base.new self @static_files = Stratagem::Model::Containers::Base.new self @gems = Stratagem::Model::Containers::Gem.new self @plugins = Stratagem::Model::Containers::Plugin.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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/stratagem/model/application.rb', line 32 def export puts "exporting site model" puts "\tmapping #{Stratagem::Instrumentation::Models::Tracing.invocations_audit.size} references" references = [] begin references = Stratagem::Instrumentation::Models::Tracing.invocations_audit.uniq.map {|ia| ia.to_reference.export }.uniq rescue puts $!. puts $!.backtrace end puts "\tmapping #{Stratagem.logger.errors.size} errors" errors = Stratagem.logger.errors.compact.uniq begin h = { :rails_version => rails_version, :rails_environment => Rails.env, :rails_root => Rails.root.to_s, :plugins => @plugins.export, :scanning_exceptions_attributes => errors, :models_attributes => @models.export, :controllers_attributes => @controllers.export, :routes_attributes => @routes.export, :views_attributes => @views.export, :gems => @gems.export, :references_attributes => references, :site_attributes => crawler ? crawler.export : {}, } rescue puts $!. puts $!.backtrace end puts "Sending snapshot of #{h.to_json.size} bytes" 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
69 70 71 |
# File 'lib/stratagem/model/application.rb', line 69 def rails_version Stratagem.rails_version end |