Module: Shef::Extensions::Object::ClassMethods

Included in:
Object
Defined in:
lib/chef/shef/ext.rb

Instance Method Summary collapse

Instance Method Details

#all_help_descriptionsObject



88
89
90
91
92
93
94
# File 'lib/chef/shef/ext.rb', line 88

def all_help_descriptions
  if sc = superclass
    help_descriptions + sc.help_descriptions
  else
    help_descriptions
  end
end

#desc(help_text) ⇒ Object



96
97
98
# File 'lib/chef/shef/ext.rb', line 96

def desc(help_text)
  @desc = help_text
end

#help_descriptionsObject



84
85
86
# File 'lib/chef/shef/ext.rb', line 84

def help_descriptions
  @help_descriptions ||= []
end

#method_added(mname) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/chef/shef/ext.rb', line 104

def method_added(mname)
  if @desc
    help_descriptions << [mname.to_s, @desc.to_s]
    @desc = nil
  end
  if @subcommand_help
    @subcommand_help.each do |subcommand, text|
      help_descriptions << ["#{mname}.#{subcommand}", text.to_s]
    end
  end
  @subcommand_help = {}
end

#subcommands(subcommand_help = {}) ⇒ Object



100
101
102
# File 'lib/chef/shef/ext.rb', line 100

def subcommands(subcommand_help={})
  @subcommand_help = subcommand_help
end