Class: Eco::Language::HashTransformModifier

Inherits:
Models::Modifier show all
Defined in:
lib/eco/language/hash_transform_modifier.rb

Constant Summary collapse

FLAT_MODE =
[:flat, :non_recursivre]
RECURSIVE_MODE =
[:recurse, :deep, :recursive, :r]
COPY_MODE =
[:copy, :clone, :c]
BANG_MODE =
[:!, :bang]
COLON_MODE =
[:colon, :colon_to_key, :only_colon]
ALL_TO_SYM =
[:all_to_sym, :all]
STRINGIFY_MODE =
[:stringify, :string, :to_s]
SYMBOLIZE_MODE =
[:symbolize, :sym, :to_sym]
KEYS_MODE =
[:keys]
NO_KEYS_MODE =
[:no_keys]
NO_VALUES_MODE =
[:no_values]
VALUES_MODE =
[:values]

Constants inherited from Models::Modifier

Models::Modifier::DEFAULT_MODE

Instance Method Summary collapse

Methods inherited from Models::Modifier

#<, #<<, #default, #default?, #flush_mode, #initialize, #mode, #new, #reset

Constructor Details

This class inherits a constructor from Eco::Language::Models::Modifier

Instance Method Details

#allObject



55
56
57
# File 'lib/eco/language/hash_transform_modifier.rb', line 55

def all
  self.push(:all)
end

#bangObject



47
48
49
# File 'lib/eco/language/hash_transform_modifier.rb', line 47

def bang
  self.push(:bang)
end

#clone?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/eco/language/hash_transform_modifier.rb', line 79

def clone?
  mode.all? { |m| !BANG_MODE.include?(m) }
end

#colonObject



51
52
53
# File 'lib/eco/language/hash_transform_modifier.rb', line 51

def colon
  self.push(:colon)
end

#colon?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/eco/language/hash_transform_modifier.rb', line 83

def colon?
  mode.any? { |m| COLON_MODE.include?(m) }
end

#copyObject



43
44
45
# File 'lib/eco/language/hash_transform_modifier.rb', line 43

def copy
  self.push(:copy)
end

#keysObject



67
68
69
# File 'lib/eco/language/hash_transform_modifier.rb', line 67

def keys
  self.push(:keys)
end

#keys?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/eco/language/hash_transform_modifier.rb', line 91

def keys?
  mode.any? { |m| KEYS_MODE.include?(m) }
end

#non_recurseObject



39
40
41
# File 'lib/eco/language/hash_transform_modifier.rb', line 39

def non_recurse
  self.push(:flat)
end

#recurseObject



35
36
37
# File 'lib/eco/language/hash_transform_modifier.rb', line 35

def recurse
  self.push(:recurse)
end

#recurse?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/eco/language/hash_transform_modifier.rb', line 75

def recurse?
  mode.any? { |m| RECURSIVE_MODE.include?(m) }
end

#reset_bangObject



27
28
29
# File 'lib/eco/language/hash_transform_modifier.rb', line 27

def reset_bang
  self < self.mode - (BANG_MODE | COPY_MODE)
end

#reset_colon_modeObject



31
32
33
# File 'lib/eco/language/hash_transform_modifier.rb', line 31

def reset_colon_mode
  self < self.mode - (COLON_MODE | ALL_TO_SYM)
end

#reset_recursiveObject



23
24
25
# File 'lib/eco/language/hash_transform_modifier.rb', line 23

def reset_recursive
  self < self.mode - (RECURSIVE_MODE | FLAT_MODE)
end

#stringifyObject



63
64
65
# File 'lib/eco/language/hash_transform_modifier.rb', line 63

def stringify
  self.push(:stringify)
end

#symbolizeObject



59
60
61
# File 'lib/eco/language/hash_transform_modifier.rb', line 59

def symbolize
  self.push(:symbolize)
end

#symbolize?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'lib/eco/language/hash_transform_modifier.rb', line 87

def symbolize?
  mode.any? { |m| SYMBOLIZE_MODE.include?(m) }
end

#valuesObject



71
72
73
# File 'lib/eco/language/hash_transform_modifier.rb', line 71

def values
  self.push(:values)
end

#values?Boolean

Returns:

  • (Boolean)


95
96
97
# File 'lib/eco/language/hash_transform_modifier.rb', line 95

def values?
  mode.any? { |m| VALUES_MODE.include?(m) }
end