Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/hobo_support.rb,
lib/hobo_support/metaid.rb,
lib/hobo_support/enumerable.rb,
lib/hobo_support/methodcall.rb
Overview
Thanks to _why
Instance Method Summary collapse
- #_? ⇒ Boolean
- #in?(enum) ⇒ Boolean
- #is_one_of?(*args) ⇒ Boolean
-
#meta_def(name, &blk) ⇒ Object
Adds methods to a metaclass.
- #meta_eval(src = nil, &blk) ⇒ Object
- #metaclass ⇒ Object
- #metaclass_eval(src = nil, &blk) ⇒ Object
- #not_in?(enum) ⇒ Boolean
- #try(*args, &block) ⇒ Object
Instance Method Details
#_? ⇒ Boolean
26 27 28 |
# File 'lib/hobo_support/methodcall.rb', line 26 def _?() self end |
#in?(enum) ⇒ Boolean
81 82 83 |
# File 'lib/hobo_support/enumerable.rb', line 81 def in?(enum) !enum.nil? && enum.include?(self) end |
#is_one_of?(*args) ⇒ Boolean
16 17 18 |
# File 'lib/hobo_support.rb', line 16 def is_one_of?(*args) args.any? {|a| is_a?(a) } end |
#meta_def(name, &blk) ⇒ Object
Adds methods to a metaclass
24 25 26 |
# File 'lib/hobo_support/metaid.rb', line 24 def (name, &blk) { define_method name, &blk } end |
#meta_eval(src = nil, &blk) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/hobo_support/metaid.rb', line 7 def (src=nil, &blk) if src .instance_eval(src) else .instance_eval &blk end end |
#metaclass ⇒ Object
5 |
# File 'lib/hobo_support/metaid.rb', line 5 def ; class << self; self; end; end |
#metaclass_eval(src = nil, &blk) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/hobo_support/metaid.rb', line 15 def (src=nil, &blk) if src .class_eval(src) else .class_eval &blk end end |
#not_in?(enum) ⇒ Boolean
85 86 87 |
# File 'lib/hobo_support/enumerable.rb', line 85 def not_in?(enum) enum.nil? || !enum.include?(self) end |
#try(*args, &block) ⇒ Object
30 31 32 |
# File 'lib/hobo_support/methodcall.rb', line 30 def try(*args, &block) HoboSupport.hobo_try(self, *args, &block) end |