Class: Element

Inherits:
Object
  • Object
show all
Defined in:
lib/Appolo/Models/element.rb

Overview

This class represent the top abstraction of an element. Specifies common behavior.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, s_name, links, type_for_links) ⇒ Element

initializes the common behavior this class specifies.



12
13
14
15
16
# File 'lib/Appolo/Models/element.rb', line 12

def initialize (id, s_name, links, type_for_links)
  @id = id
  @short_name = s_name
  @links = Links.new(links, type_for_links) unless links.nil?
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/Appolo/Models/element.rb', line 8

def id
  @id
end

Returns the value of attribute links.



8
9
10
# File 'lib/Appolo/Models/element.rb', line 8

def links
  @links
end

#short_nameObject (readonly)

Returns the value of attribute short_name.



8
9
10
# File 'lib/Appolo/Models/element.rb', line 8

def short_name
  @short_name
end

Instance Method Details

#check_json_info(json_info) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/Appolo/Models/element.rb', line 18

def check_json_info(json_info)
  if json_info.is_a? Hash
    json_data = json_info
  else
    json_data = JSON.parse json_info
  end
  json_data
end