Class: CodeModels::Ruby::InfoExtraction::RubySpecificInfoExtractionLogic

Inherits:
Object
  • Object
show all
Defined in:
lib/codemodels/ruby/info_extraction.rb

Instance Method Summary collapse

Instance Method Details

#concat(a, b) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/codemodels/ruby/info_extraction.rb', line 67

def concat(a,b)
  # if both the words are capitalized then do not insert the 
  # underscore
  #if (a.capitalize==a) && (b.capitalize==b)
  #  return a+b
  #end

  # I use the underscore also for MyIdentifier so that I match
  # my_identifier

  a+'_'+b
end

#terms_containing_value?(value) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
51
52
# File 'lib/codemodels/ruby/info_extraction.rb', line 48

def terms_containing_value?(value)
  res = ::CodeModels::Java::InfoExtraction.is_camel_case_str(value) || CodeModels::Ruby::InfoExtraction.is_id_str(value)
  #puts "Contains terms? '#{value}' : #{res} #{::CodeModels::Java::InfoExtraction.is_camel_case_str(value)} #{CodeModels::Ruby::InfoExtraction.is_id_str(value)}"
  res
end

#to_words(value) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/codemodels/ruby/info_extraction.rb', line 54

def to_words(value)
  if ::CodeModels::Java::InfoExtraction.is_camel_case_str(value)
    res = ::CodeModels::Java::InfoExtraction.camel_to_words(value)
    res.each {|v| raise "Camel case to words produced a nil" if v==nil}
    raise "No words found using the camel case to words" if res.count==0
  else
    res = CodeModels::Ruby::InfoExtraction.id_to_words(value)
    res.each {|v| raise "Id to words produced a nil" if v==nil}
    raise "No words found using the id to words on '#{value}'" if res.count==0
  end    
  res
end