Sha256: 16657f19c83489d82a7c4e4aa92704a2bb984316f2d361a5883a3c4a5aeae2dd

Contents?: true

Size: 578 Bytes

Versions: 2

Compression:

Stored size: 578 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

2 entries across 2 versions & 1 rubygems

Version Path
ProMotion-1.2.1 lib/ProMotion/extensions/conversions.rb
ProMotion-1.2.0 lib/ProMotion/extensions/conversions.rb