Class: Sirens::MethodModel

Inherits:
Object
  • Object
show all
Defined in:
lib/sirens/models/method_model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMethodModel

Initializing



8
9
10
11
12
13
14
# File 'lib/sirens/models/method_model.rb', line 8

def initialize()
    super()

    @method = ValueModel.new
    @location = ValueModel.new
    @source_code = ValueModel.new
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



16
17
18
# File 'lib/sirens/models/method_model.rb', line 16

def location
  @location
end

#methodObject (readonly)

Returns the value of attribute method.



16
17
18
# File 'lib/sirens/models/method_model.rb', line 16

def method
  @method
end

#source_codeObject (readonly)

Returns the value of attribute source_code.



16
17
18
# File 'lib/sirens/models/method_model.rb', line 16

def source_code
  @source_code
end

Instance Method Details

#set_method(method) ⇒ Object



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

def set_method(method)
    if method.nil?
        @method.set_value(nil)
        @location.set_value(nil)
        @source_code.set_value(nil)

        return
    end

    @method.set_value(method)

    @location.set_value(method.source_location)

    @source_code.set_value(method.source_code)
end