class Fable::InkList::InkListItem
The underlying type for a list item in ink. It stores the original list definition name as well as the item name, but without the value of the item. When the value is stored, it's stored in a Dictionary of InkListItem
and an integer.
Attributes
item_name[RW]
The main name of the item as defined in ink
origin_name[RW]
The name of the list where the item was originally defined.
Public Class Methods
Null()
click to toggle source
# File lib/fable/ink_list.rb, line 29 def self.Null return self.new(origin_name: nil, item_name: nil) end
new(options)
click to toggle source
# File lib/fable/ink_list.rb, line 16 def initialize(options) # Create an item from a dot-separated string of the form # `list_definition_name.list_item_name` if options.has_key?(:full_name) name_parts = options[:full_name].split(".") self.origin_name = name_parts[0] self.item_name = name_parts[1] else self.origin_name = options[:origin_name] self.item_name = options[:item_name] end end
Public Instance Methods
equal?(other_object)
click to toggle source
# File lib/fable/ink_list.rb, line 45 def equal?(other_object) return false if !other_object.is_a?(InkListItem) return ( other_object.item_name == self.item_name && other_object.origin_name == self.origin_name ) end
full_name()
click to toggle source
Get the full dot-separated name of the item, in the form of `list_definition_name.list_item_name`
# File lib/fable/ink_list.rb, line 39 def full_name return "#{origin_name.nil? ? "?" : origin_name}.#{item_name}" end
Also aliased as: to_s
null_item?()
click to toggle source
# File lib/fable/ink_list.rb, line 33 def null_item? origin_name.nil? && item_name.null? end