class FFIGen::Name
Constants
- JAVA_KEYWORDS
- RUBY_KEYWORDS
Attributes
parts[R]
raw[R]
Public Class Methods
new(parts, raw = nil)
click to toggle source
# File lib/ffi_gen.rb, line 188 def initialize(parts, raw = nil) @parts = parts @raw = raw end
Public Instance Methods
format(*modes, keyword_blacklist)
click to toggle source
# File lib/ffi_gen.rb, line 193 def format(*modes, keyword_blacklist) parts = @parts.dup parts.map!(&:downcase) if modes.include? :downcase parts.map!(&:upcase) if modes.include? :upcase parts.map! { |s| s[0].upcase + s[1..-1] } if modes.include? :camelcase parts[0] = parts[0][0].downcase + parts[0][1..-1] if modes.include? :initial_downcase str = parts.join(modes.include?(:underscores) ? "_" : "") str.sub!(/^\d/, '_\0') # fix illegal beginnings str = "#{str}_" if keyword_blacklist.include? str str end
to_java_classname()
click to toggle source
# File lib/ffi_gen/java_output.rb, line 51 def to_java_classname format :camelcase, JAVA_KEYWORDS end
to_java_constant()
click to toggle source
# File lib/ffi_gen/java_output.rb, line 55 def to_java_constant format :upcase, :underscores, JAVA_KEYWORDS end
to_java_downcase()
click to toggle source
# File lib/ffi_gen/java_output.rb, line 47 def to_java_downcase format :camelcase, :initial_downcase, JAVA_KEYWORDS end
to_ruby_classname()
click to toggle source
# File lib/ffi_gen/ruby_output.rb, line 25 def to_ruby_classname format :camelcase, RUBY_KEYWORDS end
to_ruby_constant()
click to toggle source
# File lib/ffi_gen/ruby_output.rb, line 29 def to_ruby_constant format :upcase, :underscores, RUBY_KEYWORDS end
to_ruby_downcase()
click to toggle source
# File lib/ffi_gen/ruby_output.rb, line 21 def to_ruby_downcase format :downcase, :underscores, RUBY_KEYWORDS end