module RouteNGNClient::Model::ClassMethods

Attributes

children[RW]
only_children[RW]
parents[RW]

Public Instance Methods

belongs_to(*args) click to toggle source
# File lib/routengn_client/model.rb, line 41
def belongs_to(*args)
  @parents = args.collect do |arg|
    "RouteNGNClient::#{arg.to_s.classify}".constantize
  end
end
from_hash(h) click to toggle source
# File lib/routengn_client/model.rb, line 33
def from_hash(h)
  new h
end
from_json(s) click to toggle source
# File lib/routengn_client/model.rb, line 37
def from_json(s)
  from_hash MultiJson.load(s, :symbolize_keys => true)
end
has_many(*args) click to toggle source
# File lib/routengn_client/model.rb, line 47
def has_many(*args)
  @children = args.collect do |arg|
    "RouteNGNClient::#{arg.to_s.classify}".constantize
  end
end
has_one(*args) click to toggle source
# File lib/routengn_client/model.rb, line 53
def has_one(*args)
  @only_children = args.collect do |arg|
    "RouteNGNClient::#{arg.to_s.classify}".constantize
  end
end