class NestedSend::Checker

Public Class Methods

is_complete_string?(attribute) click to toggle source
# File lib/nested_send.rb, line 28
def self.is_complete_string?(attribute)
  start_char = attribute[0]
  end_char = attribute[-1]
  does_match = (start_char == end_char)
  return does_match if is_string_hash?(attribute)
  return false
end
is_string_hash?(attribute) click to toggle source
# File lib/nested_send.rb, line 19
def self.is_string_hash?(attribute)
  strings = ["'", '"']
  strings.include?(attribute[0]) && strings.include?(attribute[-1])
end
is_stringified_array?(attribute) click to toggle source
# File lib/nested_send.rb, line 24
def self.is_stringified_array?(attribute)
  return attribute.to_i.to_s == attribute
end
is_symbolized_hash?(attribute) click to toggle source
# File lib/nested_send.rb, line 15
def self.is_symbolized_hash?(attribute)
  return attribute[0] == ':'
end
kind_of_attribute(kind) click to toggle source
# File lib/nested_send.rb, line 10
def self.kind_of_attribute(kind)
  return :method if kind == '.'
  return :collection if kind == '['
end
kind_of_collection(attribute) click to toggle source
# File lib/nested_send.rb, line 3
def self.kind_of_collection(attribute)
  return :sym_hash if is_symbolized_hash?(attribute)
  return :str_hash if is_complete_string?(attribute)
  return :array if is_stringified_array?(attribute)
  return false
end