Class: RailsClafer::SubClafer

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(clafer, card) ⇒ SubClafer

Returns a new instance of SubClafer.



9
10
11
12
13
14
# File 'lib/rails_clafer/sub_clafer.rb', line 9

def initialize(clafer, card)
  @name = clafer.name
  @clafer = clafer
  @card = card
  @gcard = GCard.new
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/rails_clafer/sub_clafer.rb', line 16

def method_missing(name, *args)
  if @clafer.respond_to?(name)
    @clafer.send(name, *args)
  else
    super
  end
end

Instance Attribute Details

#cardObject

Returns the value of attribute card.



8
9
10
# File 'lib/rails_clafer/sub_clafer.rb', line 8

def card
  @card
end

#claferObject

Returns the value of attribute clafer.



8
9
10
# File 'lib/rails_clafer/sub_clafer.rb', line 8

def clafer
  @clafer
end

#gcardObject

Returns the value of attribute gcard.



8
9
10
# File 'lib/rails_clafer/sub_clafer.rb', line 8

def gcard
  @gcard
end

#nameObject

Returns the value of attribute name.



8
9
10
# File 'lib/rails_clafer/sub_clafer.rb', line 8

def name
  @name
end

Class Method Details

.from_assoc(assoc, clafer) ⇒ Object



4
5
6
# File 'lib/rails_clafer/sub_clafer.rb', line 4

def from_assoc(assoc, clafer)
  new clafer, assoc.dst_card
end

Instance Method Details

#childrenObject



24
25
26
# File 'lib/rails_clafer/sub_clafer.rb', line 24

def children
  @clafer.children			
end