Sha256: 276481fd965a2e30fd29b614dc113fc75dc8f0732a6bc438e6a21a05fb0f6087

Contents?: true

Size: 577 Bytes

Versions: 3

Compression:

Stored size: 577 Bytes

Contents

require 'multi_json'

module NetworkExecutive
  class Program

    def name
      self.class.name.demodulize.underscore
    end

    def url
      ''
    end

    def as_json
      {
        name: name,
        url:  url
      }
    end

    def play
      MultiJson.encode( as_json )
    end

    class << self
      def inherited( klass )
        Network.programming << klass.new
      end

      # TODO: Is this the right place for this?
      def find_by_name( name )
        Network.programming.find do |p|
          p.name == name
        end
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
network_executive-0.0.4 app/models/network_executive/program.rb
network_executive-0.0.3 app/models/network_executive/program.rb
network_executive-0.0.2 app/models/network_executive/program.rb