# File lib/sugar-high/kind_of.rb, line 9 def any_kind_of? *kinds kinds.all_kinds.each do |kind| return true if self.kind_of? kind end false end
# File lib/sugar-high/methods.rb, line 2 def get_methods *types types.inject([]) do |list, type| list << case type when :all get_methods(:private, :protected, :public) when :private, :protected, :public send :"#{type}_methods" end list.flatten end.flatten.uniq end
# File lib/sugar-high/kind_of.rb, line 23 def kind_of_label? self.any_kind_of? String, Symbol end
# File lib/sugar-high/kind_of.rb, line 27 def kind_of_number? self.any_kind_of? Numeric end
# File lib/sugar-high/kind_of.rb, line 32 def kind_of_symbol? self.any_kind_of? Symbols, Symbol end
# File lib/sugar-high/kind_of.rb, line 5 def kinda_file? any_kind_of?(File, Dir) end
# File lib/sugar-high/arguments.rb, line 44 def last_arg default, *args last = args.flatten.last last.kind_of?(Hash) ? last : default end
# File lib/sugar-high/arguments.rb, line 49 def last_arg_value default, *args last = args.flatten.last raise ArgumentError, "Default value must be a Hash, was #{default}" if !default.kind_of? Hash key = default.keys.first return default[key] if !last.kind_of? Hash last[key] ? last[key] : default[key] end
# File lib/sugar-high/arguments.rb, line 38 def last_option *args default = last_arg({}, *args) last = args.flatten.last last.kind_of?(Hash) ? last : default end
# File lib/sugar-high/module.rb, line 10 def modules *module_names, &block module_names.flatten.each do |name| class_eval %{ module #{name.to_s.camelize} #{yield block if block} end } end end
# File lib/sugar-high/module.rb, line 20 def nested_modules *module_names, &block module_names.flatten.inject([]) do |res, name| res << %{ module #{name.to_s.camelize} #{yield block if block} end} end.flatten.join("\n") end
Generated with the Darkfish Rdoc Generator 2.