Class: ExpoTurbo::Rails::PairedTemplates::Element

Inherits:
Struct
  • Object
show all
Defined in:
lib/expo_turbo/rails/paired_templates.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes

Returns:

  • (Object)

    the current value of attributes



126
127
128
# File 'lib/expo_turbo/rails/paired_templates.rb', line 126

def attributes
  @attributes
end

#lineObject

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



126
127
128
# File 'lib/expo_turbo/rails/paired_templates.rb', line 126

def line
  @line
end

Instance Method Details

#idObject



127
128
129
130
# File 'lib/expo_turbo/rails/paired_templates.rb', line 127

def id
  value = attributes["id"]
  (value.nil? || value.empty?) ? nil : value
end

#labelObject

What a reader needs to find this element in the file.



133
134
135
136
137
138
# File 'lib/expo_turbo/rails/paired_templates.rb', line 133

def label
  return "##{id}" if id

  described = attributes.first
  described ? "the element with #{described.first}=#{described.last.inspect}" : "an element"
end

#summaryObject



140
141
142
# File 'lib/expo_turbo/rails/paired_templates.rb', line 140

def summary
  attributes.map { |name, value| "#{name}=#{value.inspect}" }.join(" ")
end