Class: MetadataPresenter::DateField

Inherits:
Object
  • Object
show all
Defined in:
app/models/metadata_presenter/date_field.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(day:, month:, year:) ⇒ DateField

Returns a new instance of DateField.



5
6
7
8
9
# File 'app/models/metadata_presenter/date_field.rb', line 5

def initialize(day:, month:, year:)
  @day = day
  @month = month
  @year = year
end

Instance Attribute Details

#dayObject (readonly)

Returns the value of attribute day.



3
4
5
# File 'app/models/metadata_presenter/date_field.rb', line 3

def day
  @day
end

#monthObject (readonly)

Returns the value of attribute month.



3
4
5
# File 'app/models/metadata_presenter/date_field.rb', line 3

def month
  @month
end

#yearObject (readonly)

Returns the value of attribute year.



3
4
5
# File 'app/models/metadata_presenter/date_field.rb', line 3

def year
  @year
end

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'app/models/metadata_presenter/date_field.rb', line 17

def blank?
  @day.blank? || @month.blank? || @year.blank?
end

#present?Boolean

Returns:

  • (Boolean)


11
12
13
14
15
# File 'app/models/metadata_presenter/date_field.rb', line 11

def present?
  # rubocop:disable Rails/Present
  !blank?
  # rubocop:enable Rails/Present
end