Sha256: 0275fd633f5259629387ecd78e8aa8b43adbe182090919699ce96fd89a48c144
Contents?: true
Size: 910 Bytes
Versions: 2
Compression:
Stored size: 910 Bytes
Contents
module Analytics module Serializer class Base def initialize(src) @src = src end # An abstract method used to save a file at provided path. def save(_path) raise NotImplementedError, 'Abstract Method' end end end end # String extensions - will be moved somewhere else. Somewhere.. class String # Converts a string to snake_case. def snake_case gsub(/::/, '/') .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2') .gsub(/([a-z\d])([A-Z])/, '\1_\2') .tr('-', '_') .downcase end # Converts a string to camelCase. def camel_case gsub(' ', '_') .gsub('-', '_') .snake_case .split('_') .inject([]) { |buffer, e| buffer.push(buffer.empty? ? e : e.capitalize) } .join end # Converts a string to PascalCase. def pascal_case val = camel_case val[0] = val[0].capitalize val end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ios_analytics_cli-1.1.0 | lib/ios_analytics_cli/serializers/base.rb |
ios_analytics_cli-1.0.0 | lib/ios_analytics_cli/serializers/base.rb |