Sha256: 764768668ca09e6943cb280e2ad29c87ddef85fa891f90065ddd13e8c8554dec
Contents?: true
Size: 852 Bytes
Versions: 3
Compression:
Stored size: 852 Bytes
Contents
## # Object extension to allow numbered LP variables to be initialised dynamically using the following # syntax. # # [Capitalized_varname][lp var type suffix] # # Where lp var type suffix is either _b for binary, _i for integer, or _f for float. # I.e # # Rating_i is the equivalent of Rating (type integer) # Is_happy_b is the equivalent of Is_happy (type binary/boolean) ## class << Object def const_missing(value) method_name = "#{value}" rescue "" if (("A".."Z").include?(method_name[0])) if(method_name.end_with?("b")) BV.send(method_name[0..(method_name[-2] == "_" ? -3 : -2)]) elsif(method_name.end_with?("i")) IV.send(method_name[0..(method_name[-2] == "_" ? -3 : -2)]) elsif(method_name.end_with?("f")) LV.send(method_name[0..(method_name[-2] == "_" ? -3 : -2)]) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rulp-0.0.6 | lib/extensions/object_extensions.rb |
rulp-0.0.5 | lib/extensions/object_extensions.rb |
rulp-0.0.2 | lib/extensions/object_extensions.rb |