class Moonrope::StructureAttribute
Attributes
conditions[RW]
description[RW]
doc[RW]
example[RW]
groups[RW]
mutation[RW]
name[RW]
source_attribute[RW]
structure[RW]
structure_opts[RW]
value[RW]
value_type[RW]
Public Class Methods
new(type, name)
click to toggle source
# File lib/moonrope/structure_attribute.rb, line 17 def initialize(type, name) @type = type @name = name @groups = [] @conditions = [] end
Public Instance Methods
auto_mutate(value)
click to toggle source
# File lib/moonrope/structure_attribute.rb, line 40 def auto_mutate(value) case value_type when :timestamp value.is_a?(Time) ? value.to_s : value when :unix_timestamp value.nil? ? nil : value.to_i else value end end
mutate(value)
click to toggle source
# File lib/moonrope/structure_attribute.rb, line 32 def mutate(value) if mutation value ? value.public_send(mutation) : nil else auto_mutate(value) end end
name_with_groups()
click to toggle source
# File lib/moonrope/structure_attribute.rb, line 28 def name_with_groups ([groups] + [name]).flatten.compact.join('.') end