Class: CSKit::Volumes::ScienceHealth::Page

Inherits:
Struct
  • Object
show all
Defined in:
lib/cskit/resources/volumes/science_health.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#linesObject

Returns the value of attribute lines

Returns:

  • (Object)

    the current value of lines



7
8
9
# File 'lib/cskit/resources/volumes/science_health.rb', line 7

def lines
  @lines
end

#numberObject

Returns the value of attribute number

Returns:

  • (Object)

    the current value of number



7
8
9
# File 'lib/cskit/resources/volumes/science_health.rb', line 7

def number
  @number
end

Class Method Details

.from_hash(hash) ⇒ Object



16
17
18
19
20
21
# File 'lib/cskit/resources/volumes/science_health.rb', line 16

def self.from_hash(hash)
  Page.new(
    hash['number'],
    hash['lines'].map { |line_hash| Line.from_hash(line_hash) }
  )
end

Instance Method Details

#preface?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/cskit/resources/volumes/science_health.rb', line 8

def preface?
  !!(number =~ /vi{2,3}|xi{1,2}|i{0,1}x/)
end

#to_hashObject



12
13
14
# File 'lib/cskit/resources/volumes/science_health.rb', line 12

def to_hash
  { 'number' => number, 'lines' => lines.map(&:to_hash) }
end