Class: Languages::RubySyntax
- Defined in:
- lib/kuniri/language/ruby/ruby_syntax.rb
Overview
Handling the ruby syntax for extract information.
Instance Attribute Summary
Attributes inherited from Language
#attributeHandler, #attributeState, #classHandler, #classState, #commentHandler, #commentState, #conditionalHandler, #conditionalState, #constructorHandler, #constructorState, #endBlockHandler, #externRequirementHandler, #fileElements, #flagFunctionBehaviour, #functionHandler, #functionState, #idleState, #includeState, #methodHandler, #methodState, #moduleHandler, #moduleState, #name, #path, #previousState, #repetitionHandler, #repetitionState, #state, #string_comment_to_transfer, #variableHandler, #variableState
Instance Method Summary collapse
-
#analyse_source(pPath) ⇒ Object
Analyse source code.
-
#attribute_extract ⇒ Object
TODO: remove it.
-
#class_extract ⇒ Object
TODO: remove it.
-
#comment_extract ⇒ Object
TODO: remove it.
-
#extern_requirement_extract ⇒ Object
TODO: remove it.
-
#get_classes ⇒ Object
TODO: remove it.
-
#global_variable_extract ⇒ Object
TODO: remove it.
-
#initialize ⇒ RubySyntax
constructor
A new instance of RubySyntax.
-
#method_extract ⇒ Object
TODO: remove it.
Methods inherited from Language
#attribute_capture, #class_capture, #conditional_capture, #constructor_capture, #function_capture, #get_name, #get_path, #handle_line, #idle_capture, #include_capture, #method_capture, #module_capture, #rewind_state, #set_source, #set_state, #variable_capture
Constructor Details
#initialize ⇒ RubySyntax
Returns a new instance of RubySyntax.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/kuniri/language/ruby/ruby_syntax.rb', line 24 def initialize super @externRequirementHandler = Languages::Ruby::ExternRequirementRuby.new @variableHandler = Languages::Ruby::VariableGlobalRuby.new @functionHandler = Languages::Ruby::FunctionBehaviorRuby.new @moduleHandler = Languages::Ruby::ModuleNamespaceRuby.new @classHandler = Languages::Ruby::ClassRuby.new @attributeHandler = Languages::Ruby::AttributeRuby.new @endBlockHandler = Languages::Ruby::EndBlockRuby.new @methodHandler = Languages::Ruby::FunctionBehaviorRuby.new @constructorHandler = Languages::Ruby::ConstructorRuby.new @conditionalHandler = Languages::Ruby::ConditionalRuby.new @repetitionHandler = Languages::Ruby::RepetitionRuby.new @commentHandler = Languages::Ruby::CommentRuby.new @visibility = "public" end |
Instance Method Details
#analyse_source(pPath) ⇒ Object
Analyse source code.
43 44 45 46 47 48 |
# File 'lib/kuniri/language/ruby/ruby_syntax.rb', line 43 def analyse_source(pPath) @name = File.basename(pPath, ".*") @path = File.dirname(pPath) analyse_first_step(pPath) #self.analyse_second_step end |
#attribute_extract ⇒ Object
TODO: remove it.
75 76 77 |
# File 'lib/kuniri/language/ruby/ruby_syntax.rb', line 75 def attribute_extract return @currentClass.get_attributes end |
#class_extract ⇒ Object
TODO: remove it.
70 71 72 |
# File 'lib/kuniri/language/ruby/ruby_syntax.rb', line 70 def class_extract return @currentClass end |
#comment_extract ⇒ Object
TODO: remove it.
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/kuniri/language/ruby/ruby_syntax.rb', line 51 def comment_extract all_comments = Array.new #Find a simple Ruby comment with '#' @source.scan(/#(.*)/).each do |comments| all_comments.push(comments[0]) end #Find multiple line comment. @source.scan(/^=begin(.*?)^=end/m).each do |comment| all_comments.push(comment[0].lstrip) end return all_comments end |
#extern_requirement_extract ⇒ Object
TODO: remove it.
85 86 87 |
# File 'lib/kuniri/language/ruby/ruby_syntax.rb', line 85 def extern_requirement_extract return @externRequirements end |
#get_classes ⇒ Object
TODO: remove it.
90 91 |
# File 'lib/kuniri/language/ruby/ruby_syntax.rb', line 90 def get_classes end |
#global_variable_extract ⇒ Object
TODO: remove it.
80 81 82 |
# File 'lib/kuniri/language/ruby/ruby_syntax.rb', line 80 def global_variable_extract raise NotImplementedError end |
#method_extract ⇒ Object
TODO: remove it.
65 66 67 |
# File 'lib/kuniri/language/ruby/ruby_syntax.rb', line 65 def method_extract return @currentClass.get_methods end |