Sha256: f9847445951f88657f2d4785927134769b63d5af6ac7f51d9251402921b75fa3
Contents?: true
Size: 741 Bytes
Versions: 4
Compression:
Stored size: 741 Bytes
Contents
require 'yaml' require 'json' require 'inifile' module DuperVisor # # This class is responsible for taking the input and converting it into a # Hash. It can also be initialized with the Hash, in which no conversion is performed. # # The +result+ class Content attr_accessor :body, :format, :parse_result def initialize(body: nil, format: nil) self.body = body self.format = format self.parse_result = {} end def self.to_format_from(hash, format) format_class = ::DuperVisor::Formats::Base.formats[format] raise ArgumentError.new("No format #{format} found") unless format_class Content.new(body: format_class.to.call(hash), format: format_class.format) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
dupervisor-1.0.5 | lib/dupervisor/content.rb |
dupervisor-1.0.4 | lib/dupervisor/content.rb |
dupervisor-1.0.3 | lib/dupervisor/content.rb |
dupervisor-1.0.2 | lib/dupervisor/content.rb |