Top Level Namespace

Defined Under Namespace

Modules: Kernel, Main, Process Classes: Object

Instance Method Summary (collapse)

Instance Method Details

- (Object) argument(*a, &b) Also known as: arg



5
6
7
# File 'lib/main/dsl.rb', line 5

def argument(*a, &b)
  (parameters << Parameter.create(:argument, self, *a, &b)).last
end

- (Object) can_has(ptype, *a, &b)



37
38
39
40
41
# File 'lib/main/dsl.rb', line 37

def can_has(ptype, *a, &b)
  key = a.map{|s| s.to_s}.sort_by{|s| -s.size }.first
  can_has_hash.update key => [ptype, a, b]
  key
end

- (Object) chunkname

TODO - for some reason these hork the usage!



68
69
70
71
72
73
74
75
# File 'lib/main/dsl.rb', line 68

%w[ examples samples api ].each do |chunkname|
  module_eval <<-code
    def #{ chunkname } *a, &b 
      txt = b ? b.call : a.join("\\n")
      usage['#{ chunkname }'] = txt
    end
  code
end

- (Object) default_options!



26
27
28
# File 'lib/main/dsl.rb', line 26

def default_options!
  option 'help', 'h' unless parameters.has_option?('help', 'h')
end

- (Object) environment(*a, &b) Also known as: env



21
22
23
# File 'lib/main/dsl.rb', line 21

def environment(*a, &b)
  (parameters << Parameter.create(:environment, self, *a, &b)).last
end

- (Object) has(key, *keys)



43
44
45
46
47
48
49
50
51
# File 'lib/main/dsl.rb', line 43

def has(key, *keys)
  keys = [key, *keys].flatten.compact.map{|k| k.to_s}
  keys.map do |key|
    ptype, a, b = can_has_hash[key]
    abort "yo - can *not* has #{ key.inspect }!?" unless(ptype and a and b)
    send ptype, *a, &b
    key
  end
end

- (Object) keyword(*a, &b) Also known as: kw



16
17
18
# File 'lib/main/dsl.rb', line 16

def keyword(*a, &b)
  (parameters << Parameter.create(:keyword, self, *a, &b)).last
end

- (Object) mixin(name, *names, &block)



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/main/dsl.rb', line 53

def mixin(name, *names, &block)
  names = [name, *names].flatten.compact.map{|name| name.to_s}
  if block
    names.each do |name|
      mixin_table[name] = block
    end
  else
    names.each do |name|
      module_eval(&mixin_table[name])
    end
  end
end

- (Object) mode(name, &block)



30
31
32
33
34
35
# File 'lib/main/dsl.rb', line 30

def mode(name, &block)
  name = name.to_s
  modes[name] = block
  block.fattr(:name => name)
  block
end

- (Object) option(*a, &b) Also known as: opt, switch



10
11
12
# File 'lib/main/dsl.rb', line 10

def option(*a, &b)
  (parameters << Parameter.create(:option, self, *a, &b)).last
end

- (Object) parameter(*a, &b)



1
2
3
# File 'lib/main/dsl.rb', line 1

def parameter(*a, &b)
  (parameters << Parameter.create(:parameter, self, *a, &b)).last
end