Class: SistemKebut::Paragraph::MejaSekat::Unit

Inherits:
Object
  • Object
show all
Defined in:
lib/sks/paragraph/mejasekat.rb

Defined Under Namespace

Classes: JumlahKolomTidakSama

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kolom, *args) ⇒ Unit

Returns a new instance of Unit.



17
18
19
20
21
22
23
# File 'lib/sks/paragraph/mejasekat.rb', line 17

def initialize(kolom, *args)
  berat = args.clone
  @setelan = berat.last.kind_of?(Hash) ? berat.pop : Hash.new
  kini = berat.length
  raise JumlahKolomTidakSama.new(kini, kolom) if kini != kolom
  @konten = berat
end

Instance Attribute Details

#kontenObject

Returns the value of attribute konten.



14
15
16
# File 'lib/sks/paragraph/mejasekat.rb', line 14

def konten
  @konten
end

#setelanObject (readonly)

Returns the value of attribute setelan.



15
16
17
# File 'lib/sks/paragraph/mejasekat.rb', line 15

def setelan
  @setelan
end

Instance Method Details

#[](id) ⇒ Object



25
26
27
# File 'lib/sks/paragraph/mejasekat.rb', line 25

def [](id)
  @konten[id]
end

#tiap(&block) ⇒ Object



29
30
31
# File 'lib/sks/paragraph/mejasekat.rb', line 29

def tiap(&block)
  @konten.each(&block)
end