class Hefted::ClassMethod::Base
Public Instance Methods
[](key)
click to toggle source
# File lib/hefted/class_method.rb, line 71 def [](key) fetch(key) end
each() { |key, send(key)| ... }
click to toggle source
# File lib/hefted/class_method.rb, line 20 def each return to_enum(:each) unless block_given? members.each do |key| yield(key, send(key)) end end
each_key() { |key| ... }
click to toggle source
# File lib/hefted/class_method.rb, line 27 def each_key return to_enum(:each_key) unless block_given? keys.each { |key| yield(key) } end
each_value() { |value| ... }
click to toggle source
# File lib/hefted/class_method.rb, line 32 def each_value return to_enum(:each_value) unless block_given? values.each { |value| yield(value) } end
fetch(key, *args) { |key| ... }
click to toggle source
# File lib/hefted/class_method.rb, line 51 def fetch(key, *args) return send(key) if has_key?(key) return args.first if args.size > 0 return yield(key) if block_given? end
fetch_values(*_keys) { |key| ... }
click to toggle source
# File lib/hefted/class_method.rb, line 57 def fetch_values(*_keys) _keys.map do |key| if has_key?(key) fetch(key) else yield(key) if block_given? end end end
has_key?(key)
click to toggle source
# File lib/hefted/class_method.rb, line 41 def has_key?(key) keys.include?(key.to_sym) end
Also aliased as: key?
has_value?(value)
click to toggle source
# File lib/hefted/class_method.rb, line 46 def has_value?(value) values.include?(value) end
Also aliased as: value?
keys()
click to toggle source
# File lib/hefted/class_method.rb, line 37 def keys members end
values_at(*_keys)
click to toggle source
# File lib/hefted/class_method.rb, line 67 def values_at(*_keys) fetch_values(*_keys) end