Module: StrongJSON::Type::WithAlias

Included in:
Array, Base, Enum, Hash, Literal, Object, Optional
Defined in:
lib/strong_json/type.rb

Instance Method Summary collapse

Instance Method Details

#aliasObject



17
18
19
# File 'lib/strong_json/type.rb', line 17

def alias
  defined?(@alias) ? @alias : nil
end

#with_alias(name) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/strong_json/type.rb', line 21

def with_alias(name)
  _ = dup.tap do |copy|
    copy.instance_eval do |x|
      @alias = name
    end
  end
end