Module: Alki::Execution::Helpers
- Included in:
- ValueHelpers
- Defined in:
- lib/alki/execution/helpers.rb
Instance Method Summary collapse
Instance Method Details
#lazy(*path) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/alki/execution/helpers.rb', line 22 def lazy(*path) path = path.flatten.inject('') do |new_path,elem| unless elem.is_a?(String) or elem.is_a?(Symbol) raise ArgumentError.new("lookup can only take Strings or Symbols") end new_path << elem.to_s end Alki::ServiceDelegator.new self, path end |
#lookup(*path) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/alki/execution/helpers.rb', line 6 def lookup(*path) path.flatten.inject(self) do |from_group,elem| unless elem.is_a?(String) or elem.is_a?(Symbol) raise ArgumentError.new("lookup can only take Strings or Symbols") end elem.to_s.split('.').inject(from_group) do |group,name| raise "Invalid lookup elem" unless group.is_a? Helpers if name =~ /^\d/ group[name.to_i] else group.send name.to_sym end end end end |
#reference(path, *args, &blk) ⇒ Object
32 33 34 |
# File 'lib/alki/execution/helpers.rb', line 32 def reference(path,*args,&blk) __reference__ path, args, blk end |