Class: Constantinopolis::Fort
- Inherits:
-
Object
- Object
- Constantinopolis::Fort
- Defined in:
- lib/constantinopolis.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.build! ⇒ Object
21 22 23 24 |
# File 'lib/constantinopolis.rb', line 21 def build! instance.build_methods! instance.build_js! end |
.js_code ⇒ Object
26 27 28 |
# File 'lib/constantinopolis.rb', line 26 def js_code instance.js_code end |
.namespace(namespace = nil) ⇒ Object
17 18 19 |
# File 'lib/constantinopolis.rb', line 17 def namespace(namespace = nil) @namespace ||= namespace end |
.yml(path = nil) ⇒ Object
13 14 15 |
# File 'lib/constantinopolis.rb', line 13 def yml(path = nil) @yml ||= path end |
Instance Method Details
#build_js! ⇒ Object
47 48 49 |
# File 'lib/constantinopolis.rb', line 47 def build_js! @js_code = "#{self.class.name}=#{JSON.generate(@constants)};" end |
#build_methods! ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/constantinopolis.rb', line 38 def build_methods! @constants.each do |key, value| self.class.module_eval do sig = class << self; self; end sig.send :define_method, key, ->() { value } end end end |
#js_code ⇒ Object
51 52 53 |
# File 'lib/constantinopolis.rb', line 51 def js_code @js_code end |