Class: Languages::Ruby::VariableBehaviourRuby
- Inherits:
-
VariableBehaviour
- Object
- VariableBehaviour
- Languages::Ruby::VariableBehaviourRuby
- Defined in:
- lib/kuniri/language/ruby/variable_behaviour_ruby.rb
Overview
Ruby Handling Ruby attributes
Instance Method Summary collapse
-
#handle_line_declaration(pString) ⇒ Object
protected
Override.
-
#handle_multiple_declaration_with_comma(pString) ⇒ Object
protected
Override.
-
#handle_multiple_declaration_with_equal(pString) ⇒ Object
protected
Override.
-
#prepare_final_string(pString) ⇒ Object
protected
Override.
-
#remove_unnecessary_information(pString) ⇒ Object
protected
Override.
Instance Method Details
#handle_line_declaration(pString) ⇒ Object (protected)
Override
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/kuniri/language/ruby/variable_behaviour_ruby.rb', line 61 def handle_line_declaration(pString) listOfAttributes = [] if pString =~ /=/ pString = pString.scan(/.*=/).join("") return nil if pString =~ /\./ end return nil if pString =~ /\./ pString = prepare_final_string(pString) attribute = yield(pString) listOfAttributes.push(attribute) return listOfAttributes end |
#handle_multiple_declaration_with_comma(pString) ⇒ Object (protected)
Override
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/kuniri/language/ruby/variable_behaviour_ruby.rb', line 27 def handle_multiple_declaration_with_comma(pString) listOfAttributes = [] pString = pString.split(",") pString.each do |variable| return nil if variable.scan(/=/).count > 1 variable = variable.scan(/.*=/).join("") if variable =~ /.*=/ return nil if variable =~ /\./ variable = prepare_final_string(variable) finalVariableElement = yield(variable) listOfAttributes.push(finalVariableElement) end return listOfAttributes end |
#handle_multiple_declaration_with_equal(pString) ⇒ Object (protected)
Override
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/kuniri/language/ruby/variable_behaviour_ruby.rb', line 46 def handle_multiple_declaration_with_equal(pString) listOfAttributes = [] pString = pString.split("=") pString.each do |variable| return nil if variable =~ /\./ variable = prepare_final_string(variable) attribute = yield(variable) listOfAttributes.push(attribute) end return listOfAttributes end |
#prepare_final_string(pString) ⇒ Object (protected)
Override
19 20 21 22 23 24 |
# File 'lib/kuniri/language/ruby/variable_behaviour_ruby.rb', line 19 def prepare_final_string(pString) if pString =~ /\s+|:|@|=/ return pString.gsub!(/\s+|:|@|=/,"") end return pString end |
#remove_unnecessary_information(pString) ⇒ Object (protected)
Override
13 14 15 16 |
# File 'lib/kuniri/language/ruby/variable_behaviour_ruby.rb', line 13 def remove_unnecessary_information(pString) return pString.gsub!(/\(.*\)/,"") if pString =~ /\(.*\)/ return pString end |