Class: Entityjs::Config
- Inherits:
-
Object
- Object
- Entityjs::Config
- Defined in:
- lib/entityjs/config.rb
Class Method Summary collapse
- .assets_folder ⇒ Object
- .builds_folder ⇒ Object
- .file_name ⇒ Object
- .images_folder ⇒ Object
- .instance ⇒ Object
- .scripts_folder ⇒ Object
- .sounds_folder ⇒ Object
- .tests_folder ⇒ Object
Instance Method Summary collapse
- #canvas_border ⇒ Object
- #canvas_id ⇒ Object
- #entity_ignore ⇒ Object
- #height ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #license ⇒ Object
- #reload ⇒ Object
- #scripts_ignore ⇒ Object
- #scripts_order ⇒ Object
- #tests_ignore ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
49 50 51 |
# File 'lib/entityjs/config.rb', line 49 def initialize self.reload end |
Class Method Details
.assets_folder ⇒ Object
11 12 13 |
# File 'lib/entityjs/config.rb', line 11 def self.assets_folder return 'assets' end |
.builds_folder ⇒ Object
23 24 25 |
# File 'lib/entityjs/config.rb', line 23 def self.builds_folder return 'builds' end |
.file_name ⇒ Object
7 8 9 |
# File 'lib/entityjs/config.rb', line 7 def self.file_name 'config.yml' end |
.images_folder ⇒ Object
31 32 33 |
# File 'lib/entityjs/config.rb', line 31 def self.images_folder self.assets_folder+'/images' end |
.instance ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/entityjs/config.rb', line 35 def self.instance if @instance.nil? @instance = Config.new end return @instance end |
.scripts_folder ⇒ Object
19 20 21 |
# File 'lib/entityjs/config.rb', line 19 def self.scripts_folder return 'scripts' end |
.sounds_folder ⇒ Object
27 28 29 |
# File 'lib/entityjs/config.rb', line 27 def self.sounds_folder self.assets_folder+'/sounds' end |
.tests_folder ⇒ Object
15 16 17 |
# File 'lib/entityjs/config.rb', line 15 def self.tests_folder 'tests' end |
Instance Method Details
#canvas_border ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/entityjs/config.rb', line 60 def canvas_border if @yml.nil? return true end return @yml['canvas-border'] || true end |
#canvas_id ⇒ Object
119 120 121 122 123 124 125 |
# File 'lib/entityjs/config.rb', line 119 def canvas_id if @yml.nil? return 'game-canvas' end @yml['canvas-id'] || 'game-canvas' end |
#entity_ignore ⇒ Object
108 109 110 111 112 113 114 115 116 117 |
# File 'lib/entityjs/config.rb', line 108 def entity_ignore if @yml.nil? return [] end y = @yml['entity-ignore'] if !y.nil? y.split(" ") end end |
#height ⇒ Object
68 69 70 71 72 73 |
# File 'lib/entityjs/config.rb', line 68 def height if @yml.nil? return 400 end @yml['height'] || 400 end |
#license ⇒ Object
127 128 129 130 131 132 133 |
# File 'lib/entityjs/config.rb', line 127 def license contents = IO.read(Entityjs::root+'/license.txt') contents = contents.sub(/\$VERSION/, Entityjs::VERSION) return contents+"\n" end |
#reload ⇒ Object
43 44 45 46 47 |
# File 'lib/entityjs/config.rb', line 43 def reload if File.exists?(Config.file_name) @yml = YAML::load(File.open(Config.file_name)) end end |
#scripts_ignore ⇒ Object
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/entityjs/config.rb', line 75 def scripts_ignore if @yml.nil? return [] end y = @yml['scripts-ignore'] if !y.nil? y.split(" ") end end |
#scripts_order ⇒ Object
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/entityjs/config.rb', line 86 def scripts_order if @yml.nil? return [] end y = @yml['order'] if !y.nil? y.split(" ") end end |
#tests_ignore ⇒ Object
97 98 99 100 101 102 103 104 105 106 |
# File 'lib/entityjs/config.rb', line 97 def tests_ignore if @yml.nil? return [] end y = @yml['tests-ignore'] if !y.nil? y.split(" ") end end |
#width ⇒ Object
53 54 55 56 57 58 |
# File 'lib/entityjs/config.rb', line 53 def width if @yml.nil? return 500 end @yml['width'] || 500 end |