class Tram::Page::Section

@private Contains class-level definition (name and options) for a section with a method [#call] that extracts the section part of hash from an instance of [Tram::Page]

Public Instance Methods

call(page) click to toggle source

@param [Tram::Page] page @return [Hash] a part of the section

# File lib/tram/page/section.rb, line 19
def call(page)
  skip_on?(page) ? {} : { name => value_at(page) }
end

Private Instance Methods

skip_on?(page) click to toggle source
# File lib/tram/page/section.rb, line 25
def skip_on?(page)
  return true if positive && !page.public_send(positive)
  return true if negative &&  page.public_send(negative)
end
value_at(page) click to toggle source
# File lib/tram/page/section.rb, line 30
def value_at(page)
  page.public_send(source)
end