Module: Vizier::Support
Overview
Defined Under Namespace
Modules: ClassMethods, Finder
Constant Summary
collapse
- LEGAL_CHARS =
'a-zA-Z0-9_'
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(klass) ⇒ Object
40
41
42
|
# File 'lib/support/vizier.rb', line 40
def self.included( klass )
klass.extend( ClassMethods )
end
|
Instance Method Details
#attributes ⇒ Object
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
27
28
29
|
# File 'lib/support/vizier.rb', line 27
def legal?( str )
str =~ /^[#{LEGAL_CHARS}]+$/ && str == str.split
end
|
#quote(str) ⇒ Object
35
36
37
38
|
# File 'lib/support/vizier.rb', line 35
def quote( str )
return str if legal?( str )
'"' + str.to_s.gsub(/"/,'\"') + '"'
end
|
#sanitize(str) ⇒ Object
31
32
33
|
# File 'lib/support/vizier.rb', line 31
def sanitize(str)
sanitize( str )
end
|