Module: Vizier::Support

Included in:
Attributes, Link, Node, SubGraph
Defined in:
lib/support/vizier.rb

Overview

:nodoc:all

Defined Under Namespace

Modules: ClassMethods, Finder

Constant Summary collapse

'a-zA-Z0-9_'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



41
42
43
# File 'lib/support/vizier.rb', line 41

def self.included( klass )
  klass.extend( ClassMethods )
end

Instance Method Details

#attributesObject



23
24
25
# File 'lib/support/vizier.rb', line 23

def attributes
  (@attributes ||= {}).extend( Attributes )
end

#attributes=(attrs) ⇒ Object



19
20
21
# File 'lib/support/vizier.rb', line 19

def attributes=( attrs )
  @attributes = attrs.symbolize_keys!.extend( Attributes )
end

#legal?(str) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
30
# File 'lib/support/vizier.rb', line 27

def legal?( str )
  str = str.to_s
  str =~ /^[#{LEGAL_CHARS}]+$/ && str == str.split
end

#quote(str) ⇒ Object



36
37
38
39
# File 'lib/support/vizier.rb', line 36

def quote( str )
  return str if legal?( str )
  '"' + str.to_s.gsub(/"/,'\"') + '"'
end

#sanitize(str) ⇒ Object



32
33
34
# File 'lib/support/vizier.rb', line 32

def sanitize(str)
  sanitize( str )
end