class TokyoMetro::Factory::Get::Api::MetaClass::Fundamental::Generator::NewArray::Find

Public Class Methods

new( ary ) click to toggle source
# File lib/tokyo_metro/factory/get/api/meta_class/fundamental/generator/new_array/find.rb, line 3
def initialize( ary )
  @ary = ary

  check_validity_of_ary
  check_length_of_ary
  set_namespace
end
process( ary ) click to toggle source
# File lib/tokyo_metro/factory/get/api/meta_class/fundamental/generator/new_array/find.rb, line 11
def self.process( ary )
  if ary.empty?
    return ::Array.new
  else
    self.new( ary ).process
  end
end

Private Instance Methods

check_length_of_ary() click to toggle source
# File lib/tokyo_metro/factory/get/api/meta_class/fundamental/generator/new_array/find.rb, line 21
def check_length_of_ary
  raise unless @ary.length == 1
end
namespace_basename() click to toggle source
# File lib/tokyo_metro/factory/get/api/meta_class/fundamental/generator/new_array/find.rb, line 29
def namespace_basename
  _rdf_type_from_api = rdf_type_from_api

  _namespace_basename = namespace_basenames.find { | item | ::TokyoMetro::Api.const_get( item ).rdf_type == _rdf_type_from_api }
  raise unless _namespace_basename.present?
  _namespace_basename
end
namespace_basenames() click to toggle source
# File lib/tokyo_metro/factory/get/api/meta_class/fundamental/generator/new_array/find.rb, line 43
def namespace_basenames
  [
    :Fare , :PassengerSurvey , :Point ,
    :Station , :StationFacility , :RailwayLine ,
    :StationTimetable , :TrainTimetable ,
    :TrainLocation , :TrainOperation ,
    :MlitRailwayLine , :MlitStation
  ]
end
rdf_type_from_api() click to toggle source
# File lib/tokyo_metro/factory/get/api/meta_class/fundamental/generator/new_array/find.rb, line 37
def rdf_type_from_api
  rdf = @ary.first[ "@type" ]
  raise unless rdf.present?
  rdf
end
set_namespace() click to toggle source
# File lib/tokyo_metro/factory/get/api/meta_class/fundamental/generator/new_array/find.rb, line 25
def set_namespace
  @namespace = ::TokyoMetro::Api.const_get( namespace_basename )
end