Module: Sevgi::Graphics::Attribute::Ident

Included in:
Sevgi::Graphics::Attribute
Defined in:
lib/sevgi/graphics/attribute.rb

Constant Summary collapse

INTERNAL_PREFIX =
"_"
UPDATE_SUFFIX =
"+"

Instance Method Summary collapse

Instance Method Details

#id(given) ⇒ Object



16
17
18
# File 'lib/sevgi/graphics/attribute.rb', line 16

def id(given)
  (@id ||= {})[given] ||= (updateable?(given) ? given.to_s.delete_suffix(UPDATE_SUFFIX) : given).to_sym
end

#internal?(given) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/sevgi/graphics/attribute.rb', line 12

def internal?(given)
  (@internal ||= {})[given] ||= given.start_with?(INTERNAL_PREFIX)
end

#updateable?(given) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/sevgi/graphics/attribute.rb', line 20

def updateable?(given)
  (@updateable ||= {})[given] ||= given.end_with?(UPDATE_SUFFIX)
end