Class: Vedeu::TestApplication
- Inherits:
-
Object
- Object
- Vedeu::TestApplication
- Defined in:
- lib/vedeu/distributed/test_application.rb
Overview
Create a test application as a string.
Instance Attribute Summary collapse
-
#borders ⇒ Object
Returns the value of attribute borders.
-
#configuration ⇒ Object
Returns the value of attribute configuration.
-
#events ⇒ Object
Returns the value of attribute events.
-
#geometries ⇒ Object
Returns the value of attribute geometries.
-
#interfaces ⇒ Object
Returns the value of attribute interfaces.
-
#keymaps ⇒ Object
Returns the value of attribute keymaps.
-
#menus ⇒ Object
Returns the value of attribute menus.
-
#views ⇒ Object
Returns the value of attribute views.
Class Method Summary collapse
Instance Method Summary collapse
- #build(&block) ⇒ String
- #defaults ⇒ Hash private
- #initialize(attributes = {}) ⇒ TestApplication constructor
- #lib_dir ⇒ String
- #read(filename) ⇒ String private
- #template ⇒ String private
Constructor Details
#initialize(attributes = {}) ⇒ TestApplication
45 46 47 48 49 50 51 |
# File 'lib/vedeu/distributed/test_application.rb', line 45 def initialize(attributes = {}) @attributes = defaults.merge!(attributes) @attributes.each do |k, v| instance_variable_set("@#{k.to_s}", @attributes[k]) end end |
Instance Attribute Details
#borders ⇒ Object
Returns the value of attribute borders.
19 20 21 |
# File 'lib/vedeu/distributed/test_application.rb', line 19 def borders @borders end |
#configuration ⇒ Object
Returns the value of attribute configuration.
19 20 21 |
# File 'lib/vedeu/distributed/test_application.rb', line 19 def configuration @configuration end |
#events ⇒ Object
Returns the value of attribute events.
19 20 21 |
# File 'lib/vedeu/distributed/test_application.rb', line 19 def events @events end |
#geometries ⇒ Object
Returns the value of attribute geometries.
19 20 21 |
# File 'lib/vedeu/distributed/test_application.rb', line 19 def geometries @geometries end |
#interfaces ⇒ Object
Returns the value of attribute interfaces.
19 20 21 |
# File 'lib/vedeu/distributed/test_application.rb', line 19 def interfaces @interfaces end |
#keymaps ⇒ Object
Returns the value of attribute keymaps.
19 20 21 |
# File 'lib/vedeu/distributed/test_application.rb', line 19 def keymaps @keymaps end |
#menus ⇒ Object
Returns the value of attribute menus.
19 20 21 |
# File 'lib/vedeu/distributed/test_application.rb', line 19 def @menus end |
#views ⇒ Object
Returns the value of attribute views.
19 20 21 |
# File 'lib/vedeu/distributed/test_application.rb', line 19 def views @views end |
Class Method Details
.build(attributes = {}, &block) ⇒ String
31 32 33 |
# File 'lib/vedeu/distributed/test_application.rb', line 31 def self.build(attributes = {}, &block) new(attributes).build(&block) end |
Instance Method Details
#build(&block) ⇒ String
55 56 57 58 59 |
# File 'lib/vedeu/distributed/test_application.rb', line 55 def build(&block) self.instance_eval(&block) if block_given? Template.parse(self, template) end |
#defaults ⇒ Hash (private)
TODO:
Don’t like all this file reading.
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/vedeu/distributed/test_application.rb', line 76 def defaults { borders: read('default_borders.vedeu'), configuration: read('default_configuration.vedeu'), events: read('default_events.vedeu'), geometries: read('default_geometries.vedeu'), interfaces: read('default_interfaces.vedeu'), keymaps: read('default_keymaps.vedeu'), menus: read('default_menus.vedeu'), views: read('default_views.vedeu'), } end |
#lib_dir ⇒ String
62 63 64 |
# File 'lib/vedeu/distributed/test_application.rb', line 62 def lib_dir File.dirname(__FILE__) + "/../../../lib" end |
#read(filename) ⇒ String (private)
90 91 92 |
# File 'lib/vedeu/distributed/test_application.rb', line 90 def read(filename) File.read(File.dirname(__FILE__) + '/templates/' + filename) end |
#template ⇒ String (private)
69 70 71 |
# File 'lib/vedeu/distributed/test_application.rb', line 69 def template File.dirname(__FILE__) + '/templates/default_application.vedeu' end |