Class: Batali::Struct
- Inherits:
-
AttributeStruct
- Object
- AttributeStruct
- Batali::Struct
- Defined in:
- lib/batali/b_file.rb
Instance Method Summary collapse
- #_dump(*_) ⇒ Object
- #chef_server(*args) ⇒ Object
- #cookbook(*args) ⇒ Object
- #metadata(*args) ⇒ Object
- #require(*args) ⇒ Object
- #restrict(*args) ⇒ Object
- #source(*args) ⇒ Object
Instance Method Details
#_dump(*_) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/batali/b_file.rb', line 48 def _dump(*_) _keys.each do |k| if(_data[k].nil? && _data[k].is_a?(::AttributeStruct)) _data[k] = true end end super end |
#chef_server(*args) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/batali/b_file.rb', line 26 def chef_server(*args) unless(self[:chef_server]) set!(:chef_server, ::AttributeStruct::CollapseArray.new.push(args)) else self[:chef_server].push(args) end self end |
#cookbook(*args) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/batali/b_file.rb', line 8 def cookbook(*args) unless(self[:cookbook]) set!(:cookbook, ::AttributeStruct::CollapseArray.new.push(args)) else self[:cookbook].push(args) end self end |
#metadata(*args) ⇒ Object
44 45 46 |
# File 'lib/batali/b_file.rb', line 44 def (*args) set!(:metadata, *(args.empty? ? [true] : args)) end |
#require(*args) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/batali/b_file.rb', line 62 def require(*args) result = ::Kernel.require(*args) instance_exec do class << self ::Object.constants.each do |const_name| next if const_name == :Config const_set(const_name, ::Object.const_get(const_name)) end end end result end |
#restrict(*args) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/batali/b_file.rb', line 35 def restrict(*args) unless(self[:restrict]) set!(:restrict, ::AttributeStruct::CollapseArray.new.push(args)) else self[:restrict].push(args) end self end |
#source(*args) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/batali/b_file.rb', line 17 def source(*args) unless(self[:source]) set!(:source, ::AttributeStruct::CollapseArray.new.push(args)) else self[:source].push(args) end self end |