Sha256: b688e2e441503d397034960dbb3c2a4814041f8ae1b00c4aa2f59e4e344a0fa3
Contents?: true
Size: 876 Bytes
Versions: 3
Compression:
Stored size: 876 Bytes
Contents
# frozen_string_literal: true module Shiyo # The module to provide conversion methods. module Conversion # rubocop:disable Naming/MethodName # Ensures the object to be a Shiyo compatible object. # @param object Any object. # @raise [Shiyo::ConversionError] def Specification(object) check_compatibility_of(object) end # rubocop:enable Naming/MethodName module_function # A private method used by `#Specification()`. # @!visibility private def check_compatibility_of(object) object.to_shiyo rescue NoMethodError => e raise Shiyo::Error::IncompatibleObject, <<~MESSAGE #{e.message} Can't convert #{object} into Shiyo compatible object. The class of the object must include `Shiyo::Specification`, or have `#to_shiyo()` for compatibility. MESSAGE end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
shiyo-0.1.2 | lib/shiyo/conversion.rb |
shiyo-0.1.1 | lib/shiyo/conversion.rb |
shiyo-0.1.0 | lib/shiyo/conversion.rb |