Sha256: 5111ef160f7d044e7534103eebf609d6713ef08b8df5ed6efe3f1c545a55154d

Contents?: true

Size: 594 Bytes

Versions: 9

Compression:

Stored size: 594 Bytes

Contents

module ProMotion
  module Conversions
    
    # For converting, for example, from :contacts to UITabBarSystemItemContacts
    # Unfortunately, this only works if the symbol is defined in your code.
    # So, for now, we'll have to do it manually.
    def convert_symbol(symbol, prefix)
      Object.const_get("#{prefix}#{camel_case symbol}")
    end
    
    def objective_c_method_name(str)
      str.split('_').inject([]){ |buffer,e| buffer.push(buffer.empty? ? e : e.capitalize) }.join
    end
    
    def camel_case(str)
      str.split('_').map(&:capitalize).join
    end
    
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ProMotion-1.1.2 lib/ProMotion/extensions/conversions.rb
ProMotion-1.1.1 lib/ProMotion/extensions/conversions.rb
ProMotion-1.1.0 lib/ProMotion/extensions/conversions.rb
ProMotion-1.1.0.rc1 lib/ProMotion/extensions/conversions.rb
ProMotion-1.0.4 lib/ProMotion/extensions/conversions.rb
ProMotion-1.0.3 lib/ProMotion/extensions/conversions.rb
ProMotion-1.0.2 lib/ProMotion/extensions/conversions.rb
ProMotion-1.0.1 lib/ProMotion/extensions/conversions.rb
ProMotion-1.0.0 lib/ProMotion/extensions/conversions.rb