Пытаюсь разобраться с простыми конструкциями руби. Получаю массив из json данныэ response = JSON.parse(RESPONSE) пытаюсь его обработать таким образом
Код | class GetFilm attr_accessor :group_theaters :parameter
def initialize(*catalogue) title = self.get_data(catalogue, "film") @group_theaters = title end
def get_data(*catalogue, parameter) @array = catalogue.length end end
|
Отправляю данные
Код | s = GetFilm.new(response.values) puts s.group_theaters
|
Почему-то catalogue.length у меня всегда 1, изначально json имеет вид
Код | '{"catalog": { "1": { "title": "Left Behind", "theaters": ["Ukraine", "Big World"], }, "2": { "title": "Into the storm", "theaters": ["Ukraine", "Big World"], } }}' Что делаю не так?
|
|