Module: PrivateStruct

Defined in:
lib/private_struct.rb,
lib/private_struct/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.new(*attributes, &block) ⇒ Object


4
5
6
7
8
9
10
11
12
# File 'lib/private_struct.rb', line 4

def self.new(*attributes, &block)
  struct = Struct.new(*attributes, &block)
  struct.instance_eval do
    attributes.each do |attribite|
      private attribite, "#{attribite}="
    end
  end
  struct
end