Sha256: 9f57a88d16e128789d099c244e6899d3fd2c4cc76cbff44344c6b38b36998a1e
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
module Encore module Entity module Input module ExposedAttributes extend ActiveSupport::Concern module ClassMethods # Declare a new exposed attribute def expose(attribute, opts = {}) @exposed_attributes ||= [] @exposed_attributes << Encore::Attribute.new(self, attribute.to_sym, opts) end # Return only the attribute keys for each exposed attribute def exposed_attributes_list @exposed_attributes.map(&:attribute) end # Return whether an attribute is exposed by the entity def exposed_attribute?(attribute) @exposed_attributes.detect { |a| attribute == a } end # Return whether an attribute is exposed by the entity def modifiable_attribute?(attribute) modifiable_attributes.include?(attribute) end # Return a list of all attributes that can be modified def modifiable_attributes @exposed_attributes.reject(&:readonly?) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
encore-0.0.2 | lib/encore/entity/input/exposed_attributes.rb |