move from known attributes to volotile (white to blacklist)
This commit is contained in:
parent
6b19b915a1
commit
2f5ed43073
@ -1,6 +1,6 @@
|
||||
require_relative "util"
|
||||
require_relative "members"
|
||||
require_relative "known"
|
||||
require_relative "volotile"
|
||||
require_relative "writer"
|
||||
require_relative "array"
|
||||
require_relative "occurence"
|
||||
@ -10,11 +10,6 @@ Symbol.class_eval do
|
||||
io.write ":#{to_s}"
|
||||
end
|
||||
end
|
||||
NilClass.class_eval do
|
||||
def to_sof(io,members)
|
||||
io.write "nil"
|
||||
end
|
||||
end
|
||||
TrueClass.class_eval do
|
||||
def to_sof(io , members)
|
||||
io.write "true"
|
||||
|
@ -1,13 +0,0 @@
|
||||
module Sof
|
||||
class Known
|
||||
@@mapping = {
|
||||
Virtual::MethodDefinition => [:name , :args , :receiver , :return_type , :blocks]
|
||||
}
|
||||
def self.is clazz
|
||||
@@mapping.has_key? clazz
|
||||
end
|
||||
def self.attributes clazz
|
||||
@@mapping[clazz]
|
||||
end
|
||||
end
|
||||
end
|
@ -15,11 +15,8 @@ module Sof
|
||||
end
|
||||
|
||||
def attributes_for object
|
||||
if( Known.is( object.class ))
|
||||
Known.attributes(object.class)
|
||||
else
|
||||
object.instance_variables.collect{|i| i.to_s[1..-1].to_sym } # chop of @
|
||||
end
|
||||
attributes = object.instance_variables.collect{|i| i.to_s[1..-1].to_sym } # chop of @
|
||||
attributes - Volotile.attributes(object.class)
|
||||
end
|
||||
|
||||
end
|
||||
|
10
lib/sof/volotile.rb
Normal file
10
lib/sof/volotile.rb
Normal file
@ -0,0 +1,10 @@
|
||||
module Sof
|
||||
class Volotile
|
||||
@@mapping = {
|
||||
Virtual::MethodDefinition => []
|
||||
}
|
||||
def self.attributes clazz
|
||||
@@mapping[clazz] || []
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user