Sha256: 898e2a7ec4c6123e65a51ebbe391d7f8e1d6e466841eb113019e1aa9d296514d
Contents?: true
Size: 889 Bytes
Versions: 3
Compression:
Stored size: 889 Bytes
Contents
# encoding: utf-8 require_relative "base" module Hexx module Helpers # @api hide # Adds setter and getter for the instance parameter. # # @example # # Providing that MyClass#params returns a hash # Parameter.add MyClass, :name # object = MyClass.new # # object.params["name"] # => nil # object.name # => nil # # object.params["name"] = "Ivan" # object.params["name"] # => "Ivan" # object.name # => "Ivan" # # object.name = "Ivo" # object.params["name"] # => "Ivo" # object.name # => "Ivo" class Parameter < Base private # @api hide def setter "def #{ name }; params[\"#{ name }\"]; end" end # @api hide def getter "def #{ name }=(value); params[\"#{ name }\"] = value; end" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hexx-6.0.2 | lib/hexx/helpers/parameter.rb |
hexx-6.0.1 | lib/hexx/helpers/parameter.rb |
hexx-6.0.0 | lib/hexx/helpers/parameter.rb |