Class: OysterDb::Oyster

Inherits:
Object
  • Object
show all
Defined in:
lib/OysterDb.rb

Overview

Models a single oyster

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data_hash) ⇒ Oyster

Will create a new oyster object given a hash with all the data



11
12
13
14
15
16
17
18
# File 'lib/OysterDb.rb', line 11

def initialize(data_hash)
    @id = data_hash["id"]
    @grade = data_hash["grade"]
    @volume = data_hash["volume"]
    @length = data_hash["length"]
    @width = data_hash["width"]
    @height = data_hash["height"]
end

Instance Attribute Details

#gradeObject (readonly)

This will produce read methods for all the oyster properties



9
10
11
# File 'lib/OysterDb.rb', line 9

def grade
  @grade
end

#heightObject (readonly)

This will produce read methods for all the oyster properties



9
10
11
# File 'lib/OysterDb.rb', line 9

def height
  @height
end

#idObject (readonly)

This will produce read methods for all the oyster properties



9
10
11
# File 'lib/OysterDb.rb', line 9

def id
  @id
end

#lengthObject (readonly)

This will produce read methods for all the oyster properties



9
10
11
# File 'lib/OysterDb.rb', line 9

def length
  @length
end

#volumeObject (readonly)

This will produce read methods for all the oyster properties



9
10
11
# File 'lib/OysterDb.rb', line 9

def volume
  @volume
end

#widthObject (readonly)

This will produce read methods for all the oyster properties



9
10
11
# File 'lib/OysterDb.rb', line 9

def width
  @width
end