lib/snuffle/node.rb in snuffle-0.9.1 vs lib/snuffle/node.rb in snuffle-0.10.1

- old
+ new

@@ -9,10 +9,11 @@ scope :by_id, lambda{|id| where(:id => id)} scope :by_type, lambda{|type| where(:type => type)} scope :with_parent, lambda{|parent_id| where(parent_id: parent_id) } scope :hashes, {type: :hash} + scope :methods, {is_method: true} def self.nil new(type: :nil) end @@ -29,9 +30,13 @@ @siblings ||= Snuffle::Node.by_type(self.type).to_a - [self] end def children Snuffle::Node.where(parent_id: self.id) + end + + def is_method + self.type == :def || self.type == :defs end def inspect { id: self.id, \ No newline at end of file