Sha256: dfbb2925b79b4ad7940c884059b344e53f0068e7983e0ac0a1d7e3177aba0d03
Contents?: true
Size: 654 Bytes
Versions: 3
Compression:
Stored size: 654 Bytes
Contents
require 'phut/syntax/directive' module Phut class Syntax # The 'vswitch(name) { ...attributes... }' directive. class VswitchDirective < Directive attribute :port def initialize(alias_name, &block) @attributes = { name: alias_name, port: 6653 } instance_eval(&block) end def dpid(value) dpid = if value.is_a?(String) && /^0x/=~ value value.hex else value.to_i end @attributes[:dpid] = dpid @attributes[:name] ||= format('%#x', @attributes[:dpid]) end alias_method :datapath_id, :dpid end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
phut-0.7.7 | lib/phut/syntax/vswitch_directive.rb |
phut-0.7.6 | lib/phut/syntax/vswitch_directive.rb |
phut-0.7.5 | lib/phut/syntax/vswitch_directive.rb |