Sha256: 7bc5f2f350bd18037fce6e081a8839c2d2cd5f61927beb64cd5d5ee335992fe4
Contents?: true
Size: 659 Bytes
Versions: 2
Compression:
Stored size: 659 Bytes
Contents
module Jsonity module Attribute module ClassMethods ### # Automatically export attributes to json # # @params {[String | Symbol]} *attrs ### def attr_json(*attrs) @json_attributes ||= Set.new @json_attributes |= attrs.map(&:to_s) end ### # Get json attributes # # @return {[String]} ### def json_attributes @json_attributes.to_a end end module InstanceMethods ### # Get json attributes # # @return {[String]} ### def json_attributes self.class.json_attributes end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jsonity-1.0.1 | lib/jsonity/attribute.rb |
jsonity-1.0.0 | lib/jsonity/attribute.rb |