On Mon, Aug 08, 2016 at 10:17:56AM +0200, Ancor Gonzalez Sosa wrote: > On 08/08/2016 10:11 AM, Imobach González Sosa wrote: > > Hi all, > > > > AFAIK, you're using refinements in libstorage-ng so maybe some of you are > > interested in this short article: 'The Pros and Cons of Ruby > > Refinements'[1]. > > We are using it because libstorage-ng-ruby performs strict type checking > (it's a binding for C++, so it makes sense). That kills duck typing and > makes quite hard to use forwarders, decorators and other usual Ruby > techniques. Refinements allows us to decorate classes coming from > libstorage-ng without introducing other types.
You also refine standard ruby classes, e.g. Fixnum and Float in size_casts.rb. Having looked at some other refinements I must say that I don't consider them to be good. E.g. you extend 'Partition' with 'uuid' and 'label' that provide the UUID and label from the filesystem on the partition, see partition_attributes.rb. This will cause problems if the 'Partition' object should ever get a uuid or label function, which is possible since partitions on GPT have these attributes (putting aside label/name and UUID/GUID nitpicking). ciao Arvin -- Arvin Schnell, <[email protected]> Senior Software Engineer, Research & Development SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) Maxfeldstraße 5 90409 Nürnberg Germany -- To unsubscribe, e-mail: [email protected] To contact the owner, e-mail: [email protected]
