Sha256: 2b98234ba98219b5f6a30c75aa7beab03ce84100054e5d355128b0346eefdcea
Contents?: true
Size: 553 Bytes
Versions: 2
Compression:
Stored size: 553 Bytes
Contents
module ReportsKit class Utils def self.string_to_class_method(string, string_identifer) class_name, method_name = string.split('.') raise ArgumentError.new("The #{string_identifer} value should be a class method with a format of MyClass.my_method") unless class_name && method_name klass = class_name.constantize raise ArgumentError.new("The #{string_identifer} class (#{class_name}) does not respond to a method named \"#{method_name}\"") unless klass.respond_to?(method_name) [klass, method_name] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
reports_kit-0.7.1 | lib/reports_kit/utils.rb |
reports_kit-0.7.0 | lib/reports_kit/utils.rb |