Module: RubyCodeAPI::Misc::Helper
- Included in:
- RubyCodeAPI::Manipulation
- Defined in:
- lib/manipulation/helpers.rb
Instance Method Summary collapse
Instance Method Details
#elemental? ⇒ Boolean
12 13 14 |
# File 'lib/manipulation/helpers.rb', line 12 def elemental? respond_to?(:body) || respond_to?(:elements) end |
#find_index(obj) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/manipulation/helpers.rb', line 4 def find_index(obj) get_elements.each_with_index do |elem, i| if elem == obj return i end end end |
#get_elements ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/manipulation/helpers.rb', line 16 def get_elements case self when Ruby::Class body.elements else elements end end |
#object ⇒ Object
25 26 27 |
# File 'lib/manipulation/helpers.rb', line 25 def object self.respond_to?(:block) ? self.block : self end |