Class: Bishl::ScheduleLine

Inherits:
Object
  • Object
show all
Includes:
Virtus
Defined in:
lib/schedule_line.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeScheduleLine

Returns a new instance of ScheduleLine.



11
12
13
# File 'lib/schedule_line.rb', line 11

def initialize
  @team = ScheduleTeam.new
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *arguments, &block) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/schedule_line.rb', line 19

def method_missing(method, *arguments, &block)
  #puts method.to_s
  match = method.to_s =~/create_/
  #puts match
  if match
    name = method.to_s.split("_")[1]

    if(name=="position")
      self.send("position=", arguments.pop)
    else
      @team.send("#{name}=", arguments.pop)
    end
  else
    super
  end
end

Instance Attribute Details

#teamObject

Returns the value of attribute team.



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

def team
  @team
end

Instance Method Details

#hashifyObject



15
16
17
# File 'lib/schedule_line.rb', line 15

def hashify
  self.attributes.merge!({:team => @team.attributes})
end