class Riml::ImportedClass
Constants
- ANCHOR_BEGIN
- ANCHOR_END
Attributes
name[R]
Public Class Methods
new(name)
click to toggle source
# File lib/riml/imported_class.rb, line 10 def initialize(name) @name = rm_modifier(name) end
Public Instance Methods
constructor()
click to toggle source
stubbed out constructor function
# File lib/riml/imported_class.rb, line 46 def constructor @contructor ||= begin DefNode.new('!', nil, scope_modifier, constructor_name, ['...'], [], Nodes.new([])) end end
constructor_name()
click to toggle source
# File lib/riml/imported_class.rb, line 52 def constructor_name "#{@name}Constructor" end
constructor_obj_name()
click to toggle source
# File lib/riml/imported_class.rb, line 56 def constructor_obj_name @name[0, 1].downcase + @name[1..-1] + "Obj" end
global_import?()
click to toggle source
# File lib/riml/imported_class.rb, line 37 def global_import? @name == '*' end
globbed?()
click to toggle source
an ImportedClass
is globbed?
if its name contains 1 or more ‘*’ characters.
# File lib/riml/imported_class.rb, line 20 def globbed? not @name.index('*').nil? end
imported?()
click to toggle source
# File lib/riml/imported_class.rb, line 14 def imported? true end
match?(class_name)
click to toggle source
returns MatchData or ‘nil`
# File lib/riml/imported_class.rb, line 25 def match?(class_name) match_regexp.match(rm_modifier(class_name)) end
match_regexp()
click to toggle source
returns Regexp
# File lib/riml/imported_class.rb, line 30 def match_regexp @match_regexp ||= begin normalized_glob = @name.gsub(/\*/, '.*?') Regexp.new(ANCHOR_BEGIN + normalized_glob + ANCHOR_END) end end
scope_modifier()
click to toggle source
# File lib/riml/imported_class.rb, line 41 def scope_modifier 'g:' end
Private Instance Methods
rm_modifier(class_name)
click to toggle source
# File lib/riml/imported_class.rb, line 62 def rm_modifier(class_name) class_name.sub(/g:/, '') end