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.pre22 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre21 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre20 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre19 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre18 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre17 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre15 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre14 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre13 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre12 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre11 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre10 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre9 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre8 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre7 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre6 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre5 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre4 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre3 lib/evrone/ci/router/travis/serializable.rb
evrone-ci-router-0.2.0.pre1 lib/evrone/ci/router/travis/serializable.rb