lib/validation/adjustment.rb
def PARSE(parser)
      if !::Integer.equal?(parser) and !parser.respond_to?(:parse)
        raise TypeError, 'wrong object for parser'
      end

      ->v{
        if ::Integer.equal? parser
          ::Kernel.Integer v
        else
          parser.parse(
            case v
            when String
              v
            when ->_{v.respond_to? :to_str}
              v.to_str
            when ->_{v.respond_to? :read}
              v.read
            else
              raise TypeError, 'wrong object for parsing source'
            end
          )
        end
      }
    end
def PARSE(parser)
      if !::Integer.equal?(parser) and !parser.respond_to?(:parse)
        raise TypeError, 'wrong object for parser'
      end

      ->v{
        if ::Integer.equal? parser
          ::Kernel.Integer v
        else
          parser.parse(
            case v
            when String
              v
            when ->_{v.respond_to? :to_str}
              v.to_str
            when ->_{v.respond_to? :read}
              v.read
            else
              raise TypeError, 'wrong object for parsing source'
            end
          )
        end
      }
    end
def PARSE ( parser ) if ! :: Integer . equal? ( parser ) and ! parser . respond_to? ( :parse ) raise TypeError , 'wrong object for parser' end -> v { if :: Integer . equal? parser :: Kernel . Integer v else parser . parse ( case v when String v when -> _ { v . respond_to? :to_str } v . to_str when -> _ { v . respond_to? :read } v . read else raise TypeError , 'wrong object for parsing source' end ) end } end
Accept any parser when that resopond to parse method.
 @param parser [#parse]
 @return [lambda]
Accept any parser when that resopond to parse method .