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 ⇒ String
- #configuration ⇒ String
- #events ⇒ String
- #geometries ⇒ String
- #interfaces ⇒ String
- #keymaps ⇒ String
- #menus ⇒ String
- #views ⇒ String
Class Method Summary collapse
Instance Method Summary collapse
- #build(&block) ⇒ String
- #defaults ⇒ Hash private
-
#initialize(attributes = {}) ⇒ TestApplication
constructor
Returns a new instance of Vedeu::TestApplication.
- #lib_dir ⇒ String
- #read(filename) ⇒ String private
- #template ⇒ String private
Constructor Details
#initialize(attributes = {}) ⇒ TestApplication
Returns a new instance of Vedeu::TestApplication.
67 68 69 70 71 |
# File 'lib/vedeu/distributed/test_application.rb', line 67 def initialize(attributes = {}) @attributes = defaults.merge!(attributes) @attributes.each { |k, _| instance_variable_set("@#{k}", @attributes[k]) } end |
Instance Attribute Details
#borders ⇒ String
20 21 22 |
# File 'lib/vedeu/distributed/test_application.rb', line 20 def borders @borders end |
#configuration ⇒ String
24 25 26 |
# File 'lib/vedeu/distributed/test_application.rb', line 24 def configuration @configuration end |
#events ⇒ String
28 29 30 |
# File 'lib/vedeu/distributed/test_application.rb', line 28 def events @events end |
#geometries ⇒ String
32 33 34 |
# File 'lib/vedeu/distributed/test_application.rb', line 32 def geometries @geometries end |
#interfaces ⇒ String
36 37 38 |
# File 'lib/vedeu/distributed/test_application.rb', line 36 def interfaces @interfaces end |
#keymaps ⇒ String
40 41 42 |
# File 'lib/vedeu/distributed/test_application.rb', line 40 def keymaps @keymaps end |
#menus ⇒ String
44 45 46 |
# File 'lib/vedeu/distributed/test_application.rb', line 44 def end |
#views ⇒ String
48 49 50 |
# File 'lib/vedeu/distributed/test_application.rb', line 48 def views @views end |
Class Method Details
.build(attributes = {}, &block) ⇒ Object
51 52 53 |
# File 'lib/vedeu/distributed/test_application.rb', line 51 def self.build(attributes = {}, &block) new(attributes).build(&block) end |
Instance Method Details
#build(&block) ⇒ String
75 76 77 78 79 |
# File 'lib/vedeu/distributed/test_application.rb', line 75 def build(&block) instance_eval(&block) if block_given? Vedeu::Template.parse(self, template) end |
#defaults ⇒ Hash (private)
TODO:
Don’t like all this file reading.
96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/vedeu/distributed/test_application.rb', line 96 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
82 83 84 |
# File 'lib/vedeu/distributed/test_application.rb', line 82 def lib_dir File.dirname(__FILE__) + '/../../../lib' end |
#read(filename) ⇒ String (private)
110 111 112 |
# File 'lib/vedeu/distributed/test_application.rb', line 110 def read(filename) File.read(File.dirname(__FILE__) + '/templates/' + filename) end |
#template ⇒ String (private)
89 90 91 |
# File 'lib/vedeu/distributed/test_application.rb', line 89 def template File.dirname(__FILE__) + '/templates/default_application.vedeu' end |