nice, made the change


On Fri, Feb 14, 2014 at 10:33 AM, Tony Spataro <notifications@github.com>wrote:

> In lib/right_agent/protocol_version_mixin.rb:
>
> > +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> > +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
> > +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
> > +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
> > +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> > +
> > +module RightScale
> > +
> > +  # Mixin for testing for availability of features in agents based on protocol version
> > +  module ProtocolVersionMixin
> > +
> > +    # Test whether given version of agent has the protocol version embedded in each
> > +    # packet (this is generally inferred by the version in the received packet not being
> > +    # Packet::DEFAULT_VERSION, which is true of all with version >= 12)
> > +    def can_put_version_in_packet?(version);      version && version != 0 end
> > +    def self.can_put_version_in_packet?(version); version && version != 0 end
>
> Dirty trick: you can save the double method definitions by doing this.
>
> module ProtocolVersionMixin
> extend self # mixes this module into its own eigenclass, i.e. the
> module-instance methods become callable as module methods.
> end
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/rightscale/right_agent/pull/104/files#r9758429>
> .
>