Class: Vizier::Node
Constant Summary
Constant Summary
Constants included from Support
Instance Attribute Summary (collapse)
-
- (Object) fields
Returns the value of attribute fields.
-
- (Object) name
Returns the value of attribute name.
-
- (Object) object
Returns the value of attribute object.
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (Node) initialize(name = nil, attrs = {})
constructor
A new instance of Node.
- - (Object) to_s
- - (Object) to_str
Methods included from Support
#attributes, #attributes=, included, #legal?, #quote, #sanitize
Methods inherited from Base
Constructor Details
- (Node) initialize(name = nil, attrs = {})
A new instance of Node
132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/support/vizier.rb', line 132 def initialize( name = nil, attrs={} ) self.attributes = attrs if name.is_a?( String ) self.name = name @label = attrs.delete(:label) || name else @object = name self.name = Node.make_name( @object ) @label = attrs.delete(:label) || Node.first_response( @object, :name, :identifier, :label ) || name end end |
Instance Attribute Details
- (Object) fields
Returns the value of attribute fields
129 130 131 |
# File 'lib/support/vizier.rb', line 129 def fields @fields end |
- (Object) name
Returns the value of attribute name
130 131 132 |
# File 'lib/support/vizier.rb', line 130 def name @name end |
- (Object) object
Returns the value of attribute object
128 129 130 |
# File 'lib/support/vizier.rb', line 128 def object @object end |
Class Method Details
+ (Object) first_response(obj, *method_names)
148 149 150 151 |
# File 'lib/support/vizier.rb', line 148 def self.first_response obj, *method_names responder = method_names.flatten.detect { |m| obj.respond_to?(m) } obj.send( responder ) unless responder.nil? end |
+ (Object) make_name(obj)
144 145 146 |
# File 'lib/support/vizier.rb', line 144 def self.make_name( obj ) sanitize [ obj.class, first_response( obj, :name, :identifier, :id, :hash)].join('_') end |