Skip to content

LoVka/ruby_test_task_closed_struct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Ruby test task ClosedStruct

Write class ClosedStruct that can be initialized with zero arguments or one hash argument. Should raise ArgumentError in initialized with one argument that is not a Hash.

Initialized object should have attribute readers and writers for all keys provided in hash on initialization. But should not have readers and writers for any other attributes, e.g.:

object = ClosedStruct.new({ name: "John Smith", age: 70, pension: 300 })
object.pension # => 300
object.pension = 400
object.pension # => 400
object.surname # => NoMethodError
object.surname = "Smith" # => NoMethodError

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages