lib/snuffle/node.rb in snuffle-0.11.1 vs lib/snuffle/node.rb in snuffle-0.12.0
- old
+ new
@@ -10,15 +10,20 @@
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}
+ scope :non_sends, {is_send: false}
def self.nil
new(type: :nil)
end
+ def self.not_a(type)
+ select{|node| node.type != type}
+ end
+
def initialize(*args, &block)
@id = SecureRandom.uuid
super
end
@@ -34,9 +39,13 @@
Snuffle::Node.where(parent_id: self.id)
end
def is_method
self.type == :def || self.type == :defs
+ end
+
+ def is_send
+ self.type == :send
end
def inspect
{
id: self.id,
\ No newline at end of file