Sha256: 71c8f134cde558b0ecb876f5fcccae0f2fd95589c8f7ed2eefb1075290cf6d2f

Contents?: true

Size: 754 Bytes

Versions: 21

Compression:

Stored size: 754 Bytes

Contents

require 'yaml'
require 'json'

module Evrone
  module CI
    class Router
      class Travis

        module Serializable

          def self.included(base)
            base.extend ClassMethods
          end

          def to_yaml
            YAML.dump(attributes)
          end

          def to_hash
            attributes
          end

          module ClassMethods

            def from_file(file)
              if File.readable? file
                from_yaml File.read(file)
              end
            end

            def from_yaml(yaml)
              from_attributes YAML.load(yaml)
            end

            def from_attributes(attrs)
              Travis.new attrs
            end

          end

        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
evrone-ci-router-0.2.0.pre0 lib/evrone/ci/router/travis/serializable.rb