I have come accross
OpenStruct quite a lot recently as I venture into other peoples code on GitHub or watching a few conferences online.
Can somebody please explain what is is and why you use it?
I have seen
Struct also, could someone explain what this is too and also what the difference between
Struct are ?
I saw this recently in a conference @benorenstein did last year at Rocky Mountain Ruby some of the code was this:
class DateRange < Struct.new(:start_date, :end_date) end class Order < OpenStruct def placed_between?(date_range) placed_at >= date_range.start_date && place_at <= date_range.end_date end end